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.
This commit is contained in:
Ulrich Drepper 1998-08-08 20:02:34 +00:00
parent 9fbffc4676
commit 7ce241a03e
60 changed files with 730 additions and 396 deletions

130
ChangeLog
View File

@ -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.

View File

@ -26,6 +26,25 @@
#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>

View 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
@ -22,13 +22,34 @@
#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. */

View 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'. */

View 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)

View File

@ -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

View 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

View File

@ -16,4 +16,8 @@ libc {
# s*
setgrent; setgroups;
}
GLIBC_2.1 {
# p*
putgrent;
}
}

View File

@ -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));

70
grp/putgrent.c Normal file
View File

@ -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;
}

View 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)

View 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;

View 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

View 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

View 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;

View 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;
}

51
libio/oldtmpfile.c Normal file
View File

@ -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);

View 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

View 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.

View 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));
}

View File

@ -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} \

View File

@ -46,9 +46,12 @@
# 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)))

View 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

View 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;

View File

@ -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. */

View 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

View 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
@ -19,6 +19,13 @@
#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;
}

View File

@ -45,6 +45,6 @@ libc {
printf_size; printf_size_info;
# t*
tmpfile64;
tmpfile; tmpfile64;
}
}

View 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);
}

View File

@ -19,16 +19,18 @@
#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

View 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;
}

View 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

View 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;

View 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;
}

View 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;

View 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
@ -22,13 +22,34 @@
#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. */

View 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'. */

View 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)

View File

@ -21,13 +21,14 @@
/* 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>

View 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 ();
}

View 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. */

View 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)

View 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. */

View 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 ();
}

View 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. */

View 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 ();
}

View 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. */

View 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)

View 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;

View 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)

View 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);

View File

@ -75,7 +75,5 @@ sys/user.h
sys/vt.h
xstatconv.c
getdents64.c
__sendmsg.S
__recvmsg.S
getresuid.c
getresgid.c

View 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)

View File

@ -1,5 +0,0 @@
#define socket ___syscall_recvmsg
#define __socket __syscall_recvmsg
#define SOCKOP____syscall_recvmsg SOCKOP_recvmsg
#define NARGS 3
#include <socket.S>

View File

@ -1,5 +0,0 @@
#define socket ___syscall_sendmsg
#define __socket __syscall_sendmsg
#define SOCKOP____syscall_sendmsg SOCKOP_sendmsg
#define NARGS 3
#include <socket.S>

View 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_CREDENTIALS message */
/* User visible structure for SCM_CREDS message
(chosen for BSD source compatibility) */
# 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>

View File

@ -0,0 +1,4 @@
#define socket recvmsg
#define __socket __libc_recvmsg
#define NARGS 3
#include <socket.S>

View File

@ -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)

View File

@ -0,0 +1,4 @@
#define socket sendmsg
#define __socket __libc_sendmsg
#define NARGS 3
#include <socket.S>

View File

@ -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)