Browse Source

include/bits from glibc-2.2.4-1

David Schleef 22 years ago
parent
commit
e66d628551
69 changed files with 4256 additions and 722 deletions
  1. 29 14
      libc/sysdeps/linux/powerpc/bits/byteswap.h
  2. 158 0
      libc/sysdeps/linux/powerpc/bits/cmathcalls.h
  3. 200 45
      libc/sysdeps/linux/powerpc/bits/confname.h
  4. 10 19
      libc/sysdeps/linux/powerpc/bits/dirent.h
  5. 8 10
      libc/sysdeps/linux/powerpc/bits/dlfcn.h
  6. 32 3
      libc/sysdeps/linux/powerpc/bits/endian.h
  7. 75 0
      libc/sysdeps/linux/powerpc/bits/environments.h
  8. 9 15
      libc/sysdeps/linux/powerpc/bits/errno.h
  9. 66 27
      libc/sysdeps/linux/powerpc/bits/fcntl.h
  10. 145 0
      libc/sysdeps/linux/powerpc/bits/fenv.h
  11. 59 0
      libc/sysdeps/linux/powerpc/bits/fenvinline.h
  12. 8 8
      libc/sysdeps/linux/powerpc/bits/huge_val.h
  13. 27 14
      libc/sysdeps/linux/powerpc/bits/in.h
  14. 28 0
      libc/sysdeps/linux/powerpc/bits/initspin.h
  15. 1 73
      libc/sysdeps/linux/powerpc/bits/ioctl-types.h
  16. 8 8
      libc/sysdeps/linux/powerpc/bits/ioctls.h
  17. 47 18
      libc/sysdeps/linux/powerpc/bits/ipc.h
  18. 317 0
      libc/sysdeps/linux/powerpc/bits/libc-lock.h
  19. 25 3
      libc/sysdeps/linux/powerpc/bits/local_lim.h
  20. 44 0
      libc/sysdeps/linux/powerpc/bits/locale.h
  21. 9 17
      libc/sysdeps/linux/powerpc/bits/mathcalls.h
  22. 8 8
      libc/sysdeps/linux/powerpc/bits/mathdef.h
  23. 8 8
      libc/sysdeps/linux/powerpc/bits/mathinline.h
  24. 8 8
      libc/sysdeps/linux/powerpc/bits/mman.h
  25. 8 8
      libc/sysdeps/linux/powerpc/bits/msq.h
  26. 48 0
      libc/sysdeps/linux/powerpc/bits/nan.h
  27. 33 0
      libc/sysdeps/linux/powerpc/bits/netdb.h
  28. 9 12
      libc/sysdeps/linux/powerpc/bits/poll.h
  29. 11 11
      libc/sysdeps/linux/powerpc/bits/posix1_lim.h
  30. 14 23
      libc/sysdeps/linux/powerpc/bits/posix2_lim.h
  31. 33 2
      libc/sysdeps/linux/powerpc/bits/posix_opt.h
  32. 142 0
      libc/sysdeps/linux/powerpc/bits/pthreadtypes.h
  33. 8 8
      libc/sysdeps/linux/powerpc/bits/resource.h
  34. 73 0
      libc/sysdeps/linux/powerpc/bits/sched.h
  35. 11 11
      libc/sysdeps/linux/powerpc/bits/select.h
  36. 8 8
      libc/sysdeps/linux/powerpc/bits/sem.h
  37. 8 8
      libc/sysdeps/linux/powerpc/bits/setjmp.h
  38. 51 41
      libc/sysdeps/linux/powerpc/bits/shm.h
  39. 11 11
      libc/sysdeps/linux/powerpc/bits/sigaction.h
  40. 8 8
      libc/sysdeps/linux/powerpc/bits/sigcontext.h
  41. 49 22
      libc/sysdeps/linux/powerpc/bits/siginfo.h
  42. 8 8
      libc/sysdeps/linux/powerpc/bits/signum.h
  43. 8 11
      libc/sysdeps/linux/powerpc/bits/sigset.h
  44. 11 11
      libc/sysdeps/linux/powerpc/bits/sigstack.h
  45. 6 9
      libc/sysdeps/linux/powerpc/bits/sigthread.h
  46. 9 16
      libc/sysdeps/linux/powerpc/bits/sockaddr.h
  47. 39 30
      libc/sysdeps/linux/powerpc/bits/socket.h
  48. 18 16
      libc/sysdeps/linux/powerpc/bits/stat.h
  49. 12 9
      libc/sysdeps/linux/powerpc/bits/statfs.h
  50. 99 0
      libc/sysdeps/linux/powerpc/bits/statvfs.h
  51. 50 0
      libc/sysdeps/linux/powerpc/bits/stdio-lock.h
  52. 169 0
      libc/sysdeps/linux/powerpc/bits/stdio.h
  53. 16 12
      libc/sysdeps/linux/powerpc/bits/stdio_lim.h
  54. 12 0
      libc/sysdeps/linux/powerpc/bits/string.h
  55. 1244 0
      libc/sysdeps/linux/powerpc/bits/string2.h
  56. 227 0
      libc/sysdeps/linux/powerpc/bits/stropts.h
  57. 42 23
      libc/sysdeps/linux/powerpc/bits/termios.h
  58. 25 15
      libc/sysdeps/linux/powerpc/bits/time.h
  59. 28 37
      libc/sysdeps/linux/powerpc/bits/types.h
  60. 8 8
      libc/sysdeps/linux/powerpc/bits/uio.h
  61. 27 0
      libc/sysdeps/linux/powerpc/bits/ustat.h
  62. 106 0
      libc/sysdeps/linux/powerpc/bits/utmp.h
  63. 89 0
      libc/sysdeps/linux/powerpc/bits/utmpx.h
  64. 29 0
      libc/sysdeps/linux/powerpc/bits/utsname.h
  65. 9 9
      libc/sysdeps/linux/powerpc/bits/waitflags.h
  66. 10 10
      libc/sysdeps/linux/powerpc/bits/waitstatus.h
  67. 26 0
      libc/sysdeps/linux/powerpc/bits/wchar.h
  68. 8 8
      libc/sysdeps/linux/powerpc/bits/wordsize.h
  69. 67 19
      libc/sysdeps/linux/powerpc/bits/xopen_lim.h

+ 29 - 14
libc/sysdeps/linux/powerpc/bits/byteswap.h

@@ -1,21 +1,21 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #if !defined _BYTESWAP_H && !defined _NETINET_IN_H
 # error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
@@ -53,12 +53,27 @@ __bswap_32 (unsigned int __bsx)
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
+# define __bswap_constant_64(x) \
+     ((((x) & 0xff00000000000000ull) >> 56)				      \
+      | (((x) & 0x00ff000000000000ull) >> 40)				      \
+      | (((x) & 0x0000ff0000000000ull) >> 24)				      \
+      | (((x) & 0x000000ff00000000ull) >> 8)				      \
+      | (((x) & 0x00000000ff000000ull) << 8)				      \
+      | (((x) & 0x0000000000ff0000ull) << 24)				      \
+      | (((x) & 0x000000000000ff00ull) << 40)				      \
+      | (((x) & 0x00000000000000ffull) << 56))
+
 # define __bswap_64(x) \
      (__extension__							      \
-      ({ union { unsigned long long int __ll;				      \
-		 unsigned long int __l[2]; } __v, __r;			      \
-	 __v.__ll = (x);						      \
-	 __r.__l[0] = __bswap_32 (__v.__l[1]);				      \
-	 __r.__l[1] = __bswap_32 (__v.__l[0]);				      \
+      ({ union { __extension__ unsigned long long int __ll;		      \
+		 unsigned int __l[2]; } __w, __r;			      \
+         if (__builtin_constant_p (x))					      \
+	   __r.__ll = __bswap_constant_64 (x);				      \
+	 else								      \
+	   {								      \
+	     __w.__ll = (x);						      \
+	     __r.__l[0] = __bswap_32 (__w.__l[1]);			      \
+	     __r.__l[1] = __bswap_32 (__w.__l[0]);			      \
+	   }								      \
 	 __r.__ll; }))
 #endif

+ 158 - 0
libc/sysdeps/linux/powerpc/bits/cmathcalls.h

@@ -0,0 +1,158 @@
+/* Prototype declarations for complex math functions;
+   helper file for <complex.h>.
+   Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* NOTE: Because of the special way this file is used by <complex.h>, this
+   file must NOT be protected from multiple inclusion as header files
+   usually are.
+
+   This file provides prototype declarations for the math functions.
+   Most functions are declared using the macro:
+
+   __MATHCALL (NAME, (ARGS...));
+
+   This means there is a function `NAME' returning `double' and a function
+   `NAMEf' returning `float'.  Each place `_Mdouble_' appears in the
+   prototype, that is actually `double' in the prototype for `NAME' and
+   `float' in the prototype for `NAMEf'.  Reentrant variant functions are
+   called `NAME_r' and `NAMEf_r'.
+
+   Functions returning other types like `int' are declared using the macro:
+
+   __MATHDECL (TYPE, NAME, (ARGS...));
+
+   This is just like __MATHCALL but for a function returning `TYPE'
+   instead of `_Mdouble_'.  In all of these cases, there is still
+   both a `NAME' and a `NAMEf' that takes `float' arguments.  */
+
+#ifndef _COMPLEX_H
+#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
+#endif
+
+#define _Mdouble_complex_ _Mdouble_ _Complex
+
+
+/* Trigonometric functions.  */
+
+/* Arc cosine of Z.  */
+__MATHCALL (cacos, (_Mdouble_complex_ __z));
+/* Arc sine of Z.  */
+__MATHCALL (casin, (_Mdouble_complex_ __z));
+/* Arc tangent of Z.  */
+__MATHCALL (catan, (_Mdouble_complex_ __z));
+
+/* Cosine of Z.  */
+__MATHCALL (ccos, (_Mdouble_complex_ __z));
+/* Sine of Z.  */
+__MATHCALL (csin, (_Mdouble_complex_ __z));
+/* Tangent of Z.  */
+__MATHCALL (ctan, (_Mdouble_complex_ __z));
+
+
+/* Hyperbolic functions.  */
+
+/* Hyperbolic arc cosine of Z.  */
+__MATHCALL (cacosh, (_Mdouble_complex_ __z));
+/* Hyperbolic arc sine of Z.  */
+__MATHCALL (casinh, (_Mdouble_complex_ __z));
+/* Hyperbolic arc tangent of Z.  */
+__MATHCALL (catanh, (_Mdouble_complex_ __z));
+
+/* Hyperbolic cosine of Z.  */
+__MATHCALL (ccosh, (_Mdouble_complex_ __z));
+/* Hyperbolic sine of Z.  */
+__MATHCALL (csinh, (_Mdouble_complex_ __z));
+/* Hyperbolic tangent of Z.  */
+__MATHCALL (ctanh, (_Mdouble_complex_ __z));
+
+
+/* Exponential and logarithmic functions.  */
+
+/* Exponential function of Z.  */
+__MATHCALL (cexp, (_Mdouble_complex_ __z));
+
+/* Natural logarithm of Z.  */
+__MATHCALL (clog, (_Mdouble_complex_ __z));
+
+#ifdef __USE_GNU
+/* The base 10 logarithm is not defined by the standard but to implement
+   the standard C++ library it is handy.  */
+__MATHCALL (clog10, (_Mdouble_complex_ __z));
+#endif
+
+/* Power functions.  */
+
+/* Return X to the Y power.  */
+__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
+
+/* Return the square root of Z.  */
+__MATHCALL (csqrt, (_Mdouble_complex_ __z));
+
+
+/* Absolute value, conjugates, and projection.  */
+
+/* Absolute value of Z.  */
+__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
+
+/* Argument value of Z.  */
+__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
+
+/* Complex conjugate of Z.  */
+__MATHCALL (conj, (_Mdouble_complex_ __z));
+
+/* Projection of Z onto the Riemann sphere.  */
+__MATHCALL (cproj, (_Mdouble_complex_ __z));
+
+
+/* Decomposing complex values.  */
+
+/* Imaginary part of Z.  */
+__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
+
+/* Real part of Z.  */
+__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
+
+
+/* Now some optimized versions.  GCC has handy notations for these
+   functions.  Recent GCC handles these as builtin functions so does
+   not need inlines.  */
+#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
+
+/* Imaginary part of Z.  */
+extern __inline _Mdouble_
+__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
+{
+  return __imag__ __z;
+}
+
+/* Real part of Z.  */
+extern __inline _Mdouble_
+__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
+{
+  return __real__ __z;
+}
+
+/* Complex conjugate of Z.  */
+extern __inline _Mdouble_complex_
+__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
+{
+  return __extension__ ~__z;
+}
+
+#endif

+ 200 - 45
libc/sysdeps/linux/powerpc/bits/confname.h

@@ -1,21 +1,21 @@
 /* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995-1998, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _UNISTD_H
 # error "Never use <bits/confname.h> directly; include <unistd.h> instead."
@@ -50,8 +50,20 @@ enum
 #define	_PC_PRIO_IO			_PC_PRIO_IO
     _PC_SOCK_MAXBUF,
 #define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
-    _PC_FILESIZEBITS
+    _PC_FILESIZEBITS,
 #define _PC_FILESIZEBITS		_PC_FILESIZEBITS
+    _PC_REC_INCR_XFER_SIZE,
+#define _PC_REC_INCR_XFER_SIZE		_PC_REC_INCR_XFER_SIZE
+    _PC_REC_MAX_XFER_SIZE,
+#define _PC_REC_MAX_XFER_SIZE		_PC_REC_MAX_XFER_SIZE
+    _PC_REC_MIN_XFER_SIZE,
+#define _PC_REC_MIN_XFER_SIZE		_PC_REC_MIN_XFER_SIZE
+    _PC_REC_XFER_ALIGN,
+#define _PC_REC_XFER_ALIGN		_PC_REC_XFER_ALIGN
+    _PC_ALLOC_SIZE_MIN,
+#define _PC_ALLOC_SIZE_MIN		_PC_ALLOC_SIZE_MIN
+    _PC_SYMLINK_MAX
+#define _PC_SYMLINK_MAX			_PC_SYMLINK_MAX
   };
 
 /* Values for the argument to `sysconf'.  */
@@ -185,6 +197,8 @@ enum
 #define	_SC_SELECT			_SC_SELECT
     _SC_UIO_MAXIOV,
 #define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
+    _SC_IOV_MAX = _SC_UIO_MAXIOV,
+#define _SC_IOV_MAX			_SC_IOV_MAX
     _SC_PII_INTERNET_STREAM,
 #define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
     _SC_PII_INTERNET_DGRAM,
@@ -338,8 +352,114 @@ enum
     _SC_XOPEN_REALTIME_THREADS,
 #define _SC_XOPEN_REALTIME_THREADS	_SC_XOPEN_REALTIME_THREADS
 
-	/* MUST BE LAST VALUE!!! */
-	_UCLIBC_SYSCONF_NUM_VALID_ARGS
+    _SC_ADVISORY_INFO,
+#define _SC_ADVISORY_INFO		_SC_ADVISORY_INFO
+    _SC_BARRIERS,
+#define _SC_BARRIERS			_SC_BARRIERS
+    _SC_BASE,
+#define _SC_BASE			_SC_BASE
+    _SC_C_LANG_SUPPORT,
+#define _SC_C_LANG_SUPPORT		_SC_C_LANG_SUPPORT
+    _SC_C_LANG_SUPPORT_R,
+#define _SC_C_LANG_SUPPORT_R		_SC_C_LANG_SUPPORT_R
+    _SC_CLOCK_SELECTION,
+#define _SC_CLOCK_SELECTION		_SC_CLOCK_SELECTION
+    _SC_CPUTIME,
+#define _SC_CPUTIME			_SC_CPUTIME
+    _SC_THREAD_CPUTIME,
+#define _SC_THREAD_CPUTIME		_SC_THREAD_CPUTIME
+    _SC_DEVICE_IO,
+#define _SC_DEVICE_IO			_SC_DEVICE_IO
+    _SC_DEVICE_SPECIFIC,
+#define _SC_DEVICE_SPECIFIC		_SC_DEVICE_SPECIFIC
+    _SC_DEVICE_SPECIFIC_R,
+#define _SC_DEVICE_SPECIFIC_R		_SC_DEVICE_SPECIFIC_R
+    _SC_FD_MGMT,
+#define _SC_FD_MGMT			_SC_FD_MGMT
+    _SC_FIFO,
+#define _SC_FIFO			_SC_FIFO
+    _SC_PIPE,
+#define _SC_PIPE			_SC_PIPE
+    _SC_FILE_ATTRIBUTES,
+#define _SC_FILE_ATTRIBUTES		_SC_FILE_ATTRIBUTES
+    _SC_FILE_LOCKING,
+#define _SC_FILE_LOCKING		_SC_FILE_LOCKING
+    _SC_FILE_SYSTEM,
+#define _SC_FILE_SYSTEM			_SC_FILE_SYSTEM
+    _SC_MONOTONIC_CLOCK,
+#define _SC_MONOTONIC_CLOCK		_SC_MONOTONIC_CLOCK
+    _SC_MULTI_PROCESS,
+#define _SC_MULTI_PROCESS		_SC_MULTI_PROCESS
+    _SC_SINGLE_PROCESS,
+#define _SC_SINGLE_PROCESS		_SC_SINGLE_PROCESS
+    _SC_NETWORKING,
+#define _SC_NETWORKING			_SC_NETWORKING
+    _SC_READER_WRITER_LOCKS,
+#define _SC_READER_WRITER_LOCKS		_SC_READER_WRITER_LOCKS
+    _SC_SPIN_LOCKS,
+#define _SC_SPIN_LOCKS			_SC_SPIN_LOCKS
+    _SC_REGEXP,
+#define _SC_REGEXP			_SC_REGEXP
+    _SC_REGEX_VERSION,
+#define _SC_REGEX_VERSION		_SC_REGEX_VERSION
+    _SC_SHELL,
+#define _SC_SHELL			_SC_SHELL
+    _SC_SIGNALS,
+#define _SC_SIGNALS			_SC_SIGNALS
+    _SC_SPAWN,
+#define _SC_SPAWN			_SC_SPAWN
+    _SC_SPORADIC_SERVER,
+#define _SC_SPORADIC_SERVER		_SC_SPORADIC_SERVER
+    _SC_THREAD_SPORADIC_SERVER,
+#define _SC_THREAD_SPORADIC_SERVER	_SC_THREAD_SPORADIC_SERVER
+    _SC_SYSTEM_DATABASE,
+#define _SC_SYSTEM_DATABASE		_SC_SYSTEM_DATABASE
+    _SC_SYSTEM_DATABASE_R,
+#define _SC_SYSTEM_DATABASE_R		_SC_SYSTEM_DATABASE_R
+    _SC_TIMEOUTS,
+#define _SC_TIMEOUTS			_SC_TIMEOUTS
+    _SC_TYPED_MEMORY_OBJECTS,
+#define _SC_TYPED_MEMORY_OBJECTS	_SC_TYPED_MEMORY_OBJECTS
+    _SC_USER_GROUPS,
+#define _SC_USER_GROUPS			_SC_USER_GROUPS
+    _SC_USER_GROUPS_R,
+#define _SC_USER_GROUPS_R		_SC_USER_GROUPS_R
+    _SC_2_PBS,
+#define _SC_2_PBS			_SC_2_PBS
+    _SC_2_PBS_ACCOUNTING,
+#define _SC_2_PBS_ACCOUNTING		_SC_2_PBS_ACCOUNTING
+    _SC_2_PBS_LOCATE,
+#define _SC_2_PBS_LOCATE		_SC_2_PBS_LOCATE
+    _SC_2_PBS_MESSAGE,
+#define _SC_2_PBS_MESSAGE		_SC_2_PBS_MESSAGE
+    _SC_2_PBS_TRACK,
+#define _SC_2_PBS_TRACK			_SC_2_PBS_TRACK
+    _SC_SYMLOOP_MAX,
+#define _SC_SYMLOOP_MAX			_SC_SYMLOOP_MAX
+    _SC_STREAMS,
+#define _SC_STREAMS			_SC_STREAMS
+    _SC_2_PBS_CHECKPOINT,
+#define _SC_2_PBS_CHECKPOINT		_SC_2_PBS_CHECKPOINT
+
+    _SC_V6_ILP32_OFF32,
+#define _SC_V6_ILP32_OFF32		_SC_V6_ILP32_OFF32
+    _SC_V6_ILP32_OFFBIG,
+#define _SC_V6_ILP32_OFFBIG		_SC_V6_ILP32_OFFBIG
+    _SC_V6_LP64_OFF64,
+#define _SC_V6_LP64_OFF64		_SC_V6_LP64_OFF64
+    _SC_V6_LPBIG_OFFBIG,
+#define _SC_V6_LPBIG_OFFBIG		_SC_V6_LPBIG_OFFBIG
+
+    _SC_HOST_NAME_MAX,
+#define _SC_HOST_NAME_MAX		_SC_HOST_NAME_MAX
+    _SC_TRACE,
+#define _SC_TRACE			_SC_TRACE
+    _SC_TRACE_EVENT_FILTER,
+#define _SC_TRACE_EVENT_FILTER		_SC_TRACE_EVENT_FILTER
+    _SC_TRACE_INHERIT,
+#define _SC_TRACE_INHERIT		_SC_TRACE_INHERIT
+    _SC_TRACE_LOG
+#define _SC_TRACE_LOG			_SC_TRACE_LOG
   };
 
 #if (defined __USE_POSIX2 || defined __USE_UNIX98 \
@@ -348,64 +468,99 @@ enum
 /* Values for the NAME argument to `confstr'.  */
 enum
   {
-    _CS_PATH			/* The default search path.  */
+    _CS_PATH,			/* The default search path.  */
 #define _CS_PATH		_CS_PATH
 
-#if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \
+# if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \
      || defined __USE_LARGEFILE)
-    ,
     _CS_LFS_CFLAGS = 1000,
-# define _CS_LFS_CFLAGS		_CS_LFS_CFLAGS
+#  define _CS_LFS_CFLAGS		_CS_LFS_CFLAGS
     _CS_LFS_LDFLAGS,
-# define _CS_LFS_LDFLAGS	_CS_LFS_LDFLAGS
+#  define _CS_LFS_LDFLAGS	_CS_LFS_LDFLAGS
     _CS_LFS_LIBS,
-# define _CS_LFS_LIBS		_CS_LFS_LIBS
+#  define _CS_LFS_LIBS		_CS_LFS_LIBS
     _CS_LFS_LINTFLAGS,
-# define _CS_LFS_LINTFLAGS	_CS_LFS_LINTFLAGS
+#  define _CS_LFS_LINTFLAGS	_CS_LFS_LINTFLAGS
     _CS_LFS64_CFLAGS,
-# define _CS_LFS64_CFLAGS	_CS_LFS64_CFLAGS
+#  define _CS_LFS64_CFLAGS	_CS_LFS64_CFLAGS
     _CS_LFS64_LDFLAGS,
-# define _CS_LFS64_LDFLAGS	_CS_LFS64_LDFLAGS
+#  define _CS_LFS64_LDFLAGS	_CS_LFS64_LDFLAGS
     _CS_LFS64_LIBS,
-# define _CS_LFS64_LIBS		_CS_LFS64_LIBS
-    _CS_LFS64_LINTFLAGS
-# define _CS_LFS64_LINTFLAGS	_CS_LFS64_LINTFLAGS
-#endif
+#  define _CS_LFS64_LIBS		_CS_LFS64_LIBS
+    _CS_LFS64_LINTFLAGS,
+#  define _CS_LFS64_LINTFLAGS	_CS_LFS64_LINTFLAGS
+# endif
 
-#ifdef __USE_UNIX98
-    ,
+# ifdef __USE_UNIX98
     _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
-# define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
+#  define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
     _CS_XBS5_ILP32_OFF32_LDFLAGS,
-# define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
+#  define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
     _CS_XBS5_ILP32_OFF32_LIBS,
-# define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
+#  define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
     _CS_XBS5_ILP32_OFF32_LINTFLAGS,
-# define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
+#  define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
     _CS_XBS5_ILP32_OFFBIG_CFLAGS,
-# define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
+#  define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
     _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
-# define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
+#  define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
     _CS_XBS5_ILP32_OFFBIG_LIBS,
-# define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
+#  define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
     _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
-# define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+#  define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
     _CS_XBS5_LP64_OFF64_CFLAGS,
-# define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
+#  define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
     _CS_XBS5_LP64_OFF64_LDFLAGS,
-# define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
+#  define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
     _CS_XBS5_LP64_OFF64_LIBS,
-# define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
+#  define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
     _CS_XBS5_LP64_OFF64_LINTFLAGS,
-# define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
+#  define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
     _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
-# define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
+#  define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
     _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
-# define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+#  define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
     _CS_XBS5_LPBIG_OFFBIG_LIBS,
-# define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
-    _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
-# define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
-#endif
+#  define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
+    _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
+#  define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+# endif
+# ifdef __USE_XOPEN2K
+    _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
+#  define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+    _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
+#  define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+    _CS_POSIX_V6_ILP32_OFF32_LIBS,
+#  define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS
+    _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
+#  define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+    _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
+#  define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+    _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
+#  define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+    _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
+#  define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+    _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
+#  define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+    _CS_POSIX_V6_LP64_OFF64_CFLAGS,
+#  define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS
+    _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
+#  define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+    _CS_POSIX_V6_LP64_OFF64_LIBS,
+#  define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS
+    _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
+#  define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+    _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
+#  define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+    _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
+#  define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+    _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
+#  define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+    _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS,
+#  define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+# endif
+
+    _CS_V6_WIDTH_RESTRICTED_ENVS
+# define _CS_V6_WIDTH_RESTRICTED_ENVS	_CS_V6_WIDTH_RESTRICTED_ENVS
   };
 #endif

+ 10 - 19
libc/sysdeps/linux/powerpc/bits/dirent.h

@@ -2,29 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/*
- * June 25, 2001
- *
- * Removed d_type support for dirent and undefined _DIRENT_HAVE_D_TYPE;
- * i.e. match the kernel structs and avoid any translation for now.
- * Note: glibc fakes d_type for the dirent case.
- * Note: dirent64 still has the d_type field.
- */
+   Lesser General Public License for more details.
 
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _DIRENT_H
 # error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
@@ -40,6 +30,7 @@ struct dirent
     __off64_t d_off;
 #endif
     unsigned short int d_reclen;
+    unsigned char d_type;
     char d_name[256];		/* We must not include limits.h! */
   };
 
@@ -59,4 +50,4 @@ struct dirent64
 #undef  _DIRENT_HAVE_D_NAMLEN
 #define _DIRENT_HAVE_D_RECLEN
 #define _DIRENT_HAVE_D_OFF
-#undef  _DIRENT_HAVE_D_TYPE
+#define _DIRENT_HAVE_D_TYPE

+ 8 - 10
libc/sysdeps/linux/powerpc/bits/dlfcn.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _DLFCN_H
 # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
@@ -55,7 +55,5 @@
   (_dl_mcount_wrapper_check (fctp), (*(fctp)) args)
 
 /* This function calls the profiling functions.  */
-__BEGIN_DECLS
 extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
-__END_DECLS
 #endif

+ 32 - 3
libc/sysdeps/linux/powerpc/bits/endian.h

@@ -1,8 +1,37 @@
-/* powerpc is big endian */
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* PowerPC can be little or big endian.  Hopefully gcc will know...  */
 
 #ifndef _ENDIAN_H
 # error "Never use <bits/endian.h> directly; include <endian.h> instead."
 #endif
 
-#define __BYTE_ORDER __BIG_ENDIAN
-
+#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+#  error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
+# endif
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+#  define __BYTE_ORDER __LITTLE_ENDIAN
+# else
+#  warning Cannot determine current byte order, assuming big-endian.
+#  define __BYTE_ORDER __BIG_ENDIAN
+# endif
+#endif

+ 75 - 0
libc/sysdeps/linux/powerpc/bits/environments.h

@@ -0,0 +1,75 @@
+/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32	   64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* We can never provide environments with 32-bit wide pointers.  */
+# define _POSIX_V6_ILP32_OFF32	-1
+# define _POSIX_V6_ILP32_OFFBIG	-1
+# define _XBS5_ILP32_OFF32	-1
+# define _XBS5_ILP32_OFFBIG	-1
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V6_LPBIG_OFFBIG	-1
+# define _XBS5_LPBIG_OFFBIG	-1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V6_LP64_OFF64	1
+# define _XBS5_LP64_OFF64	1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+   and all platforms support LFS.  */
+# define _POSIX_V6_ILP32_OFF32	1
+# define _POSIX_V6_ILP32_OFFBIG	1
+# define _XBS5_ILP32_OFF32	1
+# define _XBS5_ILP32_OFFBIG	1
+
+/* We optionally provide an environment with the above size but an 64-bit
+   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
+
+/* We can never provide environments with 64-bit wide pointers.  */
+# define _POSIX_V6_LP64_OFF64	-1
+# define _POSIX_V6_LPBIG_OFFBIG	-1
+# define _XBS5_LP64_OFF64	-1
+# define _XBS5_LPBIG_OFFBIG	-1
+
+#endif /* __WORDSIZE == 32 */

+ 9 - 15
libc/sysdeps/linux/powerpc/bits/errno.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifdef _ERRNO_H
 
@@ -32,14 +32,11 @@
 # define ECANCELED	125
 
 # ifndef __ASSEMBLER__
-
-__BEGIN_DECLS
-
 /* We now need a declaration of the `errno' variable.  */
 extern int errno;
 
 /* Function to get address of global `errno' variable.  */
-extern int *__errno_location (void);
+extern int *__errno_location (void) __THROW __attribute__ ((__const__));
 
 #  if defined _LIBC
 /* We wouldn't need a special macro anymore but it is history.  */
@@ -50,9 +47,6 @@ extern int *__errno_location (void);
 /* When using threads, errno is a per-thread value.  */
 #   define errno (*__errno_location ())
 #  endif
-
-__END_DECLS
-
 # endif /* !__ASSEMBLER__ */
 #endif /* _ERRNO_H */
 

+ 66 - 27
libc/sysdeps/linux/powerpc/bits/fcntl.h

@@ -1,21 +1,21 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_FCNTL_H
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
@@ -42,21 +42,20 @@
 #define O_ASYNC		020000
 
 #ifdef __USE_GNU
-# define O_DIRECTORY	040000	/* Must be a directory.  */
-# define O_NOFOLLOW	0100000	/* Do not follow links.  */
+# define O_DIRECTORY	040000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
 #endif
 
-/* XXX missing */
 #ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0
+# define O_LARGEFILE	0200000
 #endif
 
 /* For now Linux has synchronisity options for data and read operations.
    We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.  */
+   this is a superset.	*/
 #if defined __USE_POSIX199309 || defined __USE_UNIX98
 # define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
 #endif
 
 /* Values for the second argument to `fcntl'.  */
@@ -65,16 +64,22 @@
 #define F_SETFD		2	/* Set file descriptor flags.  */
 #define F_GETFL		3	/* Get file status flags.  */
 #define F_SETFL		4	/* Set file status flags.  */
-#define F_GETLK		5	/* Get record locking info.  */
-#define F_SETLK		6	/* Set record locking info (non-blocking).  */
-#define F_SETLKW	7	/* Set record locking info (blocking).  */
 
-/* XXX missing */
-#define F_GETLK64	5	/* Get record locking info.  */
-#define F_SETLK64	6	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	7	/* Set record locking info (blocking).  */
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK	5	/* Get record locking info.  */
+# define F_SETLK	6	/* Set record locking info (non-blocking).  */
+# define F_SETLKW	7	/* Set record locking info (blocking).	*/
+#else
+# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
+# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
+# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
+#endif
 
-#ifdef __USE_BSD
+#define F_GETLK64	12	/* Get record locking info.  */
+#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
 # define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
 # define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
 #endif
@@ -84,13 +89,19 @@
 # define F_GETSIG	11	/* Get number of signal to be sent.  */
 #endif
 
+#ifdef __USE_GNU
+# define F_SETLEASE	1024	/* Set a lease.	 */
+# define F_GETLEASE	1025	/* Enquire what lease is active.  */
+# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
+#endif
+
 /* For F_[GET|SET]FL.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
 #define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.  */
-#define F_UNLCK		2	/* Remove lock.  */
+#define F_WRLCK		1	/* Write lock.	*/
+#define F_UNLCK		2	/* Remove lock.	 */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -105,9 +116,27 @@
 # define LOCK_UN	8	/* remove lock */
 #endif
 
+#ifdef __USE_GNU
+# define LOCK_MAND	32	/* This is a mandatory flock:	*/
+# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
+# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
+# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY.  */
+# define DN_ACCESS	0x00000001	/* File accessed.  */
+# define DN_MODIFY	0x00000002	/* File modified.  */
+# define DN_CREATE	0x00000004	/* File created.  */
+# define DN_DELETE	0x00000008	/* File removed.  */
+# define DN_RENAME	0x00000010	/* File renamed.  */
+# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
+# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
+#endif
+
 struct flock
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
 #ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
@@ -122,7 +151,7 @@ struct flock
 #ifdef __USE_LARGEFILE64
 struct flock64
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
     __off64_t l_start;	/* Offset where the lock begins.  */
     __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
@@ -139,3 +168,13 @@ struct flock64
 # define FNONBLOCK	O_NONBLOCK
 # define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
+
+/* Advise to `posix_fadvise'.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
+# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
+# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
+# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
+# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
+# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
+#endif

+ 145 - 0
libc/sysdeps/linux/powerpc/bits/fenv.h

@@ -0,0 +1,145 @@
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+
+/* Define bits representing the exception.  We use the bit positions of
+   the appropriate bits in the FPSCR...  */
+enum
+  {
+    FE_INEXACT = 1 << (31 - 6),
+#define FE_INEXACT	FE_INEXACT
+    FE_DIVBYZERO = 1 << (31 - 5),
+#define FE_DIVBYZERO	FE_DIVBYZERO
+    FE_UNDERFLOW = 1 << (31 - 4),
+#define FE_UNDERFLOW	FE_UNDERFLOW
+    FE_OVERFLOW = 1 << (31 - 3),
+#define FE_OVERFLOW	FE_OVERFLOW
+
+    /* ... except for FE_INVALID, for which we use bit 31. FE_INVALID
+       actually corresponds to bits 7 through 12 and 21 through 23
+       in the FPSCR, but we can't use that because the current draft
+       says that it must be a power of 2.  Instead we use bit 2 which
+       is the summary bit for all the FE_INVALID exceptions, which
+       kind of makes sense.  */
+    FE_INVALID = 1 << (31 - 2),
+#define FE_INVALID	FE_INVALID
+
+#ifdef __USE_GNU
+    /* Breakdown of the FE_INVALID bits. Setting FE_INVALID on an
+       input to a routine is equivalent to setting all of these bits;
+       FE_INVALID will be set on output from a routine iff one of
+       these bits is set.  Note, though, that you can't disable or
+       enable these exceptions individually.  */
+
+    /* Operation with SNaN. */
+    FE_INVALID_SNAN = 1 << (31 - 7),
+# define FE_INVALID_SNAN	FE_INVALID_SNAN
+
+    /* Inf - Inf */
+    FE_INVALID_ISI = 1 << (31 - 8),
+# define FE_INVALID_ISI		FE_INVALID_ISI
+
+    /* Inf / Inf */
+    FE_INVALID_IDI = 1 << (31 - 9),
+# define FE_INVALID_IDI		FE_INVALID_IDI
+
+    /* 0 / 0 */
+    FE_INVALID_ZDZ = 1 << (31 - 10),
+# define FE_INVALID_ZDZ		FE_INVALID_ZDZ
+
+    /* Inf * 0 */
+    FE_INVALID_IMZ = 1 << (31 - 11),
+# define FE_INVALID_IMZ		FE_INVALID_IMZ
+
+    /* Comparison with NaN or SNaN.  */
+    FE_INVALID_COMPARE = 1 << (31 - 12),
+# define FE_INVALID_COMPARE	FE_INVALID_COMPARE
+
+    /* Invalid operation flag for software (not set by hardware).  */
+    /* Note that some chips don't have this implemented, presumably
+       because no-one expected anyone to write software for them %-).  */
+    FE_INVALID_SOFTWARE = 1 << (31 - 21),
+# define FE_INVALID_SOFTWARE	FE_INVALID_SOFTWARE
+
+    /* Square root of negative number (including -Inf).  */
+    /* Note that some chips don't have this implemented.  */
+    FE_INVALID_SQRT = 1 << (31 - 22),
+# define FE_INVALID_SQRT	FE_INVALID_SQRT
+
+    /* Conversion-to-integer of a NaN or a number too large or too small.  */
+    FE_INVALID_INTEGER_CONVERSION = 1 << (31 - 23)
+# define FE_INVALID_INTEGER_CONVERSION	FE_INVALID_INTEGER_CONVERSION
+
+# define FE_ALL_INVALID \
+        (FE_INVALID_SNAN | FE_INVALID_ISI | FE_INVALID_IDI | FE_INVALID_ZDZ \
+	 | FE_INVALID_IMZ | FE_INVALID_COMPARE | FE_INVALID_SOFTWARE \
+	 | FE_INVALID_SQRT | FE_INVALID_INTEGER_CONVERSION)
+#endif
+  };
+
+#define FE_ALL_EXCEPT \
+	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* PowerPC chips support all of the four defined rounding modes.  We
+   use the bit pattern in the FPSCR as the values for the
+   appropriate macros.  */
+enum
+  {
+    FE_TONEAREST = 0,
+#define FE_TONEAREST	FE_TONEAREST
+    FE_TOWARDZERO = 1,
+#define FE_TOWARDZERO	FE_TOWARDZERO
+    FE_UPWARD = 2,
+#define FE_UPWARD	FE_UPWARD
+    FE_DOWNWARD = 3
+#define FE_DOWNWARD	FE_DOWNWARD
+  };
+
+/* Type representing exception flags.  */
+typedef unsigned int fexcept_t;
+
+/* Type representing floating-point environment.  We leave it as 'double'
+   for efficiency reasons (rather than writing it to a 32-bit integer). */
+typedef double fenv_t;
+
+/* If the default argument is used we use this value.  */
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV	(&__fe_dfl_env)
+
+#ifdef __USE_GNU
+/* Floating-point environment where all exceptions are enabled.  Note that
+   this is not sufficient to give you SIGFPE.  */
+extern const fenv_t __fe_enabled_env;
+# define FE_ENABLED_ENV	(&__fe_enabled_env)
+
+/* Floating-point environment with (processor-dependent) non-IEEE floating
+   point.  */
+extern const fenv_t __fe_nonieee_env;
+# define FE_NONIEEE_ENV	(&__fe_nonieee_env)
+
+/* Floating-point environment with all exceptions enabled.  Note that
+   just evaluating this value will set the processor into 'FPU
+   exceptions imprecise recoverable' mode, which may cause a significant
+   performance penalty (but have no other visible effect).  */
+extern const fenv_t *__fe_nomask_env (void);
+# define FE_NOMASK_ENV	(__fe_nomask_env ())
+#endif

+ 59 - 0
libc/sysdeps/linux/powerpc/bits/fenvinline.h

@@ -0,0 +1,59 @@
+/* Inline floating-point environment handling functions for powerpc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_MATH_INLINES
+
+/* Inline definition for fegetround.  */
+# define fegetround() \
+  (__extension__  ({ int __fegetround_result;				      \
+		     __asm__ ("mcrfs 7,7 ; mfcr %0"			      \
+			     : "=r"(__fegetround_result) : : "cr7");	      \
+		     __fegetround_result & 3; }))
+
+/* The weird 'i#*X' constraints on the following suppress a gcc
+   warning when __excepts is not a constant.  Otherwise, they mean the
+   same as just plain 'i'.  */
+
+/* Inline definition for feraiseexcept.  */
+# define feraiseexcept(__excepts) \
+  ((__builtin_constant_p (__excepts)					      \
+    && ((__excepts) & ((__excepts)-1)) == 0				      \
+    && (__excepts) != FE_INVALID)					      \
+   ? ((__excepts) != 0							      \
+      ? (__extension__ ({ __asm__ __volatile__				      \
+			  ("mtfsb1 %s0"					      \
+			   : : "i#*X"(__builtin_ffs (__excepts)));	      \
+			  0; }))					      \
+      : 0)								      \
+   : (feraiseexcept) (__excepts))
+
+/* Inline definition for feclearexcept.  */
+# define feclearexcept(__excepts) \
+  ((__builtin_constant_p (__excepts)					      \
+    && ((__excepts) & ((__excepts)-1)) == 0				      \
+    && (__excepts) != FE_INVALID)					      \
+   ? ((__excepts) != 0							      \
+      ? (__extension__ ({ __asm__ __volatile__				      \
+			  ("mtfsb0 %s0"					      \
+			   : : "i#*X"(__builtin_ffs (__excepts)));	      \
+			  0; }))					      \
+      : 0)								      \
+   : (feclearexcept) (__excepts))
+
+#endif /* __GNUC__ && !_SOFT_FLOAT */

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/huge_val.h

@@ -4,19 +4,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _MATH_H
 # error "Never use <bits/huge_val.h> directly; include <math.h> instead."

+ 27 - 14
libc/sysdeps/linux/powerpc/bits/in.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* Linux version.  */
 
@@ -99,7 +99,7 @@ struct in_pktinfo
 #define IPV6_PKTINFO		2
 #define IPV6_HOPOPTS		3
 #define IPV6_DSTOPTS		4
-#define IPV6_RXSRCRT		5
+#define IPV6_RTHDR		5
 #define IPV6_PKTOPTIONS		6
 #define IPV6_CHECKSUM		7
 #define IPV6_HOPLIMIT		8
@@ -109,14 +109,21 @@ struct in_pktinfo
 #define IPV6_MULTICAST_IF	17
 #define IPV6_MULTICAST_HOPS	18
 #define IPV6_MULTICAST_LOOP	19
-#define IPV6_ADD_MEMBERSHIP	20
-#define IPV6_DROP_MEMBERSHIP	21
+#define IPV6_JOIN_GROUP		20
+#define IPV6_LEAVE_GROUP	21
 #define IPV6_ROUTER_ALERT	22
+#define IPV6_MTU_DISCOVER	23
+#define IPV6_MTU		24
+#define IPV6_RECVERR		25
 
 #define SCM_SRCRT		IPV6_RXSRCRT
 
-#define IPV6_RXHOPOPTS		IPV6_HOPOPTS	/* obsolete name */
-#define IPV6_RXDSTOPTS		IPV6_DSTOPTS	/* obsolete name */
+/* Obsolete synonyms for the above.  */
+#define IPV6_RXHOPOPTS		IPV6_HOPOPTS
+#define IPV6_RXDSTOPTS		IPV6_DSTOPTS
+#define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP
+
 
 /* IPV6_MTU_DISCOVER values.  */
 #define IPV6_PMTUDISC_DONT	0	/* Never send DF frames.  */
@@ -126,3 +133,9 @@ struct in_pktinfo
 /* Socket level values for IPv6.  */
 #define SOL_IPV6        41
 #define SOL_ICMPV6      58
+
+/* Routing header options for IPv6.  */
+#define IPV6_RTHDR_LOOSE	0	/* Hop doesn't need to be neighbour. */
+#define IPV6_RTHDR_STRICT	1	/* Hop must be a neighbour.  */
+
+#define IPV6_RTHDR_TYPE_0	0	/* IPv6 Routing header type 0.  */

+ 28 - 0
libc/sysdeps/linux/powerpc/bits/initspin.h

@@ -0,0 +1,28 @@
+/* Generic definitions for spinlock initializers.
+   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Initial value of a spinlock.  Most platforms should use zero,
+   unless they only implement a "test and clear" operation instead of
+   the usual "test and set". */
+#define __LT_SPINLOCK_INIT 0
+
+/* Macros for lock initializers, using the above definition. */
+#define __LOCK_INITIALIZER { 0, __LT_SPINLOCK_INIT }
+#define __ALT_LOCK_INITIALIZER { 0, __LT_SPINLOCK_INIT }
+#define __ATOMIC_INITIALIZER { 0, __LT_SPINLOCK_INIT }

+ 1 - 73
libc/sysdeps/linux/powerpc/bits/ioctl-types.h

@@ -1,77 +1,5 @@
-/* Structure types for pre-termios terminal ioctls.  Linux version.
-   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
 #ifndef _SYS_IOCTL_H
 # error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
 #endif
 
-/* Get definition of constants for use with `ioctl'.  */
-#include <asm/ioctls.h>
-
-
-struct winsize
-  {
-    unsigned short int ws_row;
-    unsigned short int ws_col;
-    unsigned short int ws_xpixel;
-    unsigned short int ws_ypixel;
-  };
-
-#define NCC 8
-struct termio
-  {
-    unsigned short int c_iflag;		/* input mode flags */
-    unsigned short int c_oflag;		/* output mode flags */
-    unsigned short int c_cflag;		/* control mode flags */
-    unsigned short int c_lflag;		/* local mode flags */
-    unsigned char c_line;		/* line discipline */
-    unsigned char c_cc[NCC];		/* control characters */
-};
-
-/* modem lines */
-#define TIOCM_LE	0x001
-#define TIOCM_DTR	0x002
-#define TIOCM_RTS	0x004
-#define TIOCM_ST	0x008
-#define TIOCM_SR	0x010
-#define TIOCM_CTS	0x020
-#define TIOCM_CAR	0x040
-#define TIOCM_RNG	0x080
-#define TIOCM_DSR	0x100
-#define TIOCM_CD	TIOCM_CAR
-#define TIOCM_RI	TIOCM_RNG
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-
-/* line disciplines */
-#define N_TTY		0
-#define N_SLIP		1
-#define N_MOUSE		2
-#define N_PPP		3
-#define N_STRIP		4
-#define N_AX25		5
-#define N_X25		6	/* X.25 async  */
-#define N_6PACK		7
-#define N_MASC		8	/* Mobitex module  */
-#define N_R3964		9	/* Simatic R3964 module  */
-#define N_PROFIBUS_FDL	10	/* Profibus  */
-#define N_IRDA		11	/* Linux IR  */
-#define N_SMSBLOCK	12	/* SMS block mode  */
-#define N_HDLC		13	/* synchronous HDLC  */
-#define N_SYNC_PPP	14	/* synchronous PPP  */
+#include <termios.h>

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/ioctls.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_IOCTL_H
 # error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."

+ 47 - 18
libc/sysdeps/linux/powerpc/bits/ipc.h

@@ -1,26 +1,26 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_IPC_H
 # error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Mode bits for `msgget', `semget', and `shmget'.  */
 #define IPC_CREAT	01000		/* Create key if key does not exist. */
@@ -31,7 +31,9 @@
 #define IPC_RMID	0		/* Remove identifier.  */
 #define IPC_SET		1		/* Set `ipc_perm' options.  */
 #define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#define IPC_INFO	3		/* See ipcs.  */
+#ifdef __USE_GNU
+# define IPC_INFO	3		/* See ipcs.  */
+#endif
 
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
@@ -40,11 +42,38 @@
 /* Data structure used to pass permission information to IPC operations.  */
 struct ipc_perm
   {
-    __key_t __key;			/* Key.  */
-    unsigned short int uid;		/* Owner's user ID.  */
-    unsigned short int gid;		/* Owner's group ID.  */
-    unsigned short int cuid;		/* Creator's user ID.  */
-    unsigned short int cgid;		/* Creator's group ID.  */
-    unsigned short int mode;		/* Read/write permission.  */
-    unsigned short int __seq;		/* Sequence number.  */
+    __key_t __key;		/* Key.  */
+    __uid_t uid;		/* Owner's user ID.  */
+    __gid_t gid;		/* Owner's group ID.  */
+    __uid_t cuid;		/* Creator's user ID.  */
+    __gid_t cgid;		/* Creator's group ID.  */
+    __mode_t mode;		/* Read/write permission.  */
+    unsigned long int __seq;	/* Sequence number.  */
+    unsigned int __pad1;
+    unsigned long long int __unused1;
+    unsigned long long int __unused2;
   };
+
+
+__BEGIN_DECLS
+
+/* The actual system call: all functions are multiplexed by this.  */
+extern int __ipc (int __call, int __first, int __second, int __third,
+		  void *__ptr) __THROW;
+
+__END_DECLS
+
+#ifdef __USE_GNU
+/* The codes for the functions to use the multiplexer `__ipc'.  */
+# define IPCOP_semop	 1
+# define IPCOP_semget	 2
+# define IPCOP_semctl	 3
+# define IPCOP_msgsnd	11
+# define IPCOP_msgrcv	12
+# define IPCOP_msgget	13
+# define IPCOP_msgctl	14
+# define IPCOP_shmat	21
+# define IPCOP_shmdt	22
+# define IPCOP_shmget	23
+# define IPCOP_shmctl	24
+#endif

+ 317 - 0
libc/sysdeps/linux/powerpc/bits/libc-lock.h

@@ -0,0 +1,317 @@
+/* libc-internal interface for mutex locks.  LinuxThreads version.
+   Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _BITS_LIBC_LOCK_H
+#define _BITS_LIBC_LOCK_H 1
+
+#include <pthread.h>
+
+/* Mutex type.  */
+#ifdef _LIBC
+typedef pthread_mutex_t __libc_lock_t;
+typedef pthread_rwlock_t __libc_rwlock_t;
+#else
+typedef struct __libc_lock_opaque__ __libc_lock_t;
+typedef struct __libc_rwlock_opaque__ __libc_rwlock_t;
+#endif
+
+/* Type for key to thread-specific data.  */
+typedef pthread_key_t __libc_key_t;
+
+/* Define a lock variable NAME with storage class CLASS.  The lock must be
+   initialized with __libc_lock_init before it can be used (or define it
+   with __libc_lock_define_initialized, below).  Use `extern' for CLASS to
+   declare a lock defined in another module.  In public structure
+   definitions you must use a pointer to the lock structure (i.e., NAME
+   begins with a `*'), because its storage size will not be known outside
+   of libc.  */
+#define __libc_lock_define(CLASS,NAME) \
+  CLASS __libc_lock_t NAME;
+#define __libc_rwlock_define(CLASS,NAME) \
+  CLASS __libc_rwlock_t NAME;
+
+/* Define an initialized lock variable NAME with storage class CLASS.
+
+   For the C library we take a deeper look at the initializer.  For
+   this implementation all fields are initialized to zero.  Therefore
+   we don't initialize the variable which allows putting it into the
+   BSS section.  (Except on PA-RISC and other odd architectures, where
+   initialized locks must be set to one due to the lack of normal
+   atomic operations.) */
+
+#if __LT_SPINLOCK_INIT == 0
+#  define __libc_lock_define_initialized(CLASS,NAME) \
+  CLASS __libc_lock_t NAME;
+#else
+#  define __libc_lock_define_initialized(CLASS,NAME) \
+  CLASS __libc_lock_t NAME = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+#define __libc_rwlock_define_initialized(CLASS,NAME) \
+  CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER;
+
+/* Define an initialized recursive lock variable NAME with storage
+   class CLASS.  */
+#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
+  CLASS __libc_lock_t NAME = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
+/* Initialize the named lock variable, leaving it in a consistent, unlocked
+   state.  */
+#define __libc_lock_init(NAME) \
+  (__pthread_mutex_init != NULL ? __pthread_mutex_init (&(NAME), NULL) : 0);
+#define __libc_rwlock_init(NAME) \
+  (__pthread_rwlock_init != NULL ? __pthread_rwlock_init (&(NAME), NULL) : 0);
+
+/* Same as last but this time we initialize a recursive mutex.  */
+#define __libc_lock_init_recursive(NAME) \
+  do {									      \
+    if (__pthread_mutex_init != NULL)					      \
+      {									      \
+	pthread_mutexattr_t __attr;					      \
+	__pthread_mutexattr_init (&__attr);				      \
+	__pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \
+	__pthread_mutex_init (&(NAME), &__attr);			      \
+	__pthread_mutexattr_destroy (&__attr);				      \
+      }									      \
+  } while (0);
+
+/* Finalize the named lock variable, which must be locked.  It cannot be
+   used again until __libc_lock_init is called again on it.  This must be
+   called on a lock variable before the containing storage is reused.  */
+#define __libc_lock_fini(NAME) \
+  (__pthread_mutex_destroy != NULL ? __pthread_mutex_destroy (&(NAME)) : 0);
+#define __libc_rwlock_fini(NAME) \
+  (__pthread_rwlock_destroy != NULL ? __pthread_rwlock_destroy (&(NAME)) : 0);
+
+/* Finalize recursive named lock.  */
+#define __libc_lock_fini_recursive(NAME) __libc_lock_fini (NAME)
+
+/* Lock the named lock variable.  */
+#define __libc_lock_lock(NAME) \
+  (__pthread_mutex_lock != NULL ? __pthread_mutex_lock (&(NAME)) : 0);
+#define __libc_rwlock_rdlock(NAME) \
+  (__pthread_rwlock_rdlock != NULL ? __pthread_rwlock_rdlock (&(NAME)) : 0);
+#define __libc_rwlock_wrlock(NAME) \
+  (__pthread_rwlock_wrlock != NULL ? __pthread_rwlock_wrlock (&(NAME)) : 0);
+
+/* Lock the recursive named lock variable.  */
+#define __libc_lock_lock_recursive(NAME) __libc_lock_lock (NAME)
+
+/* Try to lock the named lock variable.  */
+#define __libc_lock_trylock(NAME) \
+  (__pthread_mutex_trylock != NULL ? __pthread_mutex_trylock (&(NAME)) : 0)
+#define __libc_rwlock_tryrdlock(NAME) \
+  (__pthread_rwlock_tryrdlock != NULL \
+   ? __pthread_rwlock_tryrdlock (&(NAME)) : 0)
+#define __libc_rwlock_trywrlock(NAME) \
+  (__pthread_rwlock_trywrlock != NULL \
+   ? __pthread_rwlock_trywrlock (&(NAME)) : 0)
+
+/* Try to lock the recursive named lock variable.  */
+#define __libc_lock_trylock_recursive(NAME) __libc_lock_trylock (NAME)
+
+/* Unlock the named lock variable.  */
+#define __libc_lock_unlock(NAME) \
+  (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (&(NAME)) : 0);
+#define __libc_rwlock_unlock(NAME) \
+  (__pthread_rwlock_unlock != NULL ? __pthread_rwlock_unlock (&(NAME)) : 0);
+
+/* Unlock the recursive named lock variable.  */
+#define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock (NAME)
+
+
+/* Define once control variable.  */
+#if PTHREAD_ONCE_INIT == 0
+/* Special case for static variables where we can avoid the initialization
+   if it is zero.  */
+# define __libc_once_define(CLASS, NAME) \
+  CLASS pthread_once_t NAME
+#else
+# define __libc_once_define(CLASS, NAME) \
+  CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
+#endif
+
+/* Call handler iff the first call.  */
+#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+  do {									      \
+    if (__pthread_once != NULL)						      \
+      __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION));		      \
+    else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) {			      \
+      INIT_FUNCTION ();							      \
+      (ONCE_CONTROL) = !PTHREAD_ONCE_INIT;				      \
+    }									      \
+  } while (0)
+
+
+/* Start critical region with cleanup.  */
+#define __libc_cleanup_region_start(FCT, ARG) \
+  { struct _pthread_cleanup_buffer _buffer;				      \
+    int _avail = _pthread_cleanup_push_defer != NULL;			      \
+    if (_avail) {							      \
+      _pthread_cleanup_push_defer (&_buffer, (FCT), (ARG));		      \
+    }
+
+/* End critical region with cleanup.  */
+#define __libc_cleanup_region_end(DOIT) \
+    if (_avail) {							      \
+      _pthread_cleanup_pop_restore (&_buffer, (DOIT));			      \
+    }									      \
+  }
+
+/* Sometimes we have to exit the block in the middle.  */
+#define __libc_cleanup_end(DOIT) \
+    if (_avail) {							      \
+      _pthread_cleanup_pop_restore (&_buffer, (DOIT));			      \
+    }
+
+/* Create thread-specific key.  */
+#define __libc_key_create(KEY, DESTRUCTOR) \
+  (__pthread_key_create != NULL ? __pthread_key_create (KEY, DESTRUCTOR) : 1)
+
+/* Get thread-specific data.  */
+#define __libc_getspecific(KEY) \
+  (__pthread_getspecific != NULL ? __pthread_getspecific (KEY) : NULL)
+
+/* Set thread-specific data.  */
+#define __libc_setspecific(KEY, VALUE) \
+  (__pthread_setspecific != NULL ? __pthread_setspecific (KEY, VALUE) : 0)
+
+
+/* Register handlers to execute before and after `fork'.  */
+#define __libc_atfork(PREPARE, PARENT, CHILD) \
+  (__pthread_atfork != NULL ? __pthread_atfork (PREPARE, PARENT, CHILD) : 0)
+
+/* Functions that are used by this file and are internal to the GNU C
+   library.  */
+
+extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
+				 __const pthread_mutexattr_t *__mutex_attr);
+
+extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
+
+extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr);
+
+extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
+
+extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
+					int __kind);
+
+#ifdef __USE_UNIX98
+extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
+				  __const pthread_rwlockattr_t *__attr);
+
+extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
+
+extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
+#endif
+
+extern int __pthread_key_create (pthread_key_t *__key,
+				 void (*__destr_function) (void *));
+
+extern int __pthread_setspecific (pthread_key_t __key,
+				  __const void *__pointer);
+
+extern void *__pthread_getspecific (pthread_key_t __key);
+
+extern int __pthread_once (pthread_once_t *__once_control,
+			   void (*__init_routine) (void));
+
+extern int __pthread_atfork (void (*__prepare) (void),
+			     void (*__parent) (void),
+			     void (*__child) (void));
+
+
+
+/* Make the pthread functions weak so that we can elide them from
+   single-threaded processes.  */
+#ifndef __NO_WEAK_PTHREAD_ALIASES
+# ifdef weak_extern
+#  if _LIBC
+#   include <bp-sym.h>
+#  else
+#   define BP_SYM (sym) sym
+#  endif
+weak_extern (BP_SYM (__pthread_mutex_init))
+weak_extern (BP_SYM (__pthread_mutex_destroy))
+weak_extern (BP_SYM (__pthread_mutex_lock))
+weak_extern (BP_SYM (__pthread_mutex_trylock))
+weak_extern (BP_SYM (__pthread_mutex_unlock))
+weak_extern (BP_SYM (__pthread_mutexattr_init))
+weak_extern (BP_SYM (__pthread_mutexattr_destroy))
+weak_extern (BP_SYM (__pthread_mutexattr_settype))
+weak_extern (BP_SYM (__pthread_rwlock_init))
+weak_extern (BP_SYM (__pthread_rwlock_destroy))
+weak_extern (BP_SYM (__pthread_rwlock_rdlock))
+weak_extern (BP_SYM (__pthread_rwlock_tryrdlock))
+weak_extern (BP_SYM (__pthread_rwlock_wrlock))
+weak_extern (BP_SYM (__pthread_rwlock_trywrlock))
+weak_extern (BP_SYM (__pthread_rwlock_unlock))
+weak_extern (BP_SYM (__pthread_key_create))
+weak_extern (BP_SYM (__pthread_setspecific))
+weak_extern (BP_SYM (__pthread_getspecific))
+weak_extern (BP_SYM (__pthread_once))
+weak_extern (__pthread_initialize)
+weak_extern (__pthread_atfork)
+weak_extern (BP_SYM (_pthread_cleanup_push_defer))
+weak_extern (BP_SYM (_pthread_cleanup_pop_restore))
+# else
+#  pragma weak __pthread_mutex_init
+#  pragma weak __pthread_mutex_destroy
+#  pragma weak __pthread_mutex_lock
+#  pragma weak __pthread_mutex_trylock
+#  pragma weak __pthread_mutex_unlock
+#  pragma weak __pthread_mutexattr_init
+#  pragma weak __pthread_mutexattr_destroy
+#  pragma weak __pthread_mutexattr_settype
+#  pragma weak __pthread_rwlock_destroy
+#  pragma weak __pthread_rwlock_rdlock
+#  pragma weak __pthread_rwlock_tryrdlock
+#  pragma weak __pthread_rwlock_wrlock
+#  pragma weak __pthread_rwlock_trywrlock
+#  pragma weak __pthread_rwlock_unlock
+#  pragma weak __pthread_key_create
+#  pragma weak __pthread_setspecific
+#  pragma weak __pthread_getspecific
+#  pragma weak __pthread_once
+#  pragma weak __pthread_initialize
+#  pragma weak __pthread_atfork
+#  pragma weak _pthread_cleanup_push_defer
+#  pragma weak _pthread_cleanup_pop_restore
+# endif
+#endif
+
+/* We need portable names for some functions.  E.g., when they are
+   used as argument to __libc_cleanup_region_start.  */
+#define __libc_mutex_unlock __pthread_mutex_unlock
+
+#endif	/* bits/libc-lock.h */

+ 25 - 3
libc/sysdeps/linux/powerpc/bits/local_lim.h

@@ -1,5 +1,5 @@
 /* Minimum guaranteed maximum values for system limits.  Linux version.
-   Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,11 +17,20 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* The kernel header pollutes the namespace with the NR_OPEN symbol.
-   Remove this after including the header if necessary.  */
+/* The kernel header pollutes the namespace with the NR_OPEN symbol
+   and defines LINK_MAX although filesystems have different maxima.  A
+   similar thing is true for OPEN_MAX: the limit can be changed at
+   runtime and therefore the macro must not be defined.  Remove this
+   after including the header if necessary.  */
 #ifndef NR_OPEN
 # define __undef_NR_OPEN
 #endif
+#ifndef LINK_MAX
+# define __undef_LINK_MAX
+#endif
+#ifndef OPEN_MAX
+# define __undef_OPEN_MAX
+#endif
 
 /* The kernel sources contain a file with all the needed information.  */
 #include <linux/limits.h>
@@ -31,6 +40,16 @@
 # undef NR_OPEN
 # undef __undef_NR_OPEN
 #endif
+/* Have to remove LINK_MAX?  */
+#ifdef __undef_LINK_MAX
+# undef LINK_MAX
+# undef __undef_LINK_MAX
+#endif
+/* Have to remove OPEN_MAX?  */
+#ifdef __undef_OPEN_MAX
+# undef OPEN_MAX
+# undef __undef_OPEN_MAX
+#endif
 
 /* The number of data keys per process.  */
 #define _POSIX_THREAD_KEYS_MAX	128
@@ -53,3 +72,6 @@
 
 /* Minimum size for a thread.  We are free to choose a reasonable value.  */
 #define PTHREAD_STACK_MIN	16384
+
+/* Maximum number of POSIX timers available.  */
+#define TIMER_MAX	256

+ 44 - 0
libc/sysdeps/linux/powerpc/bits/locale.h

@@ -0,0 +1,44 @@
+/* Definition of locale category symbol values.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _LOCALE_H && !defined _LANGINFO_H
+# error "Never use <bits/locale.h> directly; include <locale.h> instead."
+#endif
+
+#ifndef _BITS_LOCALE_H
+#define _BITS_LOCALE_H	1
+
+enum
+{
+  __LC_CTYPE = 0,
+  __LC_NUMERIC = 1,
+  __LC_TIME = 2,
+  __LC_COLLATE = 3,
+  __LC_MONETARY = 4,
+  __LC_MESSAGES = 5,
+  __LC_ALL = 6,
+  __LC_PAPER = 7,
+  __LC_NAME = 8,
+  __LC_ADDRESS = 9,
+  __LC_TELEPHONE = 10,
+  __LC_MEASUREMENT = 11,
+  __LC_IDENTIFICATION = 12
+};
+
+#endif	/* bits/locale.h */

+ 9 - 17
libc/sysdeps/linux/powerpc/bits/mathcalls.h

@@ -1,21 +1,21 @@
 /* Prototype declarations for math functions; helper file for <math.h>.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* NOTE: Because of the special way this file is used by <math.h>, this
    file must NOT be protected from multiple inclusion as header files
@@ -186,14 +186,6 @@ __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
 /* Return nonzero if VALUE is finite and not NaN.  */
 __MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
 
-/* Deal with an infinite or NaN result.
-   If ERROR is ERANGE, result is +Inf;
-   if ERROR is - ERANGE, result is -Inf;
-   otherwise result is NaN.
-   This will set `errno' to either ERANGE or EDOM,
-   and may return an infinity or NaN, or may do something else.  */
-__MATHCALLX (infnan,, (int __error), (__const__));
-
 /* Return the remainder of X/Y.  */
 __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
 

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/mathdef.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #if !defined _MATH_H && !defined _COMPLEX_H
 # error "Never use <bits/mathdef.h> directly; include <math.h> instead"

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/mathinline.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #if defined __GNUC__ && !defined _SOFT_FLOAT
 

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/mman.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_MMAN_H
 # error "Never use <bits/mman.h> directly; iclude <sys/mman.h> instead."

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/msq.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_MSG_H
 # error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."

+ 48 - 0
libc/sysdeps/linux/powerpc/bits/nan.h

@@ -0,0 +1,48 @@
+/* `NAN' constant for IEEE 754 machines.
+   Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _MATH_H
+# error "Never use <bits/nan.h> directly; include <math.h> instead."
+#endif
+
+
+/* IEEE Not A Number.  */
+
+#ifdef	__GNUC__
+
+# define NAN \
+  (__extension__                                                            \
+   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })  \
+    { __l: 0x7fc00000UL }).__d)
+
+#else
+
+# include <endian.h>
+
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define __nan_bytes		{ 0x7f, 0xc0, 0, 0 }
+# endif
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define __nan_bytes		{ 0, 0, 0xc0, 0x7f }
+# endif
+
+static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
+# define NAN	(__nan_union.__d)
+
+#endif	/* GCC.  */

+ 33 - 0
libc/sysdeps/linux/powerpc/bits/netdb.h

@@ -0,0 +1,33 @@
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _NETDB_H
+# error "Never include <bits/netdb.h> directly; use <netdb.h> instead."
+#endif
+
+
+/* Description of data base entry for a single network.  NOTE: here a
+   poor assumption is made.  The network number is expected to fit
+   into an unsigned long int variable.  */
+struct netent
+{
+  char *n_name;			/* Official name of network.  */
+  char **n_aliases;		/* Alias list.  */
+  int n_addrtype;		/* Net address type.  */
+  uint32_t n_net;		/* Network number.  */
+};

+ 9 - 12
libc/sysdeps/linux/powerpc/bits/poll.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_POLL_H
 # error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
@@ -46,6 +46,3 @@
 #define POLLERR		0x008		/* Error condition.  */
 #define POLLHUP		0x010		/* Hung up.  */
 #define POLLNVAL	0x020		/* Invalid polling request.  */
-
-/* Canonical number of polling requests to read in at a time in poll.  */
-#define NPOLLFILE	30

+ 11 - 11
libc/sysdeps/linux/powerpc/bits/posix1_lim.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,96,98,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  *	POSIX Standard: 2.9.2 Minimum Values	Added to <limits.h>
@@ -73,7 +73,7 @@
 #define	_POSIX_NAME_MAX		14
 
 /* Number of bytes in a pathname.  */
-#define	_POSIX_PATH_MAX		255
+#define	_POSIX_PATH_MAX		256
 
 /* Number of bytes than can be written atomically to a pipe.  */
 #define	_POSIX_PIPE_BUF		512
@@ -97,7 +97,7 @@
 #define	_POSIX_STREAM_MAX	8
 
 /* Maximum length of a timezone name (element of `tzname').  */
-#define	_POSIX_TZNAME_MAX	3
+#define	_POSIX_TZNAME_MAX	6
 
 /* Maximum number of connections that can be queued on a socket.  */
 #define	_POSIX_QLIMIT		1

+ 14 - 23
libc/sysdeps/linux/powerpc/bits/posix2_lim.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  * Never include this file directly; include <limits.h> instead.
@@ -37,14 +37,8 @@
 #define	_POSIX2_BC_STRING_MAX		1000
 
 /* The maximum number of weights that can be assigned to an entry of
-   the LC_COLLATE `order' keyword in the locale definition file.
-   We have no fixed limit, 255 is very high.  */
-#define	_POSIX2_COLL_WEIGHTS_MAX	255
-
-/* The maximum number of weights that can be assigned to an entry of
-   the LC_COLLATE category `order' keyword in a locale definition.
-   We have no fixed limit, 255 is a high number.  */
-#define	_POSIX2_EQUIV_CLASS_MAX		255
+   the LC_COLLATE `order' keyword in the locale definition file.  */
+#define	_POSIX2_COLL_WEIGHTS_MAX	2
 
 /* The maximum number of expressions that can be nested
    within parentheses by the `expr' utility.  */
@@ -59,7 +53,7 @@
 
 /* The maximum number of bytes in a character class name.  We have no
    fixed limit, 2048 is a high number.  */
-#define	_POSIX2_CHARCLASS_NAME_MAX	2048
+#define	_POSIX2_CHARCLASS_NAME_MAX	14
 
 
 /* These values are implementation-specific,
@@ -79,10 +73,7 @@
 #define	BC_STRING_MAX		_POSIX2_BC_STRING_MAX
 #endif
 #ifndef	COLL_WEIGHTS_MAX
-#define	COLL_WEIGHTS_MAX	_POSIX2_COLL_WEIGHTS_MAX
-#endif
-#ifndef	EQUIV_CLASS_MAX
-#define	EQUIV_CLASS_MAX		_POSIX2_EQUIV_CLASS_MAX
+#define	COLL_WEIGHTS_MAX	255
 #endif
 #ifndef	EXPR_NEST_MAX
 #define	EXPR_NEST_MAX		_POSIX2_EXPR_NEST_MAX
@@ -91,7 +82,7 @@
 #define	LINE_MAX		_POSIX2_LINE_MAX
 #endif
 #ifndef	CHARCLASS_NAME_MAX
-#define	CHARCLASS_NAME_MAX	_POSIX2_CHARCLASS_NAME_MAX
+#define	CHARCLASS_NAME_MAX	2048
 #endif
 
 /* This value is defined like this in regex.h.  */

+ 33 - 2
libc/sysdeps/linux/powerpc/bits/posix_opt.h

@@ -1,5 +1,5 @@
 /* Define POSIX options for Linux.
-   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -89,13 +89,14 @@
 #define _POSIX_THREAD_ATTR_STACKADDR	1
 
 /* We support POSIX.1b semaphores, but only the non-shared form for now.  */
-/*#define _POSIX_SEMAPHORES	1	XXX We are not quite there now.  */
+#define _POSIX_SEMAPHORES	1
 
 /* Real-time signals are supported.  */
 #define _POSIX_REALTIME_SIGNALS	1
 
 /* We support asynchronous I/O.  */
 #define _POSIX_ASYNCHRONOUS_IO	1
+#define _POSIX_ASYNC_IO		1
 /* Alternative name for Unix98.  */
 #define _LFS_ASYNCHRONOUS_IO	1
 
@@ -107,4 +108,34 @@
 #define _LFS64_LARGEFILE	1
 #define _LFS64_STDIO		1
 
+/* POSIX shared memory objects are implemented.  */
+#define _POSIX_SHARED_MEMORY_OBJECTS	1
+
+/* GNU libc provides regular expression handling.  */
+#define _POSIX_REGEXP	1
+
+/* Reader/Writer locks are available.  */
+#define _POSIX_READER_WRITER_LOCKS	200912L
+
+/* We have a POSIX shell.  */
+#define _POSIX_SHELL	1
+
+/* We support the Timeouts option.  */
+#define _POSIX_TIMEOUTS	200912L
+
+/* We support spinlocks.  */
+#define _POSIX_SPIN_LOCKS	200912L
+
+/* The `spawn' function family is supported.  */
+#define _POSIX_SPAWN	200912L
+
+/* We have POSIX timers.  */
+#define _POSIX_TIMERS	1
+
+/* The barrier functions are available.  */
+#define _POSIX_BARRIERS	200912L
+
+/* POSIX message queues are not yet supported.  */
+#undef	_POSIX_MESSAGE_PASSING
+
 #endif /* posix_opt.h */

+ 142 - 0
libc/sysdeps/linux/powerpc/bits/pthreadtypes.h

@@ -0,0 +1,142 @@
+/* Linuxthreads - a simple clone()-based implementation of Posix        */
+/* threads for Linux.                                                   */
+/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)              */
+/*                                                                      */
+/* This program is free software; you can redistribute it and/or        */
+/* modify it under the terms of the GNU Library General Public License  */
+/* as published by the Free Software Foundation; either version 2       */
+/* of the License, or (at your option) any later version.               */
+/*                                                                      */
+/* This program is distributed in the hope that it will be useful,      */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
+/* GNU Library General Public License for more details.                 */
+
+#if !defined _BITS_TYPES_H && !defined _PTHREAD_H
+# error "Never include <bits/pthreadtypes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef _BITS_PTHREADTYPES_H
+#define _BITS_PTHREADTYPES_H	1
+
+#define __need_schedparam
+#include <bits/sched.h>
+
+/* Fast locks (not abstract because mutexes and conditions aren't abstract). */
+struct _pthread_fastlock
+{
+  long int __status;   /* "Free" or "taken" or head of waiting list */
+  int __spinlock;      /* Used by compare_and_swap emulation. Also,
+			  adaptive SMP lock stores spin count here. */
+};
+
+#ifndef _PTHREAD_DESCR_DEFINED
+/* Thread descriptors */
+typedef struct _pthread_descr_struct *_pthread_descr;
+# define _PTHREAD_DESCR_DEFINED
+#endif
+
+
+/* Attributes for threads.  */
+typedef struct __pthread_attr_s
+{
+  int __detachstate;
+  int __schedpolicy;
+  struct __sched_param __schedparam;
+  int __inheritsched;
+  int __scope;
+  size_t __guardsize;
+  int __stackaddr_set;
+  void *__stackaddr;
+  size_t __stacksize;
+} pthread_attr_t;
+
+
+/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */
+typedef struct
+{
+  struct _pthread_fastlock __c_lock; /* Protect against concurrent access */
+  _pthread_descr __c_waiting;        /* Threads waiting on this condition */
+} pthread_cond_t;
+
+
+/* Attribute for conditionally variables.  */
+typedef struct
+{
+  int __dummy;
+} pthread_condattr_t;
+
+/* Keys for thread-specific data */
+typedef unsigned int pthread_key_t;
+
+
+/* Mutexes (not abstract because of PTHREAD_MUTEX_INITIALIZER).  */
+/* (The layout is unnatural to maintain binary compatibility
+    with earlier releases of LinuxThreads.) */
+typedef struct
+{
+  int __m_reserved;               /* Reserved for future use */
+  int __m_count;                  /* Depth of recursive locking */
+  _pthread_descr __m_owner;       /* Owner thread (if recursive or errcheck) */
+  int __m_kind;                   /* Mutex kind: fast, recursive or errcheck */
+  struct _pthread_fastlock __m_lock; /* Underlying fast lock */
+} pthread_mutex_t;
+
+
+/* Attribute for mutex.  */
+typedef struct
+{
+  int __mutexkind;
+} pthread_mutexattr_t;
+
+
+/* Once-only execution */
+typedef int pthread_once_t;
+
+
+#ifdef __USE_UNIX98
+/* Read-write locks.  */
+typedef struct _pthread_rwlock_t
+{
+  struct _pthread_fastlock __rw_lock; /* Lock to guarantee mutual exclusion */
+  int __rw_readers;                   /* Number of readers */
+  _pthread_descr __rw_writer;         /* Identity of writer, or NULL if none */
+  _pthread_descr __rw_read_waiting;   /* Threads waiting for reading */
+  _pthread_descr __rw_write_waiting;  /* Threads waiting for writing */
+  int __rw_kind;                      /* Reader/Writer preference selection */
+  int __rw_pshared;                   /* Shared between processes or not */
+} pthread_rwlock_t;
+
+
+/* Attribute for read-write locks.  */
+typedef struct
+{
+  int __lockkind;
+  int __pshared;
+} pthread_rwlockattr_t;
+#endif
+
+#ifdef __USE_XOPEN2K
+/* POSIX spinlock data type.  */
+typedef volatile int pthread_spinlock_t;
+
+/* POSIX barrier. */
+typedef struct {
+  struct _pthread_fastlock __ba_lock; /* Lock to guarantee mutual exclusion */
+  int __ba_required;                  /* Threads needed for completion */
+  int __ba_present;                   /* Threads waiting */
+  _pthread_descr __ba_waiting;        /* Queue of waiting threads */
+} pthread_barrier_t;
+
+/* barrier attribute */
+typedef struct {
+  int __pshared;
+} pthread_barrierattr_t;
+
+#endif
+
+
+/* Thread identifiers */
+typedef unsigned long int pthread_t;
+
+#endif	/* bits/pthreadtypes.h */

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/resource.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_RESOURCE_H
 # error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."

+ 73 - 0
libc/sysdeps/linux/powerpc/bits/sched.h

@@ -0,0 +1,73 @@
+/* Definitions of constants and data structure for POSIX 1003.1b-1993
+   scheduling interface.
+   Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef __need_schedparam
+
+#ifndef _SCHED_H
+# error "Never include <bits/sched.h> directly; use <sched.h> instead."
+#endif
+
+
+/* Scheduling algorithms.  */
+#define SCHED_OTHER	0
+#define SCHED_FIFO	1
+#define SCHED_RR	2
+
+#ifdef __USE_MISC
+/* Cloning flags.  */
+# define CSIGNAL       0x000000ff /* Signal mask to be sent at exit.  */
+# define CLONE_VM      0x00000100 /* Set if VM shared between processes.  */
+# define CLONE_FS      0x00000200 /* Set if fs info shared between processes.  */
+# define CLONE_FILES   0x00000400 /* Set if open files shared between processes.  */
+# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared.  */
+# define CLONE_PID     0x00001000 /* Set if pid shared.  */
+# define CLONE_PTRACE  0x00002000 /* Set if tracing continues on the child.  */
+# define CLONE_VFORK   0x00004000 /* Set if the parent wants the child to
+				     wake it up on mm_release.  */
+#endif
+
+/* The official definition.  */
+struct sched_param
+  {
+    int __sched_priority;
+  };
+
+__BEGIN_DECLS
+
+/* Clone current process.  */
+#ifdef __USE_MISC
+extern int clone (int (*__fn) (void *__arg), void *__child_stack,
+		  int __flags, void *__arg) __THROW;
+#endif
+
+__END_DECLS
+
+#endif	/* need schedparam */
+
+#if !defined __defined_schedparam \
+    && (defined __need_schedparam || defined _SCHED_H)
+# define __defined_schedparam	1
+/* Data structure to describe a process' schedulability.  */
+struct __sched_param
+  {
+    int __sched_priority;
+  };
+# undef __need_schedparam
+#endif

+ 11 - 11
libc/sysdeps/linux/powerpc/bits/select.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_SELECT_H
 # error "Never use <bits/select.h> directly; include <sys/select.h> instead."
@@ -26,8 +26,8 @@
 #define __FD_ZERO(s) \
   do {									      \
     unsigned int __i;							      \
-    __fd_set *__arr = (s);						      \
-    for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i)	      \
+    fd_set *__arr = (s);						      \
+    for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i)	      \
       __FDS_BITS (__arr)[__i] = 0;					      \
   } while (0)
 #define __FD_SET(d, s)     (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d))

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/sem.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_SEM_H
 # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/setjmp.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /* Define the machine-dependent type `jmp_buf'.  PowerPC version.  */
 

+ 51 - 41
libc/sysdeps/linux/powerpc/bits/shm.h

@@ -1,82 +1,92 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_SHM_H
 # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
 
 /* Permission flag for shmget.  */
-#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
-#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
+#define SHM_R          0400            /* or S_IRUGO from <linux/stat.h> */
+#define SHM_W          0200            /* or S_IWUGO from <linux/stat.h> */
 
 /* Flags for `shmat'.  */
-#define SHM_RDONLY	010000		/* attach read-only else read-write */
-#define SHM_RND		020000		/* round attach address to SHMLBA */
-#define SHM_REMAP	040000		/* take-over region on attach */
+#define SHM_RDONLY     010000          /* attach read-only else read-write */
+#define SHM_RND                020000          /* round attach address to SHMLBA */
+#define SHM_REMAP      040000          /* take-over region on attach */
 
 /* Commands for `shmctl'.  */
-#define SHM_LOCK	11		/* lock segment (root only) */
-#define SHM_UNLOCK	12		/* unlock segment (root only) */
+#define SHM_LOCK       11              /* lock segment (root only) */
+#define SHM_UNLOCK     12              /* unlock segment (root only) */
 
 
+/* Type to count number of attaches.  */
+typedef unsigned long int shmatt_t;
+
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
   {
-    struct ipc_perm shm_perm;		/* operation permission struct */
-    int shm_segsz;			/* size of segment in bytes */
-    __time_t shm_atime;			/* time of last shmat() */
-    __time_t shm_dtime;			/* time of last shmdt() */
-    __time_t shm_ctime;			/* time of last change by shmctl() */
-    __ipc_pid_t shm_cpid;		/* pid of creator */
-    __ipc_pid_t shm_lpid;		/* pid of last shmop */
-    unsigned short int shm_nattch;	/* number of current attaches */
-    unsigned short int __shm_npages;	/* size of segment (pages) */
-    unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
-    struct vm_area_struct *__attaches;	/* descriptors for attaches */
+    struct ipc_perm shm_perm;          /* operation permission struct */
+    unsigned int __unused1;
+    __time_t shm_atime;                        /* time of last shmat() */
+    unsigned int __unused2;
+    __time_t shm_dtime;                        /* time of last shmdt() */
+    unsigned int __unused3;
+    __time_t shm_ctime;                        /* time of last change by shmctl() */
+    unsigned int __unused4;
+    size_t shm_segsz;                  /* size of segment in bytes */
+    __pid_t shm_cpid;                  /* pid of creator */
+    __pid_t shm_lpid;                  /* pid of last shmop */
+    shmatt_t shm_nattch;               /* number of current attaches */
+    unsigned long __unused5;
+    unsigned long __unused6;
   };
 
 #ifdef __USE_MISC
 
 /* ipcs ctl commands */
-# define SHM_STAT 	13
-# define SHM_INFO 	14
+# define SHM_STAT      13
+# define SHM_INFO      14
 
 /* shm_mode upper byte flags */
-# define SHM_DEST	01000	/* segment will be destroyed on last detach */
-# define SHM_LOCKED	02000   /* segment will not be swapped */
+# define SHM_DEST      01000   /* segment will be destroyed on last detach */
+# define SHM_LOCKED    02000   /* segment will not be swapped */
 
-struct	shminfo
+struct shminfo
   {
-    int shmmax;
-    int shmmin;
-    int shmmni;
-    int shmseg;
-    int shmall;
+    unsigned long int shmmax;
+    unsigned long int shmmin;
+    unsigned long int shmmni;
+    unsigned long int shmseg;
+    unsigned long int shmall;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+    unsigned long int __unused3;
+    unsigned long int __unused4;
   };
 
 struct shm_info
   {
     int used_ids;
-    unsigned long int shm_tot;	/* total allocated shm */
-    unsigned long int shm_rss;	/* total resident shm */
-    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int shm_tot; /* total allocated shm */
+    unsigned long int shm_rss; /* total resident shm */
+    unsigned long int shm_swp; /* total swapped shm */
     unsigned long int swap_attempts;
     unsigned long int swap_successes;
   };

+ 11 - 11
libc/sysdeps/linux/powerpc/bits/sigaction.h

@@ -1,21 +1,21 @@
 /* The proper definitions for Linux's sigaction.
-   Copyright (C) 1993, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SIGNAL_H
 # error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
@@ -31,7 +31,7 @@ struct sigaction
 	/* Used if SA_SIGINFO is not set.  */
 	__sighandler_t sa_handler;
 	/* Used if SA_SIGINFO is set.  */
-	void (*sa_sigaction) __P ((int, siginfo_t *, void *));
+	void (*sa_sigaction) (int, siginfo_t *, void *);
       }
     __sigaction_handler;
 # define sa_handler	__sigaction_handler.sa_handler
@@ -47,7 +47,7 @@ struct sigaction
     int sa_flags;
 
     /* Restore handler.  */
-    void (*sa_restorer) __P ((void));
+    void (*sa_restorer) (void);
   };
 
 /* Bits in `sa_flags'.  */

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/sigcontext.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."

+ 49 - 22
libc/sysdeps/linux/powerpc/bits/siginfo.h

@@ -1,29 +1,33 @@
-/* siginfo_t, sigevent and constants.  Linux version.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* siginfo_t, sigevent and constants.  Linux/SPARC version.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#if !defined _SIGNAL_H && !defined __need_siginfo_t
+#if !defined _SIGNAL_H && !defined __need_siginfo_t \
+    && !defined __need_sigevent_t
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
-#if (!defined __have_siginfo_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t))
-# define __have_siginfo_t	1
+#include <bits/wordsize.h>
+
+#if (!defined __have_sigval_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t \
+	 || defined __need_sigevent_t))
+# define __have_sigval_t	1
 
 /* Type for data associated with a signal.  */
 typedef union sigval
@@ -31,9 +35,18 @@ typedef union sigval
     int sival_int;
     void *sival_ptr;
   } sigval_t;
+#endif
+
+#if (!defined __have_siginfo_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t	1
 
 # define __SI_MAX_SIZE     128
-# define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# if __WORDSIZE == 64
+#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
 
 typedef struct siginfo
   {
@@ -87,7 +100,7 @@ typedef struct siginfo
 	/* SIGPOLL.  */
 	struct
 	  {
-	    int si_band;	/* Band event for SIGPOLL.  */
+	    long int si_band;	/* Band event for SIGPOLL.  */
 	    int si_fd;
 	  } _sigpoll;
       } _sifields;
@@ -97,6 +110,8 @@ typedef struct siginfo
 /* X/Open requires some more fields with fixed names.  */
 # define si_pid		_sifields._kill.si_pid
 # define si_uid		_sifields._kill.si_uid
+# define si_timer1	_sifields._timer._timer1
+# define si_timer2	_sifields._timer._timer2
 # define si_status	_sifields._sigchld.si_status
 # define si_utime	_sifields._sigchld.si_utime
 # define si_stime	_sifields._sigchld.si_stime
@@ -112,7 +127,9 @@ typedef struct siginfo
    signals.  */
 enum
 {
-  SI_SIGIO = -5,		/* Sent by queued SIGIO. */
+  SI_ASYNCNL = -6,		/* Sent by asynch name lookup completion.  */
+# define SI_ASYNCNL	SI_ASYNCNL
+  SI_SIGIO,			/* Sent by queued SIGIO. */
 # define SI_SIGIO	SI_SIGIO
   SI_ASYNCIO,			/* Sent by AIO completion.  */
 # define SI_ASYNCIO	SI_ASYNCIO
@@ -122,8 +139,10 @@ enum
 # define SI_TIMER	SI_TIMER
   SI_QUEUE,			/* Sent by sigqueue.  */
 # define SI_QUEUE	SI_QUEUE
-  SI_USER			/* Sent by kill, sigsend, raise.  */
+  SI_USER,			/* Sent by kill, sigsend, raise.  */
 # define SI_USER	SI_USER
+  SI_KERNEL = 0x80		/* Send by kernel.  */
+#define SI_KERNEL	SI_KERNEL
 };
 
 
@@ -236,12 +255,20 @@ enum
 #endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
 
 
-#if defined _SIGNAL_H && !defined __have_sigevent_t
+#if (defined _SIGNAL_H || defined __need_sigevent_t) \
+    && !defined __have_sigevent_t
 # define __have_sigevent_t	1
 
 /* Structure to transport application-defined values with signals.  */
 # define __SIGEV_MAX_SIZE	64
-# define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# if __WORDSIZE == 64
+#  define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# endif
+
+/* Forward declaration of the `pthread_attr_t' type.  */
+struct __pthread_attr_s;
 
 typedef struct sigevent
   {
@@ -255,8 +282,8 @@ typedef struct sigevent
 
 	struct
 	  {
-	    void (*_function) __P ((sigval_t)); /* Function to start.  */
-	    void *_attribute;			  /* Really pthread_attr_t.  */
+	    void (*_function) (sigval_t);	  /* Function to start.  */
+	    struct __pthread_attr_s *_attribute;  /* Really pthread_attr_t.  */
 	  } _sigev_thread;
       } _sigev_un;
   } sigevent_t;

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/signum.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifdef	_SIGNAL_H
 

+ 8 - 11
libc/sysdeps/linux/powerpc/bits/sigset.h

@@ -3,19 +3,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef	_SIGSET_H_types
 # define _SIGSET_H_types	1
@@ -97,8 +97,6 @@ typedef struct
 #  endif
 # endif
 
-__BEGIN_DECLS
-
 /* These functions needn't check for a bogus signal number -- error
    checking is done in the non __ versions.  */
 
@@ -123,6 +121,5 @@ __SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), )
 #  undef __SIGSETFN
 # endif
 
-__END_DECLS
 
 #endif /* ! _SIGSET_H_fns.  */

+ 11 - 11
libc/sysdeps/linux/powerpc/bits/sigstack.h

@@ -1,21 +1,21 @@
 /* sigstack, sigaltstack definitions.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SIGNAL_H
 # error "Never include this file directly.  Use <signal.h> instead"
@@ -25,7 +25,7 @@
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
   {
-    __ptr_t ss_sp;		/* Signal stack pointer.  */
+    void *ss_sp;		/* Signal stack pointer.  */
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
@@ -49,7 +49,7 @@ enum
 /* Alternate, preferred interface.  */
 typedef struct sigaltstack
   {
-    __ptr_t ss_sp;
+    void *ss_sp;
     int ss_flags;
     size_t ss_size;
   } stack_t;

+ 6 - 9
libc/sysdeps/linux/powerpc/bits/sigthread.h

@@ -1,5 +1,5 @@
 /* Signal handling function for threaded programs.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,25 +17,22 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _BITS_SIGTHREAD_H 
+#ifndef _BITS_SIGTHREAD_H
 #define _BITS_SIGTHREAD_H	1
 
 #if !defined _SIGNAL_H && !defined _PTHREAD_H
 # error "Never include this file directly.  Use <pthread.h> instead"
 #endif
 
-__BEGIN_DECLS
-
 /* Functions for handling signals. */
 
 /* Modify the signal mask for the calling thread.  The arguments have
    the same meaning as for sigprocmask(2). */
-extern int pthread_sigmask __P ((int __how, __const __sigset_t *__newmask,
-				 __sigset_t *__oldmask));
+extern int pthread_sigmask (int __how,
+			    __const __sigset_t *__restrict __newmask,
+			    __sigset_t *__restrict __oldmask)__THROW;
 
 /* Send signal SIGNO to the given thread. */
-extern int pthread_kill __P ((pthread_t __thread, int __signo));
-
-__END_DECLS
+extern int pthread_kill (pthread_t __thread, int __signo) __THROW;
 
 #endif	/* bits/sigthread.h */

+ 9 - 16
libc/sysdeps/linux/powerpc/bits/sockaddr.h

@@ -1,21 +1,21 @@
 /* Definition of `struct sockaddr_*' common members.  Generic/4.2 BSD version.
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  * Never include this file directly; use <sys/socket.h> instead.
@@ -24,7 +24,6 @@
 #ifndef _BITS_SOCKADDR_H
 #define _BITS_SOCKADDR_H	1
 
-__BEGIN_DECLS
 
 /* POSIX.1g specifies this type name for the `sa_family' member.  */
 typedef unsigned short int sa_family_t;
@@ -38,10 +37,4 @@ typedef unsigned short int sa_family_t;
 
 #define __SOCKADDR_COMMON_SIZE	(sizeof (unsigned short int))
 
-/* Return the length of a `sockaddr' structure.  */
-#define SA_LEN(_x)	__libc_sa_len((_x)->sa_family)
-extern int __libc_sa_len __P ((sa_family_t __af));
-
-__END_DECLS
-
 #endif	/* bits/sockaddr.h */

+ 39 - 30
libc/sysdeps/linux/powerpc/bits/socket.h

@@ -1,21 +1,21 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1994-1999,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef __BITS_SOCKET_H
 #define __BITS_SOCKET_H
@@ -32,7 +32,10 @@
 #include <sys/types.h>
 
 /* Type for length arguments in socket calls.  */
-typedef unsigned int socklen_t;
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
 
 /* Types of sockets.  */
 enum __socket_type
@@ -82,7 +85,10 @@ enum __socket_type
 #define	PF_ECONET	19	/* Acorn Econet.  */
 #define	PF_ATMSVC	20	/* ATM SVCs.  */
 #define	PF_SNA		22	/* Linux SNA Project */
-#define PF_IRDA		23	/* IRDA sockets.  */
+#define	PF_IRDA		23	/* IRDA sockets.  */
+#define	PF_PPPOX	24	/* PPPoX sockets.  */
+#define	PF_WANPIPE	25	/* Wanpipe API sockets.  */
+#define	PF_BLUETOOTH	31	/* Bluetooth sockets.  */
 #define	PF_MAX		32	/* For now..  */
 
 /* Address families.  */
@@ -111,7 +117,10 @@ enum __socket_type
 #define	AF_ECONET	PF_ECONET
 #define	AF_ATMSVC	PF_ATMSVC
 #define	AF_SNA		PF_SNA
-#define AF_IRDA		PF_IRDA
+#define	AF_IRDA		PF_IRDA
+#define	AF_PPPOX	PF_PPPOX
+#define	AF_WANPIPE	PF_WANPIPE
+#define	AF_BLUETOOTH	PF_BLUETOOTH
 #define	AF_MAX		PF_MAX
 
 /* Socket level values.  Others are defined in the appropriate headers.
@@ -152,7 +161,7 @@ struct sockaddr
 
 struct sockaddr_storage
   {
-    __SOCKADDR_COMMON (__ss_);	/* Address family, etc.  */
+    __SOCKADDR_COMMON (ss_);	/* Address family, etc.  */
     __ss_aligntype __ss_align;	/* Force desired alignment.  */
     char __ss_padding[_SS_PADSIZE];
   };
@@ -188,14 +197,16 @@ enum
 #define	MSG_FIN		MSG_FIN
     MSG_SYN		= 0x400,
 #define	MSG_SYN		MSG_SYN
-    MSG_URG		= 0x800,
-#define	MSG_URG		MSG_URG
+    MSG_CONFIRM		= 0x800, /* Confirm path validity.  */
+#define	MSG_CONFIRM	MSG_CONFIRM
     MSG_RST		= 0x1000,
 #define	MSG_RST		MSG_RST
     MSG_ERRQUEUE	= 0x2000, /* Fetch message from error queue.  */
 #define	MSG_ERRQUEUE	MSG_ERRQUEUE
-    MSG_NOSIGNAL	= 0x4000  /* Do not generate SIGPIPE.  */
+    MSG_NOSIGNAL	= 0x4000, /* Do not generate SIGPIPE.  */
 #define	MSG_NOSIGNAL	MSG_NOSIGNAL
+    MSG_MORE		= 0x8000  /* Sender will send more.  */
+#define	MSG_MORE	MSG_MORE
   };
 
 
@@ -203,14 +214,14 @@ enum
    `sendmsg' and received by `recvmsg'.  */
 struct msghdr
   {
-    __ptr_t msg_name;		/* Address to send to/receive from.  */
+    void *msg_name;		/* Address to send to/receive from.  */
     socklen_t msg_namelen;	/* Length of address data.  */
 
     struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
-    size_t msg_iovlen;		/* Number of elements in the vector.  */
+    int msg_iovlen;		/* Number of elements in the vector.  */
 
-    __ptr_t msg_control;	/* Ancillary data (eg BSD filedesc passing). */
-    size_t msg_controllen;	/* Ancillary data buffer length.  */
+    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
+    socklen_t msg_controllen;	/* Ancillary data buffer length.  */
 
     int msg_flags;		/* Flags on received message.  */
   };
@@ -222,10 +233,8 @@ struct cmsghdr
 				   of cmsghdr structure.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
-#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
-    unsigned char __cmsg_data[0]; /* Ancillary data.  */
+    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
     /* XXX Perhaps this should be removed.  */
-#endif
   };
 
 /* Ancillary data object manipulation macros.  */
@@ -239,19 +248,19 @@ struct cmsghdr
   ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
    ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
 #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
-			 & ~(sizeof (size_t) - 1))
+			 & (size_t) ~(sizeof (size_t) - 1))
 #define CMSG_SPACE(len) (CMSG_ALIGN (len) \
 			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
 #define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
 
-extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
-					   struct cmsghdr *__cmsg));
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+				      struct cmsghdr *__cmsg) __THROW;
 #ifdef __USE_EXTERN_INLINES
 # ifndef _EXTERN_INLINE
 #  define _EXTERN_INLINE extern __inline
 # endif
 _EXTERN_INLINE struct cmsghdr *
-__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
+__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
 {
   if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
     /* The kernel header does this so there may be a reason.  */
@@ -259,10 +268,10 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
 
   __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
 			       + CMSG_ALIGN (__cmsg->cmsg_len));
-  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
-					 + __mhdr->msg_controllen)
+  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+					+ __mhdr->msg_controllen)
       || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
-	  >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
     /* No more entries.  */
     return 0;
   return __cmsg;

+ 18 - 16
libc/sysdeps/linux/powerpc/bits/stat.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_STAT_H
 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
@@ -36,8 +36,8 @@
 struct stat
   {
     __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
 #ifndef __USE_FILE_OFFSET64
+    unsigned short int __pad1;
     __ino_t st_ino;			/* File serial number.	*/
 #else
     __ino64_t st_ino;			/* File serial number.	*/
@@ -53,7 +53,7 @@ struct stat
 #else
     __off64_t st_size;			/* Size of file, in bytes.  */
 #endif
-    unsigned long int st_blksize;	/* Optimal block size for I/O.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
 #ifndef __USE_FILE_OFFSET64
     __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
@@ -74,8 +74,6 @@ struct stat
 struct stat64
   {
     __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
-
     __ino64_t st_ino;			/* File serial number.	*/
     __mode_t st_mode;			/* File mode.  */
     __nlink_t st_nlink;			/* Link count.  */
@@ -84,7 +82,7 @@ struct stat64
     __dev_t st_rdev;			/* Device number, if device.  */
     unsigned short int __pad2;
     __off64_t st_size;			/* Size of file, in bytes.  */
-    unsigned long int st_blksize;	/* Optimal block size for I/O.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
     __time_t st_atime;			/* Time of last access.  */
@@ -112,11 +110,15 @@ struct stat64
 #define	__S_IFBLK	0060000	/* Block device.  */
 #define	__S_IFREG	0100000	/* Regular file.  */
 #define	__S_IFIFO	0010000	/* FIFO.  */
-
-/* These don't actually exist on System V, but having them doesn't hurt.  */
 #define	__S_IFLNK	0120000	/* Symbolic link.  */
 #define	__S_IFSOCK	0140000	/* Socket.  */
 
+/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
+   they do it by enforcing the correct use of the macros.  */
+#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+
 /* Protection bits.  */
 
 #define	__S_ISUID	04000	/* Set user ID on execution.  */

+ 12 - 9
libc/sysdeps/linux/powerpc/bits/statfs.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_STATFS_H
 # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
@@ -59,3 +59,6 @@ struct statfs64
     int f_spare[6];
   };
 #endif
+
+/* Tell code we have this member.  */
+#define _STATFS_F_NAMELEN

+ 99 - 0
libc/sysdeps/linux/powerpc/bits/statvfs.h

@@ -0,0 +1,99 @@
+/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_STATVFS_H
+# error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead."
+#endif
+
+#include <bits/types.h>  /* For __fsblkcnt_t and __fsfilcnt_t.  */
+
+struct statvfs
+  {
+    unsigned long int f_bsize;
+    unsigned long int f_frsize;
+#ifndef __USE_FILE_OFFSET64
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_bavail;
+    __fsfilcnt_t f_files;
+    __fsfilcnt_t f_ffree;
+    __fsfilcnt_t f_favail;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsfilcnt64_t f_files;
+    __fsfilcnt64_t f_ffree;
+    __fsfilcnt64_t f_favail;
+#endif
+    unsigned long int f_fsid;
+    int __f_unused;
+    unsigned long int f_flag;
+    unsigned long int f_namemax;
+    int __f_spare[6];
+  };
+#define _STATVFSBUF_F_UNUSED
+
+#ifdef __USE_LARGEFILE64
+struct statvfs64
+  {
+    unsigned long int f_bsize;
+    unsigned long int f_frsize;
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsfilcnt64_t f_files;
+    __fsfilcnt64_t f_ffree;
+    __fsfilcnt64_t f_favail;
+    unsigned long int f_fsid;
+    int __f_unused;
+    unsigned long int f_flag;
+    unsigned long int f_namemax;
+    int __f_spare[6];
+  };
+#endif
+
+/* Definitions for the flag in `f_flag'.  These definitions should be
+   kept in sync which the definitions in <sys/mount.h>.  */
+enum
+{
+  ST_RDONLY = 1,		/* Mount read-only.  */
+#define ST_RDONLY	ST_RDONLY
+  ST_NOSUID = 2,		/* Ignore suid and sgid bits.  */
+#define ST_NOSUID	ST_NOSUID
+#ifdef __USE_GNU
+  ST_NODEV = 4,			/* Disallow access to device special files.  */
+# define ST_NODEV	ST_NODEV
+  ST_NOEXEC = 8,		/* Disallow program execution.  */
+# define ST_NOEXEC	ST_NOEXEC
+  ST_SYNCHRONOUS = 16,		/* Writes are synced at once.  */
+# define ST_SYNCHRONOUS	ST_SYNCHRONOUS
+  ST_MANDLOCK = 64,		/* Allow mandatory locks on an FS.  */
+# define ST_MANDLOCK	ST_MANDLOCK
+  ST_WRITE = 128,		/* Write on file/directory/symlink.  */
+# define ST_WRITE	ST_WRITE
+  ST_APPEND = 256,		/* Append-only file.  */
+# define ST_APPEND	ST_APPEND
+  ST_IMMUTABLE = 512,		/* Immutable file.  */
+# define ST_IMMUTABLE	ST_IMMUTABLE
+  ST_NOATIME = 1024,		/* Do not update access times.  */
+# define ST_NOATIME	ST_NOATIME
+  ST_NODIRATIME			/* Do not update directory access times.  */
+# define ST_NODIRATIME	ST_NODIRATIME
+#endif	/* Use GNU.  */
+};

+ 50 - 0
libc/sysdeps/linux/powerpc/bits/stdio-lock.h

@@ -0,0 +1,50 @@
+/* Thread package specific definitions of stream lock type.
+   Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <pthread.h>
+
+typedef pthread_mutex_t _IO_lock_t;
+
+/* We need recursive (counting) mutexes.  */
+#define _IO_lock_initializer PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+
+#define _IO_cleanup_region_start(_fct, _fp) \
+  { struct _pthread_cleanup_buffer _buffer;				      \
+    int _avail = (((_fp)->_flags & _IO_USER_LOCK) == 0			      \
+		  && _pthread_cleanup_push_defer != NULL);		      \
+    if (_avail) {							      \
+      _pthread_cleanup_push_defer (&_buffer, (_fct), (_fp));		      \
+    }
+#define _IO_cleanup_region_start_noarg(_fct) \
+  { struct _pthread_cleanup_buffer _buffer;				      \
+    int _avail = _pthread_cleanup_push_defer != NULL;			      \
+    if (_avail) {							      \
+      _pthread_cleanup_push_defer (&_buffer, (_fct), NULL);		      \
+    }
+#define _IO_cleanup_region_end(_doit) \
+     __libc_cleanup_region_end (_doit)
+#define _IO_lock_init(_name) \
+     __libc_lock_init_recursive (_name)
+#define _IO_lock_fini(_name) \
+     __libc_lock_fini_recursive (_name)
+#define _IO_lock_lock(_name) \
+     __libc_lock_lock (_name)
+#define _IO_lock_unlock(_name) \
+     __libc_lock_unlock (_name)

+ 169 - 0
libc/sysdeps/linux/powerpc/bits/stdio.h

@@ -0,0 +1,169 @@
+/* Optimizing macros and inline functions for stdio functions.
+   Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _STDIO_H
+# error "Never include <bits/stdio.h> directly; use <stdio.h> instead."
+#endif
+
+#ifdef __cplusplus
+# define __STDIO_INLINE inline
+#else
+# define __STDIO_INLINE extern __inline
+#endif
+
+
+#ifdef __USE_EXTERN_INLINES
+/* Write formatted output to stdout from argument list ARG.  */
+__STDIO_INLINE int
+vprintf (__const char *__restrict __fmt, _G_va_list __arg) __THROW
+{
+  return vfprintf (stdout, __fmt, __arg);
+}
+
+/* Read a character from stdin.  */
+__STDIO_INLINE int
+getchar (void) __THROW
+{
+  return _IO_getc (stdin);
+}
+
+
+# if defined __USE_POSIX || defined __USE_MISC
+/* This is defined in POSIX.1:1996.  */
+__STDIO_INLINE int
+getc_unlocked (FILE *__fp) __THROW
+{
+  return _IO_getc_unlocked (__fp);
+}
+
+/* This is defined in POSIX.1:1996.  */
+__STDIO_INLINE int
+getchar_unlocked (void) __THROW
+{
+  return _IO_getc_unlocked (stdin);
+}
+# endif	/* POSIX || misc */
+
+
+/* Write a character to stdout.  */
+__STDIO_INLINE int
+putchar (int __c) __THROW
+{
+  return _IO_putc (__c, stdout);
+}
+
+
+# ifdef __USE_MISC
+/* Faster version when locking is not necessary.  */
+__STDIO_INLINE int
+fputc_unlocked (int __c, FILE *__stream) __THROW
+{
+  return _IO_putc_unlocked (__c, __stream);
+}
+# endif /* misc */
+
+
+# if defined __USE_POSIX || defined __USE_MISC
+/* This is defined in POSIX.1:1996.  */
+__STDIO_INLINE int
+putc_unlocked (int __c, FILE *__stream) __THROW
+{
+  return _IO_putc_unlocked (__c, __stream);
+}
+
+/* This is defined in POSIX.1:1996.  */
+__STDIO_INLINE int
+putchar_unlocked (int __c) __THROW
+{
+  return _IO_putc_unlocked (__c, stdout);
+}
+# endif	/* POSIX || misc */
+
+
+# ifdef	__USE_GNU
+/* Like `getdelim', but reads up to a newline.  */
+__STDIO_INLINE _IO_ssize_t
+getline (char **__lineptr, size_t *__n, FILE *__stream) __THROW
+{
+  return __getdelim (__lineptr, __n, '\n', __stream);
+}
+# endif /* GNU */
+
+
+# ifdef __USE_MISC
+/* Faster versions when locking is not required.  */
+__STDIO_INLINE int
+feof_unlocked (FILE *__stream) __THROW
+{
+  return _IO_feof_unlocked (__stream);
+}
+
+/* Faster versions when locking is not required.  */
+__STDIO_INLINE int
+ferror_unlocked (FILE *__stream) __THROW
+{
+  return _IO_ferror_unlocked (__stream);
+}
+# endif /* misc */
+
+#endif /* Use extern inlines.  */
+
+
+#if defined __USE_MISC && defined __GNUC__ && defined __OPTIMIZE__
+/* Perform some simple optimizations.  */
+# define fread_unlocked(ptr, size, n, stream) \
+  (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n)    \
+		   && (size_t) ((size) * (n)) <= 8 && (size) != 0)	      \
+		  ? ({ char *__ptr = (char *) (ptr);			      \
+		       FILE *__stream = (stream);			      \
+		       size_t __cnt;					      \
+		       for (__cnt = (size) * (n); __cnt > 0; --__cnt)	      \
+			 {						      \
+			   int __c = _IO_getc_unlocked (__stream);	      \
+			   if (__c == EOF)				      \
+			     break;					      \
+			   *__ptr++ = __c;				      \
+			 }						      \
+		       ((size_t) ((size) * (n)) - __cnt) / (size); })	      \
+		  : (((__builtin_constant_p (size) && (size) == 0)	      \
+		      || (__builtin_constant_p (n) && (n) == 0))	      \
+			/* Evaluate all parameters once.  */		      \
+		     ? ((void) (ptr), (void) (stream), (void) (size),	      \
+			(void) (n), 0)					      \
+		     : fread_unlocked (ptr, size, n, stream))))
+
+# define fwrite_unlocked(ptr, size, n, stream) \
+  (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n)    \
+		   && (size_t) ((size) * (n)) <= 8 && (size) != 0)	      \
+		  ? ({ const char *__ptr = (const char *) (ptr);	      \
+		       FILE *__stream = (stream);			      \
+		       size_t __cnt;					      \
+		       for (__cnt = (size) * (n); __cnt > 0; --__cnt)	      \
+			 if (_IO_putc_unlocked (*__ptr++, __stream) == EOF)   \
+			   break;					      \
+		       ((size_t) ((size) * (n)) - __cnt) / (size); })	      \
+		  : (((__builtin_constant_p (size) && (size) == 0)	      \
+		      || (__builtin_constant_p (n) && (n) == 0))	      \
+			/* Evaluate all parameters once.  */		      \
+		     ? ((void) (ptr), (void) (stream), (void) (size), n)      \
+		     : fwrite_unlocked (ptr, size, n, stream))))
+#endif
+
+/* Define helper macro.  */
+#undef __STDIO_INLINE

+ 16 - 12
libc/sysdeps/linux/powerpc/bits/stdio_lim.h

@@ -1,29 +1,29 @@
-/* Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#if !defined _STDIO_H && !defined __need_FOPEN_MAX
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX
 # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
 #endif
 
 #ifdef _STDIO_H
 # define L_tmpnam 20
 # define TMP_MAX 238328
-# define FILENAME_MAX 255
+# define FILENAME_MAX 4095 
 
 # ifdef __USE_POSIX
 #  define L_ctermid 9
@@ -33,5 +33,9 @@
 
 #if defined __need_FOPEN_MAX || defined _STDIO_H
 # undef  FOPEN_MAX
-# define FOPEN_MAX 256 
+# define FOPEN_MAX 16
+#endif
+
+#if defined __need_IOV_MAX && !defined IOV_MAX
+# define IOV_MAX 1024 
 #endif

+ 12 - 0
libc/sysdeps/linux/powerpc/bits/string.h

@@ -0,0 +1,12 @@
+/* This file should provide inline versions of string functions.
+
+   Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
+
+   This file should define __STRING_INLINES if functions are actually defined
+   as inlines.  */
+
+#ifndef _BITS_STRING_H
+#define _BITS_STRING_H	1
+
+
+#endif /* bits/string.h */

+ 1244 - 0
libc/sysdeps/linux/powerpc/bits/string2.h

@@ -0,0 +1,1244 @@
+/* Machine-independant string function optimizations.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _STRING_H
+# error "Never use <bits/string2.h> directly; include <string.h> instead."
+#endif
+
+#if !defined __NO_STRING_INLINES && !defined __BOUNDED_POINTERS__
+
+/* Unlike the definitions in the header <bits/string.h> the
+   definitions contained here are not optimized down to assembler
+   level.  Those optimizations are not always a good idea since this
+   means the code size increases a lot.  Instead the definitions here
+   optimize some functions in a way which do not dramatically
+   increase the code size and which do not use assembler.  The main
+   trick is to use GNU CC's `__builtin_constant_p' function.
+
+   Every function XXX which has a defined version in
+   <bits/string.h> must be accompanied by a symbol _HAVE_STRING_ARCH_XXX
+   to make sure we don't get redefinitions.
+
+   We must use here macros instead of inline functions since the
+   trick won't work with the latter.  */
+
+#ifndef __STRING_INLINE
+# ifdef __cplusplus
+#  define __STRING_INLINE inline
+# else
+#  define __STRING_INLINE extern __inline
+# endif
+#endif
+
+#if _STRING_ARCH_unaligned
+/* If we can do unaligned memory accesses we must know the endianess.  */
+# include <endian.h>
+# include <bits/types.h>
+
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define __STRING2_SMALL_GET16(src, idx) \
+     (((__const unsigned char *) (__const char *) (src))[idx + 1] << 8	      \
+      | ((__const unsigned char *) (__const char *) (src))[idx])
+#  define __STRING2_SMALL_GET32(src, idx) \
+     (((((__const unsigned char *) (__const char *) (src))[idx + 3] << 8      \
+	| ((__const unsigned char *) (__const char *) (src))[idx + 2]) << 8   \
+       | ((__const unsigned char *) (__const char *) (src))[idx + 1]) << 8    \
+      | ((__const unsigned char *) (__const char *) (src))[idx])
+# else
+#  define __STRING2_SMALL_GET16(src, idx) \
+     (((__const unsigned char *) (__const char *) (src))[idx] << 8	      \
+      | ((__const unsigned char *) (__const char *) (src))[idx + 1])
+#  define __STRING2_SMALL_GET32(src, idx) \
+     (((((__const unsigned char *) (__const char *) (src))[idx] << 8	      \
+	| ((__const unsigned char *) (__const char *) (src))[idx + 1]) << 8   \
+       | ((__const unsigned char *) (__const char *) (src))[idx + 2]) << 8    \
+      | ((__const unsigned char *) (__const char *) (src))[idx + 3])
+# endif
+#else
+/* These are a few types we need for the optimizations if we cannot
+   use unaligned memory accesses.  */
+# define __STRING2_COPY_TYPE(N) \
+  typedef struct { unsigned char __arr[N]; }				      \
+    __STRING2_COPY_ARR##N __attribute__ ((packed))
+__STRING2_COPY_TYPE (2);
+__STRING2_COPY_TYPE (3);
+__STRING2_COPY_TYPE (4);
+__STRING2_COPY_TYPE (5);
+__STRING2_COPY_TYPE (6);
+__STRING2_COPY_TYPE (7);
+__STRING2_COPY_TYPE (8);
+# undef __STRING2_COPY_TYPE
+#endif
+
+/* Dereferencing a pointer arg to run sizeof on it fails for the void
+   pointer case, so we use this instead.
+   Note that __x is evaluated twice. */
+#define __string2_1bptr_p(__x) \
+  ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1)
+
+/* Set N bytes of S to C.  */
+#ifndef _HAVE_STRING_ARCH_memset
+# if _STRING_ARCH_unaligned
+#  define memset(s, c, n) \
+  (__extension__ (__builtin_constant_p (n) && (n) <= 16			      \
+		  ? ((n) == 1						      \
+		     ? __memset_1 (s, c)				      \
+		     : __memset_gc (s, c, n))				      \
+		  : (__builtin_constant_p (c) && (c) == '\0'		      \
+		     ? ({ void *__s = (s); __bzero (__s, n); __s; })	      \
+		     : memset (s, c, n))))
+
+#  define __memset_1(s, c) ({ void *__s = (s);				      \
+			    *((__uint8_t *) __s) = (__uint8_t) c; __s; })
+
+#  define __memset_gc(s, c, n) \
+  ({ void *__s = (s);							      \
+     union {								      \
+       unsigned int __ui;						      \
+       unsigned short int __usi;					      \
+       unsigned char __uc;						      \
+     } *__u = __s;							      \
+     __uint8_t __c = (__uint8_t) (c);					      \
+									      \
+     /* This `switch' statement will be removed at compile-time.  */	      \
+     switch ((unsigned int) (n))					      \
+       {								      \
+       case 15:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 11:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 7:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 3:								      \
+	 __u->__usi = (unsigned short int) __c * 0x0101;		      \
+	 __u = __extension__ (void *)((char *) __u + 2);		      \
+	 __u->__uc = (unsigned char) __c;				      \
+	 break;								      \
+									      \
+       case 14:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 10:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 6:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 2:								      \
+	 __u->__usi = (unsigned short int) __c * 0x0101;		      \
+	 break;								      \
+									      \
+       case 13:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 9:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 5:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 1:								      \
+	 __u->__uc = (unsigned char) __c;				      \
+	 break;								      \
+									      \
+       case 16:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 12:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 8:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+	 __u = __extension__ (void *)((char *) __u + 4);		      \
+       case 4:								      \
+	 __u->__ui = __c * 0x01010101;					      \
+       case 0:								      \
+	 break;								      \
+       }								      \
+									      \
+     __s; })
+# else
+#  define memset(s, c, n) \
+  (__extension__ (__builtin_constant_p (c) && (c) == '\0'		      \
+		  ? ({ void *__s = (s); __bzero (__s, n); __s; })	      \
+		  : memset (s, c, n)))
+# endif
+
+/* GCC optimizes memset(s, 0, n) but not bzero(s, n).
+   The optimization is broken before EGCS 1.1.  */
+# if __GNUC_PREREQ (2, 91)
+#  define __bzero(s, n) __builtin_memset (s, '\0', n)
+# endif
+
+#endif
+
+
+/* Copy N bytes from SRC to DEST, returning pointer to byte following the
+   last copied.  */
+#ifdef __USE_GNU
+# ifndef _HAVE_STRING_ARCH_mempcpy
+#  define __mempcpy(dest, src, n) \
+  (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \
+		  && __string2_1bptr_p (src) && n <= 8			      \
+		  ? __mempcpy_small (dest, __mempcpy_args (src), n)	      \
+		  : __mempcpy (dest, src, n)))
+/* In glibc we use this function frequently but for namespace reasons
+   we have to use the name `__mempcpy'.  */
+#  define mempcpy(dest, src, n) __mempcpy (dest, src, n)
+
+#  if _STRING_ARCH_unaligned
+#   define __mempcpy_args(src) \
+     ((__const char *) (src))[0], ((__const char *) (src))[2],		      \
+     ((__const char *) (src))[4], ((__const char *) (src))[6],		      \
+     __extension__ __STRING2_SMALL_GET16 (src, 0),			      \
+     __extension__ __STRING2_SMALL_GET16 (src, 4),			      \
+     __extension__ __STRING2_SMALL_GET32 (src, 0),			      \
+     __extension__ __STRING2_SMALL_GET32 (src, 4)
+__STRING_INLINE void *__mempcpy_small (void *, char, char, char, char,
+				       __uint16_t, __uint16_t, __uint32_t,
+				       __uint32_t, size_t);
+__STRING_INLINE void *
+__mempcpy_small (void *__dest1,
+		 char __src0_1, char __src2_1, char __src4_1, char __src6_1,
+		 __uint16_t __src0_2, __uint16_t __src4_2,
+		 __uint32_t __src0_4, __uint32_t __src4_4,
+		 size_t __srclen)
+{
+  union {
+    __uint32_t __ui;
+    __uint16_t __usi;
+    unsigned char __uc;
+    unsigned char __c;
+  } *__u = __dest1;
+  switch ((unsigned int) __srclen)
+    {
+    case 1:
+      __u->__c = __src0_1;
+      __u = __extension__ (void *)((char *) __u + 1);
+      break;
+    case 2:
+      __u->__usi = __src0_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      break;
+    case 3:
+      __u->__usi = __src0_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      __u->__c = __src2_1;
+      __u = __extension__ (void *)((char *) __u + 1);
+      break;
+    case 4:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      break;
+    case 5:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__c = __src4_1;
+      __u = __extension__ (void *)((char *) __u + 1);
+      break;
+    case 6:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__usi = __src4_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      break;
+    case 7:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__usi = __src4_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      __u->__c = __src6_1;
+      __u = __extension__ (void *)((char *) __u + 1);
+      break;
+    case 8:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__ui = __src4_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      break;
+    }
+  return (void *) __u;
+}
+#  else
+#   define __mempcpy_args(src) \
+     ((__const char *) (src))[0],					      \
+     __extension__ ((__STRING2_COPY_ARR2)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1] } }),      \
+     __extension__ ((__STRING2_COPY_ARR3)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2] } }),				      \
+     __extension__ ((__STRING2_COPY_ARR4)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3] } }),      \
+     __extension__ ((__STRING2_COPY_ARR5)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4] } }),				      \
+     __extension__ ((__STRING2_COPY_ARR6)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5] } }),      \
+     __extension__ ((__STRING2_COPY_ARR7)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5],	      \
+	  ((__const char *) (src))[6] } }),				      \
+     __extension__ ((__STRING2_COPY_ARR8)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5],	      \
+	  ((__const char *) (src))[6], ((__const char *) (src))[7] } })
+__STRING_INLINE void *__mempcpy_small (void *, char, __STRING2_COPY_ARR2,
+				       __STRING2_COPY_ARR3,
+				       __STRING2_COPY_ARR4,
+				       __STRING2_COPY_ARR5,
+				       __STRING2_COPY_ARR6,
+				       __STRING2_COPY_ARR7,
+				       __STRING2_COPY_ARR8, size_t);
+__STRING_INLINE void *
+__mempcpy_small (void *__dest, char __src1,
+		 __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3,
+		 __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5,
+		 __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7,
+		 __STRING2_COPY_ARR8 __src8, size_t __srclen)
+{
+  union {
+    char __c;
+    __STRING2_COPY_ARR2 __sca2;
+    __STRING2_COPY_ARR3 __sca3;
+    __STRING2_COPY_ARR4 __sca4;
+    __STRING2_COPY_ARR5 __sca5;
+    __STRING2_COPY_ARR6 __sca6;
+    __STRING2_COPY_ARR7 __sca7;
+    __STRING2_COPY_ARR8 __sca8;
+  } *__u = __dest;
+  switch ((unsigned int) __srclen)
+    {
+    case 1:
+      __u->__c = __src1;
+      break;
+    case 2:
+      __extension__ __u->__sca2 = __src2;
+      break;
+    case 3:
+      __extension__ __u->__sca3 = __src3;
+      break;
+    case 4:
+      __extension__ __u->__sca4 = __src4;
+      break;
+    case 5:
+      __extension__ __u->__sca5 = __src5;
+      break;
+    case 6:
+      __extension__ __u->__sca6 = __src6;
+      break;
+    case 7:
+      __extension__ __u->__sca7 = __src7;
+      break;
+    case 8:
+      __extension__ __u->__sca8 = __src8;
+      break;
+    }
+  return __extension__ (void *)((char *) __u + __srclen);
+}
+#  endif
+# endif
+#endif
+
+
+/* Return pointer to C in S.  */
+#ifndef _HAVE_STRING_ARCH_strchr
+extern void *__rawmemchr (const void *__s, int __c);
+# define strchr(s, c) \
+  (__extension__ (__builtin_constant_p (c) && (c) == '\0'		      \
+		  ? (char *) __rawmemchr (s, c)				      \
+		  : strchr (s, c)))
+#endif
+
+
+/* Copy SRC to DEST.  */
+#ifndef _HAVE_STRING_ARCH_strcpy
+# define strcpy(dest, src) \
+  (__extension__ (__builtin_constant_p (src)				      \
+		  ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8	      \
+		     ? __strcpy_small (dest, __strcpy_args (src),	      \
+				       strlen (src) + 1)		      \
+		     : (char *) memcpy (dest, src, strlen (src) + 1))	      \
+		  : strcpy (dest, src)))
+
+# if _STRING_ARCH_unaligned
+#  define __strcpy_args(src) \
+     __extension__ __STRING2_SMALL_GET16 (src, 0),			      \
+     __extension__ __STRING2_SMALL_GET16 (src, 4),			      \
+     __extension__ __STRING2_SMALL_GET32 (src, 0),			      \
+     __extension__ __STRING2_SMALL_GET32 (src, 4)
+__STRING_INLINE char *__strcpy_small (char *, __uint16_t, __uint16_t,
+				      __uint32_t, __uint32_t, size_t);
+__STRING_INLINE char *
+__strcpy_small (char *__dest,
+		__uint16_t __src0_2, __uint16_t __src4_2,
+		__uint32_t __src0_4, __uint32_t __src4_4,
+		size_t __srclen)
+{
+  union {
+    __uint32_t __ui;
+    __uint16_t __usi;
+    unsigned char __uc;
+  } *__u = (void *) __dest;
+  switch ((unsigned int) __srclen)
+    {
+    case 1:
+      __u->__uc = '\0';
+      break;
+    case 2:
+      __u->__usi = __src0_2;
+      break;
+    case 3:
+      __u->__usi = __src0_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      __u->__uc = '\0';
+      break;
+    case 4:
+      __u->__ui = __src0_4;
+      break;
+    case 5:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__uc = '\0';
+      break;
+    case 6:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__usi = __src4_2;
+      break;
+    case 7:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__usi = __src4_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      __u->__uc = '\0';
+      break;
+    case 8:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__ui = __src4_4;
+      break;
+    }
+  return __dest;
+}
+# else
+#  define __strcpy_args(src) \
+     __extension__ ((__STRING2_COPY_ARR2)				      \
+      { { ((__const char *) (src))[0], '\0' } }),			      \
+     __extension__ ((__STRING2_COPY_ARR3)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  '\0' } }),							      \
+     __extension__ ((__STRING2_COPY_ARR4)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], '\0' } }),			      \
+     __extension__ ((__STRING2_COPY_ARR5)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  '\0' } }),							      \
+     __extension__ ((__STRING2_COPY_ARR6)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], '\0' } }),			      \
+     __extension__ ((__STRING2_COPY_ARR7)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5],	      \
+	  '\0' } }),							      \
+     __extension__ ((__STRING2_COPY_ARR8)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5],	      \
+	  ((__const char *) (src))[6], '\0' } })
+__STRING_INLINE char *__strcpy_small (char *, __STRING2_COPY_ARR2,
+				      __STRING2_COPY_ARR3,
+				      __STRING2_COPY_ARR4,
+				      __STRING2_COPY_ARR5,
+				      __STRING2_COPY_ARR6,
+				      __STRING2_COPY_ARR7,
+				      __STRING2_COPY_ARR8, size_t);
+__STRING_INLINE char *
+__strcpy_small (char *__dest,
+		__STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3,
+		__STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5,
+		__STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7,
+		__STRING2_COPY_ARR8 __src8, size_t __srclen)
+{
+  union {
+    char __c;
+    __STRING2_COPY_ARR2 __sca2;
+    __STRING2_COPY_ARR3 __sca3;
+    __STRING2_COPY_ARR4 __sca4;
+    __STRING2_COPY_ARR5 __sca5;
+    __STRING2_COPY_ARR6 __sca6;
+    __STRING2_COPY_ARR7 __sca7;
+    __STRING2_COPY_ARR8 __sca8;
+  } *__u = (void *) __dest;
+  switch ((unsigned int) __srclen)
+    {
+    case 1:
+      __u->__c = '\0';
+      break;
+    case 2:
+      __extension__ __u->__sca2 = __src2;
+      break;
+    case 3:
+      __extension__ __u->__sca3 = __src3;
+      break;
+    case 4:
+      __extension__ __u->__sca4 = __src4;
+      break;
+    case 5:
+      __extension__ __u->__sca5 = __src5;
+      break;
+    case 6:
+      __extension__ __u->__sca6 = __src6;
+      break;
+    case 7:
+      __extension__ __u->__sca7 = __src7;
+      break;
+    case 8:
+      __extension__ __u->__sca8 = __src8;
+      break;
+  }
+  return __dest;
+}
+# endif
+#endif
+
+
+/* Copy SRC to DEST, returning pointer to final NUL byte.  */
+#ifdef __USE_GNU
+# ifndef _HAVE_STRING_ARCH_stpcpy
+#  define __stpcpy(dest, src) \
+  (__extension__ (__builtin_constant_p (src)				      \
+		  ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8	      \
+		     ? __stpcpy_small (dest, __stpcpy_args (src),	      \
+				       strlen (src) + 1)		      \
+		     : ((char *) __mempcpy (dest, src, strlen (src) + 1) - 1))\
+		  : __stpcpy (dest, src)))
+/* In glibc we use this function frequently but for namespace reasons
+   we have to use the name `__stpcpy'.  */
+#  define stpcpy(dest, src) __stpcpy (dest, src)
+
+#  if _STRING_ARCH_unaligned
+#   define __stpcpy_args(src) \
+     __extension__ __STRING2_SMALL_GET16 (src, 0),			      \
+     __extension__ __STRING2_SMALL_GET16 (src, 4),			      \
+     __extension__ __STRING2_SMALL_GET32 (src, 0),			      \
+     __extension__ __STRING2_SMALL_GET32 (src, 4)
+__STRING_INLINE char *__stpcpy_small (char *, __uint16_t, __uint16_t,
+				      __uint32_t, __uint32_t, size_t);
+__STRING_INLINE char *
+__stpcpy_small (char *__dest,
+		__uint16_t __src0_2, __uint16_t __src4_2,
+		__uint32_t __src0_4, __uint32_t __src4_4,
+		size_t __srclen)
+{
+  union {
+    unsigned int __ui;
+    unsigned short int __usi;
+    unsigned char __uc;
+    char __c;
+  } *__u = (void *) __dest;
+  switch ((unsigned int) __srclen)
+    {
+    case 1:
+      __u->__uc = '\0';
+      break;
+    case 2:
+      __u->__usi = __src0_2;
+      __u = __extension__ (void *)((char *) __u + 1);
+      break;
+    case 3:
+      __u->__usi = __src0_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      __u->__uc = '\0';
+      break;
+    case 4:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 3);
+      break;
+    case 5:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__uc = '\0';
+      break;
+    case 6:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__usi = __src4_2;
+      __u = __extension__ (void *)((char *) __u + 1);
+      break;
+    case 7:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__usi = __src4_2;
+      __u = __extension__ (void *)((char *) __u + 2);
+      __u->__uc = '\0';
+      break;
+    case 8:
+      __u->__ui = __src0_4;
+      __u = __extension__ (void *)((char *) __u + 4);
+      __u->__ui = __src4_4;
+      __u = __extension__ (void *)((char *) __u + 3);
+      break;
+    }
+  return &__u->__c;
+}
+#  else
+#  define __stpcpy_args(src) \
+     __extension__ ((__STRING2_COPY_ARR2)				      \
+      { { ((__const char *) (src))[0], '\0' } }),			      \
+     __extension__ ((__STRING2_COPY_ARR3)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  '\0' } }),							      \
+     __extension__ ((__STRING2_COPY_ARR4)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], '\0' } }),			      \
+     __extension__ ((__STRING2_COPY_ARR5)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  '\0' } }),							      \
+     __extension__ ((__STRING2_COPY_ARR6)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], '\0' } }),			      \
+     __extension__ ((__STRING2_COPY_ARR7)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5],	      \
+	  '\0' } }),							      \
+     __extension__ ((__STRING2_COPY_ARR8)				      \
+      { { ((__const char *) (src))[0], ((__const char *) (src))[1],	      \
+	  ((__const char *) (src))[2], ((__const char *) (src))[3],	      \
+	  ((__const char *) (src))[4], ((__const char *) (src))[5],	      \
+	  ((__const char *) (src))[6], '\0' } })
+__STRING_INLINE char *__stpcpy_small (char *, __STRING2_COPY_ARR2,
+				      __STRING2_COPY_ARR3,
+				      __STRING2_COPY_ARR4,
+				      __STRING2_COPY_ARR5,
+				      __STRING2_COPY_ARR6,
+				      __STRING2_COPY_ARR7,
+				      __STRING2_COPY_ARR8, size_t);
+__STRING_INLINE char *
+__stpcpy_small (char *__dest,
+		__STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3,
+		__STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5,
+		__STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7,
+		__STRING2_COPY_ARR8 __src8, size_t __srclen)
+{
+  union {
+    char __c;
+    __STRING2_COPY_ARR2 __sca2;
+    __STRING2_COPY_ARR3 __sca3;
+    __STRING2_COPY_ARR4 __sca4;
+    __STRING2_COPY_ARR5 __sca5;
+    __STRING2_COPY_ARR6 __sca6;
+    __STRING2_COPY_ARR7 __sca7;
+    __STRING2_COPY_ARR8 __sca8;
+  } *__u = (void *) __dest;
+  switch ((unsigned int) __srclen)
+    {
+    case 1:
+      __u->__c = '\0';
+      break;
+    case 2:
+      __extension__ __u->__sca2 = __src2;
+      break;
+    case 3:
+      __extension__ __u->__sca3 = __src3;
+      break;
+    case 4:
+      __extension__ __u->__sca4 = __src4;
+      break;
+    case 5:
+      __extension__ __u->__sca5 = __src5;
+      break;
+    case 6:
+      __extension__ __u->__sca6 = __src6;
+      break;
+    case 7:
+      __extension__ __u->__sca7 = __src7;
+      break;
+    case 8:
+      __extension__ __u->__sca8 = __src8;
+      break;
+  }
+  return __dest + __srclen - 1;
+}
+#  endif
+# endif
+#endif
+
+
+/* Copy no more than N characters of SRC to DEST.  */
+#ifndef _HAVE_STRING_ARCH_strncpy
+# if defined _USE_STRING_ARCH_memset && defined _USE_STRING_ARCH_mempcpy
+#  define strncpy(dest, src, n) \
+  (__extension__ ({ char *__dest = (dest);				      \
+		    __builtin_constant_p (src) && __builtin_constant_p (n)    \
+		    ? (strlen (src) + 1 >= ((size_t) (n))		      \
+		       ? (char *) memcpy (__dest, src, n)		      \
+		       : (memset (__mempcpy (__dest, src, strlen (src)),      \
+				  '\0', n - strlen (src)),		      \
+			  __dest))					      \
+		    : strncpy (__dest, src, n); }))
+# else
+#  define strncpy(dest, src, n) \
+  (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \
+		  ? (strlen (src) + 1 >= ((size_t) (n))			      \
+		     ? (char *) memcpy (dest, src, n)			      \
+		     : strncpy (dest, src, n))				      \
+		  : strncpy (dest, src, n)))
+# endif
+#endif
+
+
+/* Append no more than N characters from SRC onto DEST.  */
+#ifndef _HAVE_STRING_ARCH_strncat
+# ifdef _USE_STRING_ARCH_strchr
+#  define strncat(dest, src, n) \
+  (__extension__ ({ char *__dest = (dest);				      \
+		    __builtin_constant_p (src) && __builtin_constant_p (n)    \
+		    ? (strlen (src) < ((size_t) (n))			      \
+		       ? strcat (__dest, src)				      \
+		       : (*((char *) __mempcpy (strchr (__dest, '\0'),	      \
+						src, n)) = '\0', __dest))     \
+		    : strncat (dest, src, n); }))
+# else
+#  define strncat(dest, src, n) \
+  (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \
+		  ? (strlen (src) < ((size_t) (n))			      \
+		     ? strcat (dest, src)				      \
+		     : strncat (dest, src, n))				      \
+		  : strncat (dest, src, n)))
+# endif
+#endif
+
+
+/* Compare characters of S1 and S2.  */
+#ifndef _HAVE_STRING_ARCH_strcmp
+# define strcmp(s1, s2) \
+  __extension__								      \
+  ({ size_t __s1_len, __s2_len;						      \
+     (__builtin_constant_p (s1) && __builtin_constant_p (s2)		      \
+      && (__s1_len = strlen (s1), __s2_len = strlen (s2),		      \
+	  (!__string2_1bptr_p (s1) || __s1_len >= 4)			      \
+	  && (!__string2_1bptr_p (s2) || __s2_len >= 4))		      \
+      ? memcmp ((__const char *) (s1), (__const char *) (s2),		      \
+		(__s1_len < __s2_len ? __s1_len : __s2_len) + 1)	      \
+      : (__builtin_constant_p (s1) && __string2_1bptr_p (s1)		      \
+	 && (__s1_len = strlen (s1), __s1_len < 4)			      \
+	 ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2)		      \
+	    ? __strcmp_cc (s1, s2, __s1_len)				      \
+	    : __strcmp_cg (s1, s2, __s1_len))				      \
+	 : (__builtin_constant_p (s2) && __string2_1bptr_p (s2)		      \
+	    && (__s2_len = strlen (s2), __s2_len < 4)			      \
+	    ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1)	      \
+	       ? __strcmp_cc (s1, s2, __s2_len)				      \
+	       : __strcmp_gc (s1, s2, __s2_len))			      \
+	    : strcmp (s1, s2)))); })
+
+# define __strcmp_cc(s1, s2, l) \
+  (__extension__ ({ register int __result =				      \
+		      (((__const unsigned char *) (__const char *) (s1))[0]   \
+		       - ((__const unsigned char *) (__const char *)(s2))[0]);\
+		    if (l > 0 && __result == 0)				      \
+		      {							      \
+			__result = (((__const unsigned char *)		      \
+				     (__const char *) (s1))[1]		      \
+				    - ((__const unsigned char *)	      \
+				       (__const char *) (s2))[1]);	      \
+			if (l > 1 && __result == 0)			      \
+			  {						      \
+			    __result =					      \
+			      (((__const unsigned char *)		      \
+				(__const char *) (s1))[2]		      \
+			       - ((__const unsigned char *)		      \
+				  (__const char *) (s2))[2]);		      \
+			    if (l > 2 && __result == 0)			      \
+			      __result =				      \
+				(((__const unsigned char *)		      \
+				  (__const char *) (s1))[3]		      \
+				 - ((__const unsigned char *)		      \
+				    (__const char *) (s2))[3]);		      \
+			  }						      \
+		      }							      \
+		    __result; }))
+
+# define __strcmp_cg(s1, s2, l1) \
+  (__extension__ ({ __const unsigned char *__s2 =			      \
+		      (__const unsigned char *) (__const char *) (s2);	      \
+		    register int __result =				      \
+		      (((__const unsigned char *) (__const char *) (s1))[0]   \
+		       - __s2[0]);					      \
+		    if (l1 > 0 && __result == 0)			      \
+		      {							      \
+			__result = (((__const unsigned char *)		      \
+				     (__const char *) (s1))[1] - __s2[1]);    \
+			if (l1 > 1 && __result == 0)			      \
+			  {						      \
+			    __result = (((__const unsigned char *)	      \
+					 (__const char *) (s1))[2] - __s2[2]);\
+			    if (l1 > 2 && __result == 0)		      \
+			      __result = (((__const unsigned char *)	      \
+					  (__const char *)  (s1))[3]	      \
+					  - __s2[3]);			      \
+			  }						      \
+		      }							      \
+		    __result; }))
+
+# define __strcmp_gc(s1, s2, l2) \
+  (__extension__ ({ __const unsigned char *__s1 =			      \
+		      (__const unsigned char *) (__const char *) (s1);	      \
+		    register int __result =				      \
+		      __s1[0] - ((__const unsigned char *)		      \
+				 (__const char *) (s2))[0];		      \
+		    if (l2 > 0 && __result == 0)			      \
+		      {							      \
+			__result = (__s1[1]				      \
+				    - ((__const unsigned char *)	      \
+				       (__const char *) (s2))[1]);	      \
+			if (l2 > 1 && __result == 0)			      \
+			  {						      \
+			    __result =					      \
+			      (__s1[2] - ((__const unsigned char *)	      \
+					  (__const char *) (s2))[2]);	      \
+			    if (l2 > 2 && __result == 0)		      \
+			      __result =				      \
+				(__s1[3]				      \
+				 - ((__const unsigned char *)		      \
+				    (__const char *) (s2))[3]);		      \
+			  }						      \
+		      }							      \
+		    __result; }))
+#endif
+
+
+/* Compare N characters of S1 and S2.  */
+#ifndef _HAVE_STRING_ARCH_strncmp
+# define strncmp(s1, s2, n)						      \
+  (__extension__ (__builtin_constant_p (n)				      \
+		  && ((__builtin_constant_p (s1)			      \
+		       && strlen (s1) < ((size_t) (n)))			      \
+		      || (__builtin_constant_p (s2)			      \
+			  && strlen (s2) < ((size_t) (n))))		      \
+		  ? strcmp (s1, s2) : strncmp (s1, s2, n)))
+#endif
+
+
+/* Return the length of the initial segment of S which
+   consists entirely of characters not in REJECT.  */
+#ifndef _HAVE_STRING_ARCH_strcspn
+# define strcspn(s, reject) \
+  __extension__								      \
+  ({ char __r0, __r1, __r2;						      \
+     (__builtin_constant_p (reject) && __string2_1bptr_p (reject)	      \
+      ? ((__r0 = ((__const char *) (reject))[0], __r0 == '\0')		      \
+	 ? strlen (s)							      \
+	 : ((__r1 = ((__const char *) (reject))[1], __r1 == '\0')	      \
+	    ? __strcspn_c1 (s, __r0)					      \
+	    : ((__r2 = ((__const char *) (reject))[2], __r2 == '\0')	      \
+	       ? __strcspn_c2 (s, __r0, __r1)				      \
+	       : (((__const char *) (reject))[3] == '\0'		      \
+		  ? __strcspn_c3 (s, __r0, __r1, __r2)			      \
+		  : strcspn (s, reject)))))				      \
+		  : strcspn (s, reject)); })
+
+__STRING_INLINE size_t __strcspn_c1 (__const char *__s, char __reject);
+__STRING_INLINE size_t
+__strcspn_c1 (__const char *__s, char __reject)
+{
+  register size_t __result = 0;
+  while (__s[__result] != '\0' && __s[__result] != __reject)
+    ++__result;
+  return __result;
+}
+
+__STRING_INLINE size_t __strcspn_c2 (__const char *__s, char __reject1,
+				     char __reject2);
+__STRING_INLINE size_t
+__strcspn_c2 (__const char *__s, char __reject1, char __reject2)
+{
+  register size_t __result = 0;
+  while (__s[__result] != '\0' && __s[__result] != __reject1
+	 && __s[__result] != __reject2)
+    ++__result;
+  return __result;
+}
+
+__STRING_INLINE size_t __strcspn_c3 (__const char *__s, char __reject1,
+				     char __reject2, char __reject3);
+__STRING_INLINE size_t
+__strcspn_c3 (__const char *__s, char __reject1, char __reject2,
+	      char __reject3)
+{
+  register size_t __result = 0;
+  while (__s[__result] != '\0' && __s[__result] != __reject1
+	 && __s[__result] != __reject2 && __s[__result] != __reject3)
+    ++__result;
+  return __result;
+}
+#endif
+
+
+/* Return the length of the initial segment of S which
+   consists entirely of characters in ACCEPT.  */
+#ifndef _HAVE_STRING_ARCH_strspn
+# define strspn(s, accept) \
+  __extension__								      \
+  ({ char __a0, __a1, __a2;						      \
+     (__builtin_constant_p (accept) && __string2_1bptr_p (accept)	      \
+      ? ((__a0 = ((__const char *) (accept))[0], __a0 == '\0')		      \
+	 ? ((void) (s), 0)						      \
+	 : ((__a1 = ((__const char *) (accept))[1], __a1 == '\0')	      \
+	    ? __strspn_c1 (s, __a0)					      \
+	    : ((__a2 = ((__const char *) (accept))[2], __a2 == '\0')	      \
+	       ? __strspn_c2 (s, __a0, __a1)				      \
+	       : (((__const char *) (accept))[3] == '\0'		      \
+		  ? __strspn_c3 (s, __a0, __a1, __a2)			      \
+		  : strspn (s, accept)))))				      \
+      : strspn (s, accept)); })
+
+__STRING_INLINE size_t __strspn_c1 (__const char *__s, char __accept);
+__STRING_INLINE size_t
+__strspn_c1 (__const char *__s, char __accept)
+{
+  register size_t __result = 0;
+  /* Please note that __accept never can be '\0'.  */
+  while (__s[__result] == __accept)
+    ++__result;
+  return __result;
+}
+
+__STRING_INLINE size_t __strspn_c2 (__const char *__s, char __accept1,
+				    char __accept2);
+__STRING_INLINE size_t
+__strspn_c2 (__const char *__s, char __accept1, char __accept2)
+{
+  register size_t __result = 0;
+  /* Please note that __accept1 and __accept2 never can be '\0'.  */
+  while (__s[__result] == __accept1 || __s[__result] == __accept2)
+    ++__result;
+  return __result;
+}
+
+__STRING_INLINE size_t __strspn_c3 (__const char *__s, char __accept1,
+				    char __accept2, char __accept3);
+__STRING_INLINE size_t
+__strspn_c3 (__const char *__s, char __accept1, char __accept2, char __accept3)
+{
+  register size_t __result = 0;
+  /* Please note that __accept1 to __accept3 never can be '\0'.  */
+  while (__s[__result] == __accept1 || __s[__result] == __accept2
+	 || __s[__result] == __accept3)
+    ++__result;
+  return __result;
+}
+#endif
+
+
+/* Find the first occurrence in S of any character in ACCEPT.  */
+#ifndef _HAVE_STRING_ARCH_strpbrk
+# define strpbrk(s, accept) \
+  __extension__								      \
+  ({ char __a0, __a1, __a2;						      \
+     (__builtin_constant_p (accept) && __string2_1bptr_p (accept)	      \
+      ? ((__a0 = ((__const char  *) (accept))[0], __a0 == '\0')		      \
+	 ? ((void) (s), NULL)						      \
+	 : ((__a1 = ((__const char *) (accept))[1], __a1 == '\0')	      \
+	    ? strchr (s, __a0)						      \
+	    : ((__a2 = ((__const char *) (accept))[2], __a2 == '\0')	      \
+	       ? __strpbrk_c2 (s, __a0, __a1)				      \
+	       : (((__const char *) (accept))[3] == '\0'		      \
+		  ? __strpbrk_c3 (s, __a0, __a1, __a2)			      \
+		  : strpbrk (s, accept)))))				      \
+      : strpbrk (s, accept)); })
+
+__STRING_INLINE char *__strpbrk_c2 (__const char *__s, int __accept1,
+				     int __accept2);
+__STRING_INLINE char *
+__strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
+{
+  /* Please note that __accept1 and __accept2 never can be '\0'.  */
+  while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
+    ++__s;
+  return *__s == '\0' ? NULL : (char *) (size_t) __s;
+}
+
+__STRING_INLINE char *__strpbrk_c3 (__const char *__s, int __accept1,
+				     int __accept2, int __accept3);
+__STRING_INLINE char *
+__strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
+	      int __accept3)
+{
+  /* Please note that __accept1 to __accept3 never can be '\0'.  */
+  while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
+	 && *__s != __accept3)
+    ++__s;
+  return *__s == '\0' ? NULL : (char *) (size_t) __s;
+}
+#endif
+
+
+/* Find the first occurrence of NEEDLE in HAYSTACK.  Newer gcc versions
+   do this itself.  */
+#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97)
+# define strstr(haystack, needle) \
+  (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \
+		  ? (((__const char *) (needle))[0] == '\0'		      \
+		     ? (char *) (size_t) (haystack)			      \
+		     : (((__const char *) (needle))[1] == '\0'		      \
+			? strchr (haystack,				      \
+				  ((__const char *) (needle))[0]) 	      \
+			: strstr (haystack, needle)))			      \
+		  : strstr (haystack, needle)))
+#endif
+
+
+#if defined __USE_GNU && !defined _FORCE_INLINES
+# ifndef _HAVE_STRING_ARCH_strnlen
+__STRING_INLINE size_t
+strnlen (__const char *__string, size_t __maxlen)
+{
+  __const char *__end = (__const char *) memchr (__string, '\0', __maxlen);
+  return __end ? (size_t) (__end - __string) : __maxlen;
+}
+# endif
+#endif
+
+
+#ifndef _HAVE_STRING_ARCH_strtok_r
+# define __strtok_r(s, sep, nextp) \
+  (__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep)	      \
+		  ? (((__const char *) (sep))[0] != '\0'		      \
+		     && ((__const char *) (sep))[1] == '\0'		      \
+		     ? __strtok_r_1c (s, ((__const char *) (sep))[0], nextp)  \
+		     : __strtok_r (s, sep, nextp))			      \
+		  : __strtok_r (s, sep, nextp)))
+
+__STRING_INLINE char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
+__STRING_INLINE char *
+__strtok_r_1c (char *__s, char __sep, char **__nextp)
+{
+  char *__result;
+  if (__s == NULL)
+    __s = *__nextp;
+  while (*__s == __sep)
+    ++__s;
+  if (*__s == '\0')
+    __result = NULL;
+  else
+    {
+      __result = __s;
+      while (*__s != '\0' && *__s != __sep)
+	++__s;
+      if (*__s == '\0')
+	*__nextp = __s;
+      else
+	{
+	  *__s = '\0';
+	  *__nextp = __s + 1;
+	}
+    }
+  return __result;
+}
+# if defined __USE_POSIX || defined __USE_MISC
+#  define strtok_r(s, sep, nextp) __strtok_r ((s), (sep), (nextp))
+# endif
+#endif
+
+
+#ifndef _HAVE_STRING_ARCH_strsep
+
+# define __strsep(s, reject) \
+  __extension__								      \
+  ({ char __r0, __r1, __r2;						      \
+     (__builtin_constant_p (reject) && __string2_1bptr_p (reject)	      \
+      && (__r0 = ((__const char *) (reject))[0],			      \
+	  ((__const char *) (reject))[0] != '\0')			      \
+      ? ((__r1 = ((__const char *) (reject))[1],			      \
+	 ((__const char *) (reject))[1] == '\0')			      \
+	 ? __strsep_1c (s, __r0)					      \
+	 : ((__r2 = ((__const char *) (reject))[2], __r2 == '\0')	      \
+	    ? __strsep_2c (s, __r0, __r1)				      \
+	    : (((__const char *) (reject))[3] == '\0'			      \
+	       ? __strsep_3c (s, __r0, __r1, __r2)			      \
+	       : __strsep_g (s, reject))))				      \
+      : __strsep_g (s, reject)); })
+
+__STRING_INLINE char *__strsep_1c (char **__s, char __reject);
+__STRING_INLINE char *
+__strsep_1c (char **__s, char __reject)
+{
+  register char *__retval = *__s;
+  if (__retval == NULL)
+    return *__s = NULL;
+  if (*__retval == __reject)
+    *(*__s)++ = '\0';
+  else
+    if ((*__s = strchr (__retval, __reject)) != NULL)
+      *(*__s)++ = '\0';
+    else
+      *__s = NULL;
+  return __retval;
+}
+
+__STRING_INLINE char *__strsep_2c (char **__s, char __reject1, char __reject2);
+__STRING_INLINE char *
+__strsep_2c (char **__s, char __reject1, char __reject2)
+{
+  register char *__retval = *__s;
+  if (__retval == NULL)
+    return *__s = NULL;
+  if (*__retval == __reject1 || *__retval == __reject2)
+    *(*__s)++ = '\0';
+  else
+    {
+      register char *__cp = __retval;
+      while (*__cp != '\0' && *__cp != __reject1 && *__cp != __reject2)
+	++__cp;
+      if (*__cp != '\0')
+	{
+	  *__s = __cp;
+	  *(*__s)++ = '\0';
+	}
+      else
+	*__s = NULL;
+    }
+  return __retval;
+}
+
+__STRING_INLINE char *__strsep_3c (char **__s, char __reject1, char __reject2,
+				   char __reject3);
+__STRING_INLINE char *
+__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
+{
+  register char *__retval = *__s;
+  if (__retval == NULL)
+    return *__s = NULL;
+  if (*__retval == __reject1 || *__retval == __reject2
+      || *__retval == __reject3)
+    *(*__s)++ = '\0';
+  else
+    {
+      register char *__cp = __retval;
+      while (*__cp != '\0' && *__cp != __reject1 && *__cp != __reject2
+	     && *__cp != __reject3)
+	++__cp;
+      if (*__cp != '\0')
+	{
+	  *__s = __cp;
+	  *(*__s)++ = '\0';
+	}
+      else
+	*__s = NULL;
+    }
+  return __retval;
+}
+
+__STRING_INLINE char *__strsep_g (char **__s, __const char *__reject);
+__STRING_INLINE char *
+__strsep_g (char **__s, __const char *__reject)
+{
+  register char *__retval = *__s;
+  if (__retval == NULL)
+    return NULL;
+  if ((*__s = strpbrk (__retval, __reject)) != NULL)
+    *(*__s)++ = '\0';
+  return __retval;
+}
+# ifdef __USE_BSD
+#  define strsep(s, reject) __strsep ((s), (reject))
+# endif
+#endif
+
+/* We need the memory allocation functions for inline strdup().
+   Referring to stdlib.h (even minimally) is not allowed
+   in any of the tight standards compliant modes.  */
+#ifdef __USE_MISC
+
+# if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup
+#  define __need_malloc_and_calloc
+#  include <stdlib.h>
+# endif
+
+# ifndef _HAVE_STRING_ARCH_strdup
+
+extern char *__strdup (__const char *__string) __THROW __attribute_malloc__;
+#  define __strdup(s) \
+  (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s)	      \
+		  ? (((__const char *) (s))[0] == '\0'			      \
+		     ? (char *) calloc (1, 1)				      \
+		     : ({ size_t __len = strlen (s) + 1;		      \
+			  char *__retval = (char *) malloc (__len);	      \
+			  if (__retval != NULL)				      \
+			    __retval = (char *) memcpy (__retval, s, __len);  \
+			  __retval; }))					      \
+		  : __strdup (s)))
+
+#  if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#   define strdup(s) __strdup (s)
+#  endif
+# endif
+
+# ifndef _HAVE_STRING_ARCH_strndup
+
+extern char *__strndup (__const char *__string, size_t __n)
+     __THROW __attribute_malloc__;
+#  define __strndup(s, n) \
+  (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s)	      \
+		  ? (((__const char *) (s))[0] == '\0'			      \
+		     ? (char *) calloc (1, 1)				      \
+		     : ({ size_t __len = strlen (s) + 1;		      \
+			  size_t __n = (n);				      \
+			  char *__retval;				      \
+			  if (__n < __len)				      \
+			    __len = __n;				      \
+			  __retval = (char *) malloc (__len);		      \
+			  if (__retval != NULL)				      \
+			    {						      \
+			      __retval[__len - 1] = '\0';		      \
+			      __retval = (char *) memcpy (__retval, s,	      \
+							  __len - 1);	      \
+			    }						      \
+			  __retval; }))					      \
+		  : __strndup ((s), (n))))
+
+#  ifdef __USE_GNU
+#   define strndup(s, n) __strndup ((s), (n))
+#  endif
+# endif
+
+#endif /* Use misc. or use GNU.  */
+
+#ifndef _FORCE_INLINES
+# undef __STRING_INLINE
+#endif
+
+#endif /* No string inlines.  */

+ 227 - 0
libc/sysdeps/linux/powerpc/bits/stropts.h

@@ -0,0 +1,227 @@
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _BITS_STROPTS_H
+#define _BITS_STROPTS_H	1
+
+#include <bits/types.h>
+
+/* Macros used as `request' argument to `ioctl'.  */
+#define __SID		('S' << 8)
+
+#define I_NREAD	    (__SID | 1)	/* Counts the number of data bytes in the data
+				   block in the first message.  */
+#define I_PUSH	    (__SID | 2)	/* Push STREAMS module onto top of the current
+				   STREAM, just below the STREAM head.  */
+#define I_POP	    (__SID | 3)	/* Remove STREAMS module from just below the
+				   STREAM head.  */
+#define I_LOOK	    (__SID | 4)	/* Retrieve the name of the module just below
+				   the STREAM head and place it in a character
+				   string.  */
+#define I_FLUSH	    (__SID | 5)	/* Flush all input and/or output.  */
+#define I_SRDOPT    (__SID | 6)	/* Sets the read mode.  */
+#define I_GRDOPT    (__SID | 7)	/* Returns the current read mode setting.  */
+#define I_STR	    (__SID | 8)	/* Construct an internal STREAMS `ioctl'
+				   message and send that message downstream. */
+#define I_SETSIG    (__SID | 9)	/* Inform the STREAM head that the process
+				   wants the SIGPOLL signal issued.  */
+#define I_GETSIG    (__SID |10) /* Return the events for which the calling
+				   process is currently registered to be sent
+				   a SIGPOLL signal.  */
+#define I_FIND	    (__SID |11) /* Compares the names of all modules currently
+				   present in the STREAM to the name pointed to
+				   by `arg'.  */
+#define I_LINK	    (__SID |12) /* Connect two STREAMs.  */
+#define I_UNLINK    (__SID |13) /* Disconnects the two STREAMs.  */
+#define I_PEEK	    (__SID |15) /* Allows a process to retrieve the information
+				   in the first message on the STREAM head read
+				   queue without taking the message off the
+				   queue.  */
+#define I_FDINSERT  (__SID |16) /* Create a message from the specified
+				   buffer(s), adds information about another
+				   STREAM, and send the message downstream.  */
+#define I_SENDFD    (__SID |17) /* Requests the STREAM associated with `fildes'
+				   to send a message, containing a file
+				   pointer, to the STREAM head at the other end
+				   of a STREAMS pipe.  */
+#define I_RECVFD    (__SID |14) /* Non-EFT definition.  */
+#define I_SWROPT    (__SID |19) /* Set the write mode.  */
+#define I_GWROPT    (__SID |20) /* Return the current write mode setting.  */
+#define I_LIST	    (__SID |21) /* List all the module names on the STREAM, up
+				   to and including the topmost driver name. */
+#define I_PLINK	    (__SID |22) /* Connect two STREAMs with a persistent
+				   link.  */
+#define I_PUNLINK   (__SID |23) /* Disconnect the two STREAMs that were
+				   connected with a persistent link.  */
+#define I_FLUSHBAND (__SID |28) /* Flush only band specified.  */
+#define I_CKBAND    (__SID |29) /* Check if the message of a given priority
+				   band exists on the STREAM head read
+				   queue.  */
+#define I_GETBAND   (__SID |30) /* Return the priority band of the first
+				   message on the STREAM head read queue.  */
+#define I_ATMARK    (__SID |31) /* See if the current message on the STREAM
+				   head read queue is "marked" by some module
+				   downstream.  */
+#define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when
+				   a STREAM is closing and there is data on
+				   the write queues.  */
+#define I_GETCLTIME (__SID |33) /* Get current value for closing timeout.  */
+#define I_CANPUT    (__SID |34) /* Check if a certain band is writable.  */
+
+
+/* Used in `I_LOOK' request.  */
+#define FMNAMESZ	8	/* compatibility w/UnixWare/Solaris.  */
+
+/* Flush options.  */
+#define FLUSHR		0x01	/* Flush read queues.  */
+#define FLUSHW		0x02	/* Flush write queues.  */
+#define FLUSHRW		0x03	/* Flush read and write queues.  */
+#ifdef __USE_GNU
+# define FLUSHBAND	0x04	/* Flush only specified band.  */
+#endif
+
+/* Possible arguments for `I_SETSIG'.  */
+#define S_INPUT		0x0001	/* A message, other than a high-priority
+				   message, has arrived.  */
+#define S_HIPRI		0x0002	/* A high-priority message is present.  */
+#define S_OUTPUT	0x0004	/* The write queue for normal data is no longer
+				   full.  */
+#define S_MSG		0x0008	/* A STREAMS signal message that contains the
+				   SIGPOLL signal reaches the front of the
+				   STREAM head read queue.  */
+#define S_ERROR		0x0010	/* Notification of an error condition.  */
+#define S_HANGUP	0x0020	/* Notification of a hangup.  */
+#define S_RDNORM	0x0040	/* A normal message has arrived.  */
+#define S_WRNORM	S_OUTPUT
+#define S_RDBAND	0x0080	/* A message with a non-zero priority has
+				   arrived.  */
+#define S_WRBAND	0x0100	/* The write queue for a non-zero priority
+				   band is no longer full.  */
+#define S_BANDURG	0x0200	/* When used in conjunction with S_RDBAND,
+				   SIGURG is generated instead of SIGPOLL when
+				   a priority message reaches the front of the
+				   STREAM head read queue.  */
+
+/* Option for `I_PEEK'.  */
+#define RS_HIPRI	0x01	/* Only look for high-priority messages.  */
+
+/* Options for `I_SRDOPT'.  */
+#define RNORM		0x0000	/* Byte-STREAM mode, the default.  */
+#define RMSGD		0x0001	/* Message-discard mode.   */
+#define RMSGN		0x0002	/* Message-nondiscard mode.   */
+#define RPROTDAT	0x0004	/* Deliver the control part of a message as
+				   data.  */
+#define RPROTDIS	0x0008	/* Discard the control part of a message,
+				   delivering any data part.  */
+#define RPROTNORM	0x0010	/* Fail `read' with EBADMSG if a message
+				   containing a control part is at the front
+				   of the STREAM head read queue.  */
+#ifdef __USE_GNU
+# define RPROTMASK	0x001C	/* The RPROT bits */
+#endif
+
+/* Possible mode for `I_SWROPT'.  */
+#define SNDZERO		0x001	/* Send a zero-length message downstream when a
+				   `write' of 0 bytes occurs.  */
+#ifdef __USE_GNU
+# define SNDPIPE	0x002	/* Send SIGPIPE on write and putmsg if
+				   sd_werror is set.  */
+#endif
+
+/* Arguments for `I_ATMARK'.  */
+#define ANYMARK		0x01	/* Check if the message is marked.  */
+#define LASTMARK	0x02	/* Check if the message is the last one marked
+				   on the queue.  */
+
+/* Argument for `I_UNLINK'.  */
+#ifdef __USE_GNU
+# define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM
+				   associated with `fildes'.  */
+#endif
+
+
+/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'.  */
+#define MSG_HIPRI	0x01	/* Send/receive high priority message.  */
+#define MSG_ANY		0x02	/* Receive any message.  */
+#define MSG_BAND	0x04	/* Receive message from specified band.  */
+
+/* Values returned by getmsg and getpmsg */
+#define MORECTL		1	/* More control information is left in
+				   message.  */
+#define MOREDATA	2	/* More data is left in message.  */
+
+
+/* Structure used for the I_FLUSHBAND ioctl on streams.  */
+struct bandinfo
+  {
+    unsigned char bi_pri;
+    int bi_flag;
+  };
+
+struct strbuf
+  {
+    int maxlen;		/* Maximum buffer length.  */
+    int len;		/* Length of data.  */
+    char *buf;		/* Pointer to buffer.  */
+  };
+
+struct strpeek
+  {
+    struct strbuf ctlbuf;
+    struct strbuf databuf;
+    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
+  };
+
+struct strfdinsert
+  {
+    struct strbuf ctlbuf;
+    struct strbuf databuf;
+    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
+    int fildes;
+    int offset;
+  };
+
+struct strioctl
+  {
+    int ic_cmd;
+    int ic_timout;
+    int ic_len;
+    char *ic_dp;
+  };
+
+struct strrecvfd
+  {
+    int fd;
+    uid_t uid;
+    gid_t gid;
+    char __fill[8];			/* UnixWare/Solaris compatibility */
+  };
+
+
+struct str_mlist
+  {
+    char l_name[FMNAMESZ + 1];
+  };
+
+struct str_list
+  {
+    int sl_nmods;
+    struct str_mlist *sl_modlist;
+  };
+
+#endif /* bits/stropts.h */

+ 42 - 23
libc/sysdeps/linux/powerpc/bits/termios.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _TERMIOS_H
 # error "Never include <bits/termios.h> directly; use <termios.h> instead."
@@ -24,24 +24,28 @@ typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
 typedef unsigned int	tcflag_t;
 
-/* note: this is fixed to be the same as the kernel, not glibc */
+/*
+ * termios type and macro definitions.  Be careful about adding stuff
+ * to this file since it's used in GNU libc and there are strict rules
+ * concerning namespace pollution.
+ */
 
-#define NCCS 19
+#define NCCS 32
 struct termios {
 	tcflag_t c_iflag;		/* input mode flags */
 	tcflag_t c_oflag;		/* output mode flags */
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
+	cc_t c_line;			/* line discipline (== c_cc[19]) */
 	cc_t c_cc[NCCS];		/* control characters */
-	cc_t c_line;			/* line discipline */
 	speed_t c_ispeed;		/* input speed */
 	speed_t c_ospeed;		/* output speed */
 };
 
 /* c_cc characters */
-#define VINTR 	0
-#define VQUIT 	1
-#define VERASE 	2
+#define VINTR	0
+#define VQUIT	1
+#define VERASE	2
 #define VKILL	3
 #define VEOF	4
 #define VMIN	5
@@ -50,9 +54,9 @@ struct termios {
 #define VEOL2	8
 #define VSWTC	9
 
-#define VWERASE 	10
+#define VWERASE	10
 #define VREPRINT	11
-#define VSUSP 		12
+#define VSUSP		12
 #define VSTART		13
 #define VSTOP		14
 #define VLNEXT		15
@@ -70,12 +74,9 @@ struct termios {
 #define ICRNL	0000400
 #define IXON	0001000
 #define IXOFF	0002000
-/* POSIX.1 doesn't want these... */
-#ifdef __USE_BSD
-# define IXANY		0004000
-# define IUCLC		0010000
-# define IMAXBEL	0020000
-#endif
+#define IXANY	0004000
+#define IUCLC	0010000
+#define IMAXBEL	0020000
 
 /* c_oflag bits */
 #define OPOST	0000001
@@ -235,6 +236,23 @@ struct ltchars {
 #define TIOCPKT_NOSTOP		16
 #define TIOCPKT_DOSTOP		32
 
+struct winsize {
+	unsigned short ws_row;
+	unsigned short ws_col;
+	unsigned short ws_xpixel;
+	unsigned short ws_ypixel;
+};
+
+#define NCC 10
+struct termio {
+	unsigned short c_iflag;		/* input mode flags */
+	unsigned short c_oflag;		/* output mode flags */
+	unsigned short c_cflag;		/* control mode flags */
+	unsigned short c_lflag;		/* local mode flags */
+	unsigned char c_line;		/* line discipline */
+	unsigned char c_cc[NCC];	/* control characters */
+};
+
 /* c_cc characters */
 #define _VINTR	0
 #define _VQUIT	1
@@ -279,3 +297,4 @@ struct ltchars {
 #define N_SMSBLOCK	12	/* SMS block mode  */
 #define N_HDLC		13	/* synchronous HDLC  */
 #define N_SYNC_PPP	14	/* synchronous PPP  */
+#define	N_HCI		15	/* Bluetooth HCI UART  */

+ 25 - 15
libc/sysdeps/linux/powerpc/bits/time.h

@@ -1,21 +1,21 @@
 /* System-dependent timing definitions.  Linux version.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  * Never include this file directly; use <time.h> instead.
@@ -31,18 +31,28 @@
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-#  define CLOCKS_PER_SEC  1000000
+#  define CLOCKS_PER_SEC  1000000l
 
-#  ifndef __STRICT_ANSI__
+#  if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-#   define CLK_TCK 100
+#   include <bits/types.h>
+extern long int __sysconf (int);
+#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
+#  endif
+
+#  ifdef __USE_POSIX199309
+/* Identifier for system-wide realtime clock.  */
+#   define CLOCK_REALTIME	0
+
+/* Flag to indicate time is absolute.  */
+#   define TIMER_ABSTIME	1
 #  endif
 
 # endif	/* bits/time.h */
 #endif
 
-#ifdef __need_timeval 
+#ifdef __need_timeval
 # undef __need_timeval
 # ifndef _STRUCT_TIMEVAL
 #  define _STRUCT_TIMEVAL	1
@@ -53,7 +63,7 @@
 struct timeval
   {
     __time_t tv_sec;		/* Seconds.  */
-    __time_t tv_usec;		/* Microseconds.  */
+    __suseconds_t tv_usec;	/* Microseconds.  */
   };
 # endif	/* struct timeval */
-#endif	/* need timeval */ 
+#endif	/* need timeval */

+ 28 - 37
libc/sysdeps/linux/powerpc/bits/types.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  * Never include this file directly; use <sys/types.h> instead.
@@ -58,14 +58,12 @@ __extension__ typedef unsigned long long int __uint64_t;
 #endif
 typedef __quad_t *__qaddr_t;
 
-/* These types are modified from glibc to be more compatible with
- * the kernel. */
-typedef __u_int __dev_t;		/* Type of device numbers.  */
+typedef __u_quad_t __dev_t;		/* Type of device numbers.  */
 typedef __u_int __uid_t;		/* Type of user identifications.  */
 typedef __u_int __gid_t;		/* Type of group identifications.  */
-typedef __u_int __ino_t;		/* Type of file serial numbers.  */
+typedef __u_long __ino_t;		/* Type of file serial numbers.  */
 typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
-typedef __u_short __nlink_t; 		/* Type of file link counts.  */
+typedef __u_int __nlink_t; 		/* Type of file link counts.  */
 typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */
@@ -83,34 +81,21 @@ typedef struct
 typedef int __daddr_t;			/* The type of a disk address.  */
 typedef char *__caddr_t;
 typedef long int __time_t;
+typedef unsigned int __useconds_t;
+typedef long int __suseconds_t;
 typedef long int __swblk_t;		/* Type of a swap block maybe?  */
 
 typedef long int __clock_t;
 
-/* One element in the file descriptor mask array.  */
-typedef unsigned long int __fd_mask;
+/* Clock ID used in clock and timer functions.  */
+typedef int __clockid_t;
 
-/* Number of descriptors that can fit in an `fd_set'.  */
-#define __FD_SETSIZE	1024
+/* Timer ID returned by `timer_create'.  */
+typedef int __timer_t;
 
-/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
-#define __NFDBITS	(8 * sizeof (__fd_mask))
-#define	__FDELT(d)	((d) / __NFDBITS)
-#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
 
-/* fd_set for select and pselect.  */
-typedef struct
-  {
-    /* XPG4.2 requires this member name.  Otherwise avoid the name
-       from the global namespace.  */
-#ifdef __USE_XOPEN
-    __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->fds_bits)
-#else
-    __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->__fds_bits)
-#endif
-  } __fd_set;
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define __FD_SETSIZE	1024
 
 
 typedef int __key_t;
@@ -119,6 +104,9 @@ typedef int __key_t;
 typedef unsigned short int __ipc_pid_t;
 
 
+/* Type to represent block size.  */
+typedef long int __blksize_t;
+
 /* Types from the Large File Support interface.  */
 
 /* Type to count number os disk blocks.  */
@@ -134,7 +122,7 @@ typedef __u_long __fsfilcnt_t;
 typedef __u_quad_t __fsfilcnt64_t;
 
 /* Type of file serial numbers.  */
-typedef __u_long __ino64_t;
+typedef __u_quad_t __ino64_t;
 
 /* Type of file sizes and offsets.  */
 typedef __loff_t __off64_t;
@@ -146,9 +134,12 @@ typedef unsigned long int __t_uscalar_t;
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 typedef int __intptr_t;
 
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
 
 /* Now add the thread types.  */
-#ifdef __USE_UNIX98
+#if defined __USE_POSIX199506 || defined __USE_UNIX98
 # include <bits/pthreadtypes.h>
 #endif
 

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/uio.h

@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #ifndef _SYS_UIO_H
 # error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."

+ 27 - 0
libc/sysdeps/linux/powerpc/bits/ustat.h

@@ -0,0 +1,27 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+
+struct ustat
+  {
+    __daddr_t f_tfree;
+    __ino_t f_tinode;
+    char f_fname[6];
+    char f_fpack[6];
+  };

+ 106 - 0
libc/sysdeps/linux/powerpc/bits/utmp.h

@@ -0,0 +1,106 @@
+/* The `struct utmp' type, describing entries in the utmp file.  GNU version.
+   Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UTMP_H
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
+#endif
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+
+#define UT_LINESIZE	32
+#define UT_NAMESIZE	32
+#define UT_HOSTSIZE	256
+
+
+/* The structure describing an entry in the database of
+   previous logins.  */
+struct lastlog
+  {
+    __time_t ll_time;
+    char ll_line[UT_LINESIZE];
+    char ll_host[UT_HOSTSIZE];
+  };
+
+
+/* The structure describing the status of a terminated process.  This
+   type is used in `struct utmp' below.  */
+struct exit_status
+  {
+    short int e_termination;	/* Process termination status.  */
+    short int e_exit;		/* Process exit status.  */
+  };
+
+
+/* The structure describing an entry in the user accounting database.  */
+struct utmp
+{
+  short int ut_type;		/* Type of login.  */
+  pid_t ut_pid;			/* Process ID of login process.  */
+  char ut_line[UT_LINESIZE];	/* Devicename.  */
+  char ut_id[4];		/* Inittab ID.  */
+  char ut_user[UT_NAMESIZE];	/* Username.  */
+  char ut_host[UT_HOSTSIZE];	/* Hostname for remote login.  */
+  struct exit_status ut_exit;	/* Exit status of a process marked
+				   as DEAD_PROCESS.  */
+  long int ut_session;		/* Session ID, used for windowing.  */
+  struct timeval ut_tv;		/* Time entry was made.  */
+  int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
+  char __unused[20];		/* Reserved for future use.  */
+};
+
+/* Backwards compatibility hacks.  */
+#define ut_name		ut_user
+#ifndef _NO_UT_TIME
+/* We have a problem here: `ut_time' is also used otherwise.  Define
+   _NO_UT_TIME if the compiler complains.  */
+# define ut_time	ut_tv.tv_sec
+#endif
+#define ut_xtime	ut_tv.tv_sec
+#define ut_addr		ut_addr_v6[0]
+
+
+/* Values for the `ut_type' field of a `struct utmp'.  */
+#define EMPTY		0	/* No valid user accounting information.  */
+
+#define RUN_LVL		1	/* The system's runlevel.  */
+#define BOOT_TIME	2	/* Time of system boot.  */
+#define NEW_TIME	3	/* Time after system clock changed.  */
+#define OLD_TIME	4	/* Time when system clock changed.  */
+
+#define INIT_PROCESS	5	/* Process spawned by the init process.  */
+#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
+#define USER_PROCESS	7	/* Normal process.  */
+#define DEAD_PROCESS	8	/* Terminated process.  */
+
+#define ACCOUNTING	9
+
+/* Old Linux name for the EMPTY type.  */
+#define UT_UNKNOWN	EMPTY
+
+
+/* Tell the user that we have a modern system with UT_HOST, UT_PID,
+   UT_TYPE, UT_ID and UT_TV fields.  */
+#define _HAVE_UT_TYPE	1
+#define _HAVE_UT_PID	1
+#define _HAVE_UT_ID	1
+#define _HAVE_UT_TV	1
+#define _HAVE_UT_HOST	1

+ 89 - 0
libc/sysdeps/linux/powerpc/bits/utmpx.h

@@ -0,0 +1,89 @@
+/* Structures and definitions for the user accounting database.  GNU version.
+   Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UTMPX_H
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <sys/time.h>
+
+
+#ifdef __USE_GNU
+# include <paths.h>
+# define _PATH_UTMPX	_PATH_UTMP
+# define _PATH_WTMPX	_PATH_WTMP
+#endif
+
+
+#define __UT_LINESIZE	32
+#define __UT_NAMESIZE	32
+#define __UT_HOSTSIZE	256
+
+
+/* The structure describing the status of a terminated process.  This
+   type is used in `struct utmpx' below.  */
+struct __exit_status
+  {
+#ifdef __USE_GNU
+    short int e_termination;	/* Process termination status.  */
+    short int e_exit;		/* Process exit status.  */
+#else
+    short int __e_termination;	/* Process termination status.  */
+    short int __e_exit;		/* Process exit status.  */
+#endif
+  };
+
+
+/* The structure describing an entry in the user accounting database.  */
+struct utmpx
+{
+  short int ut_type;		/* Type of login.  */
+  __pid_t ut_pid;		/* Process ID of login process.  */
+  char ut_line[__UT_LINESIZE];	/* Devicename.  */
+  char ut_id[4];		/* Inittab ID. */
+  char ut_user[__UT_NAMESIZE];	/* Username.  */
+  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+  struct __exit_status ut_exit;	/* Exit status of a process marked
+				   as DEAD_PROCESS.  */
+  long int ut_session;		/* Session ID, used for windowing.  */
+  struct timeval ut_tv;		/* Time entry was made.  */
+  __int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
+  char __unused[20];		/* Reserved for future use.  */
+};
+
+
+/* Values for the `ut_type' field of a `struct utmpx'.  */
+#define EMPTY		0	/* No valid user accounting information.  */
+
+#ifdef __USE_GNU
+# define RUN_LVL	1	/* The system's runlevel.  */
+#endif
+#define BOOT_TIME	2	/* Time of system boot.  */
+#define NEW_TIME	3	/* Time after system clock changed.  */
+#define OLD_TIME	4	/* Time when system clock changed.  */
+
+#define INIT_PROCESS	5	/* Process spawned by the init process.  */
+#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
+#define USER_PROCESS	7	/* Normal process.  */
+#define DEAD_PROCESS	8	/* Terminated process.  */
+
+#ifdef __USE_GNU
+# define ACCOUNTING	9	/* System accounting.  */
+#endif

+ 29 - 0
libc/sysdeps/linux/powerpc/bits/utsname.h

@@ -0,0 +1,29 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
+/* Length of the entries in `struct utsname' is 65.  */
+#define _UTSNAME_LENGTH 65
+
+/* Linux provides as additional information in the `struct utsname'
+   the name of the current domain.  Define _UTSNAME_DOMAIN_LENGTH
+   to a value != 0 to activate this entry.  */
+#define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH

+ 9 - 9
libc/sysdeps/linux/powerpc/bits/waitflags.h

@@ -3,21 +3,21 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 

+ 10 - 10
libc/sysdeps/linux/powerpc/bits/waitstatus.h

@@ -1,23 +1,23 @@
 /* Definitions of status bits for `wait' et al.
-   Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#ifndef _SYS_WAIT_H
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
 # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
 #endif
 

+ 26 - 0
libc/sysdeps/linux/powerpc/bits/wchar.h

@@ -0,0 +1,26 @@
+/* wchar_t type related definitions.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _BITS_WCHAR_H
+#define _BITS_WCHAR_H	1
+
+#define __WCHAR_MIN	(-2147483647 - 1)
+#define __WCHAR_MAX	(2147483647)
+
+#endif	/* bits/wchar.h */

+ 8 - 8
libc/sysdeps/linux/powerpc/bits/wordsize.h

@@ -2,18 +2,18 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #define __WORDSIZE	32

+ 67 - 19
libc/sysdeps/linux/powerpc/bits/xopen_lim.h

@@ -1,20 +1,20 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 /*
  * Never include this file directly; use <limits.h> instead.
@@ -30,7 +30,7 @@
 #ifndef _XOPEN_LIM_H
 #define _XOPEN_LIM_H	1
 
-#define __need_FOPEN_MAX
+#define __need_IOV_MAX
 #include <bits/stdio_lim.h>
 
 /* We do not provide fixed values for
@@ -51,18 +51,14 @@
    PAGE_SIZE	Size of bytes of a page.
 
    PASS_MAX	Maximum number of significant bytes in a password.
-*/
-
 
-/* Maximum number of `iovec' structures that one process has available
-   for use with `readv' or writev'.  */
-#define IOV_MAX		_XOPEN_IOV_MAX
+   We only provide a fixed limit for
 
-/* The number of streams that one process can have open at one time.  */
-#define STREAM_MAX	FOPEN_MAX
+   IOV_MAX	Maximum number of `iovec' structures that one process has
+		available for use with `readv' or writev'.
 
-/* Maximum number of bytes supported for the name of a time zone.  */
-#define TZNAME_MAX	_POSIX_TZNAME_MAX
+   if this is indeed fixed by the underlying system.
+*/
 
 
 /* Maximum number of `iovec' structures that one process has available
@@ -93,4 +89,56 @@
 /* Default process priority.  */
 #define NZERO		20
 
+
+/* Number of bits in a word of type `int'.  */
+#ifdef INT_MAX
+# if INT_MAX == 32767
+#  define WORD_BIT	16
+# else
+#  if INT_MAX == 2147483647
+#   define WORD_BIT	32
+#  else
+/* Safe assumption.  */
+#   define WORD_BIT	64
+#  endif
+# endif
+#elif defined __INT_MAX__
+# if __INT_MAX__ == 32767
+#  define WORD_BIT	16
+# else
+#  if __INT_MAX__ == 2147483647
+#   define WORD_BIT	32
+#  else
+/* Safe assumption.  */
+#   define WORD_BIT	64
+#  endif
+# endif
+#else
+# define WORD_BIT	32
+#endif
+
+/* Number of bits in a word of type `long int'.  */
+#ifdef LONG_MAX
+# if LONG_MAX == 2147483647
+#  define LONG_BIT	32
+# else
+/* Safe assumption.  */
+#  define LONG_BIT	64
+# endif
+#elif defined __LONG_MAX__
+# if __LONG_MAX__ == 2147483647
+#  define LONG_BIT	32
+# else
+/* Safe assumption.  */
+#  define LONG_BIT	64
+# endif
+#else
+# include <bits/wordsize.h>
+# if __WORDSIZE == 64
+#  define LONG_BIT	64
+# else
+#  define LONG_BIT	32
+# endif
+#endif
+
 #endif /* bits/xopen_lim.h */