]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 8 Aug 1998 20:02:34 +0000 (20:02 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 8 Aug 1998 20:02:34 +0000 (20:02 +0000)
1998-07-31 17:59  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/generic/bits/byteswap.h: Fix problems with side effects.

* manual/filesys.texi: Document truncate and ftruncate.
Patch by Michael Deutschmann <michael@talamasca.wkpowerlink.com>.

* shadow/putspent.c: Lock stream while generating the output.

* sunrpc/clnt_unix.c: Use ucred instead of cmsgcred again.
(__msgwrite): Rewrite accordingly.
* sunrpc/svc_unix.c: Likewise.
* sysdeps/unix/sysv/linux/Dist: Remove __recvmsg.S and __sendmsg.S.
* sysdeps/unix/sysv/linux/Makefile [$(subdir)==socket]
(sysdep_routines): Remove __sendmsg and __recvmsg.
* sysdeps/unix/sysv/linux/__recvmsg.S: Removed.
* sysdeps/unix/sysv/linux/__sendmsg.S: Removed.
* sysdeps/unix/sysv/linux/recvmsg.c: Removed.
* sysdeps/unix/sysv/linux/sendmsg.c: Removed.
* sysdeps/unix/sysv/linux/recvmsg.S: New file.
* sysdeps/unix/sysv/linux/sendmsg.S: New file.
* sysdeps/unix/sysv/linux/bits/socket.h: Define SCM_CREDENTIALS and
struct ucred.  Remove struct cmsgcred.
Patches by Thorsten Kukuk.

1998-08-03  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

* inet/rcmd.c (__ivaliduser): Allow '#' as comment character.

1998-08-08 14:42  Ulrich Drepper  <drepper@cygnus.com>

* argp/argp-help.c: Prepare to be used outside glibc without gcc by
adding usual alloca cruft.
Reported by Eleftherios Gkioulekas <lf@amath.washington.edu>.

1998-04-05  Jim Meyering  <meyering@ascend.com>

* lib/regex.c (WIDE_CHAR_SUPPORT): Define.
This now depends on HAVE_BTOWC so systems that lack btowc (like
solaris-2.5.1) don't lose.

1998-08-07  Mark Kettenis  <kettenis@phys.uva.nl>

* sysdeps/generic/bits/sigaction.h: Remove definition of SA_DISABLE.
* sysdeps/generic/bits/sigstack.h: Define SS_DISABLE, SS_ONSTACK,
MINSIGSTKZ and SIGSTKSZ.  Definitions match BSD.
* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Use SS_ONSTACK
instead of SA_ONSTACK.
* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Renamed from
sigaltstack, and created a weak alias.  Use SS_DISABLE and
SS_ONSTACK instead of SA_DISABLE and SA_ONSTACK.
* sysdeps/mach/hurd/sigstack.c (sigstack): Use SS_ONSTACK instead
of SA_ONSTACK.  Call __sigaltstack instead of sigaltstack.
* sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn): Use SS_ONSTACK
instead of SA_ONSTACK.
* sysdeps/mach/hurd/alpha/sigreturn.c (__sigreturn): Likewise.
* sysdeps/mach/hurd/mips/sigreturn.c (__sigreturn): Likewise.
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
Use SS_DISABLE instead of SA_DISABLE.  Use SS_ONSTACK instead of
SA_ONSTACK where appropriate.
* sysdeps/mach/hurd/alpha/trampoline.c (_hurd_setup_sighandler):
Likewise.
* sysdeps/mach/hurd/hppa/trampoline.c (_hurd_setup_sighandler):
Likewise.
* sysdeps/mach/hurd/mips/trampoline.c (_hurd_setup_sighandler):
Likewise.
* manual/signal.texi (Signal Stack): Talk about SS_DISABLE and
SS_ONSTACK instead of SA_DISABLE and SA_ONSTACK in discussion of
the `ss_flags' member of `struct sigaltstack'.

1998-08-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* libio/Makefile (routines) [$(versioning)=yes]: Add oldtmpfile.
(shared-only-routines): Likewise.
* libio/oldtmpfile.c: New file
* stdio-common/tmpfile.c: Use __fdopen and __close.
[USE_IN_LIBIO]: Use _IO_fdopen instead of _IO_new_fdopen.  Put
tmpfile on symbol version GLIBC_2.1.
* stdio-common/tmpfile64.c: Use __fdopen and __close.
[USE_IN_LIBIO]: Use _IO_fdopen instead of _IO_new_fdopen.
* stdio-common/Version [GLIBC_2.1]: Add tmpfile.
* stdio-common/tempnam.c: Use __strdup instead of strdup.
* sysdeps/posix/fdopen.c: Define __fdopen and make fdopen weak
alias.
* sysdeps/generic/fdopen.c: Likewise.
* sysdeps/mach/hurd/fdopen.c: Likewise.
* stdio/stdio.h: Declare __fdopen.
* sunrpc/openchild.c: Use __fdopen instead of fdopen.
[USE_IN_LIBIO]: Map __fdopen to _IO_fdopen.
* sysdeps/posix/tempname.c (__gen_tempname): Don't bother checking
__stub_open64, it is never defined.

1998-08-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* libio/iofopen64.c: Fix typo.  Avoid unnessary casts.
* libio/iopopen.c: Unlink file before freeing it if command
creation failed.  Avoid unnessary casts.
* libio/iofdopen.c:  Avoid unnecessary cast.
* pwd/fgetpwent_r.c [USE_IN_LIBIO]: Map funlockfile to
_IO_funlockfile.
* pwd/fgetspent_r.c [USE_IN_LIBIO]: Likewise.

1998-08-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* grp/grp.h, pwd/pwd.h: Don't declare __grpopen, __grpread,
__grpalloc, __grpscan and the corresponding pwd functions, they
were removed long ago.

1998-08-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* math/libm-test.c (csqrt_test): Adjust epsilons.
(casinh_test): Likewise.

1998-08-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* posix/globtest.sh: Fix typo.  Remove second test output file.

1998-08-07  Cristian Gafton  <gafton@redhat.com>

* pwd/putpwent.c (putpwent): Avoid writting (none) in the passwd file.
* shadow/putspent.c (putspent): Likewise.
* grp/putgrent.c: New file.
* grp/Makefile (routines): Add putgrent.
* grp/Versions [GLIBC_2.1]: Add putgrent.
* grp/grp.h: Add putgrent prototype.

1998-08-04 19:33  Ulrich Drepper  <drepper@cygnus.com>

* elf/elf.h: More ELF definitions.

60 files changed:
ChangeLog
argp/argp-help.c
bits/byteswap.h
bits/sigaction.h
bits/sigstack.h
elf/elf.h
grp/Makefile
grp/Versions
grp/grp.h
grp/putgrent.c [new file with mode: 0644]
hurd/sigunwind.c
inet/rcmd.c
libio/Makefile
libio/iofdopen.c
libio/iofopen64.c
libio/iopopen.c
libio/oldtmpfile.c [new file with mode: 0644]
manual/filesys.texi
manual/signal.texi
math/libm-test.c
posix/globtest.sh
posix/regex.c
pwd/fgetpwent_r.c
pwd/putpwent.c
pwd/pwd.h
shadow/fgetspent_r.c
shadow/putspent.c
stdio-common/Versions
stdio-common/tempnam.c
stdio-common/tmpfile.c
stdio-common/tmpfile64.c
stdio/stdio.h
sunrpc/clnt_unix.c
sunrpc/openchild.c
sunrpc/svc_unix.c
sysdeps/generic/bits/byteswap.h
sysdeps/generic/bits/sigaction.h
sysdeps/generic/bits/sigstack.h
sysdeps/generic/fdopen.c
sysdeps/mach/hurd/alpha/sigreturn.c
sysdeps/mach/hurd/alpha/trampoline.c
sysdeps/mach/hurd/fdopen.c
sysdeps/mach/hurd/hppa/trampoline.c
sysdeps/mach/hurd/i386/sigreturn.c
sysdeps/mach/hurd/i386/trampoline.c
sysdeps/mach/hurd/mips/sigreturn.c
sysdeps/mach/hurd/mips/trampoline.c
sysdeps/mach/hurd/sigaltstack.c
sysdeps/mach/hurd/sigstack.c
sysdeps/posix/fdopen.c
sysdeps/posix/tempname.c
sysdeps/unix/sysv/linux/Dist
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/__recvmsg.S [deleted file]
sysdeps/unix/sysv/linux/__sendmsg.S [deleted file]
sysdeps/unix/sysv/linux/bits/socket.h
sysdeps/unix/sysv/linux/recvmsg.S [new file with mode: 0644]
sysdeps/unix/sysv/linux/recvmsg.c [deleted file]
sysdeps/unix/sysv/linux/sendmsg.S [new file with mode: 0644]
sysdeps/unix/sysv/linux/sendmsg.c [deleted file]

index f7e23fddb4e29e1e42449a379286abe54f0a1cf6..6a73cb6c4e538879c7593fe3afb7cd37ecfd0591 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,133 @@
+1998-07-31 17:59  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/generic/bits/byteswap.h: Fix problems with side effects.
+
+       * manual/filesys.texi: Document truncate and ftruncate.
+       Patch by Michael Deutschmann <michael@talamasca.wkpowerlink.com>.
+
+       * shadow/putspent.c: Lock stream while generating the output.
+
+       * sunrpc/clnt_unix.c: Use ucred instead of cmsgcred again.
+       (__msgwrite): Rewrite accordingly.
+       * sunrpc/svc_unix.c: Likewise.
+       * sysdeps/unix/sysv/linux/Dist: Remove __recvmsg.S and __sendmsg.S.
+       * sysdeps/unix/sysv/linux/Makefile [$(subdir)==socket]
+       (sysdep_routines): Remove __sendmsg and __recvmsg.
+       * sysdeps/unix/sysv/linux/__recvmsg.S: Removed.
+       * sysdeps/unix/sysv/linux/__sendmsg.S: Removed.
+       * sysdeps/unix/sysv/linux/recvmsg.c: Removed.
+       * sysdeps/unix/sysv/linux/sendmsg.c: Removed.
+       * sysdeps/unix/sysv/linux/recvmsg.S: New file.
+       * sysdeps/unix/sysv/linux/sendmsg.S: New file.
+       * sysdeps/unix/sysv/linux/bits/socket.h: Define SCM_CREDENTIALS and
+       struct ucred.  Remove struct cmsgcred.
+       Patches by Thorsten Kukuk.
+
+1998-08-03  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * inet/rcmd.c (__ivaliduser): Allow '#' as comment character.
+
+1998-08-08 14:42  Ulrich Drepper  <drepper@cygnus.com>
+
+       * argp/argp-help.c: Prepare to be used outside glibc without gcc by
+       adding usual alloca cruft.
+       Reported by Eleftherios Gkioulekas <lf@amath.washington.edu>.
+
+1998-04-05  Jim Meyering  <meyering@ascend.com>
+
+       * lib/regex.c (WIDE_CHAR_SUPPORT): Define.
+       This now depends on HAVE_BTOWC so systems that lack btowc (like
+       solaris-2.5.1) don't lose.
+
+1998-08-07  Mark Kettenis  <kettenis@phys.uva.nl>
+
+       * sysdeps/generic/bits/sigaction.h: Remove definition of SA_DISABLE.
+       * sysdeps/generic/bits/sigstack.h: Define SS_DISABLE, SS_ONSTACK,
+       MINSIGSTKZ and SIGSTKSZ.  Definitions match BSD.
+       * hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Use SS_ONSTACK
+       instead of SA_ONSTACK.
+       * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Renamed from
+       sigaltstack, and created a weak alias.  Use SS_DISABLE and
+       SS_ONSTACK instead of SA_DISABLE and SA_ONSTACK.
+       * sysdeps/mach/hurd/sigstack.c (sigstack): Use SS_ONSTACK instead
+       of SA_ONSTACK.  Call __sigaltstack instead of sigaltstack.
+       * sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn): Use SS_ONSTACK
+       instead of SA_ONSTACK.
+       * sysdeps/mach/hurd/alpha/sigreturn.c (__sigreturn): Likewise.
+       * sysdeps/mach/hurd/mips/sigreturn.c (__sigreturn): Likewise.
+       * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
+       Use SS_DISABLE instead of SA_DISABLE.  Use SS_ONSTACK instead of
+       SA_ONSTACK where appropriate.
+       * sysdeps/mach/hurd/alpha/trampoline.c (_hurd_setup_sighandler):
+       Likewise.
+       * sysdeps/mach/hurd/hppa/trampoline.c (_hurd_setup_sighandler):
+       Likewise.
+       * sysdeps/mach/hurd/mips/trampoline.c (_hurd_setup_sighandler):
+       Likewise.
+       * manual/signal.texi (Signal Stack): Talk about SS_DISABLE and
+       SS_ONSTACK instead of SA_DISABLE and SA_ONSTACK in discussion of
+       the `ss_flags' member of `struct sigaltstack'.
+
+1998-08-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * libio/Makefile (routines) [$(versioning)=yes]: Add oldtmpfile.
+       (shared-only-routines): Likewise.
+       * libio/oldtmpfile.c: New file
+       * stdio-common/tmpfile.c: Use __fdopen and __close.
+       [USE_IN_LIBIO]: Use _IO_fdopen instead of _IO_new_fdopen.  Put
+       tmpfile on symbol version GLIBC_2.1.
+       * stdio-common/tmpfile64.c: Use __fdopen and __close.
+       [USE_IN_LIBIO]: Use _IO_fdopen instead of _IO_new_fdopen.
+       * stdio-common/Version [GLIBC_2.1]: Add tmpfile.
+       * stdio-common/tempnam.c: Use __strdup instead of strdup.
+       * sysdeps/posix/fdopen.c: Define __fdopen and make fdopen weak
+       alias.
+       * sysdeps/generic/fdopen.c: Likewise.
+       * sysdeps/mach/hurd/fdopen.c: Likewise.
+       * stdio/stdio.h: Declare __fdopen.
+       * sunrpc/openchild.c: Use __fdopen instead of fdopen.
+       [USE_IN_LIBIO]: Map __fdopen to _IO_fdopen.
+       * sysdeps/posix/tempname.c (__gen_tempname): Don't bother checking
+       __stub_open64, it is never defined.
+
+1998-08-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * libio/iofopen64.c: Fix typo.  Avoid unnessary casts.
+       * libio/iopopen.c: Unlink file before freeing it if command
+       creation failed.  Avoid unnessary casts.
+       * libio/iofdopen.c:  Avoid unnecessary cast.
+       * pwd/fgetpwent_r.c [USE_IN_LIBIO]: Map funlockfile to
+       _IO_funlockfile.
+       * pwd/fgetspent_r.c [USE_IN_LIBIO]: Likewise.
+
+1998-08-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * grp/grp.h, pwd/pwd.h: Don't declare __grpopen, __grpread,
+       __grpalloc, __grpscan and the corresponding pwd functions, they
+       were removed long ago.
+
+1998-08-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * math/libm-test.c (csqrt_test): Adjust epsilons.
+       (casinh_test): Likewise.
+
+1998-08-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * posix/globtest.sh: Fix typo.  Remove second test output file.
+
+1998-08-07  Cristian Gafton  <gafton@redhat.com>
+
+       * pwd/putpwent.c (putpwent): Avoid writting (none) in the passwd file.
+       * shadow/putspent.c (putspent): Likewise.
+       * grp/putgrent.c: New file.
+       * grp/Makefile (routines): Add putgrent.
+       * grp/Versions [GLIBC_2.1]: Add putgrent.
+       * grp/grp.h: Add putgrent prototype.
+
+1998-08-04 19:33  Ulrich Drepper  <drepper@cygnus.com>
+
+       * elf/elf.h: More ELF definitions.
+
 1998-08-04 16:53  Ulrich Drepper  <drepper@cygnus.com>
 
        * stdio-common/tmpfile.c: Include unistd.h for close prototype.
index baa54c91d646f7faaa900cbb8dc1fcf8372bbda8..616db9b47c97ee684340f5fe041fa4af2833f241 100644 (file)
 #include <config.h>
 #endif
 
+#ifndef alloca
+# ifdef __GNUC__
+#  define alloca __builtin_alloca
+#  define HAVE_ALLOCA 1
+# else
+#  if defined HAVE_ALLOCA_H || defined _LIBC
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
index 04a5efe9f096f0bb152bb479263e5da0d10d643c..a5dd4a7db3e698d0a9479fc8805e40a885586eee 100644 (file)
@@ -1,5 +1,5 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   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
 #endif
 
 /* Swap bytes in 16 bit value.  */
-#define __bswap_16(x) \
-     ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+#ifdef __GNUC__
+# define __bswap_16(x) \
+    (__extension__                                                           \
+     ({ unsigned short int __bsx = (x);                                              \
+        ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
+#else
+static __inline unsigned short int
+__bswap16 (unsigned short int x)
+{
+  return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
+}
+#endif
 
 /* Swap bytes in 32 bit value.  */
-#define __bswap_32(x) \
-     ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |                      \
-      (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
+#ifdef __GNUC__
+# define __bswap_32(x) \
+    (__extension__                                                           \
+     ({ unsigned int __bsx = (x);                                            \
+        ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |    \
+        (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24)); }))
+#else
+static __inline unsigned int
+__bswap32 (unsigned int x)
+{
+  return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |
+         (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24));
+}
+#endif
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
index 4499517b1a68daea5cafa9781ee2dce49a137ab4..8d75c9151e69c2ae76c5d06fdc6d93048e6fed14 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 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
@@ -40,12 +40,11 @@ struct sigaction
   };
 
 /* Bits in `sa_flags'.  */
-#ifdef __USE_BSD
-# define SA_ONSTACK    0x1     /* Take signal on signal stack.  */
-# define SA_RESTART    0x2     /* Restart syscall on signal return.  */
-# define SA_DISABLE    0x4     /* Disable alternate signal stack.  */
+#if defined __USE_UNIX98 || defined __USE_MISC
+# define SA_ONSTACK    0x0001  /* Take signal on signal stack.  */
+# define SA_RESTART    0x0002  /* Restart syscall on signal return.  */
 #endif
-#define        SA_NOCLDSTOP    0x8     /* Don't send SIGCHLD when children stop.  */
+#define        SA_NOCLDSTOP    0x0008  /* Don't send SIGCHLD when children stop.  */
 
 
 /* Values for the HOW argument to `sigprocmask'.  */
index 3a58e8bb586372a751f0f1671f7439735e655c18..0998256613719dc96f1211d98793d2d1cf8b21a8 100644 (file)
@@ -37,3 +37,19 @@ typedef struct sigaltstack
     size_t ss_size;
     int ss_flags;
   } stack_t;
+
+
+/* Possible values for `ss_flags.'.  */
+enum
+{
+  SS_ONSTACK = 0x0001,
+#define SS_ONSTACK     SS_ONSTACK
+  SS_DISABLE = 0x0004,
+#define SS_DISABLE     SS_DISABLE
+};
+    
+/* Minumum stack size for a signal handler.  */
+#define MINSIGSTKSZ    8192
+
+/* System default stack size.  */
+#define SIGSTKSZ       (MINSIGSTKSZ + 32768)
index 6418927160d5f5e98527c0f6ae19f57f0050da3e..e149b6f4aa24d362fdb36513962f36ff50b2a7a9 100644 (file)
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -180,7 +180,17 @@ typedef struct
 #define EM_OLD_ALPHA   41              /* Digital Alpha */
 #define EM_SH          42              /* Hitachi SH */
 #define EM_SPARCV9     43              /* SPARC v9 64-bit */
-#define EM_NUM         44
+#define EM_TRICORE     44              /* Siemens Tricore */
+#define EM_ARC         45              /* Argonaut RISC Core */
+#define EM_H8_300      46              /* Hitachi H8/300 */
+#define EM_H8_300H     47              /* Hitachi H8/300H */
+#define EM_H8S         48              /* Hitachi H8S */
+#define EM_H8_500      49              /* Hitachi H8/500 */
+#define EM_IA_64       50              /* Intel Merced */
+#define EM_MIPS_X      51              /* Stanford MIPS-X */
+#define EM_COLDFIRE    52              /* Motorola Coldfire */
+#define EM_68HC12      53              /* Motorola M68HC12 */
+#define EM_NUM         54
 
 /* If it is necessary to assign new unofficial EM_* values, please
    pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
@@ -249,6 +259,7 @@ typedef struct
 #define SHT_SHLIB       10             /* Reserved */
 #define SHT_DYNSYM      11             /* Dynamic linker symbol table */
 #define        SHT_NUM          12             /* Number of defined types.  */
+#define SHT_LOOS        0x60000000     /* Start OS-specific */
 #define SHT_LOSUNW      0x6ffffffb     /* Sun-specific low bound.  */
 #define SHT_SUNW_COMDAT  0x6ffffffb
 #define SHT_SUNW_syminfo 0x6ffffffc
@@ -256,6 +267,7 @@ typedef struct
 #define SHT_GNU_verneed         0x6ffffffe     /* Version needs section.  */
 #define SHT_GNU_versym  0x6fffffff     /* Version symbol table.  */
 #define SHT_HISUNW      0x6fffffff     /* Sun-specific high bound.  */
+#define SHT_HIOS        0x60000000     /* End OS-specific type */
 #define SHT_LOPROC      0x70000000     /* Start of processor-specific */
 #define SHT_HIPROC      0x7fffffff     /* End of processor-specific */
 #define SHT_LOUSER      0x80000000     /* Start of application-specific */
@@ -311,6 +323,8 @@ typedef struct
 #define STB_GLOBAL     1               /* Global symbol */
 #define STB_WEAK       2               /* Weak symbol */
 #define        STB_NUM         3               /* Number of defined types.  */
+#define STB_LOOS       10              /* Start of OS-specific */
+#define STB_HIOS       12              /* End of OS-specific */
 #define STB_LOPROC     13              /* Start of processor-specific */
 #define STB_HIPROC     15              /* End of processor-specific */
 
@@ -322,6 +336,8 @@ typedef struct
 #define STT_SECTION    3               /* Symbol associated with a section */
 #define STT_FILE       4               /* Symbol's name is file name */
 #define        STT_NUM         5               /* Number of defined types.  */
+#define STT_LOOS       11              /* Start of OS-specific */
+#define STT_HIOS       12              /* End of OS-specific */
 #define STT_LOPROC     13              /* Start of processor-specific */
 #define STT_HIPROC     15              /* End of processor-specific */
 
@@ -414,6 +430,8 @@ typedef struct
 #define PT_SHLIB       5               /* Reserved */
 #define PT_PHDR                6               /* Entry for header table itself */
 #define        PT_NUM          7               /* Number of defined types.  */
+#define PT_LOOS                0x60000000      /* Start of OS-specific */
+#define PT_HIOS                0x6fffffff      /* End of OS-specific */
 #define PT_LOPROC      0x70000000      /* Start of processor-specific */
 #define PT_HIPROC      0x7fffffff      /* End of processor-specific */
 
@@ -493,7 +511,14 @@ typedef struct
 #define DT_DEBUG       21              /* For debugging; unspecified */
 #define DT_TEXTREL     22              /* Reloc might modify .text */
 #define DT_JMPREL      23              /* Address of PLT relocs */
-#define        DT_NUM          24              /* Number used */
+#define        DT_BIND_NOW     24              /* Process relocations of object */
+#define        DT_INIT_ARRAY   25              /* Array with addresses of init fct */
+#define        DT_FINI_ARRAY   26              /* Array with addresses of fini fct */
+#define        DT_INIT_ARRAYSZ 27              /* Size in bytes of DT_INIT_ARRAY */
+#define        DT_FINI_ARRAYSZ 28              /* Size in bytes of DT_FINI_ARRAY */
+#define        DT_NUM          29              /* Number used */
+#define DT_LOOS                0x60000000      /* Start of OS-specific */
+#define DT_HIOS                0x6fffffff      /* End of OS-specific */
 #define DT_LOPROC      0x70000000      /* Start of processor-specific */
 #define DT_HIPROC      0x7fffffff      /* End of processor-specific */
 #define        DT_PROCNUM      DT_MIPS_NUM     /* Most used by any processor */
@@ -771,6 +796,8 @@ typedef struct
 #define R_68K_GLOB_DAT 20              /* Create GOT entry */
 #define R_68K_JMP_SLOT 21              /* Create PLT entry */
 #define R_68K_RELATIVE 22              /* Adjust by program base */
+/* Keep this the last entry.  */
+#define R_68K_NUM      23
 
 /* Intel 80386 specific definitions.  */
 
@@ -787,6 +814,8 @@ typedef struct
 #define R_386_RELATIVE 8               /* Adjust by program base */
 #define R_386_GOTOFF   9               /* 32 bit offset to GOT */
 #define R_386_GOTPC    10              /* 32 bit PC relative offset to GOT */
+/* Keep this the last entry.  */
+#define R_386_NUM      11
 
 /* SUN SPARC specific definitions.  */
 
@@ -860,6 +889,8 @@ typedef struct
 #define R_SPARC_REGISTER 53            /* Global register usage */
 #define R_SPARC_UA64   54              /* Direct 64 bit unaligned */
 #define R_SPARC_UA16   55              /* Direct 16 bit unaligned */
+/* Keep this the last entry.  */
+#define R_SPARC_NUM    56
 
 /* For Sparc64, legal values for d_tag of Elf64_Dyn.  */
 
@@ -1103,6 +1134,8 @@ typedef struct
 #define R_MIPS_ADD_IMMEDIATE   34
 #define R_MIPS_PJUMP           35
 #define R_MIPS_RELGOT          36
+/* Keep this the last entry.  */
+#define R_MIPS_NUM             37
 
 /* Legal values for p_type field of Elf32_Phdr.  */
 
@@ -1296,6 +1329,8 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_ALPHA_GLOB_DAT       25      /* Create GOT entry */
 #define R_ALPHA_JMP_SLOT       26      /* Create PLT entry */
 #define R_ALPHA_RELATIVE       27      /* Adjust by program base */
+/* Keep this the last entry.  */
+#define R_ALPHA_NUM            28
 
 
 /* PowerPC specific declarations */
@@ -1338,6 +1373,8 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_PPC_SECTOFF_LO       34
 #define R_PPC_SECTOFF_HI       35
 #define R_PPC_SECTOFF_HA       36
+/* Keep this the last entry.  */
+#define R_PPC_NUM              37
 
 /* The remaining relocs are from the Embedded ELF ABI, and are not
    in the SVR4 ELF ABI.  */
@@ -1371,6 +1408,15 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_ARM_PC24     1               /* PC relative 26 bit branch */
 #define R_ARM_ABS32    2               /* Direct 32 bit  */
 #define R_ARM_REL32    3               /* PC relative 32 bit */
+#define R_ARM_ABS8     4
+#define R_ARM_ABS16    5
+#define R_ARM_ABS12    6
+#define R_ARM_THM_ABS5 7
+#define R_ARM_THM_PC22 8
+#define R_ARM_SBREL32  9
+#define R_ARM_AMP_VCALL9 10
+#define R_ARM_THM_PC11 11
+#define R_ARM_THM_PC9  12
 #define R_ARM_COPY     20              /* Copy symbol at runtime */
 #define R_ARM_GLOB_DAT 21              /* Create GOT entry */
 #define R_ARM_JUMP_SLOT        22              /* Create PLT entry */
@@ -1379,6 +1425,8 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_ARM_GOTPC    25              /* 32 bit PC relative offset to GOT */
 #define R_ARM_GOT32    26              /* 32 bit GOT entry */
 #define R_ARM_PLT32    27              /* 32 bit PLT address */
+/* Keep this the last entry.  */
+#define R_ARM_NUM      28
 
 __END_DECLS
 
index ac889218c12986c9fc8b02154c7abc85ea7e6384..0d13495bd8a730e37a8a6371e799ecbc6687e20d 100644 (file)
@@ -23,7 +23,7 @@ subdir        := grp
 headers := grp.h
 
 routines := fgetgrent initgroups setgroups \
-           getgrent getgrgid getgrnam \
+           getgrent getgrgid getgrnam putgrent \
            getgrent_r getgrgid_r getgrnam_r fgetgrent_r
 
 tests := testgrp
index 1e13e5574c8a92fc9dc0b5bfedb50bb57da5bd48..1615b2418631613b3cb7a11009c2aa6bd806c0a1 100644 (file)
@@ -16,4 +16,8 @@ libc {
     # s*
     setgrent; setgroups;
   }
+  GLIBC_2.1 {
+    # p*
+    putgrent;
+  }
 }
index 265f3c20039ac2d6e2a9bc38af05be1d53d30e59..7e7362574134d4f49111052ffff5ffb733f323f3 100644 (file)
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -54,23 +54,6 @@ struct group
 # include <stdio.h>
 #endif
 
-#ifdef __USE_GNU
-/* Return a new stream open on the group file.  */
-extern FILE *__grpopen __P ((void));
-
-/* Read a group entry from STREAM, filling in G.
-   Return the `struct group' of G if successful, NULL on failure.  */
-extern struct group *__grpread __P ((FILE *__stream, __ptr_t __g));
-
-/* Return a chunk of memory containing pre-initialized data for __grpread.  */
-extern __ptr_t __grpalloc __P ((void));
-
-/* Scan the group file, filling in G, until SELECTOR returns nonzero for an
-   entry.  Return the `struct group' of G if successful, NULL on failure.  */
-extern struct group *__grpscan __P ((__ptr_t *__p,
-                                    int (*__selector) (struct group *)));
-#endif
-
 
 #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 /* Rewind the group-file stream.  */
@@ -88,6 +71,11 @@ extern struct group *getgrent __P ((void));
 extern struct group *fgetgrent __P ((FILE *__stream));
 #endif
 
+#ifdef __USE_GNU
+/* Write the given entry onto the given stream.  */
+extern int putgrent __P ((__const struct group *__p, FILE *__f));
+#endif
+
 /* Search for an entry with a matching group ID.  */
 extern struct group *getgrgid __P ((__gid_t __gid));
 
diff --git a/grp/putgrent.c b/grp/putgrent.c
new file mode 100644 (file)
index 0000000..7d7732a
--- /dev/null
@@ -0,0 +1,70 @@
+/* Copyright (C) 1991, 1992, 1996, 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 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 <errno.h>
+#include <stdio.h>
+#include <grp.h>
+
+#ifdef USE_IN_LIBIO
+# define flockfile(s) _IO_flockfile (s)
+# define funlockfile(s) _IO_funlockfile (s)
+#endif
+
+#define _S(x)  x ? x : ""
+
+/* Write an entry to the given stream.
+   This must know the format of the group file.  */
+int
+putgrent (gr, stream)
+     const struct group *gr;
+     FILE *stream;
+{
+  int retval;
+
+  if (gr == NULL || stream == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  flockfile (stream);
+
+  retval = fprintf (stream, "%s:%s:%u:",
+                   gr->gr_name, _S (gr->gr_passwd), gr->gr_gid);
+  if (retval < 0)
+    return -1;
+
+  if (gr->gr_mem != NULL)
+    {
+      int i;
+
+      for (i = 0 ; gr->gr_mem[i] != NULL; i++)
+       if (fprintf (stream, "%c%s", i == 0 ? ':' : ',', gr->gr_mem[i]) < 0)
+         {
+           /* What else can we do?  */
+           funlockfile (stream);
+           return -1;
+         }
+    }
+
+  retval = fputc_unlocked ('\n', stream);
+
+  funlockfile (stream);
+
+  return retval < 0 ? -1 : 0;
+}
index 8d1b8892a809368971c3fb945b67978a40ab78ba..b22878e09b389dba2c22e58b3ee53affa819fc16 100644 (file)
@@ -1,5 +1,5 @@
 /* longjmp cleanup function for unwinding past signal handlers.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 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
@@ -58,7 +58,7 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
      which calls us inside a critical section.  */
   assert (__spin_lock_locked (&ss->critical_section_lock));
   /* Are we on the alternate signal stack now?  */
-  onstack = (ss->sigaltstack.ss_flags & SA_ONSTACK);
+  onstack = (ss->sigaltstack.ss_flags & SS_ONSTACK);
   __spin_unlock (&ss->lock);
 
   if (onstack && ! scp->sc_onstack)
index c734f2721f1a948b422466651c93ada90c370446..51fa34eca871dcc58daa172894cbc13fccc5e78c 100644 (file)
@@ -413,11 +413,18 @@ __ivaliduser(hostf, raddr, luser, ruser)
        register char *user, *p;
        int ch;
        char *buf = NULL;
+       char *cp;
        size_t bufsize = 0;
        ssize_t nread;
 
        while ((nread = __getline (&buf, &bufsize, hostf)) > 0) {
                buf[bufsize - 1] = '\0'; /* Make sure it's terminated.  */
+               /* Because the file format does not know any form of quoting we
+                  can search forward for the next '#' character and if found
+                  make it terminating the line.  */
+               cp = strchr (buf, '#');
+               if (cp != NULL)
+                 *cp = '\0';
                p = buf;
                while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
                        *p = isupper(*p) ? tolower(*p) : *p;
index 84240bd852886099ba4e6f05338b887707799f16..ca1a3e4b80b413fb4b52f625f4122930b8764ac9 100644 (file)
@@ -43,7 +43,7 @@ all: # Make this the default target; it will be defined in Rules.
 include ../Makeconfig
 
 ifeq ($(versioning),yes)
-routines += oldiofopen oldiofdopen oldiofclose
+routines += oldiofopen oldiofdopen oldiofclose oldtmpfile
 endif
 
 CPPFLAGS-.o += -DIO_DEBUG
@@ -63,7 +63,7 @@ aux   += oldfileops oldstdfiles
 endif
 
 shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops   \
-                      oldstdfiles
+                      oldstdfiles oldtmpfile
 
 distribute := iolibio.h libioP.h strfile.h Banner
 
index 44be50a37d01b5152cb056f314672908ea8e8c21..40419bd267ccfeaf60d8671d5241d9f6d15b9919 100644 (file)
@@ -130,7 +130,7 @@ _IO_new_fdopen (fd, mode)
     _IO_mask_flags (&new_f->fp.file, read_write,
                    _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
 
-  return (_IO_FILE *) &new_f->fp;
+  return &new_f->fp.file;
 }
 
 #if defined PIC && DO_VERSIONING
index 3572295ad8467085df136b4e48df575c23a457ba..f5e799466dac61f42877b6b9a79499cfa8490c08 100644 (file)
@@ -51,10 +51,10 @@ _IO_fopen64 (filename, mode)
   _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
   _IO_file_init (&new_f->fp.file);
 #if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.plus.vtable = NULL;
+  new_f->fp.vtable = NULL;
 #endif
   if (_IO_file_fopen (&new_f->fp.file, filename, mode, 1) != NULL)
-    return (_IO_FILE *) &new_f->fp;
+    return &new_f->fp.file;
   _IO_un_link (&new_f->fp.file);
   free (new_f);
   return NULL;
index 30ff4b8ae78931886b7dc36d25c75e47bb4e23eb..62a6de20f5ec62cb10abdceda2f3a0e56f87daf3 100644 (file)
@@ -196,15 +196,16 @@ _IO_popen (command, mode)
 #ifdef _IO_MTSAFE_IO
   new_f->fpx.file.file._lock = &new_f->lock;
 #endif
-  fp = (_IO_FILE*)&new_f->fpx;
+  fp = &new_f->fpx.file.file;
   _IO_init (fp, 0);
   _IO_JUMPS (fp) = &_IO_proc_jumps;
   _IO_file_init (fp);
 #if  !_IO_UNIFIED_JUMPTABLES
-  ((struct _IO_FILE_plus *) fp)->vtable = NULL;
+  new_f->fpx.file.vtable = NULL;
 #endif
   if (_IO_proc_open (fp, command, mode) != NULL)
     return fp;
+  _IO_un_link (fp);
   free (new_f);
   return NULL;
 }
diff --git a/libio/oldtmpfile.c b/libio/oldtmpfile.c
new file mode 100644 (file)
index 0000000..6c4275d
--- /dev/null
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991, 1993, 1996, 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 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.  */
+
+#define _IO_USE_OLD_IO_FILE
+#include <stdio.h>
+#include <unistd.h>
+#include <iolibio.h>
+
+/* This returns a new stream opened on a temporary file (generated
+   by tmpnam).  The file is opened with mode "w+b" (binary read/write).
+   If we couldn't generate a unique filename or the file couldn't
+   be opened, NULL is returned.  */
+FILE *
+__old_tmpfile (void)
+{
+  char buf[FILENAME_MAX];
+  int fd;
+  FILE *f;
+
+  if (__path_search (buf, FILENAME_MAX, NULL, "tmpf"))
+    return NULL;
+  fd = __gen_tempname (buf, 1, 0);
+  if (fd < 0)
+    return NULL;
+
+  /* Note that this relies on the Unix semantics that
+     a file is not really removed until it is closed.  */
+  (void) remove (buf);
+
+  if ((f = _IO_old_fdopen (fd, "w+b")) == NULL)
+    close (fd);
+
+  return f;
+}
+
+symbol_version (__old_tmpfile, tmpfile, GLIBC_2.0);
index 5d6df0a1ac603dcb6724f35765cbb2a92e30b245..302010f78f74f7b7072eebcfb623410ba4448b93 100644 (file)
@@ -1308,6 +1308,7 @@ modify these attributes of files.
 * Testing File Access::         How to find out if your process can
                                  access a file.
 * File Times::                  About the time attributes of a file.
+* File Size::                  Manually changing the size of a file.
 @end menu
 
 @node Attribute Meanings
@@ -2502,6 +2503,148 @@ The return values and error conditions are the same as for the @code{utime}
 function.
 @end deftypefun
 
+@node File Size
+@subsection File Size
+
+Normally file sizes are maintained automatically.  A file begins with a
+size of @math{0} and is automatically extended when data is written
+past its end.  It is also possible to empty a file completely in an
+@code{open} or @code{fopen} call.
+
+However, sometimes it is neccessary to @emph{reduce} the size of a file.
+This can be done with the @code{truncate} and @code{ftruncate} functions.
+They were introduced in BSD Unix.  @code{ftruncate} was later added to
+POSIX.1.
+
+Some systems allow you to extend a file (creating holes) with these
+functions.  This is useful when using memory-mapped I/O
+(@pxref{Memory-mapped I/O}), where files are not automatically extended.
+However it is not portable but must be implemented if @code{mmap} allows
+mapping of files (i.e., @code{_POSIX_MAPPED_FILES} is defined).
+
+Using these functions on anything other than a regular file gives
+@emph{undefined} results.  On many systems, such a call will appear to
+succeed, without actually accomplishing anything.
+
+@deftypefun int truncate (const char *@var{filename}, off_t @var{length})
+
+The @code{truncate} function changes the size of @var{filename} to
+@var{length}.  If @var{length} is shorter than the previous length, data at
+the end will be lost.
+
+If @var{length} is longer, holes will be added to the end.  However, some
+systems do not support this feature and will leave the file unchanged.
+
+The return value is @math{0} for success, or @math{-1} for an error.  In
+addition to the usual file name errors, the following errors may occur:
+
+@table @code
+
+@item EACCES
+The file is a directory or not writable.
+
+@item EINVAL
+@var{length} is negative.
+
+@item EFBIG
+The operation would extend the file beyond the limits of the operating system.
+
+@item EIO
+A hardware I/O error occured.
+
+@item EPERM
+The file is "append-only" or "immutable".
+
+@item EINTR
+The operation was interrupted by a signal.
+
+@end table
+
+@end deftypefun
+
+@deftypefun int ftruncate (int @var{fd}, off_t @var{length})
+
+This is like @code{truncate}, but it works on a file descriptor @var{fd}.
+
+@code{ftruncate} is especially useful in combination with @code{mmap}.
+Since the mapped region must have a fixed size one cannot enlarge the
+file by writing something beyond the last mapped page.  Instead one has
+to enlarge the file itself and then remap the file with the new size.
+The example below shows how this works.
+
+The return value is @math{0} for success, or @math{-1} for an error.  The
+following errors may occur:
+
+@table @code
+
+@item EBADF
+@var{fd} does not correspond to an open file.
+
+@item EACCES
+@var{fd} is a directory or not open for write.
+
+@item EINVAL
+@var{length} is negative.
+
+@item EFBIG
+The operation would extend the file beyond the limits of the operating system.
+@c or the open() call -- with the not-yet-discussed feature of opening
+@c files with extra-large offsets.
+
+@item EIO
+A hardware I/O error occured.
+
+@item EPERM
+The file is "append-only" or "immutable".
+
+@item EINTR
+The operation was interrupted by a signal.
+
+@c ENOENT is also possible on Linux --- however it only occurs if the file
+@c descriptor has a `file' structure but no `inode' structure.  I'm not
+@c sure how such an fd could be created.  Perhaps it's a bug.
+
+@end table
+
+@end deftypefun
+
+As announced here is a little example how to use @code{ftruncate} in
+combination with @code{mmap}:
+
+@smallexample
+int fd;
+void *start;
+size_t len;
+
+int
+add (off_t at, void *block, size_t size)
+@{
+  if (at + size > len)
+    @{
+      /* Resize the file and remap.  */
+      size_t ps = sysconf (_SC_PAGESIZE);
+      size_t ns = (at + size + ps - 1) & ~(ps - 1);
+      void *np;
+      if (ftruncate (fd, ns) < 0)
+        return -1;
+      np = mmap (NULL, ns, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+      if (np == MAP_FAILED)
+        return -1;
+      start = np;
+      len = ns;
+    @}
+  memcpy ((char *) start + at, block, size);
+  return 0;
+@}
+@end smallexample
+
+The function @code{add} allows to add at arbitrary positions in the file
+given blocks of memory.  If the current size of the file is too small it
+is extended.  Please note the it is extended in multiples of a pagesize.
+This is a requirement of @code{mmap}.  The program has to track the real
+size and once the program finished to work a final @code{ftruncate} call
+should set the real size of the file.
+
 @node Making Special Files
 @section Making Special Files
 @cindex creating special files
index b3f67b6685d157dbba1aac9b75c57515fdf9e1bf..2961c4f6ada0aecf0cb3b6a851d54bef9f8233b9 100644 (file)
@@ -3123,10 +3123,10 @@ stack and increase @code{ss_size} accordingly.
 This field contains the bitwise @sc{or} of these flags:
 
 @vtable @code
-@item SA_DISABLE
+@item SS_DISABLE
 This tells the system that it should not use the signal stack.
 
-@item SA_ONSTACK
+@item SS_ONSTACK
 This is set by the system, and indicates that the signal stack is
 currently in use.  If this bit is not set, then signals will be
 delivered on the normal user stack.
index 049086641ada25b9e6de79b3124dc98aa55d45b5..cc51485cd085aa74fdfc2ad381a3116c4a50a44f 100644 (file)
@@ -4035,11 +4035,11 @@ casinh_test (void)
   check_eps ("real(casinh(0.7 + i 1.2)) == 0.97865...", __real__ result,
             0.9786545955936738768L, CHOOSE(5e-17L, 2e-16, 0));
   check_eps ("imag(casinh(0.7 + i 1.2)) == 0.91135...", __imag__ result,
-            0.9113541895315601156L, CHOOSE(7e-19L, 2e-16, 6e-8));
+            0.9113541895315601156L, CHOOSE(7e-19L, 2e-16, 2e-7));
 
   result = FUNC(casinh) (BUILD_COMPLEX (-2, -3));
   check_eps ("real(casinh(-2 - i 3)) == -1.96863...", __real__ result,
-            -1.9686379257930962917L, CHOOSE(7e-19L, 2e-15, 2e-7));
+            -1.9686379257930962917L, CHOOSE(7e-19L, 2e-15, 3e-6));
   check_eps ("imag(casinh(-2 - i 3)) == -0.96465...", __imag__ result,
             -0.9646585044076027920L, CHOOSE(4e-19L, 2e-15, 4e-7));
 }
@@ -5158,13 +5158,13 @@ csqrt_test (void)
 
   result = FUNC(csqrt) (BUILD_COMPLEX (-2, -3));
   check_eps ("real(csqrt(-2 - i 3)) == 0.89597...", __real__ result,
-            0.8959774761298381247L, CHOOSE(6e-20L, 2e-16, 6e-8));
+            0.8959774761298381247L, CHOOSE(6e-16L, 4e-16, 6e-8));
   check_eps ("imag(csqrt(-2 - i 3)) == -1.67414...", __imag__ result,
             -1.6741492280355400404L, CHOOSE(0, 5e-16, 0));
 
   result = FUNC(csqrt) (BUILD_COMPLEX (-2, 3));
   check_eps ("real(csqrt(-2 + i 3)) == 0.89597...", __real__ result,
-            0.8959774761298381247L, CHOOSE(6e-20L, 2e-16, 6e-8));
+            0.8959774761298381247L, CHOOSE(6e-20L, 4e-16, 6e-8));
   check_eps ("imag(csqrt(-2 + i 3)) == 1.67414...", __imag__ result,
             1.6741492280355400404L, CHOOSE(0, 5e-16, 0));
 }
index 12635b76d9f7674b526f87a416f16f19f859ba03..806b481c7eb1aad4b280e440c2492ee4a698f25d 100755 (executable)
@@ -7,7 +7,7 @@ rtld_installed_name=$1; shift
 # We have to find the libc and the NSS modules.
 library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis
 
-# Since we use `osrt' we must make sure to use the same locale everywhere.
+# Since we use `sort' we must make sure to use the same locale everywhere.
 LC_ALL=C
 export LC_ALL
 LANG=C
@@ -17,9 +17,8 @@ export LANG
 : ${TMPDIR=/tmp}
 testdir=$TMPDIR/globtest-dir
 testout=$TMPDIR/globtest-out
-testout2=$TMPDIR/globtest-out2
 
-trap 'rm -fr $testdir $testout $testout2' 1 2 3 15
+trap 'rm -fr $testdir $testout' 1 2 3 15
 
 rm -fr $testdir
 mkdir $testdir
@@ -197,22 +196,19 @@ EOF
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
 sort >$testout
-echo ~ > $testout2
-cmp $testout2 $testout || result=1
+echo ~ | cmp - $testout || result=1
 
 # Test tilde expansion with trailing slash
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
 sort > $testout
-echo ~/ > $testout2
-cmp $testout2 $testout || result=1
+echo ~/ | cmp - $testout || result=1
 
 # Test tilde expansion with username
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
 sort > $testout
-eval echo ~$USER > $testout2
-cmp $testout2 $testout || result=1
+eval echo ~$USER | cmp - $testout || result=1
 
 # Tilde expansion shouldn't match a file
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
index 484e13d799f8e5560ab692b1444c8cd41968b77f..0543433fbe228cf3cf0c25a87569f0ea87db4751 100644 (file)
 # include <sys/types.h>
 #endif
 
+#define WIDE_CHAR_SUPPORT \
+  defined _LIBC || (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
+
 /* For platform which support the ISO C amendement 1 functionality we
    support user defined character classes.  */
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if WIDE_CHAR_SUPPORT
 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
 # include <wchar.h>
 # include <wctype.h>
@@ -1716,7 +1719,7 @@ typedef struct
        }                                                               \
     }
 
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if WIDE_CHAR_SUPPORT
 /* The GNU C library provides support for user-defined character classes
    and the functions from ISO C amendement 1.  */
 # ifdef CHARCLASS_NAME_MAX
@@ -2220,7 +2223,7 @@ regex_compile (pattern, size, syntax, bufp)
                        the leading `:' and `[' (but set bits for them).  */
                     if (c == ':' && *p == ']')
                       {
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if WIDE_CHAR_SUPPORT
                         boolean is_lower = STREQ (str, "lower");
                         boolean is_upper = STREQ (str, "upper");
                        wctype_t wt;
@@ -2241,10 +2244,10 @@ regex_compile (pattern, size, syntax, bufp)
 # ifdef _LIBC
                            if (__iswctype (__btowc (ch), wt))
                              SET_LIST_BIT (ch);
-#else
+# else
                            if (iswctype (btowc (ch), wt))
                              SET_LIST_BIT (ch);
-#endif
+# endif
 
                            if (translate && (is_upper || is_lower)
                                && (ISUPPER (ch) || ISLOWER (ch)))
index 78b491d3868e4a08b450932dbb54615883cba9a6..4986e7452cee70eba1b1c5ea35e7c241fc58a41e 100644 (file)
@@ -23,6 +23,7 @@
 
 #ifdef USE_IN_LIBIO
 # define flockfile(s) _IO_flockfile (s)
+# define funlockfile(s) _IO_funlockfile (s)
 #endif
 
 /* Define a line parsing function using the common code
index c27f687b2610139fddd51927ebe64dd7822d6fba..7ab48c16d6ca9ac7a10197732b82cc54993d8517 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 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
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <pwd.h>
 
+#define _S(x)  x ? x : ""
 
 /* Write an entry to the given stream.
    This must know the format of the password file.  */
@@ -35,9 +36,9 @@ putpwent (p, stream)
     }
 
   if (fprintf (stream, "%s:%s:%u:%u:%s:%s:%s\n",
-              p->pw_name, p->pw_passwd,
+              p->pw_name, _S (p->pw_passwd),
               p->pw_uid, p->pw_gid,
-              p->pw_gecos, p->pw_dir, p->pw_shell) < 0)
+              _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
     return -1;
 
   return 0;
index a254cb05f6ee42aafaf6e9901e3be7b4e8cf2a08..d3096567902e60b6430133681c6f3aa2b937eb79 100644 (file)
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -64,24 +64,6 @@ struct passwd
 # include <stdio.h>
 #endif
 
-#ifdef __USE_GNU
-/* Return a new stream open on the password file.  */
-extern FILE *__pwdopen __P ((void));
-
-/* Read a password entry from STREAM, filling in P.
-   Return the `struct passwd' of P if successful, NULL on failure.  */
-extern struct passwd *__pwdread __P ((FILE *__stream, __ptr_t __p));
-
-/* Return a chunk of memory containing pre-initialized data for __pwdread.  */
-extern __ptr_t __pwdalloc __P ((void));
-
-/* Scan the password file, filling in P, until SELECTOR returns nonzero for
-   an entry.  Return the `struct passwd' of P if successful, NULL on
-   failure.  */
-extern struct passwd *__pwdscan __P ((__ptr_t *__p,
-                                     int (*__selector) (struct passwd *)));
-#endif
-
 
 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 /* Rewind the password-file stream.  */
index bedc36182e73d7b5ad60de22a7898a8258cac938..50d1fd9972b037043ab7cd6936d6093417be953a 100644 (file)
@@ -23,6 +23,7 @@
 
 #ifdef USE_IN_LIBIO
 # define flockfile(s) _IO_flockfile (s)
+# define funlockfile(s) _IO_funlockfile (s)
 #endif
 
 /* Define a line parsing function using the common code
index 0e8649bc2c20c314aad37d24946ecc77a99401dc..a952a221694e4a87e146606a36fff175ef64752d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 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
 #include <stdio.h>
 #include <shadow.h>
 
+#ifdef USE_IN_LIBIO
+# define flockfile(s) _IO_flockfile (s)
+# define funlockfile(s) _IO_funlockfile (s)
+#endif
+
+#define _S(x)  x ? x : ""
+
 
 /* Write an entry to the given stream.
    This must know the format of the password file.  */
@@ -27,51 +34,55 @@ putspent (const struct spwd *p, FILE *stream)
 {
   int errors = 0;
 
-  if (fprintf (stream, "%s:%s:", p->sp_namp, p->sp_pwdp) < 0)
+  flockfile (stream);
+
+  if (fprintf (stream, "%s:%s:", p->sp_namp, _S (p->sp_pwdp)) < 0)
     ++errors;
 
   if ((p->sp_lstchg != (long int) -1
        && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
       || (p->sp_lstchg == (long int) -1
-         && putc (':', stream) == EOF))
+         && putc_unlocked (':', stream) == EOF))
     ++errors;
 
   if ((p->sp_min != (long int) -1
        && fprintf (stream, "%ld:", p->sp_min) < 0)
       || (p->sp_min == (long int) -1
-         && putc (':', stream) == EOF))
+         && putc_unlocked (':', stream) == EOF))
     ++errors;
 
   if ((p->sp_max != (long int) -1
        && fprintf (stream, "%ld:", p->sp_max) < 0)
       || (p->sp_max == (long int) -1
-         && putc (':', stream) == EOF))
+         && putc_unlocked (':', stream) == EOF))
     ++errors;
 
   if ((p->sp_warn != (long int) -1
        && fprintf (stream, "%ld:", p->sp_warn) < 0)
       || (p->sp_warn == (long int) -1
-         && putc (':', stream) == EOF))
+         && putc_unlocked (':', stream) == EOF))
     ++errors;
 
   if ((p->sp_inact != (long int) -1
        && fprintf (stream, "%ld:", p->sp_inact) < 0)
       || (p->sp_inact == (long int) -1
-         && putc (':', stream) == EOF))
+         && putc_unlocked (':', stream) == EOF))
     ++errors;
 
   if ((p->sp_expire != (long int) -1
        && fprintf (stream, "%ld:", p->sp_expire) < 0)
       || (p->sp_expire == (long int) -1
-         && putc (':', stream) == EOF))
+         && putc_unlocked (':', stream) == EOF))
     ++errors;
 
   if (p->sp_flag != ~0ul
       && fprintf (stream, "%ld", p->sp_flag) < 0)
     ++errors;
 
-  if (putc ('\n', stream) == EOF)
+  if (putc_unlocked ('\n', stream) == EOF)
     ++errors;
 
+  funlockfile (stream);
+
   return errors ? -1 : 0;
 }
index 6191e0b97d01936125311cc68679cb930ac3ec98..11e0900f01b455ccb7016fc909079fbed032d88d 100644 (file)
@@ -45,6 +45,6 @@ libc {
     printf_size; printf_size_info;
 
     # t*
-    tmpfile64;
+    tmpfile; tmpfile64;
   }
 }
index 8683643c76ff4943439429c833f4c03e65619fe7..5d4960f216f90a313b533addb726ec239bf6fbb6 100644 (file)
@@ -37,5 +37,5 @@ tempnam (const char *dir, const char *pfx)
   if (__gen_tempname (buf, 0, 0))
     return NULL;
 
-  return strdup (buf);
+  return __strdup (buf);
 }
index 6b9dfd44b0988ac6718ca7eb2668819ea3062071..4a9e4e2e0a849601a9d9c018980067edc4da2442 100644 (file)
 #include <stdio.h>
 #include <unistd.h>
 
-#ifdef _USE_IN_LIBIO
-# define fdopen _IO_new_fdopen
+#ifdef USE_IN_LIBIO
+# include <iolibio.h>
+# define __fdopen _IO_fdopen
+# define tmpfile __new_tmpfile
 #endif
 
 /* This returns a new stream opened on a temporary file (generated
-   by tmpnam) The file is opened with mode "w+b" (binary read/write).
+   by tmpnam) The file is opened with mode "w+b" (binary read/write).
    If we couldn't generate a unique filename or the file couldn't
    be opened, NULL is returned.  */
 FILE *
-tmpfile ()
+tmpfile (void)
 {
   char buf[FILENAME_MAX];
   int fd;
@@ -36,15 +38,27 @@ tmpfile ()
 
   if (__path_search (buf, FILENAME_MAX, NULL, "tmpf"))
     return NULL;
-  if ((fd = __gen_tempname (buf, 1, 0)) < 0)
+  fd = __gen_tempname (buf, 1, 0);
+  if (fd < 0)
     return NULL;
 
   /* Note that this relies on the Unix semantics that
      a file is not really removed until it is closed.  */
   (void) remove (buf);
 
-  if ((f = fdopen (fd, "w+b")) == NULL)
-    close (fd);
+  if ((f = __fdopen (fd, "w+b")) == NULL)
+    __close (fd);
 
   return f;
 }
+
+#ifdef USE_IN_LIBIO
+# undef tmpfile
+# if defined PIC && DO_VERSIONING
+default_symbol_version (__new_tmpfile, tmpfile, GLIBC_2.1);
+# else
+#  ifdef weak_alias
+weak_alias (__new_tmpfile, tmpfile)
+#  endif
+# endif
+#endif
index a7fce66a86dbe1f9cf36dab8b60ad6c675114821..0f3a0044a4ba181eb2c81f1fceb324e356c13371 100644 (file)
@@ -19,8 +19,9 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#ifdef _USE_IN_LIBIO
-# define fdopen _IO_new_fdopen
+#ifdef USE_IN_LIBIO
+# include <iolibio.h>
+# define __fdopen _IO_fdopen
 #endif
 
 /* This returns a new stream opened on a temporary file (generated
@@ -36,15 +37,16 @@ tmpfile64 ()
 
   if (__path_search (buf, FILENAME_MAX, NULL, "tmpf"))
     return NULL;
-  if ((fd = __gen_tempname (buf, 1, 1)) < 0)
+  fd = __gen_tempname (buf, 1, 1);
+  if (fd < 0)
     return NULL;
 
   /* Note that this relies on the Unix semantics that
      a file is not really removed until it is closed.  */
   (void) remove (buf);
 
-  if ((f = fdopen (fd, "w+b")) == NULL)
-    close (fd);
+  if ((f = __fdopen (fd, "w+b")) == NULL)
+    __close (fd);
 
   return f;
 }
index 2214302b68abe8ccab738c23e4187faf7f232a3a..f0ddc7abede34467dc620550a6349b276e5f83d6 100644 (file)
@@ -364,6 +364,7 @@ extern FILE *__newstream __P ((void));
 
 #ifdef __USE_POSIX
 /* Create a new stream that refers to an existing system file descriptor.  */
+extern FILE *__fdopen __P ((int __fd, __const char *__modes));
 extern FILE *fdopen __P ((int __fd, __const char *__modes));
 #endif
 
index ad12d5fa8911fe264b13c14e1773276faadc0760..f5d06ce5f509aedb22aa2a6cb9d4ad147f5786c8 100644 (file)
@@ -436,7 +436,7 @@ clntunix_destroy (CLIENT *h)
 
 struct cmessage {
   struct cmsghdr cmsg;
-  struct cmsgcred cmcred;
+  struct ucred cmcred;
 };
 
 static int
@@ -469,7 +469,7 @@ __msgread (int sock, void *buf, size_t cnt)
 static int
 __msgwrite (int sock, void *buf, size_t cnt)
 {
-#ifndef SCM_CREDS
+#ifndef SCM_CREDENTIALS
   /* We cannot implement this reliably.  */
   __set_errno (ENOSYS);
   return -1;
@@ -481,15 +481,15 @@ __msgwrite (int sock, void *buf, size_t cnt)
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
 
-  cm.cmsg.cmsg_type = SCM_CREDS;
+  cm.cmsg.cmsg_type = SCM_CREDENTIALS;
   cm.cmsg.cmsg_level = SOL_SOCKET;
   cm.cmsg.cmsg_len = sizeof (struct cmessage);
   /* XXX I'm not sure, if gete?id() is always correct, or if we should use
      get?id(). But since keyserv needs geteuid(), we have no other chance.
      It would be much better, if the kernel could pass both to the server. */
-  cm.cmcred.cmcred_pid = __getpid ();
-  cm.cmcred.cmcred_uid = __geteuid ();
-  cm.cmcred.cmcred_gid = __getegid ();
+  cm.cmcred.pid = __getpid ();
+  cm.cmcred.uid = __geteuid ();
+  cm.cmcred.gid = __getegid ();
 
   msg.msg_iov = iov;
   msg.msg_iovlen = 1;
index e30e5cc872b98fe45322c7f8bb30792a98f8d0fd..8399b261bd6d74b7967c5197e53f5dc157fb8e56 100644 (file)
@@ -46,6 +46,7 @@
 #ifdef USE_IN_LIBIO
 # include <libio/iolibio.h>
 # define fflush(s) _IO_fflush (s)
+# define __fdopen(fd,m) _IO_fdopen (fd,m)
 #endif
 
 /*
@@ -88,9 +89,9 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
       /*
        * parent: write into pdto[1], read from pdfrom[0]
        */
-      *fto = fdopen (pdto[1], "w");
+      *fto = __fdopen (pdto[1], "w");
       __close (pdto[0]);
-      *ffrom = fdopen (pdfrom[0], "r");
+      *ffrom = __fdopen (pdfrom[0], "r");
       __close (pdfrom[1]);
       break;
     }
index c42d30ed83c0f6410210206ae2bbd779b6da4c16..9ee64d030310c1674570ce76f56abb4c15cd2716 100644 (file)
@@ -281,7 +281,7 @@ svcunix_destroy (SVCXPRT *xprt)
 
 struct cmessage {
   struct cmsghdr cmsg;
-  struct cmsgcred cmcred;
+  struct ucred cmcred;
 };
 
 /* XXX This is not thread safe, but since the main functions in svc.c
@@ -318,7 +318,7 @@ __msgread (int sock, void *buf, size_t cnt)
 static int
 __msgwrite (int sock, void *buf, size_t cnt)
 {
-#ifndef SCM_CREDS
+#ifndef SCM_CREDENTIALS
   /* We cannot implement this reliably.  */
   __set_errno (ENOSYS);
   return -1;
@@ -329,15 +329,15 @@ __msgwrite (int sock, void *buf, size_t cnt)
   iov[0].iov_base = buf;
   iov[0].iov_len = cnt;
 
-  cm.cmsg.cmsg_type = SCM_CREDS;
+  cm.cmsg.cmsg_type = SCM_CREDENTIALS;
   cm.cmsg.cmsg_level = SOL_SOCKET;
   cm.cmsg.cmsg_len = sizeof (struct cmessage);
   /* XXX I'm not sure, if we really should use gete?id(), or get?id().
      It would be much better, if the kernel could pass both to the
      client. */
-  cm.cmcred.cmcred_pid = __getpid ();
-  cm.cmcred.cmcred_uid = __geteuid ();
-  cm.cmcred.cmcred_gid = __getegid ();
+  cm.cmcred.pid = __getpid ();
+  cm.cmcred.uid = __geteuid ();
+  cm.cmcred.gid = __getegid ();
 
   msg.msg_iov = iov;
   msg.msg_iovlen = 1;
index 04a5efe9f096f0bb152bb479263e5da0d10d643c..a5dd4a7db3e698d0a9479fc8805e40a885586eee 100644 (file)
@@ -1,5 +1,5 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   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
 #endif
 
 /* Swap bytes in 16 bit value.  */
-#define __bswap_16(x) \
-     ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+#ifdef __GNUC__
+# define __bswap_16(x) \
+    (__extension__                                                           \
+     ({ unsigned short int __bsx = (x);                                              \
+        ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
+#else
+static __inline unsigned short int
+__bswap16 (unsigned short int x)
+{
+  return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
+}
+#endif
 
 /* Swap bytes in 32 bit value.  */
-#define __bswap_32(x) \
-     ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |                      \
-      (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
+#ifdef __GNUC__
+# define __bswap_32(x) \
+    (__extension__                                                           \
+     ({ unsigned int __bsx = (x);                                            \
+        ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |    \
+        (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24)); }))
+#else
+static __inline unsigned int
+__bswap32 (unsigned int x)
+{
+  return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |
+         (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24));
+}
+#endif
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
index 4499517b1a68daea5cafa9781ee2dce49a137ab4..8d75c9151e69c2ae76c5d06fdc6d93048e6fed14 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 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
@@ -40,12 +40,11 @@ struct sigaction
   };
 
 /* Bits in `sa_flags'.  */
-#ifdef __USE_BSD
-# define SA_ONSTACK    0x1     /* Take signal on signal stack.  */
-# define SA_RESTART    0x2     /* Restart syscall on signal return.  */
-# define SA_DISABLE    0x4     /* Disable alternate signal stack.  */
+#if defined __USE_UNIX98 || defined __USE_MISC
+# define SA_ONSTACK    0x0001  /* Take signal on signal stack.  */
+# define SA_RESTART    0x0002  /* Restart syscall on signal return.  */
 #endif
-#define        SA_NOCLDSTOP    0x8     /* Don't send SIGCHLD when children stop.  */
+#define        SA_NOCLDSTOP    0x0008  /* Don't send SIGCHLD when children stop.  */
 
 
 /* Values for the HOW argument to `sigprocmask'.  */
index 3a58e8bb586372a751f0f1671f7439735e655c18..0998256613719dc96f1211d98793d2d1cf8b21a8 100644 (file)
@@ -37,3 +37,19 @@ typedef struct sigaltstack
     size_t ss_size;
     int ss_flags;
   } stack_t;
+
+
+/* Possible values for `ss_flags.'.  */
+enum
+{
+  SS_ONSTACK = 0x0001,
+#define SS_ONSTACK     SS_ONSTACK
+  SS_DISABLE = 0x0004,
+#define SS_DISABLE     SS_DISABLE
+};
+    
+/* Minumum stack size for a signal handler.  */
+#define MINSIGSTKSZ    8192
+
+/* System default stack size.  */
+#define SIGSTKSZ       (MINSIGSTKSZ + 32768)
index c7d7f556fa6505fc5d1ca763b1e3694e770db0e4..4650c5c1ae4e6ef157371cb7ca95f71538041dc4 100644 (file)
 
 /* Open a new stream on a given system file descriptor.  */
 FILE *
-fdopen (fd, mode)
+__fdopen (fd, mode)
      int fd;
      const char *mode;
 {
   __set_errno (ENOSYS);
   return NULL;
 }
+weak_alias (__fdopen, fdopen)
 
 stub_warning (fdopen)
 #include <stub-tag.h>
index ff6e4edcaff8bbf05acf5875190e27a12b5c89cd..102b0231d822f9a68070a69744053a61dfe054a6 100644 (file)
@@ -1,5 +1,5 @@
 /* Return from signal handler in GNU C library for Hurd.  Alpha version.
-   Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 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
@@ -65,7 +65,7 @@ __sigreturn (struct sigcontext *scp)
 
   if (scp->sc_onstack)
     {
-      ss->sigaltstack.ss_flags &= ~SA_ONSTACK; /* XXX threadvars */
+      ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */
       /* XXX cannot unlock until off sigstack */
       abort ();
     }
index b650478347f39d19f6a79967596ef8c0640f33a8..a1d0dfb5a7398d7c4f1a3cc551c80a088bdf0ffe 100644 (file)
@@ -1,5 +1,5 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  Alpha version.
-   Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 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
@@ -86,10 +86,10 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
     return NULL;
 
   if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
-      !(ss->sigaltstack.ss_flags & (SA_DISABLE|SA_ONSTACK)))
+      !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
     {
       sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
-      ss->sigaltstack.ss_flags |= SA_ONSTACK;
+      ss->sigaltstack.ss_flags |= SS_ONSTACK;
       /* XXX need to set up base of new stack for
         per-thread variables, cthreads.  */
     }
@@ -114,7 +114,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
     {
       /* Set up the sigcontext from the current state of the thread.  */
 
-      scp->sc_onstack = ss->sigaltstack.ss_flags & SA_ONSTACK ? 1 : 0;
+      scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
 
       /* struct sigcontext is laid out so that starting at sc_regs
         mimics a struct alpha_thread_state.  */
index 5a3106d4a0f639106561824e268bad4ffe0aa460..fcdf84e969112feb57728876274f1aaeaea61228 100644 (file)
@@ -27,7 +27,7 @@ extern int __getmode __P ((const char *mode, __io_mode *mptr));
 
 /* Open a new stream on a given system file descriptor.  */
 FILE *
-fdopen (fd, mode)
+__fdopen (fd, mode)
      int fd;
      const char *mode;
 {
@@ -68,3 +68,5 @@ fdopen (fd, mode)
 
   return stream;
 }
+
+weak_alias (__fdopen, fdopen)
index ceb16235fed3c8ccd4b135b2af863570f3d89549..b046b945a460b87885417a58e6fc4addcc6f1a05 100644 (file)
@@ -1,5 +1,5 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  HPPA version.
-   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 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
@@ -75,10 +75,10 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
     return NULL;
 
   if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
-      !(ss->sigaltstack.ss_flags & (SA_DISABLE|SA_ONSTACK)))
+      !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
     {
       sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
-      ss->sigaltstack.ss_flags |= SA_ONSTACK;
+      ss->sigaltstack.ss_flags |= SS_ONSTACK;
       /* XXX need to set up base of new stack for
         per-thread variables, cthreads.  */
     }
@@ -104,7 +104,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 
       /* Set up the sigcontext from the current state of the thread.  */
 
-      scp->sc_onstack = ss->sigaltstack.ss_flags & SA_ONSTACK ? 1 : 0;
+      scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
 
       /* struct sigcontext is laid out so that starting at sc_regs mimics a
         struct parisc_thread_state.  */
index 002a4e10a4bbf4dd439bbfc0eb5785015db1b4d4..334351d2852d505af0bcd2ad43f1d6b066a68340 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 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
@@ -68,7 +68,7 @@ __sigreturn (struct sigcontext *scp)
 
   if (scp->sc_onstack)
     {
-      ss->sigaltstack.ss_flags &= ~SA_ONSTACK; /* XXX threadvars */
+      ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */
       /* XXX cannot unlock until off sigstack */
       abort ();
     }
index 5841c60a01d16f7e2d3a47eea7863e0db5b8285f..4c1fa60e2e32db5fdf53f87a6bd87c57ba9724c6 100644 (file)
@@ -1,5 +1,5 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  i386 version.
-   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 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
@@ -74,10 +74,10 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
   state->basic.esp = state->basic.uesp;
 
   if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
-      !(ss->sigaltstack.ss_flags & (SA_DISABLE|SA_ONSTACK)))
+      !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
     {
       sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
-      ss->sigaltstack.ss_flags |= SA_ONSTACK;
+      ss->sigaltstack.ss_flags |= SS_ONSTACK;
       /* XXX need to set up base of new stack for
         per-thread variables, cthreads.  */
     }
@@ -144,7 +144,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 
       /* Set up the sigcontext from the current state of the thread.  */
 
-      scp->sc_onstack = ss->sigaltstack.ss_flags & SA_ONSTACK ? 1 : 0;
+      scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
 
       /* struct sigcontext is laid out so that starting at sc_gs mimics a
         struct i386_thread_state.  */
index fe38fac1df256be5bf0f6aaf6365e90510ee9956..0e775736bd1cc7b08f7f6cc46cdde031550e4534 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 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
@@ -64,7 +64,7 @@ __sigreturn (struct sigcontext *scp)
 
   if (scp->sc_onstack)
     {
-      ss->sigaltstack.ss_flags &= ~SA_ONSTACK; /* XXX threadvars */
+      ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */
       /* XXX cannot unlock until off sigstack */
       abort ();
     }
index fbb7df508fc9fa8d32ced780110954d85e656310..284b95c330d712749f262b1b3ec59a1500cdb1ec 100644 (file)
@@ -1,5 +1,5 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  MIPS version.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 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
@@ -77,10 +77,10 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
   state->basic.r16 = state->basic.r29;
 
   if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
-      !(ss->sigaltstack.ss_flags & (SA_DISABLE|SA_ONSTACK)))
+      !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
     {
       sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
-      ss->sigaltstack.ss_flags |= SA_ONSTACK;
+      ss->sigaltstack.ss_flags |= SS_ONSTACK;
       /* XXX need to set up base of new stack for
         per-thread variables, cthreads.  */
     }
@@ -129,7 +129,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 
       /* Set up the sigcontext from the current state of the thread.  */
 
-      scp->sc_onstack = ss->sigaltstack.ss_flags & SA_ONSTACK ? 1 : 0;
+      scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
 
       /* struct sigcontext is laid out so that starting at sc_gpr
         mimics a struct mips_thread_state.  */
index 659b6b87a8451690307174f16c974da90baf214b..29817969951dfb4e2f7996cbb3d169fbbb5250ef 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 93, 94, 95, 97, 98 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
@@ -23,7 +23,7 @@
 /* Run signals handlers on the stack specified by SS (if not NULL).
    If OSS is not NULL, it is filled in with the old signal stack status.  */
 int
-sigaltstack (argss, oss)
+__sigaltstack (argss, oss)
      const struct sigaltstack *argss;
      struct sigaltstack *oss;
 {
@@ -40,7 +40,7 @@ sigaltstack (argss, oss)
   __spin_lock (&s->lock);
 
   if (argss != NULL &&
-      (ss.ss_flags & SA_DISABLE) && (s->sigaltstack.ss_flags & SA_ONSTACK))
+      (ss.ss_flags & SS_DISABLE) && (s->sigaltstack.ss_flags & SS_ONSTACK))
     {
       /* Can't disable a stack that is in use.  */
       __spin_unlock (&s->lock);
@@ -60,3 +60,4 @@ sigaltstack (argss, oss)
 
   return 0;
 }
+weak_alias(__sigaltstack, sigaltstack)
index d6044ece041c7da5ec313c22a1bcfd47469e4b76..0f5afbaf9957d905b5cfb2c43cf265ee7d53ba65 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 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
@@ -22,7 +22,6 @@
 
 /* Run signals handlers on the stack specified by SS (if not NULL).
    If OSS is not NULL, it is filled in with the old signal stack status.  */
-/* XXX should be __sigstack ? */
 int
 sigstack (ss, oss)
      const struct sigstack *ss;
@@ -34,13 +33,13 @@ sigstack (ss, oss)
   as.ss_size = 0;
   as.ss_flags = 0;
 
-  if (sigaltstack (&as, &oas) < 0)
+  if (__sigaltstack (&as, &oas) < 0)
     return -1;
 
   if (oss != NULL)
     {
       oss->ss_sp = oas.ss_sp;
-      oss->ss_onstack = oas.ss_flags & SA_ONSTACK;
+      oss->ss_onstack = oas.ss_flags & SS_ONSTACK;
     }
 
   return 0;
index 4e7d3051eb6c1008089aa60bc61ad1e0911d5ba8..39d8463b70595343fa057bf47e48f21b0d632a54 100644 (file)
@@ -25,7 +25,7 @@ extern int __getmode (const char *mode, __io_mode *mptr);
 
 /* Open a new stream on a given system file descriptor.  */
 FILE *
-fdopen (fd, mode)
+__fdopen (fd, mode)
      int fd;
      const char *mode;
 {
@@ -71,3 +71,5 @@ fdopen (fd, mode)
 
   return stream;
 }
+
+weak_alias (__fdopen, fdopen)
index 6dd893e613e71879feb18012305baad73c450d12..d49971db26dc29ee9c08f7e6c6b9def8d13dc3d8 100644 (file)
@@ -145,15 +145,9 @@ __gen_tempname (char *tmpl, int openit, int largefile)
 
       if (openit)
        {
-         /* XXX Do we want to fail on largefile if 64 bit fileops
-            are not implemented, or just fall back to the old stuff? */
-#ifndef __stub_open64
          fd = (largefile
                ? __open (tmpl, O_RDWR | O_CREAT | O_EXCL, 0666)
                : __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, 0666));
-#else
-         fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, 0666);
-#endif
          if (fd >= 0)
            {
              __set_errno (save_errno);
index e813a08c14615f428d502ee1fb4e721b08c4b037..dbe401de3f1617a727fb3aad8a616e99ed14bb2a 100644 (file)
@@ -75,7 +75,5 @@ sys/user.h
 sys/vt.h
 xstatconv.c
 getdents64.c
-__sendmsg.S
-__recvmsg.S
 getresuid.c
 getresgid.c
index af53184cb25c92fc42f064c2e1ea70253550aaa5..b84fbed0c711f2faec8995bf07cf05e7d9d89f90 100644 (file)
@@ -58,7 +58,7 @@ ifeq ($(subdir),socket)
 sysdep_headers += net/if.h net/if_ppp.h net/ppp-comp.h \
                  net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
                  net/if_slip.h net/if_packet.h
-sysdep_routines += cmsg_nxthdr sa_len __sendmsg __recvmsg
+sysdep_routines += cmsg_nxthdr sa_len
 endif
 
 ifeq ($(subdir),sunrpc)
diff --git a/sysdeps/unix/sysv/linux/__recvmsg.S b/sysdeps/unix/sysv/linux/__recvmsg.S
deleted file mode 100644 (file)
index f76cce0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define        socket  ___syscall_recvmsg
-#define        __socket __syscall_recvmsg
-#define SOCKOP____syscall_recvmsg SOCKOP_recvmsg
-#define        NARGS   3
-#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/__sendmsg.S b/sysdeps/unix/sysv/linux/__sendmsg.S
deleted file mode 100644 (file)
index bd935bd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define        socket  ___syscall_sendmsg
-#define        __socket __syscall_sendmsg
-#define SOCKOP____syscall_sendmsg SOCKOP_sendmsg
-#define        NARGS   3
-#include <socket.S>
index c1f752ec29993b79e3b56d4532125fccd8f6bfb1..226e3320435d8999d3d3b59b7c03aecbb1ce4896 100644 (file)
@@ -225,29 +225,20 @@ enum
     SCM_RIGHTS = 0x01,         /* Transfer file descriptors.  */
 #define SCM_RIGHTS SCM_RIGHTS
 #ifdef __USE_BSD
-    SCM_CREDS = 0x02,          /* BSD-compatible credentials passing.  */
-# define SCM_CREDS SCM_CREDS
+    SCM_CREDENTIALS = 0x02,     /* Credentials passing.  */
+# define SCM_CREDENTIALS SCM_CREDENTIALS
 #endif
     __SCM_CONNECT = 0x03,      /* Data array is `struct scm_connect'.  */
   };
 
-#ifdef __USE_BSD
-
-/* User visible structure for SCM_CREDS message
-   (chosen for BSD source compatibility) */
+/* User visible structure for SCM_CREDENTIALS message */
 
-# define CMGROUP_MAX 16  /* Linux does not provide this info, so it doesn't
-                           matter... use what bsd does. */
-struct cmsgcred
+struct ucred
 {
-  pid_t cmcred_pid;                    /* PID of sending process.  */
-  uid_t cmcred_uid;                    /* Real UID of sending process.  */
-  uid_t cmcred_euid;                   /* Effective UID of sending process. */
-  gid_t cmcred_gid;                    /* Real GID of sending process.  */
-  short int cmcred_ngroups;            /* Number or groups.  */
-  gid_t cmcred_groups[CMGROUP_MAX];    /* Groups.  */
+  pid_t pid;                   /* PID of sending process.  */
+  uid_t uid;                   /* UID of sending process.  */
+  gid_t gid;                   /* GID of sending process.  */
 };
-#endif
 
 /* Get socket manipulation related informations from kernel headers.  */
 #include <asm/socket.h>
diff --git a/sysdeps/unix/sysv/linux/recvmsg.S b/sysdeps/unix/sysv/linux/recvmsg.S
new file mode 100644 (file)
index 0000000..b4125d2
--- /dev/null
@@ -0,0 +1,4 @@
+#define        socket  recvmsg
+#define        __socket __libc_recvmsg
+#define        NARGS   3
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/recvmsg.c b/sysdeps/unix/sysv/linux/recvmsg.c
deleted file mode 100644 (file)
index 52a0abc..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 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 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 <sys/socket.h>
-#include <errno.h>
-#include <string.h>
-
-#include <asm/posix_types.h>
-
-/* The kernel expects this structure in SCM_CREDS messages.
- * Note: sizeof(struct __kernel_ucred) <= sizeof(struct cmsgcred) must hold.
- */
-struct __kernel_ucred
-{
-  __kernel_pid_t pid;
-  __kernel_uid_t uid;
-  __kernel_gid_t gid;
-};
-
-extern int __syscall_recvmsg (int, struct msghdr *, int);
-
-int
-__libc_recvmsg (int fd, struct msghdr *message, int flags)
-{
-  struct cmsghdr *cm;
-  int ret;
-
-  ret = __syscall_recvmsg (fd, message, flags);
-
-  if (ret == -1)
-    return ret;
-
-  /* Postprocess the message control block for SCM_CREDS.  */
-  cm = CMSG_FIRSTHDR (message);
-  while (cm)
-    {
-      if (cm->cmsg_type == SCM_CREDS)
-       {
-         struct cmsgcred *c = (struct cmsgcred *) CMSG_DATA (cm);
-         struct __kernel_ucred u;
-         int i;
-         memcpy (&u, CMSG_DATA (cm), sizeof (struct __kernel_ucred));
-
-         c->cmcred_pid = u.pid;
-         c->cmcred_uid = u.uid;
-         c->cmcred_gid = u.gid;
-
-         c->cmcred_euid = -1;
-         c->cmcred_ngroups = 0;
-         for (i = 0; i < CMGROUP_MAX; i++)
-           c->cmcred_groups[i] = -1;
-       }
-      cm = CMSG_NXTHDR (message, cm);
-    }
-
-  return ret;
-}
-
-weak_alias (__libc_recvmsg, recvmsg)
diff --git a/sysdeps/unix/sysv/linux/sendmsg.S b/sysdeps/unix/sysv/linux/sendmsg.S
new file mode 100644 (file)
index 0000000..0defce9
--- /dev/null
@@ -0,0 +1,4 @@
+#define        socket  sendmsg
+#define        __socket __libc_sendmsg
+#define        NARGS   3
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/sendmsg.c b/sysdeps/unix/sysv/linux/sendmsg.c
deleted file mode 100644 (file)
index 304aa6e..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Copyright (C) 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 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 <sys/socket.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <asm/posix_types.h>
-
-/* The kernel expects this structure in SCM_CREDS messages.
- * Note: sizeof(struct __kernel_ucred) <= sizeof(struct cmsgcred) must hold.
- */
-struct kernel_ucred
-  {
-    __kernel_pid_t pid;
-    __kernel_uid_t uid;
-    __kernel_gid_t gid;
-  };
-
-struct credmsg
-  {
-    struct cmsghdr cm;
-    struct cmsgcred cc;
-  };
-
-struct kcredmsg
-  {
-    struct cmsghdr cm;
-    struct kernel_ucred cc;
-  };
-
-extern int __syscall_sendmsg (int, const struct msghdr *, int);
-
-/* Send a message described by MESSAGE on socket FD.
-   Returns the number of bytes sent, or -1 for errors.  */
-int
-__libc_sendmsg (int fd, const struct msghdr *message, int flags)
-{
-  struct msghdr m;
-  char *buf, *a, *b;
-  struct credmsg *cred = 0;
-  struct kcredmsg *kcred;
-  struct cmsghdr *cm;
-  long int offset = 0;
-  pid_t pid;
-
-  /* Preprocess the message control block for SCM_CREDS. */
-  if (message->msg_controllen)
-    {
-      cm = CMSG_FIRSTHDR (message);
-      while (cm)
-       {
-         if (cm->cmsg_type == SCM_CREDS)
-           {
-             if (cred ||
-                 cm->cmsg_len < CMSG_LEN (sizeof (struct cmsgcred)))
-               {
-                 __set_errno (EINVAL);
-                 return -1;
-               }
-             else
-               {
-                 cred = (struct credmsg *) cm;
-                 offset = (char *) cm - (char *) message->msg_control;
-               }
-           }
-         cm = CMSG_NXTHDR ((struct msghdr *) message, cm);
-       }
-
-      if (cred)
-       {
-         buf = alloca (message->msg_controllen);
-         memcpy (buf, message->msg_control, message->msg_controllen);
-         kcred = (struct kcredmsg *) (buf + offset);
-         a = (char *) kcred + CMSG_LEN (sizeof (struct kernel_ucred));
-         b = (char *) kcred + CMSG_LEN (sizeof (struct cmsgcred));
-         memmove (a, b, message->msg_controllen - (b - buf));
-
-         kcred->cm.cmsg_len = CMSG_LEN (sizeof (struct kernel_ucred));
-
-         /* Linux expects the calling process to pass in
-            its credentials, and sanity checks them.
-            You can send real, effective, or set- uid and gid.
-            If the user hasn't filled in the buffer, we default to
-            real uid and gid. */
-         pid = __getpid ();
-         if (cred->cc.cmcred_pid != pid)
-           {
-             kcred->cc.pid = pid;
-             kcred->cc.uid = __getuid ();
-             kcred->cc.gid = __getgid ();
-           }
-         else
-           {
-             kcred->cc.uid = cred->cc.cmcred_uid;
-             kcred->cc.gid = cred->cc.cmcred_gid;
-           }
-         memcpy (&m, message, sizeof (struct msghdr));
-         m.msg_control = buf;
-         m.msg_controllen -= b - a;
-         return __syscall_sendmsg (fd, &m, flags);
-       }
-    }
-  return __syscall_sendmsg (fd, message, flags);
-}
-
-weak_alias (__libc_sendmsg, sendmsg)