update from main archive 961030

Thu Oct 31 00:01:39 1996  Ulrich Drepper  <drepper@cygnus.com>

	* signal/Makefile (routines): Add sigwait.
	* signal/signal.h: Add prototype for sigwait.
	* sysdeps/posix/sigwait.c: New file.  Implementation of sigwait
	function from POSIX.1c.
	* sysdeps/stub/sigwait.c: New file.  Stub version of sigwait.

Wed Oct 30 02:01:17 1996  Richard Henderson  <rth@tamu.edu>

	* sunrpc/xdr_float.c (xdr_float): Handle sizeof(float)!=sizeof(long),
	but don't bother going farther than sizeof(float)==sizeof(int).
	(xdr_double): Handle little-endian machines!  Handle sizeof(double)
	!= 2*sizeof(long), though again don't bother with more than int.

Thu Oct 29 16:09:42 1996  Craig Metz  <cmetz@inner.net>

	* sysdeps/posix/getaddrinfo.c: Use buffer limits for inet_ntop
	function.

Tue Oct 29 12:37:22 1996  Ulrich Drepper  <drepper@cygnus.com>

	* Makerules: Create symbolic links for linking in $(libdir).
	(make-link): Use absolute path for destination if this is not in
	the same directory.

	* elf/rtld.c (dl_main): When verifying don't check the name of
	the dynamic linker.

	* shlib-versions: Change entries for Hurd specific libs from
	*-*-gnu* to *-*-gnu?* so that i586-pc-linux-gnu does not match
	these entries.

	* assert/assert.h: Reformat copyright.
	Change reference to ANSI into reference to ISO C.
	* ctype/ctype.h: Likewise.
	* errno.h: Likewise.
	* limits.h: Likewise.
	* math/math.h: Likewise.
	* setjmp/setjmp.h: Likewise.
	* stdio/stdio.h: Likewise.
	* libio/stdio.h: Likewise.
	* stdlib/stdlib.h: Likewise.
	* string/string.h: Likewise.
	* time/time.h: Likewise.

	* string/argz.h: Use __const is definitions.

	* elf/dlfcn.h: Use __const and __P.  Reformat copyright.
	* misc/err.h: Likewise.

	* wctype/wctype.h (wctrans_t): Use __const instead of const.

	* Makeconfig ($(common-objpfx)soversions.mk): Generate list of
	sonames for versioned libraries.
	* Makefile: Remove code to generate libc-version.h.
	Generate gnu/lib-names.h with info from soversions.mk.
	* features.h: Define __GLIBC__ and __GLIBC_MINOR__.

	* dirent/tst-seekdir.c: Initialize save3.
	* grp/testgrp.c: Initialize my_group.

	* grp/fgetgrent_r.c: Change interface to follow POSIX.1c.
	* grp/grp.h: Likewise.
	* nss/getXXbyYY.c: Likewise.
	* nss/getXXbyYY_r.c: Likewise.
	* nss/getXXent.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* pwd/fgetpwent_r.c: Likewise.
	* pwd/pwd.h: Likewise.
	* shadow/fgetspent_r.c: Likewise.
	* shadow/sgetspent.c: Likewise.
	* shadow/sgetspent_r.c: Likewise.
	* grp/fgetgrent.c: Adapt for change in interface of fgetgrent_r.
	* pwd/fgetpwent.c: Likewise, for fgetpwent_r.c.
	* shadow/fgetspent.c: Likewise, for fgetpwent_r.c.
	* resolv/netdb.h: Adapt prototypes for reentrant functions to
	follow POSIX.1c.
	* sunrpc/rpc/netdb.h: Likewise,
	* shadow/shadow.h: Likewise.

	* inet/getnetgrent_r.c: Follow change in pwd/grp function interface.

	* sysdeps/unix/getlogin_r.c: Return ERANGE when buffer is too small.

	* inet/herrno.c: Don't define __h_errno.  Only h_errno otherwise the
	ELF aliasing creates strange situations.
	* sysdeps/unix/sysv/linux/errnos.H: Define __set_errno as inline
	function.
	* sysdeps/unix/sysv/linux/i386/sysdep.S: Don't define __errno.
	* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.

	* libio/libio.h: Don't declare _IO_flockfile and _IO_funlockfile
	weak.

	* locale/programs/charmap.c: Add casts to prevent warnings.
	* locale/programs/linereader.h: Likewise.
	* locale/programs/ld-collate.c: Likewise.
	* locale/programs/stringtrans.c: Likewise.
	Change types for various variables to prevent warnings.
	* locale/programs/ld-ctype.c: Likewise.
	* locale/programs/linereader.h (lr_ungetc): Likewise.
	* locale/programs/charset.h (struct charset): Use `unsigned int'
	as type for width_default.
	* posix/regex.c: Change type of `this_reg' variables.
	* stdio-common/Makefile: Use -Wno-format for tstdiomisc.c.
	* stdio-common/bug5.c: De-ANSI-fy.  Use correct types for
	variables.
	* stdio-common/printf_fp.c: Initialize to_shift.
	* stdio-common/test_rdwr.c: Add cast.
	* stdio-common/vfprintf.c: Add casts and use correct types to
	prevent warnings.
	* stdio-common/vfscanf.c: Initialize str and strptr.
	* sysdeps/libm-ieee754/e_jnf.c: Use correct types to prevent warnings.
	* sysdeps/libm-ieee754/e_pow.c: Likewise.
	* sysdeps/libm-ieee754/e_powf.c: Likewise.
	* sysdeps/libm-ieee754/e_rem_pio2f.c: Likewise.
	* time/test-tz.c: Likewise.

	* manual/creature.texi: Document _REENTRANT and _THREAD_SAFE.
	* manual/libc.texinfo: Prevent makeinfo failure by avoiding
	libc.cp index.  This must be fixed.
	* manual/nss.texi: Adapt for correct POSIX.1c interface of
	reentrant functions.
	* manual/users.texi: Document netgroup functions.

	* po/es.po: Updated.
	* po/fr.po: Updated.

	* posix/fnmatch.c: Change to match libit version.

	* posix/unistd.h: Change prototype for ttyname_r to match POSIX.1c.
	* sysdep/posix/ttyname_r.c: Likewise.

	* stdlib/atexit.h (__new_exitfn): Add internal locking.
	* stdlib/exit.c: De-ANSI-fy.  Handle new ef_us value for flavor.
	* stdlib/exit.h: De-ANSI-fy.  Define new ef_us value for flavor.
	* stdlib/random.c (__srandom): Add internal locking.
	(__initstate): Likewise.
	(__setstate): Likewise.
	(__random): Likewise.

Mon Oct 28 22:28:37 1996  NIIBE Yutaka  <gniibe@mri.co.jp>

	* sysdeps/generic/crypt-entry.c (crypt_r): Use __set_errno.
	(crypt): Likewise.
	* resolv/gethnamaddr.c (gethostbyname2): Likewise.
	* sysdeps/generic/uname.c: Likewise.
	* sysdeps/posix/rename.c: Likewise.
	* sysdeps/stub/setrlimit.c: Likewise.

	* nss/nss_db/db-netgrp.c (_nss_db_setnetgrent): Fix typo.

Sun Oct 27 11:12:50 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/programs/ld-collate.c (collate_order_elem): Fix format
	string.
	(collate_element_to): Cast field width argument to `int' for
	format string.
	(collate_symbol): Likewise.
	(collate_order_elem): Likewise.
	(collate_weight_bsymbol): Likewise.
	(collate_simple_weight): Likewise.

	* locale/programs/ld-time.c (STRARR_ELEM): Fix format string.

	* locale/programs/ld-ctype.c (ctype_class_newP): Add missing
	argument for format string.
	(ctype_map_newP): Likewise.
	(set_class_defaults): Fix format string.

	* locale/programs/localedef.c (construct_output_path): Putting an
	explicit \0 into the format string does not work, use %c.

Sat Oct 26 20:38:36 1996  Richard Henderson  <rth@tamu.edu>

	* Makerules: Install all shared libraries in $(slibdir).

	* login/Makefile: Build libutil.so in others pass after
	libc.so is created.

	* misc/mntent.h: Include <paths.h> for _PATH_MNTTAB & _PATH_MOUNTED.

	* string/stratcliff.c: Allocate 3 pages instead of one, then use
	mprotect so that we know that the adjacent pages are inaccessible.

	* resource/sys/resource.h: Move all structures and enums to ...
	* sysdeps/generic/resourcebits.h: ... here ...
	* sysdeps/unix/bsd/sun/sunos4/resourcebits.h: ... and here.
	* sysdeps/unix/sysv/linux/alpha/resourcebits.h: Remove.
	* sysdeps/unix/sysv/linux/i386/resourcebits.h: Remove.
	* sysdeps/unix/sysv/linux/m68k/resourcebits.h: Remove.
	* sysdeps/unix/sysv/linux/mips/resourcebits.h: Remove.
	* sysdeps/unix/sysv/linux/resourcebits.h: New file.  Use kernel
	header for RLIMIT_* definitions.  The members of struct rlimit
	are longs.


Thu Oct 24 17:43:34 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* MakeTAGS (sysdep-dirs): Fix typo.

Wed Oct 23 03:45:22 1996  Ulrich Drepper  <drepper@cygnus.com>

	* Makefile (headers): Don't mention libc-version.h.
	(install-others): ...but here.

	* time/strptime.c: Recognize %s, %u, %g, and %G format.
 	nothing is found.  This guarantees all subsequent calls behave
	* sysdeps/unix/sysv/linux/syscalls.list: Change function name for
	* io/getwd.c (getwd) [! PATH_MAX]: Don't assume that the user's
	buffer is any longer than the amount necessary to hold the
	filename; the Hurd getcwd uses the *entire* contents of the
	buffer, however long it is specified to be.
	* posix/getconf.c: De-ANSI-fy.  Recognize POSIX.2 constant names.
	since these do not depend on the platform.
This commit is contained in:
Ulrich Drepper 1996-10-31 02:57:12 +00:00
parent f0f4432f46
commit ba1ffaa1c6
102 changed files with 4306 additions and 1868 deletions

225
ChangeLog
View File

@ -1,3 +1,210 @@
Thu Oct 31 00:01:39 1996 Ulrich Drepper <drepper@cygnus.com>
* signal/Makefile (routines): Add sigwait.
* signal/signal.h: Add prototype for sigwait.
* sysdeps/posix/sigwait.c: New file. Implementation of sigwait
function from POSIX.1c.
* sysdeps/stub/sigwait.c: New file. Stub version of sigwait.
Wed Oct 30 02:01:17 1996 Richard Henderson <rth@tamu.edu>
* sunrpc/xdr_float.c (xdr_float): Handle sizeof(float)!=sizeof(long),
but don't bother going farther than sizeof(float)==sizeof(int).
(xdr_double): Handle little-endian machines! Handle sizeof(double)
!= 2*sizeof(long), though again don't bother with more than int.
Thu Oct 29 16:09:42 1996 Craig Metz <cmetz@inner.net>
* sysdeps/posix/getaddrinfo.c: Use buffer limits for inet_ntop
function.
Tue Oct 29 12:37:22 1996 Ulrich Drepper <drepper@cygnus.com>
* Makerules: Create symbolic links for linking in $(libdir).
(make-link): Use absolute path for destination if this is not in
the same directory.
* elf/rtld.c (dl_main): When verifying don't check the name of
the dynamic linker.
* shlib-versions: Change entries for Hurd specific libs from
*-*-gnu* to *-*-gnu?* so that i586-pc-linux-gnu does not match
these entries.
* assert/assert.h: Reformat copyright.
Change reference to ANSI into reference to ISO C.
* ctype/ctype.h: Likewise.
* errno.h: Likewise.
* limits.h: Likewise.
* math/math.h: Likewise.
* setjmp/setjmp.h: Likewise.
* stdio/stdio.h: Likewise.
* libio/stdio.h: Likewise.
* stdlib/stdlib.h: Likewise.
* string/string.h: Likewise.
* time/time.h: Likewise.
* string/argz.h: Use __const is definitions.
* elf/dlfcn.h: Use __const and __P. Reformat copyright.
* misc/err.h: Likewise.
* wctype/wctype.h (wctrans_t): Use __const instead of const.
* Makeconfig ($(common-objpfx)soversions.mk): Generate list of
sonames for versioned libraries.
* Makefile: Remove code to generate libc-version.h.
Generate gnu/lib-names.h with info from soversions.mk.
* features.h: Define __GLIBC__ and __GLIBC_MINOR__.
* dirent/tst-seekdir.c: Initialize save3.
* grp/testgrp.c: Initialize my_group.
* grp/fgetgrent_r.c: Change interface to follow POSIX.1c.
* grp/grp.h: Likewise.
* nss/getXXbyYY.c: Likewise.
* nss/getXXbyYY_r.c: Likewise.
* nss/getXXent.c: Likewise.
* nss/getXXent_r.c: Likewise.
* pwd/fgetpwent_r.c: Likewise.
* pwd/pwd.h: Likewise.
* shadow/fgetspent_r.c: Likewise.
* shadow/sgetspent.c: Likewise.
* shadow/sgetspent_r.c: Likewise.
* grp/fgetgrent.c: Adapt for change in interface of fgetgrent_r.
* pwd/fgetpwent.c: Likewise, for fgetpwent_r.c.
* shadow/fgetspent.c: Likewise, for fgetpwent_r.c.
* resolv/netdb.h: Adapt prototypes for reentrant functions to
follow POSIX.1c.
* sunrpc/rpc/netdb.h: Likewise,
* shadow/shadow.h: Likewise.
* inet/getnetgrent_r.c: Follow change in pwd/grp function interface.
* sysdeps/unix/getlogin_r.c: Return ERANGE when buffer is too small.
* inet/herrno.c: Don't define __h_errno. Only h_errno otherwise the
ELF aliasing creates strange situations.
* sysdeps/unix/sysv/linux/errnos.H: Define __set_errno as inline
function.
* sysdeps/unix/sysv/linux/i386/sysdep.S: Don't define __errno.
* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.
* libio/libio.h: Don't declare _IO_flockfile and _IO_funlockfile
weak.
* locale/programs/charmap.c: Add casts to prevent warnings.
* locale/programs/linereader.h: Likewise.
* locale/programs/ld-collate.c: Likewise.
* locale/programs/stringtrans.c: Likewise.
Change types for various variables to prevent warnings.
* locale/programs/ld-ctype.c: Likewise.
* locale/programs/linereader.h (lr_ungetc): Likewise.
* locale/programs/charset.h (struct charset): Use `unsigned int'
as type for width_default.
* posix/regex.c: Change type of `this_reg' variables.
* stdio-common/Makefile: Use -Wno-format for tstdiomisc.c.
* stdio-common/bug5.c: De-ANSI-fy. Use correct types for
variables.
* stdio-common/printf_fp.c: Initialize to_shift.
* stdio-common/test_rdwr.c: Add cast.
* stdio-common/vfprintf.c: Add casts and use correct types to
prevent warnings.
* stdio-common/vfscanf.c: Initialize str and strptr.
* sysdeps/libm-ieee754/e_jnf.c: Use correct types to prevent warnings.
* sysdeps/libm-ieee754/e_pow.c: Likewise.
* sysdeps/libm-ieee754/e_powf.c: Likewise.
* sysdeps/libm-ieee754/e_rem_pio2f.c: Likewise.
* time/test-tz.c: Likewise.
* manual/creature.texi: Document _REENTRANT and _THREAD_SAFE.
* manual/libc.texinfo: Prevent makeinfo failure by avoiding
libc.cp index. This must be fixed.
* manual/nss.texi: Adapt for correct POSIX.1c interface of
reentrant functions.
* manual/users.texi: Document netgroup functions.
* po/es.po: Updated.
* po/fr.po: Updated.
* posix/fnmatch.c: Change to match libit version.
* posix/unistd.h: Change prototype for ttyname_r to match POSIX.1c.
* sysdep/posix/ttyname_r.c: Likewise.
* stdlib/atexit.h (__new_exitfn): Add internal locking.
* stdlib/exit.c: De-ANSI-fy. Handle new ef_us value for flavor.
* stdlib/exit.h: De-ANSI-fy. Define new ef_us value for flavor.
* stdlib/random.c (__srandom): Add internal locking.
(__initstate): Likewise.
(__setstate): Likewise.
(__random): Likewise.
Mon Oct 28 22:28:37 1996 NIIBE Yutaka <gniibe@mri.co.jp>
* sysdeps/generic/crypt-entry.c (crypt_r): Use __set_errno.
(crypt): Likewise.
* resolv/gethnamaddr.c (gethostbyname2): Likewise.
* sysdeps/generic/uname.c: Likewise.
* sysdeps/posix/rename.c: Likewise.
* sysdeps/stub/setrlimit.c: Likewise.
* nss/nss_db/db-netgrp.c (_nss_db_setnetgrent): Fix typo.
Sun Oct 27 11:12:50 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* locale/programs/ld-collate.c (collate_order_elem): Fix format
string.
(collate_element_to): Cast field width argument to `int' for
format string.
(collate_symbol): Likewise.
(collate_order_elem): Likewise.
(collate_weight_bsymbol): Likewise.
(collate_simple_weight): Likewise.
* locale/programs/ld-time.c (STRARR_ELEM): Fix format string.
* locale/programs/ld-ctype.c (ctype_class_newP): Add missing
argument for format string.
(ctype_map_newP): Likewise.
(set_class_defaults): Fix format string.
* locale/programs/localedef.c (construct_output_path): Putting an
explicit \0 into the format string does not work, use %c.
Sat Oct 26 20:38:36 1996 Richard Henderson <rth@tamu.edu>
* Makerules: Install all shared libraries in $(slibdir).
* login/Makefile: Build libutil.so in others pass after
libc.so is created.
* misc/mntent.h: Include <paths.h> for _PATH_MNTTAB & _PATH_MOUNTED.
* string/stratcliff.c: Allocate 3 pages instead of one, then use
mprotect so that we know that the adjacent pages are inaccessible.
* resource/sys/resource.h: Move all structures and enums to ...
* sysdeps/generic/resourcebits.h: ... here ...
* sysdeps/unix/bsd/sun/sunos4/resourcebits.h: ... and here.
* sysdeps/unix/sysv/linux/alpha/resourcebits.h: Remove.
* sysdeps/unix/sysv/linux/i386/resourcebits.h: Remove.
* sysdeps/unix/sysv/linux/m68k/resourcebits.h: Remove.
* sysdeps/unix/sysv/linux/mips/resourcebits.h: Remove.
* sysdeps/unix/sysv/linux/resourcebits.h: New file. Use kernel
header for RLIMIT_* definitions. The members of struct rlimit
are longs.
Thu Oct 24 17:43:34 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* MakeTAGS (sysdep-dirs): Fix typo.
Wed Oct 23 03:45:22 1996 Ulrich Drepper <drepper@cygnus.com>
* Makefile (headers): Don't mention libc-version.h.
(install-others): ...but here.
Tue Oct 22 21:38:21 1996 Ulrich Drepper <drepper@cygnus.com>
* version.h: Bump version number to 1.97.
@ -449,7 +656,7 @@ Sat Oct 12 23:10:43 1996 Ulrich Drepper <drepper@cygnus.com>
* po/fr.po: Update.
cd * time/strptime.c: Recognize %s, %u, %g, and %G format.
* time/strptime.c: Recognize %s, %u, %g, and %G format.
* posix/getopt.c: Add some more casts and initializations to
prevent warnings.
@ -1039,7 +1246,7 @@ Thu Oct 3 13:33:31 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
Wed Oct 2 13:41:48 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/strtok.c: Don't set stored pointer to NULL when
notheing is found. This guarantees all subsequent calls behave
nothing is found. This guarantees all subsequent calls behave
the same.
* sysdeps/generic/strtok_r.c: Likewise.
@ -1224,7 +1431,7 @@ Mon Sep 30 00:14:26 1996 Ulrich Drepper <drepper@cygnus.com>
Sun Sep 29 12:55:58 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/syscalls.list: Change funciton name for
* sysdeps/unix/sysv/linux/syscalls.list: Change function name for
_llseek to _llseek (not llseek).
Reported by Matthias Urlichs <smurf@smurf.noris.de>.
@ -3792,10 +3999,10 @@ Mon Aug 12 19:03:22 1996 Thomas Bushnell n/BSG <thomas@psilocin.gnu.ai.mit.edu
Mon Aug 12 16:41:52 1996 Thomas Bushnell n/BSG <thomas@gnu.ai.mit.edu>
* io/getwd.c (getwd) [! PATH_MAX]: Don't assume that the user's
buffer is any longer than the amount necessary to hold the
filename; the Hurd getcwd uses the *entire* contents of the
buffer, however long it is specified to be.
* io/getwd.c (getwd) [! PATH_MAX]: Don't assume that the user's
buffer is any longer than the amount necessary to hold the
filename; the Hurd getcwd uses the *entire* contents of the
buffer, however long it is specified to be.
Mon Aug 12 04:33:09 1996 Ulrich Drepper <drepper@cygnus.com>
@ -4662,13 +4869,13 @@ Fri Jul 26 03:46:08 1996 Ulrich Drepper <drepper@cygnus.com>
* stdlib/stdlib.h: Ditto.
* string/string.h: Ditto.
* posix/getconf.c: De-ASNI-fy. Recognize POSIX.2 constant names.
* posix/getconf.c: De-ANSI-fy. Recognize POSIX.2 constant names.
Use `error' function instead of doing it by hand.
* sysdeps/posix/sysconf.c: De-ANSI-fy.
Handle _SC_COLL_WEIGHTS_MAX.
* sysdeps/stub/sysconf.c: Handle _SC_CHARCLASS_NAME_MAX,
_SC_COLL_WEIGHTS_MAX, _SC_EQUIV_CLASS_MAX, _SC_2_LOCALEDEF
since these do depend on the platform.
since these do not depend on the platform.
Add POSIX.4 symbols.
* posix/posix2_lim.h: Add missing definition of

39
FAQ
View File

@ -63,6 +63,11 @@ please let me know.
functions `stat', `lstat', `fstat', and `mknod' and while
linking on my Linux system I get error messages. How is
this supposed to work?''
[Q18] ``The prototypes for `connect', `accept', `getsockopt',
`setsockopt', `getsockname', `getpeername', `send',
`sendto', and `recvfrom' are different in GNU libc than
on any other system I saw. This is a bug, isn't it?''
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q1] ``What systems does the GNU C Library run on?''
@ -75,9 +80,9 @@ The systems glibc is known to work on in the moment and most probably
in the future are:
*-*-gnu GNU Hurd
i[3456]86-*-linux Linux-2.0 on Intel
m68k-*-linux Linux-2.0 on Motorola 680x0
alpha-*-linux Linux-2.0 on DEC Alpha
i[3456]86-*-linux-gnu Linux-2.0 on Intel
m68k-*-linux-gnu Linux-2.0 on Motorola 680x0
alpha-*-linux-gnu Linux-2.0 on DEC Alpha
Other Linux platforms are also on the way to be supported but I need
some success reports first.
@ -159,14 +164,10 @@ Library.
slow.
* plenty of time (approx 1h for i?86-linux on i586@133 or 2.5h on
i486@66 or 4.5h on i486@33).
i486@66 or 4.5h on i486@33). For Hurd systems times are much higher.
If you have some more measurements let me know.
* Some files depend on special tools. E.g., files ending in .gperf
need a `gperf' program. The GNU version (part of libg++) is known
to work while some vendor versions do not.
* When compiling for Linux:
+ the header files of the Linux kernel must be available in the
@ -176,6 +177,8 @@ Library.
need a `gperf' program. The GNU version (part of libg++) is known
to work while some vendor versions do not.
You should not need these tools unless you change the source files.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q7] ``When I run `nm -u libc.so' on the produced library I still
find unresolved symbols? Can this be ok?''
@ -407,7 +410,7 @@ libc binaries from the US.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q15] ``What are these `add-ons'?''
[A15] {UD} To avoid complications with external or external source
[A15] {UD} To avoid complications with export rules or external source
code some optional parts of the libc are distributed as separate
packages (e.g., the crypt package, see Q14).
@ -416,7 +419,7 @@ the package and tell the configuration script about these additional
subdirectories using the --enable-add-ons option. When you add the
crypt add-on you just have to use
configure --enable-add-ons=crypt,XXX ...
configure --enable-add-ons=des-crypt,XXX ...
where XXX are possible other add-ons and ... means the rest of the
normal option list.
@ -551,6 +554,22 @@ link. The linker script with the above contents is placed in
/usr/lib which is enough for the linker.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q18] ``The prototypes for `connect', `accept', `getsockopt',
`setsockopt', `getsockname', `getpeername', `send',
`sendto', and `recvfrom' are different in GNU libc from
any other system I saw. This is a bug, isn't it?''
[A18] {UD} No, this is no bug. This version of the GNU libc already
follows the to-be-released POSIX.1g standard. In this standard
the type `size_t' is used for all parameters which describe a size.
So better change now.
This change is critical for system which have
sizeof (int) != sizeof (size_t)
like the Alpha.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Answers were given by:

View File

@ -39,7 +39,7 @@ tags_sources = $(all-sources) $(all-headers) $(all-dist)
endif # ctype
endif # No tags_sources
sysdep-dirs := $(full-config-subdirs)
sysdep-dirs := $(full-config-sysdirs)
ifndef sysdep_dirs
# Find all sysdep directories.

View File

@ -532,8 +532,10 @@ $(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makeconfig \
eval vers_lib$${lib}=yes; \
number=`echo $$v | sed "s/^.*=//"`; \
case $$number in \
[0-9]*) echo "$$lib.so-version=.$$number";; \
*) echo "$$lib.so-version=$$number";; \
[0-9]*) echo "$$lib.so-version=.$$number"; \
echo "all-sonames+=$$lib.so\$$($$lib.so-version)";;\
*) echo "$$lib.so-version=$$number"; \
echo "all-sonames+=\$$($$lib.so-version)";; \
esac; \
fi; \
done ;; esac; done; \

View File

@ -82,14 +82,14 @@ subdirs := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
$(addprefix install-, no-libc.a bin lib data headers others)
headers := errno.h sys/errno.h errnos.h limits.h values.h \
features.h gnu-versions.h libc-lock.h libc-version.h
features.h gnu-versions.h libc-lock.h
aux = sysdep $(libc-init) version
before-compile = $(objpfx)version-info.h $(objpfx)libc-version.h
before-compile = $(objpfx)version-info.h
echo-headers: subdir_echo-headers
# What to install.
install-others = $(includedir)/stubs.h
install-others = $(includedir)/stubs.h $(includedir)/gnu/lib-names.h
ifeq (yes,$(gnu-ld))
libc-init = set-init
@ -152,36 +152,6 @@ generated += version-info.h
version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
$(version.c-objects): $(objpfx)version-info.h
$(objpfx)libc-version.h: Makefile $(common-objpfx)soversions.mk \
$(common-objpfx)version.mk
nr="$(libc.so-version)"; \
lnr=`echo $(version) | sed 's/[.].*//'`; \
lmnr=`echo $(version) | sed 's/[^.]*[.]//'`; \
if test -n $$nr; then \
nr=`echo $$nr | sed 's/^[.]\([0-9]*\).*/\1/'`; \
else \
nr="$$lnr"; \
fi; \
rm -f $@T; \
(echo '#ifndef __LIBC_VERSION_H'; \
echo '#define __LIBC_VERSION_H 1'; \
echo; \
if test -n "$(libc.so-version)"; then \
echo '/* Show that this is the GNU C Library. The value is the'; \
echo ' interface number of the shared library. */'; \
else \
echo '/* Show that this is the GNU C Library. */'; \
fi; \
echo "#define __GNU_LIBRARY__ $$nr"; \
echo; \
echo '/* Version numbers for GNU libc release. */'; \
echo "#define __GLIBC__ $$lnr"; \
echo "#define __GLIBC_MINOR__ $$lmnr"; \
echo; \
echo '#endif /* libc-version.h */') > $@T
mv -f $@T $@
generated += libc-version.h
# Makerules creates a file `stub-$(subdir)' for each subdirectory, which
# contains `#define __stub_FUNCTION' for each function which is a stub.
# Here we paste all of these together into <stubs.h>.
@ -202,10 +172,32 @@ $(includedir)/stubs.h: subdir_install
echo ' every time called, usually setting errno to ENOSYS. */';\
sort $(subdir-stubs)) > $(objpfx)stubs.h
if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
then echo stubs.h unchanged ; \
then echo 'stubs.h unchanged'; \
else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
rm -f $(objpfx)stubs.h
# Like stubs.h the gnu/lib-names.h header is not used while building the
# libc itself. So we generate it while installing.
$(includedir)/gnu/lib-names.h: $(common-objpfx)soversions.mk
@rm -f $(objpfx)lib-names.h
(echo '/* This file is automatically generated.';\
echo ' It defines macros to allow user program to find the shared';\
echo ' library files which come as part of GNU libc. */';\
echo '#ifndef __GNU_LIB_NAMES_H'; \
echo '#define __GNU_LIB_NAMES_H 1'; \
echo; \
(libs='$(all-sonames)';\
for l in $$libs; do \
upname=`echo $$l | sed 's/[.]so.*//' | tr [:lower:]- [:upper:]_`; \
echo "#define $${upname}_SO $$l"; \
done;) | sort; \
echo; \
echo '#endif /* gnu/lib-names.h */';) > $(objpfx)lib-names.h
if test -r $@ && cmp -s $(objpfx)lib-names.h $@; \
then echo 'gnu/lib-names.h unchanged'; \
else $(INSTALL_DATA) $(objpfx)lib-names.h $@; fi
rm -f $(objpfx)lib-names.h
# This makes the Info or DVI file of the documentation from the Texinfo source.
.PHONY: info dvi
info dvi:

View File

@ -596,11 +596,18 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
$(patsubst %,$(so),$($(so)-version))))
# Install all the unversioned shared libraries.
$(addprefix $(libdir)/,$(filter-out $(versioned),$(install-lib.so))): \
$(libdir)/%.so: $(objpfx)%.so; $(do-install-program)
$(addprefix $(slibdir)/,$(filter-out $(versioned),$(install-lib.so))): \
$(slibdir)/%.so: $(objpfx)%.so; $(do-install-program)
define make-link
cd $(@D); rm -f $(@F).new; $(LN_S) $(<F) $(@F).new; mv -f $(@F).new $(@F)
cd $(@D); \
rm -f $(@F).new; \
if test '$(@D)' = '$(<D)'; then \
$(LN_S) $(<F) $(@F).new; \
else \
$(LN_S) $< $(@F).new; \
fi; \
mv -f $(@F).new $(@F)
endef
ifdef libc.so-version
@ -642,7 +649,7 @@ ifneq (,$(versioned))
# Produce three sets of rules as above for all the smaller versioned libraries.
define o-iterator-doit
$(libdir)/$o: $(libdir)/$o$($o-version); $$(make-link)
$(libdir)/$o: $(slibdir)/$o$($o-version); $$(make-link)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
@ -658,26 +665,26 @@ include $(o-iterator)
ifeq (,$($(subdir)-version))
define o-iterator-doit
$(libdir)/$o$($o-version): $(libdir)/$(o:.so=)-$(version).so; $$(make-link)
$(slibdir)/$o$($o-version): $(slibdir)/$(o:.so=)-$(version).so; $$(make-link)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
define o-iterator-doit
$(libdir)/$(o:.so=)-$(version).so: $(objpfx)$o; $$(do-install-program)
$(slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o; $$(do-install-program)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
else
define o-iterator-doit
$(libdir)/$o$($o-version): $(libdir)/$(o:.so=)-$($(subdir)-version).so;
$(slibdir)/$o$($o-version): $(slibdir)/$(o:.so=)-$($(subdir)-version).so;
$$(make-link)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
define o-iterator-doit
$(libdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o;
$(slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o;
$$(do-install-program)
endef
object-suffixes-left := $(versioned)
@ -693,10 +700,10 @@ endef
so-versions := $(sort $(foreach so,$(install-lib.so),.so$($(so)-version)))
$(foreach v,$(so-versions),\
$(libdir)/lib$(libprefix)%$v): $(common-objpfx)lib%.so
$(slibdir)/lib$(libprefix)%$v): $(common-objpfx)lib%.so
$(do-install-so)
$(foreach v,$(so-versions),\
$(libdir)/$(libprefix)%$v): $(common-objpfx)%.so
$(slibdir)/$(libprefix)%$v): $(common-objpfx)%.so
$(do-install-so)
endif

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.2 DIAGNOSTICS <assert.h>
* ISO C Standard: 4.2 DIAGNOSTICS <assert.h>
*/
#ifdef _ASSERT_H

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard 4.3: CHARACTER HANDLING <ctype.h>
* ISO C Standard 4.3: CHARACTER HANDLING <ctype.h>
*/
#ifndef _CTYPE_H
@ -65,7 +65,7 @@ enum
These point into arrays of 384, so they can be indexed by any `unsigned
char' value [0,255]; by EOF (-1); or by any `signed char' value
[-128,-1). ANSI requires that the ctype functions work for `unsigned
[-128,-1). ISO C requires that the ctype functions work for `unsigned
char' values and for EOF; we also support negative `signed char' values
for broken old programs. The case conversion arrays are of `int's
rather than `unsigned char's because tolower (EOF) must be EOF, which

View File

@ -7,7 +7,7 @@ main (int argc, char *argv[])
{
DIR * dirp;
long save3;
long int save3 = 0;
int i = 0;
struct dirent *dp;

View File

@ -1,25 +1,26 @@
/* dlfcn.h -- User functions for run-time dynamic loading.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Copyright (C) 1995, 1996 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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _DLFCN_H
#define _DLFCN_H 1
#define _DLFCN_H 1
#include <features.h>
/* The MODE argument to `dlopen' contains one of the following: */
#define RTLD_LAZY 0x001 /* Lazy function call binding. */
@ -33,30 +34,30 @@ Cambridge, MA 02139, USA. */
/* Open the shared object FILE and map it in; return a handle that can be
passed to `dlsym' to get symbol values from it. */
extern void *dlopen (const char *__file, int __mode);
extern void *dlopen __P ((__const char *__file, int __mode));
/* Unmap and close a shared object opened by `dlopen'.
The handle cannot be used again after calling `dlclose'. */
extern int dlclose (void *__handle);
extern int dlclose __P ((void *__handle));
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME. */
extern void *dlsym (void *__handle, const char *__name);
extern void *dlsym __P ((void *__handle, __const char *__name));
/* When any of the above functions fails, call this function
to return a string describing the error. Each call resets
the error string so that a following call returns null. */
extern char *dlerror (void);
extern char *dlerror __P ((void));
/* Fill in *INFO with the following information about ADDRESS.
Returns 0 iff no shared object's segments contain that address. */
typedef struct
{
const char *dli_fname; /* File name of defining object. */
__const char *dli_fname; /* File name of defining object. */
void *dli_fbase; /* Load address of that object. */
const char *dli_sname; /* Name of nearest symbol. */
__const char *dli_sname; /* Name of nearest symbol. */
void *dli_saddr; /* Exact value of nearest symbol. */
} Dl_info;
extern int dladdr (void *__address, Dl_info *__info);
extern int dladdr __P ((void *__address, Dl_info *__info));
#endif /* dlfcn.h */

View File

@ -285,9 +285,7 @@ of this helper program; chances are you did not intend to run this program.\n",
if (mode == verify)
/* We were called just to verify that this is a dynamic executable
using us as the program interpreter. */
_exit ((strcmp (_dl_rtld_map.l_libname, _dl_rtld_map.l_name) ||
l->l_ld == NULL)
? EXIT_FAILURE : EXIT_SUCCESS);
_exit (l->l_ld == NULL ? EXIT_FAILURE : EXIT_SUCCESS);
/* Extract the contents of the dynamic section for easy access. */
elf_get_dynamic_info (l->l_ld, l->l_info);

28
errno.h
View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.1.3 Errors <errno.h>
* ISO C Standard: 4.1.3 Errors <errno.h>
*/
#ifndef _ERRNO_H

View File

@ -144,8 +144,19 @@ Cambridge, MA 02139, USA. */
#endif
/* Include header with information of libc version numbers. */
#include <libc-version.h>
/* This macro indicates that the installed library is the GNU C Library.
For historic reasons the value now is 6 and this will stay from now
on. The use of this variable is deprecated. Use __GLIBC__ and
__GLIBC_MINOR__ now (see below) when you want to test for a specific
GNU C library version and use the values in <gnu/lib-names.h> to get
the sonames of the shared libraries. */
#undef __GNU_LIBRARY__
#define __GNU_LIBRARY__ 6
/* Major and minor version number of the GNU C library package. Use
these macros to test for features in specific releases. */
#define __GLIBC__ 2
#define __GLIBC_MINOR__ 0
#if !defined (__GNUC__) || __GNUC__ < 2

View File

@ -25,7 +25,11 @@ struct group *
fgetgrent (FILE *stream)
{
static char buffer[BUFSIZ];
static struct group result;
static struct group resbuf;
struct group *result;
return __fgetgrent_r (stream, &result, buffer, sizeof buffer);
if (__fgetgrent_r (stream, &resbuf, buffer, sizeof buffer, &result) != 0)
return NULL;
return result;
}

View File

@ -42,8 +42,9 @@ LINE_PARSER
/* Read one entry from the given stream. */
struct group *
__fgetgrent_r (FILE *stream, struct group *result, char *buffer, int buflen)
int
__fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
struct group **result)
{
char *p;
@ -51,7 +52,10 @@ __fgetgrent_r (FILE *stream, struct group *result, char *buffer, int buflen)
{
p = fgets (buffer, buflen, stream);
if (p == NULL)
return NULL;
{
*result = NULL;
return errno;
}
/* Skip leading blanks. */
while (isspace (*p))
@ -59,8 +63,9 @@ __fgetgrent_r (FILE *stream, struct group *result, char *buffer, int buflen)
} while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */
! parse_line (p, result, (void *) buffer, buflen));
! parse_line (p, resbuf, (void *) buffer, buflen));
return result;
*result = resbuf;
return 0;
}
weak_alias (__fgetgrent_r, fgetgrent_r)

View File

@ -51,7 +51,7 @@ 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));
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));
@ -76,7 +76,7 @@ extern struct group *getgrent __P ((void));
#ifdef __USE_SVID
/* Read a group entry from STREAM. */
extern struct group *fgetgrent __P ((FILE * __stream));
extern struct group *fgetgrent __P ((FILE *__stream));
#endif
/* Search for an entry with a matching group ID. */
@ -96,28 +96,28 @@ extern struct group *getgrnam __P ((__const char *__name));
may change in later versions of this library. */
#if defined(__USE_SVID) || defined(__USE_MISC) || defined (__USE_BSD)
extern struct group *getgrent_r __P ((struct group *__resultbuf,
char *buffer, int __buflen));
extern int getgrent_r __P ((struct group *__resultbuf, char *buffer,
size_t __buflen, struct group **__result));
#endif
/* Search for an entry with a matching group ID. */
extern struct group *getgrgid_r __P ((__gid_t __gid,
struct group *__resultbuf,
char *buffer, int __buflen));
extern int getgrgid_r __P ((__gid_t __gid, struct group *__resultbuf,
char *buffer, size_t __buflen,
struct group **__result));
/* Search for an entry with a matching group name. */
extern struct group *getgrnam_r __P ((__const char *__name,
struct group *__resultbuf,
char *buffer, int __buflen));
extern int getgrnam_r __P ((__const char *__name, struct group *__resultbuf,
char *buffer, size_t __buflen,
struct group **__result));
#ifdef __USE_SVID
/* Read a group entry from STREAM. */
extern struct group *__fgetgrent_r __P ((FILE * __stream,
struct group *__resultbuf,
char *buffer, int __buflen));
extern struct group *fgetgrent_r __P ((FILE * __stream,
struct group *__resultbuf,
char *buffer, int __buflen));
extern int __fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
char *buffer, size_t __buflen,
struct group **__result));
extern int fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf,
char *buffer, size_t __buflen,
struct group **__result));
#endif
#endif /* reentrant */
@ -129,12 +129,12 @@ extern struct group *fgetgrent_r __P ((FILE * __stream,
#include <stddef.h>
/* Set the group set for the current user to GROUPS (N of them). */
extern int setgroups __P ((size_t __n, __const __gid_t * groups));
extern int setgroups __P ((size_t __n, __const __gid_t *__groups));
/* Initialize the group set for the current user
by reading the group database and using all groups
of which USER is a member. Also include GROUP. */
extern int initgroups __P ((__const char *user, __gid_t group));
extern int initgroups __P ((__const char *__user, __gid_t __group));
#endif /* Use BSD. */

View File

@ -10,7 +10,7 @@ main (int argc, char *argv[])
{
uid_t me;
struct passwd *my_passwd;
struct group *my_group;
struct group *my_group = NULL;
char **members;
me = getuid ();

View File

@ -113,7 +113,7 @@ internal_setnetgrent (const char *group)
/* Add the current group to the list of known groups. */
new_elem = (struct name_list *) malloc (sizeof (struct name_list));
if (new_elem == NULL || (new_elem->name = strdup (group)) == NULL)
if (new_elem == NULL || (new_elem->name = __strdup (group)) == NULL)
{
if (new_elem != NULL)
free (new_elem);
@ -178,7 +178,7 @@ endnetgrent (void)
int
__getnetgrent_r (char **hostp, char **userp, char **domainp,
char *buffer, int buflen)
char *buffer, size_t buflen)
{
enum nss_status (*fct) (struct __netgrent *, char *, int);
struct __netgrent result;
@ -230,7 +230,7 @@ __getnetgrent_r (char **hostp, char **userp, char **domainp,
namep = (struct name_list *) malloc (sizeof (struct name_list));
if (namep == NULL
|| (namep->name = strdup (result.val.group)) == NULL)
|| (namep->name = __strdup (result.val.group)) == NULL)
{
/* We are out of memory. */
if (namep != NULL)
@ -315,7 +315,7 @@ innetgr (const char *netgroup, const char *host, const char *user,
namep =
(struct name_list *) malloc (sizeof (*namep));
if (namep == NULL
|| ((namep->name = strdup (entry.val.group))
|| ((namep->name = __strdup (entry.val.group))
== NULL))
{
/* Out of memory, simply return. */

View File

@ -20,15 +20,12 @@ Boston, MA 02111-1307, USA. */
/* We need to have the error status variable of the resolver
accessible in the libc. */
int __h_errno = 0;
strong_alias (__h_errno, h_errno)
int h_errno = 0;
/* When threaded, h_errno may be a per-process variable. */
#ifdef __USE_REENTRANT
int *
weak_const_function
__h_errno_location (void)
{
return &__h_errno;
return &h_errno;
}
#endif

View File

@ -278,10 +278,7 @@ extern void _IO_flockfile __P ((_IO_FILE *));
extern void _IO_funlockfile __P ((_IO_FILE *));
extern int _IO_ftrylockfile __P ((_IO_FILE *));
#ifdef _IO_MTSAFE_IO
weak_extern (_IO_flockfile)
weak_extern (_IO_funlockfile)
#else
#ifndef _IO_MTSAFE_IO
# define _IO_flockfile(_fp) /**/
# define _IO_funlockfile(_fp) /**/
# define _IO_ftrylockfile(_fp) /**/

View File

@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
* ISO C Standard: 4.9 INPUT/OUTPUT <stdio.h>
*/
#ifndef _STDIO_H

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
* ISO C Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
*/
#include <features.h>

View File

@ -238,9 +238,9 @@ parse_charmap (const char *filename)
continue;
}
if ((nowtok == tok_mb_cur_max && result->mb_cur_min != 0
&& arg->val.num < result->mb_cur_min)
&& (int) arg->val.num < result->mb_cur_min)
|| (nowtok == tok_mb_cur_min && result->mb_cur_max != 0
&& arg->val.num > result->mb_cur_max))
&& (int) arg->val.num > result->mb_cur_max))
{
lr_error (cmfile, _("\
value of <mb_cur_max> must be greater than the value of <mb_cur_min>"));
@ -612,7 +612,7 @@ new_width (struct linereader *cmfile, struct charset_t *result,
unsigned int from_val, to_val;
from_val = charset_find_value (result, from, strlen (from));
if (from_val == ILLEGAL_CHAR_VALUE)
if ((wchar_t) from_val == ILLEGAL_CHAR_VALUE)
{
lr_error (cmfile, _("unknown character `%s'"), from);
return;
@ -623,7 +623,7 @@ new_width (struct linereader *cmfile, struct charset_t *result,
else
{
to_val = charset_find_value (result, to, strlen (to));
if (to_val == ILLEGAL_CHAR_VALUE)
if ((wchar_t) to_val == ILLEGAL_CHAR_VALUE)
{
lr_error (cmfile, _("unknown character `%s'"), to);
return;

View File

@ -43,7 +43,7 @@ struct charset_t
struct width_rule *width_rules;
size_t nwidth_rules;
size_t nwidth_rules_max;
int width_default;
unsigned int width_default;
struct obstack mem_pool;
hash_table char_table;

View File

@ -98,8 +98,8 @@ struct locale_collate_t
hash_table result;
/* Sorting rules given in order_start line. */
int nrules;
int nrules_max;
u_int32_t nrules;
u_int32_t nrules_max;
enum coll_sort_rule *rules;
/* Used while recognizing symbol composed of multiple tokens
@ -122,10 +122,10 @@ struct locale_collate_t
/* While collecting the weigths we need some temporary space. */
unsigned int current_order;
int *weight_cnt;
int weight_idx;
unsigned int weight_idx;
unsigned int *weight;
int nweight;
int nweight_max;
size_t nweight;
size_t nweight_max;
/* Patch lists. */
patch_t *current_patch;
@ -241,7 +241,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
if (value == 0)
error_at_line (0, 0, patch->fname, patch->lineno,
_("no weight defined for symbol `%s'"), patch->token);
_("no weight defined for symbol `%s'"), patch->token);
else
*patch->where.pos = value;
}
@ -482,7 +482,8 @@ Computing table size for collation information might take a while..."),
ADD_VALUE (collate->undefined.ordering[cnt]); \
for (disp = 0; disp < collate->undefined.ordering[cnt]; ++disp) \
{ \
if (collate->undefined.ordering[idx] == ELLIPSIS_CHAR) \
if ((wchar_t) collate->undefined.ordering[idx] \
== ELLIPSIS_CHAR) \
ADD_VALUE ((pelem)->name[0]); \
else \
ADD_VALUE (collate->undefined.ordering[idx++]); \
@ -540,7 +541,7 @@ Computing table size for collation information might take a while..."),
size_t inner;
for (inner = 0; inner < collate->nrules; ++inner)
if (collate->undefined.ordering[collate->nrules + inner]
if ((wchar_t)collate->undefined.ordering[collate->nrules + inner]
== ELLIPSIS_CHAR)
table[cnt * entry_size + 1 + inner] = cnt;
else
@ -1049,11 +1050,11 @@ collate_element_to (struct linereader *lr, struct localedef_t *locale,
}
value = charset_find_value (charset, code->val.str.start, code->val.str.len);
if (value != ILLEGAL_CHAR_VALUE)
if ((wchar_t) value != ILLEGAL_CHAR_VALUE)
{
lr_error (lr, _("symbol for multicharacter collating element "
"`%.*s' duplicates symbolic name in charset"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
return;
}
@ -1062,7 +1063,7 @@ collate_element_to (struct linereader *lr, struct localedef_t *locale,
{
lr_error (lr, _("symbol for multicharacter collating element "
"`%.*s' duplicates other element definition"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
return;
}
@ -1071,7 +1072,7 @@ collate_element_to (struct linereader *lr, struct localedef_t *locale,
{
lr_error (lr, _("symbol for multicharacter collating element "
"`%.*s' duplicates symbol definition"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
return;
}
@ -1180,7 +1181,7 @@ collate_symbol (struct linereader *lr, struct localedef_t *locale,
{
lr_error (lr, _("symbol for multicharacter collating element "
"`%.*s' duplicates symbolic name in charset"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
return;
}
@ -1189,7 +1190,7 @@ collate_symbol (struct linereader *lr, struct localedef_t *locale,
{
lr_error (lr, _("symbol for multicharacter collating element "
"`%.*s' duplicates element definition"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
return;
}
@ -1198,7 +1199,7 @@ collate_symbol (struct linereader *lr, struct localedef_t *locale,
{
lr_error (lr, _("symbol for multicharacter collating element "
"`%.*s' duplicates other symbol definition"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
return;
}
@ -1256,7 +1257,7 @@ collate_order_elem (struct linereader *lr, struct localedef_t *locale,
int result = 0;
wchar_t value;
void *tmp;
int i;
unsigned int i;
switch (code->tok)
{
@ -1284,7 +1285,7 @@ collate_order_elem (struct linereader *lr, struct localedef_t *locale,
if (lastp->name[0] == value && lastp->name[1] == L'\0')
{
lr_error (lr, _("duplicate definition for character `%.*s'"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
lr_ignore_rest (lr, 0);
result = -1;
break;
@ -1311,7 +1312,7 @@ collate_order_elem (struct linereader *lr, struct localedef_t *locale,
(void *) collate->current_element) < 0)
{
lr_error (lr, _("cannot insert collation element `%.*s'"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
exit (4);
}
}
@ -1344,8 +1345,8 @@ collation element `%.*s' appears more than once: ignore line"),
if ((unsigned long int) tmp != 0ul)
{
lr_error (lr, _("\
collation symbol `.*s' appears more than once: ignore line"),
code->val.str.len, code->val.str.start);
collation symbol `%.*s' appears more than once: ignore line"),
(int) code->val.str.len, code->val.str.start);
lr_ignore_rest (lr, 0);
result = -1;
break;
@ -1364,7 +1365,7 @@ collation symbol `.*s' appears more than once: ignore line"),
{
if (verbose)
lr_error (lr, _("unknown symbol `%.*s': line ignored"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
lr_ignore_rest (lr, 0);
result = -1;
@ -1454,7 +1455,7 @@ line after ellipsis must contain character definition"));
data[collate->nrules + cnt] = collate->weight[cnt];
for (cnt = 0; cnt < collate->nrules; ++cnt)
if (data[ptr[cnt]] != ELLIPSIS_CHAR)
if ((wchar_t) data[ptr[cnt]] != ELLIPSIS_CHAR)
ptr[cnt] = 0;
while (name[0] <= value)
@ -1555,7 +1556,7 @@ collate_weight_bsymbol (struct linereader *lr, struct localedef_t *locale,
{
if (verbose)
lr_error (lr, _("unknown symbol `%.*s': line ignored"),
code->val.str.len, code->val.str.start);
(int) code->val.str.len, code->val.str.start);
lr_ignore_rest (lr, 0);
return -1;
}
@ -1729,7 +1730,7 @@ collate_simple_weight (struct linereader *lr, struct localedef_t *locale,
{
if (verbose)
lr_error (lr, _("unknown symbol `%.*s': line ignored"),
putp - startp, startp);
(int) (putp - startp), startp);
lr_ignore_rest (lr, 0);
return -1;
}
@ -1741,8 +1742,8 @@ collate_simple_weight (struct linereader *lr, struct localedef_t *locale,
if (*runp == lr->escape_char)
{
static char digits[] = "0123456789abcdef";
char *dp;
static const char digits[] = "0123456789abcdef";
const char *dp;
int base;
++runp;

View File

@ -75,7 +75,7 @@ struct locale_ctype_t
/* We will allow up to 8 * sizeof(u_int32_t) - 1 character classes. */
#define MAX_NR_CHARCLASS (8 * sizeof (u_int32_t) - 1)
int nr_charclass;
size_t nr_charclass;
const char *classnames[MAX_NR_CHARCLASS];
unsigned long int current_class_mask;
unsigned int last_class_char;
@ -306,7 +306,7 @@ character %s'%s' in class `%s' must not be in class `%s'"),
/* ... and now test <SP> as a special case. */
space_value = charset_find_value (charset, "SP", 2);
if (space_value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("character <SP> not defined in character map"));
else if ((cnt = BITPOS (tok_space),
(ELEM (ctype, class_collection, , space_value)
@ -537,7 +537,7 @@ int
ctype_is_charclass (struct linereader *lr, struct localedef_t *locale,
const char *name)
{
int cnt;
size_t cnt;
for (cnt = 0; cnt < locale->categories[LC_CTYPE].ctype->nr_charclass; ++cnt)
if (strcmp (name, locale->categories[LC_CTYPE].ctype->classnames[cnt])
@ -554,7 +554,7 @@ ctype_class_start (struct linereader *lr, struct localedef_t *locale,
struct charset_t *charset)
{
struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype;
int cnt;
size_t cnt;
switch (tok)
{
@ -625,7 +625,7 @@ ctype_class_from (struct linereader *lr, struct localedef_t *locale,
ctype->last_class_char = value;
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
/* In the LC_CTYPE category it is no error when a character is
not found. This has to be ignored silently. */
return;
@ -737,7 +737,7 @@ ctype_map_from (struct linereader *lr, struct localedef_t *locale,
value = charset_find_value (charset, code->val.str.start, code->val.str.len);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
/* In the LC_CTYPE category it is no error when a character is
not found. This has to be ignored silently. */
return;
@ -757,8 +757,8 @@ ctype_map_to (struct linereader *lr, struct localedef_t *locale,
value = charset_find_value (charset, code->val.str.start, code->val.str.len);
if (ctype->from_map_char == ILLEGAL_CHAR_VALUE
|| value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) ctype->from_map_char == ILLEGAL_CHAR_VALUE
|| (wchar_t) value == ILLEGAL_CHAR_VALUE)
{
/* In the LC_CTYPE category it is no error when a character is
not found. This has to be ignored silently. */
@ -790,7 +790,7 @@ static void
ctype_class_newP (struct linereader *lr, struct locale_ctype_t *ctype,
const char *name)
{
int cnt;
size_t cnt;
for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
if (strcmp (ctype->classnames[cnt], name) == 0)
@ -798,7 +798,7 @@ ctype_class_newP (struct linereader *lr, struct locale_ctype_t *ctype,
if (cnt < ctype->nr_charclass)
{
lr_error (lr, _("character class `%s' already defined"));
lr_error (lr, _("character class `%s' already defined"), name);
return;
}
@ -817,7 +817,7 @@ ctype_map_newP (struct linereader *lr, struct locale_ctype_t *ctype,
const char *name, struct charset_t *charset)
{
size_t max_chars = 0;
int cnt;
size_t cnt;
for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
{
@ -830,7 +830,7 @@ ctype_map_newP (struct linereader *lr, struct locale_ctype_t *ctype,
if (cnt < ctype->map_collection_nr)
{
lr_error (lr, _("character map `%s' already defined"));
lr_error (lr, _("character map `%s' already defined"), name);
return;
}
@ -934,7 +934,7 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset)
tmp[0] = ch;
value = charset_find_value (charset, tmp, 1);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
error (0, 0, _("\
character `%s' not defined while needed as default value"),
@ -998,7 +998,7 @@ character `%s' not defined while needed as default value"),
unsigned int value;
value = charset_find_value (charset, "space", 5);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<space>");
@ -1006,7 +1006,7 @@ character `%s' not defined while needed as default value"),
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "form-feed", 9);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<form-feed>");
@ -1014,7 +1014,7 @@ character `%s' not defined while needed as default value"),
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "newline", 7);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<newline>");
@ -1022,7 +1022,7 @@ character `%s' not defined while needed as default value"),
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "carriage-return", 15);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<carriage-return>");
@ -1030,7 +1030,7 @@ character `%s' not defined while needed as default value"),
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "tab", 3);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<tab>");
@ -1038,7 +1038,7 @@ character `%s' not defined while needed as default value"),
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "vertical-tab", 12);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<vertical-tab>");
@ -1064,7 +1064,7 @@ character `%s' not defined while needed as default value"),
unsigned int value;
value = charset_find_value (charset, "space", 5);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<space>");
@ -1072,7 +1072,7 @@ character `%s' not defined while needed as default value"),
ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
value = charset_find_value (charset, "tab", 3);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<tab>");
@ -1103,7 +1103,7 @@ character `%s' not defined while needed as default value"),
unsigned long int mask = BIT (tok_upper) | BIT (tok_lower) |
BIT (tok_alpha) | BIT (tok_digit) | BIT (tok_xdigit) | BIT (tok_punct);
size_t cnt;
int space;
wchar_t space;
for (cnt = 0; cnt < ctype->class_collection_act; ++cnt)
if ((ctype->class_collection[cnt] & mask) != 0)
@ -1136,10 +1136,10 @@ character `%s' not defined while needed as default value"),
tmp[1] = (char) ch;
value_from = charset_find_value (charset, &tmp[1], 1);
if (value_from == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE)
{
error (0, 0, _("\
character `%c' not defined while needed as default value"),
character `%s' not defined while needed as default value"),
tmp);
continue;
}
@ -1147,7 +1147,7 @@ character `%c' not defined while needed as default value"),
/* This conversion is implementation defined. */
tmp[1] = (char) (ch + ('A' - 'a'));
value_to = charset_find_value (charset, &tmp[1], 1);
if (value_to == -1)
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE)
{
error (0, 0, _("\
character `%s' not defined while needed as default value"),

View File

@ -672,7 +672,7 @@ time_add (struct linereader *lr, struct localedef_t *locale,
case tok_##cat: \
if (time->cur_num_##cat >= max) \
lr_error (lr, _("\
too many values for field `%s' in category `LC_TIME'"), \
too many values for field `%s' in category `%s'"), \
#cat, "LC_TIME"); \
else if (code->val.str.start == NULL) \
{ \

View File

@ -279,7 +279,7 @@ get_toplvl_escape (struct linereader *lr)
}
if ((base == 16 && !isxdigit (ch))
|| (base != 16 && (ch < '0' || ch >= '0' + base)))
|| (base != 16 && (ch < '0' || ch >= (int) ('0' + base))))
{
esc_error:
lr->token.val.str.start = &lr->buf[start_idx];
@ -299,7 +299,7 @@ get_toplvl_escape (struct linereader *lr)
ch = lr_getc (lr);
if ((base == 16 && !isxdigit (ch))
|| (base != 16 && (ch < '0' || ch >= '0' + base)))
|| (base != 16 && (ch < '0' || ch >= (int) ('0' + base))))
goto esc_error;
byte *= base;
@ -521,7 +521,7 @@ get_string (struct linereader *lr, const struct charset_t *charset)
{
value = charset_find_value (charset, &buf[startidx],
bufact - startidx);
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
illegal_string = 1;
bufact = startidx;

View File

@ -117,7 +117,7 @@ lr_ungetc (struct linereader *lr, int ch)
static inline int
lr_ungetn (struct linereader *lr, int n)
lr_ungetn (struct linereader *lr, size_t n)
{
if (lr->idx < n)
return -1;

View File

@ -463,10 +463,10 @@ construct_output_path (char *path)
the end of the function we need another byte for the trailing
'/'. */
if (normal == NULL)
asprintf (&result, "%s/%s\0", LOCALE_PATH, path);
asprintf (&result, "%s/%s%c", LOCALE_PATH, path, '\0');
else
asprintf (&result, "%s/%.*s%s%s\0", LOCALE_PATH, startp - path, path,
normal, endp);
asprintf (&result, "%s/%.*s%s%s%c", LOCALE_PATH, startp - path, path,
normal, endp, '\0');
}
else
{

View File

@ -93,7 +93,7 @@ translate_string (char *str, struct charset_t *charset)
}
value = charset_find_value (charset, str + 1, tp - (str + 1));
if (value == ILLEGAL_CHAR_VALUE)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
free (buf);
return NULL;

View File

@ -30,6 +30,8 @@ routines := setutent endutent getutent getutid getutline pututline \
# Build the -lutil library with these extra functions.
extra-libs := libutil
extra-libs-others := $(extra-libs)
libutil-routines:= login login_tty logout logwtmp pty

View File

@ -93,6 +93,20 @@ compiler or linker. @strong{Note:} If you forget to do this, you may
get very strange errors at run time.
@end defvr
@comment (none)
@comment GNU
@defvr Macro _REENTRANT,_THREAD_SAFE
If you define this macro, reentrant versions of several functions get
declared. Some of the functions is specified in POSIX.1c but many others
are only available on a few other systems or are unique to GNU libc.
The problem is that the standardization of the thread safe C library
interface still is behind.
Unlike on some other systems no special version of the C library must be
used for linking. There is only one version but while compiling this
it must have been specified to compile as thread safe.
@end defvr
We recommend you use @code{_GNU_SOURCE} in new programs. If you don't
specify the @samp{-ansi} option to GCC and don't define any of these macros
explicitly, the effect is the same as defining @code{_GNU_SOURCE}.

View File

@ -57,7 +57,7 @@ Foundation.
@sp 2
@center Sandra Loosemore
@center with
@center Richard M. Stallman, Roland McGrath, and Andrew Oram
@center Richard M. Stallman, Roland McGrath, Andrew Oram, and Ulrich Drepper
@sp 3
@center Edition @value{EDITION}
@sp 1
@ -988,7 +988,12 @@ Porting the GNU C Library
@node Concept Index, Type Index, Copying, Top
@unnumbered Concept Index
@printindex cp
@comment Could somebody with better texinfo knowledge look into this?
@comment When I comment out the following line I get
@comment Misplaced `{'.
@comment Misplaced `}'.
@comment This happens even if the libc.cp file is empty.
@comment @printindex cp
@node Type Index, Function Index, Concept Index, Top
@unnumbered Type Index

View File

@ -57,6 +57,7 @@ The databases available in the NSS are
@cindex ethers
@cindex group
@cindex hosts
@cindex netgroup
@cindex network
@cindex protocols
@cindex passwd
@ -71,6 +72,8 @@ Ethernet numbers,
Groups of users, @pxref{Group Database}.
@item hosts
Host names and numbers, @pxref{Host Names}.
@item netgroup
Network wide list of host and users, @pxref{Netgroup Database}.
@item network
Network names and numbers, @pxref{Networks Database}.
@item protocols
@ -89,8 +92,7 @@ Shadow user passwords,
@noindent
There will be some more added later (@code{aliases}, @code{automount},
@code{bootparams}, @code{netgroup}, @code{netmasks}, and
@code{publickey}).
@code{bootparams}, @code{netmasks}, and @code{publickey}).
@node NSS Configuration File, NSS Module Internals, NSS Basics, Name Service Switch
@section The NSS Configuration File
@ -122,7 +124,7 @@ the reaction on lookup result line @code{[NOTFOUND=return]}.
@end itemize
@menu
* Services in the NSS configuration:: Service names in the NSS configuratin.
* Services in the NSS configuration:: Service names in the NSS configuration.
* Actions in the NSS configuration:: React approprite on the lookup result.
* Notes on NSS Configuration File:: Things to take care about while
configuring NSS.
@ -256,6 +258,20 @@ all supported databases there is a default value so it should normally
be possible to get the system running even if the file is corrupted or
missing.
@cindex default value, and NSS
For the @code{hosts} and @code{network} databases the default value is
@code{dns [!UNAVAIL=return] files}. I.e., the system is prepared for
the DNS service not to be available but if it is available the answer it
returns is ultimative.
For all other databases the default value is
@code{compat [NOTFOUND=return] files}. This solution give the best
chance to be correct since NIS and file based lookup is used. The
@code{compat} service is available in a separate add-on to GNU C
library, available in the same place you got the GNU C library source
from.
@cindex optimizing NSS
A second point is that the user should try to optimize the lookup
process. The different service have different response times. A simple
file look up on a local file could be fast, but if the file is long and the
@ -365,17 +381,19 @@ struct hostent *gethostbyname_r (const char *name,
@end smallexample
@noindent
The actual prototype of the function is the NSS modules in this case is
The actual prototype of the function in the NSS modules in this case is
@smallexample
int _nss_files_gethostbyname_r (const char *name,
struct hostent *result_buf, char *buf,
int buflen, int *h_errnop)
enum nss_status _nss_files_gethostbyname_r (const char *name,
struct hostent *result_buf,
char *buf, int buflen,
int *h_errnop)
@end smallexample
I.e., the interface function is in fact the reentrant function with
the change of the return value. While the user-level function returns a
pointer to the result the reentrant function return an @code{int} value:
I.e., the interface function is in fact the reentrant function with the
change of the return value. While the user-level function returns a
pointer to the result the reentrant function return an @code{enum
nss_status} value:
@cindex NSS_STATUS_TRYAGAIN
@cindex NSS_STATUS_UNAVAIL
@ -399,7 +417,12 @@ numeric value @code{1}
Now you see where the action items of the @file{/etc/nsswitch.conf} file
are used.
The above function has somthing special which is missing for almost all
If you study the source code you will find there is a fifth value:
@code{NSS_STATUS_RETURN}. This is an internal use only value, used by a
few functions in places where none of the above value can be used. If
necessary the source code should be examined to learn about the details.
The above function has something special which is missing for almost all
the other module functions. There is an argument @var{h_errnop}. This
points to a variable which will be filled with the error code in case
the execution of the function fails for some reason. The reentrant

View File

@ -1,4 +1,4 @@
@node Users and Groups, System Information, Name Service Switch, Top
@node Users and Groups
@chapter Users and Groups
Every user who can log in on the system is identified by a unique number
@ -46,11 +46,12 @@ can use to examine these databases.
accessing the user database.
* Group Database:: Functions and data structures for
accessing the group database.
* Netgroup Database:: Functions for accessing the netgroup database.
* Database Example:: Example program showing use of database
inquiry functions.
@end menu
@node User and Group IDs
@node User and Group IDs, Process Persona, Users and Groups, Users and Groups
@section User and Group IDs
@cindex login name
@ -71,7 +72,7 @@ not accessible to users who are not a member of that group. Each group
has a @dfn{group name} and @dfn{group ID}. @xref{Group Database},
for how to find information about a group ID or group name.
@node Process Persona
@node Process Persona, Why Change Persona, User and Group IDs, Users and Groups
@section The Persona of a Process
@cindex persona
@cindex effective user ID
@ -113,7 +114,7 @@ its permission to access files, see @ref{Access Permission}.
The user ID of a process also controls permissions for sending signals
using the @code{kill} function. @xref{Signaling Another Process}.
@node Why Change Persona
@node Why Change Persona, How Change Persona, Process Persona, Users and Groups
@section Why Change the Persona of a Process?
The most obvious situation where it is necessary for a process to change
@ -145,7 +146,7 @@ the game program wants to update this file, it can change its effective
user ID to be that for @code{games}. In effect, the program must
adopt the persona of @code{games} so it can write the scores file.
@node How Change Persona
@node How Change Persona, Reading Persona, Why Change Persona, Users and Groups
@section How an Application Can Change Persona
@cindex @code{setuid} programs
@ -176,7 +177,7 @@ when they are not needed, which makes for more robustness.
@c !!! talk about _POSIX_SAVED_IDS
@node Reading Persona
@node Reading Persona, Setting User ID, How Change Persona, Users and Groups
@section Reading the Persona of a Process
Here are detailed descriptions of the functions for reading the user and
@ -261,7 +262,7 @@ read_all_groups (void)
@end smallexample
@end deftypefun
@node Setting User ID
@node Setting User ID, Setting Groups, Reading Persona, Users and Groups
@section Setting the User ID
This section describes the functions for altering the user ID (real
@ -324,7 +325,7 @@ have permission to change to the specified ID.
@end table
@end deftypefun
@node Setting Groups
@node Setting Groups, Enable/Disable Setuid, Setting User ID, Users and Groups
@section Setting the Group IDs
This section describes the functions for altering the group IDs (real
@ -399,7 +400,7 @@ the user name @var{user}. The group ID @var{gid} is also included.
@c groups USER is a member of.
@end deftypefun
@node Enable/Disable Setuid
@node Enable/Disable Setuid, Setuid Program Example, Setting Groups, Users and Groups
@section Enabling and Disabling Setuid Access
A typical setuid program does not need its special access all of the
@ -465,7 +466,7 @@ feature with a preprocessor conditional, like this:
#endif
@end smallexample
@node Setuid Program Example
@node Setuid Program Example, Tips for Setuid, Enable/Disable Setuid, Users and Groups
@section Setuid Program Example
Here's an example showing how to set up a program that changes its
@ -605,7 +606,7 @@ record_score (int score)
@end group
@end smallexample
@node Tips for Setuid
@node Tips for Setuid, Who Logged In, Setuid Program Example, Users and Groups
@section Tips for Writing Setuid Programs
It is easy for setuid programs to give the user access that isn't
@ -649,7 +650,7 @@ would ordinarily have permission to access those files. You can use the
uses the real user and group IDs, rather than the effective IDs.
@end itemize
@node Who Logged In
@node Who Logged In, User Database, Tips for Setuid, Users and Groups
@section Identifying Who Logged In
@cindex login name, determining
@cindex user ID, determining
@ -703,7 +704,7 @@ For most purposes, it is more useful to use the environment variable
precisely because the user can set @code{LOGNAME} arbitrarily.
@xref{Standard Environment}.
@node User Database
@node User Database, Group Database, Who Logged In, Users and Groups
@section User Database
@cindex user database
@cindex password database
@ -721,7 +722,7 @@ network server gives access to it.
* Writing a User Entry:: How a program can rewrite a user's record.
@end menu
@node User Data Structure
@node User Data Structure, Lookup User, User Database, User Database
@subsection The Data Structure that Describes a User
The functions and data structures for accessing the system user database
@ -762,7 +763,7 @@ be used.
@end table
@end deftp
@node Lookup User
@node Lookup User, Scanning All Users, User Data Structure, User Database
@subsection Looking Up One User
@cindex converting user ID to user name
@cindex converting user name to user ID
@ -782,6 +783,27 @@ A null pointer value indicates there is no user in the data base with
user ID @var{uid}.
@end deftypefun
@comment pwd.h
@comment POSIX.1c
@deftypefun int getpwuid_r (uid_t @var{uid}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
This function is similar to @code{getpwuid} in that is returns
information about the user whose user ID is @var{uid}. But the result
is not placed in a static buffer. Instead the user supplied structure
pointed to by @var{result_buf} is filled with the information. The
first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure.
If the return value is @code{0} the pointer returned in @var{result}
points to the record which contains the wanted data (i.e., @var{result}
contains the value @var{result_buf}). In case the return value is non
null there is no user in the data base with user ID @var{uid} or the
buffer @var{buffer} is too small to contain all the needed information.
In the later case the global @var{errno} variable is set to
@code{ERANGE}.
@end deftypefun
@comment pwd.h
@comment POSIX.1
@deftypefun {struct passwd *} getpwnam (const char *@var{name})
@ -793,7 +815,28 @@ This structure may be overwritten on subsequent calls to
A null pointer value indicates there is no user named @var{name}.
@end deftypefun
@node Scanning All Users
@comment pwd.h
@comment POSIX.1c
@deftypefun int getpwnam_r (const char *@var{name}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
This function is similar to @code{getpwnam} in that is returns
information about the user whose user name is @var{name}. But the result
is not placed in a static buffer. Instead the user supplied structure
pointed to by @var{result_buf} is filled with the information. The
first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure.
If the return value is @code{0} the pointer returned in @var{result}
points to the record which contains the wanted data (i.e., @var{result}
contains the value @var{result_buf}). In case the return value is non
null there is no user in the data base with user name @var{name} or the
buffer @var{buffer} is too small to contain all the needed information.
In the later case the global @var{errno} variable is set to
@code{ERANGE}.
@end deftypefun
@node Scanning All Users, Writing a User Entry, Lookup User, User Database
@subsection Scanning the List of All Users
@cindex scanning the user list
@ -816,14 +859,33 @@ This stream must correspond to a file in the same format as the standard
password database file. This function comes from System V.
@end deftypefun
@comment pwd.h
@comment GNU
@deftypefun int fgetpwent_r (FILE *@var{stream}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
This function is similar to @code{fgetpwent} in that it reads the next
user entry from @var{stream}. But the result is returned in the
structure pointed to by @var{result_buf}. The
first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure.
This stream must correspond to a file in the same format as the standard
password database file.
If the funciton returns null @var{result} points to the structure with
the wanted data (normally this is in @var{result_buf}). If errors
occured the return value is non-null and @var{result} contains a null
pointer.
@end deftypefun
The way to scan all the entries in the user database is with
@code{setpwent}, @code{getpwent}, and @code{endpwent}.
@comment pwd.h
@comment SVID, BSD
@deftypefun void setpwent (void)
This function initializes a stream which @code{getpwent} uses to read
the user database.
This function initializes a stream which @code{getpwent} and
@code{getpwent_r} use to read the user database.
@end deftypefun
@comment pwd.h
@ -834,15 +896,35 @@ initialized by @code{setpwent}. It returns a pointer to the entry. The
structure is statically allocated and is rewritten on subsequent calls
to @code{getpwent}. You must copy the contents of the structure if you
wish to save the information.
A null pointer is returned in case no further entry is available.
@end deftypefun
@comment pwd.h
@comment GNU
@deftypefun int getpwent_r (struct passwd *@var{result_buf}, char *@var{buffer}, int @var{buflen}, struct passwd **@var{result})
This function is similar to @code{getpwent} in that it returns the next
entry from the stream initialized by @code{setpwent}. But in contrast
to the @code{getpwent} function this function is reentrant since the
result is placed in the user supplied structure pointed to by
@var{result_buf}. Additional data, normally the strings pointed to by
the elements of the result structure, are placed in the additional
buffer or length @var{buflen} starting at @var{buffer}.
If the function returns null @var{result} points to the structure with
the wanted data (normally this is in @var{result_buf}). If errors
occured the return value is non-null and @var{result} contains a null
pointer.
@end deftypefun
@comment pwd.h
@comment SVID, BSD
@deftypefun void endpwent (void)
This function closes the internal stream used by @code{getpwent}.
This function closes the internal stream used by @code{getpwent} or
@code{getpwent_r}.
@end deftypefun
@node Writing a User Entry
@node Writing a User Entry, , Scanning All Users, User Database
@subsection Writing a User Entry
@comment pwd.h
@ -862,7 +944,7 @@ would inevitably leave out much of the important information.
The function @code{putpwent} is declared in @file{pwd.h}.
@end deftypefun
@node Group Database
@node Group Database, Netgroup Database, User Database, Users and Groups
@section Group Database
@cindex group database
@pindex /etc/group
@ -878,7 +960,7 @@ service provides access to it.
* Scanning All Groups:: Scanning the list of all groups.
@end menu
@node Group Data Structure
@node Group Data Structure, Lookup Group, Group Database, Group Database
@subsection The Data Structure for a Group
The functions and data structures for accessing the system group
@ -905,7 +987,7 @@ null pointer.
@end table
@end deftp
@node Lookup Group
@node Lookup Group, Scanning All Groups, Group Data Structure, Group Database
@subsection Looking Up One Group
@cindex converting group name to group ID
@cindex converting group ID to group name
@ -925,6 +1007,26 @@ This structure may be overwritten by subsequent calls to
A null pointer indicates there is no group with ID @var{gid}.
@end deftypefun
@comment grp.h
@comment POSIX.1c
@deftypefun int getgrgid_r (gid_t @var{gid}, struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
This function is similar to @code{getgrgid} in that is returns
information about the group whose group ID is @var{gid}. But the result
is not placed in a static buffer. Instead the user supplied structure
pointed to by @var{result_buf} is filled with the information. The
first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure.
If the return value is @code{0} the pointer returned in @var{result}
points to the record which contains the wanted data (i.e., @var{result}
contains the value @var{result_buf}). In case the return value is non
null there is no group in the data base with group ID @var{gid} or the
buffer @var{buffer} is too small to contain all the needed information.
In the later case the global @var{errno} variable is set to
@code{ERANGE}.
@end deftypefun
@comment grp.h
@comment SVID, BSD
@deftypefun {struct group *} getgrnam (const char *@var{name})
@ -936,7 +1038,27 @@ This structure may be overwritten by subsequent calls to
A null pointer indicates there is no group named @var{name}.
@end deftypefun
@node Scanning All Groups
@comment grp.h
@comment POSIX.1c
@deftypefun int getgrnam_r (const char *@var{name}, struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
This function is similar to @code{getgrnam} in that is returns
information about the group whose group name is @var{name}. But the result
is not placed in a static buffer. Instead the user supplied structure
pointed to by @var{result_buf} is filled with the information. The
first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure.
If the return value is @code{0} the pointer returned in @var{result}
points to the record which contains the wanted data (i.e., @var{result}
contains the value @var{result_buf}). In case the return value is non
null there is no group in the data base with group name @var{name} or the
buffer @var{buffer} is too small to contain all the needed information.
In the later case the global @var{errno} variable is set to
@code{ERANGE}.
@end deftypefun
@node Scanning All Groups, , Lookup Group, Group Database
@subsection Scanning the List of All Groups
@cindex scanning the group list
@ -960,6 +1082,25 @@ The stream must correspond to a file in the same format as the standard
group database file.
@end deftypefun
@comment grp.h
@comment GNU
@deftypefun int fgetgrent_r (FILE *@var{stream}, struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
This function is similar to @code{fgetgrent} in that it reads the next
user entry from @var{stream}. But the result is returned in the
structure pointed to by @var{result_buf}. The
first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure.
This stream must correspond to a file in the same format as the standard
group database file.
If the funciton returns null @var{result} points to the structure with
the wanted data (normally this is in @var{result_buf}). If errors
occured the return value is non-null and @var{result} contains a null
pointer.
@end deftypefun
The way to scan all the entries in the group database is with
@code{setgrent}, @code{getgrent}, and @code{endgrent}.
@ -967,7 +1108,7 @@ The way to scan all the entries in the group database is with
@comment SVID, BSD
@deftypefun void setgrent (void)
This function initializes a stream for reading from the group data base.
You use this stream by calling @code{getgrent}.
You use this stream by calling @code{getgrent} or @code{getgrent_r}.
@end deftypefun
@comment grp.h
@ -981,12 +1122,177 @@ wish to save the information.
@end deftypefun
@comment grp.h
@comment SVID, BSD
@deftypefun void endgrent (void)
This function closes the internal stream used by @code{getgrent}.
@comment GNU
@deftypefun int getgrent_r (struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
This function is similar to @code{getgrent} in that it returns the next
entry from the stream initialized by @code{setgrent}. But in contrast
to the @code{getgrent} function this function is reentrant since the
result is placed in the user supplied structure pointed to by
@var{result_buf}. Additional data, normally the strings pointed to by
the elements of the result structure, are placed in the additional
buffer or length @var{buflen} starting at @var{buffer}.
If the function returns null @var{result} points to the structure with
the wanted data (normally this is in @var{result_buf}). If errors
occured the return value is non-null and @var{result} contains a null
pointer.
@end deftypefun
@node Database Example
@comment grp.h
@comment SVID, BSD
@deftypefun void endgrent (void)
This function closes the internal stream used by @code{getgrent} or
@code{getgrent_r}.
@end deftypefun
@node Netgroup Database, Database Example, Group Database, Users and Groups
@section Netgroup Database
@menu
* Netgroup Data:: Data in the Netgroup database and where
it comes from.
* Lookup Netgroup:: How to look for a particular netgroup.
* Netgroup Membership:: How to test for netgroup membership.
@end menu
@node Netgroup Data, Lookup Netgroup, Netgroup Database, Netgroup Database
@subsection Netgroup Data
@cindex{Netgroup}
Sometimes it is useful group users according to other criterias like the
ones used in the @xref{Group Database}. E.g., it is useful to associate
a certain group of users with a certain machine. On the other hand
grouping of host names is not supported so far.
In Sun Microsystems SunOS appeared a new kind of database, the netgroup
database. It allows to group hosts, users, and domain freely, giving
them individual names. More concrete: a netgroup is a list of triples
consisting of a host name, a user name, and a domain name, where any of
the entries can be a wildcard entry, matching all inputs. A last
possibility is that names of other netgroups can also be given in the
list specifying a netgroup. So one can construct arbitrary hierachies
without loops.
Sun's implementation allows netgroups only for the @code{nis} or
@code{nisplus} service @pxref{Services in the NSS configuration}. The
implementation in the GNU C library has no such restriction. An entry
in either of the input services must have the following form:
@smallexample
@var{groupname} ( @var{groupname} | @code{(}@var{hostname}@code{,}@var{username}@code{,}@code{domainname}@code{)} )+
@end smallexample
Any of the fields in the triple can be empty which means anything
matches. While describing te functions we will see that the opposite
case is useful as well. I.e., there shall be entries which will not
match any input. For entries like a name consisting of the single
character @code{-} shall be used.
@node Lookup Netgroup, Netgroup Membership, Netgroup Data, Netgroup Database
@subsection Looking up one Netgroup
The lookup functions for netgroups are a bit different to all other
system database handling functions. Since a single netgroup can contain
many entries a two-step process is needed. First a single netgroup is
selected and then one can iterate over all entries in this netgroup.
These functions are declared in @file{netdb.h}.
@comment netdb.h
@deftypefun int setnetgrent (const char *@var{netgroup})
A call to this function initializes the internal state of the library to
allow following calls of the @code{getnetgrent} iterate over all entries
in the netgroup with name @var{netgroup}.
When the call is successful (i.e., when a netgroup with this name exist)
the return value is @code{1}. When the return value is @code{0} no
netgroup of this name is known or some other error occured.
@end deftypefun
It is important to remember that there is only one single state for
iterating the netgroups. Even if the programmer uses the
@code{getnetgrent_r} function the result is not really reentrant since
always only one single netgroup at a time can be processed. If the
program needs to process more than one netgroup simultaneously she
must protect this by using external locking. This problem was
introduced in the original netgroups implementation in SunOS and since
we must stay compatible it is not possible to change this.
Some other functions also use the netgroups state. Currently these are
the @code{innetgr} function and parts of the implementation of the
@code{compat} service part of the NSS implementation.
@comment netdb.h
@deftypefun int getnetgrent (char **@var{hostp}, char **@var{userp}, char **@var{domainp})
This function returns the next unprocessed entry of the currently
selected netgroup. The string pointers, which addresses are passed in
the arguments @var{hostp}, @var{userp}, and @var{domainp}, will contain
after a successful call pointers to appropriate strings. If the string
in the next entry is empty the pointer has the value @code{NULL}.
The returned string pointers are only valid unless no of the netgroup
related functions are called.
The return value is @code{1} if the next entry was successfully read. A
value of @code{0} means no further entry exist or internal errors occured.
@end deftypefun
@comment netdb.h
@deftypefun int getnetgrent_r (char **@var{hostp}, char **@var{userp}, char **@var{domainp}, char *@var{buffer}, int @var{buflen})
This function is similar to @code{getnetgrent} with only one exception:
the strings the three string pointers @var{hostp}, @var{userp}, and
@var{domainp} point to, are placed in the buffer of @var{buflen} bytes
starting at @var{buffer}. This means the returned values are valid
even after other netgroup related functions are called.
The return value is @code{1} if the next entry was successfully read and
the buffer contains enough room to place the strings in it. @code{0} is
returned in case no more entries are found, the buffer is too small, or
internal errors occured.
This function is a GNU extension. The original implementation in the
SunOS libc does not provide this function.
@end deftypefun
@comment netdb.h
@deftypefun void endnetgrent (void)
This function free all buffers which were allocated to process the last
selected netgroup. As a result all string pointers returned by calls
to @code{getnetgrent} are invalid afterwards.
@end deftypefun
@node Netgroup Membership, , Lookup Netgroup, Netgroup Database
@subsection Testing for Netgroup Membership
It is often not necessary to scan the whole netgroup since often the
only interesting question is whether a given entry is part of the
selected netgroup.
@comment netdb.h
@deftypefun int innetgr (const char *@var{netgroup}, const char *@var{host}, const char *@var{user}, const char *@var{domain})
This function tests whether the triple specified by the parameters
@var{hostp}, @var{userp}, and @var{domainp} is part of the netgroup
@var{netgroup}. Using this function has the advantage that
@enumerate
@item
no other netgroup function can use the global netgroup state since
internal locking is used and
@item
the function is implemented more efficiently than successive calls
to the other @code{set}/@code{get}/@code{endnetgrent} functions.
@end enumerate
Any of the pointers @var{hostp}, @var{userp}, and @var{domainp} can be
@code{NULL} which means any value is excepted in this position. This is
also true for the name @code{-} which should not match any other string
otherwise.
The return value is @code{1} if an entry matching the given triple is
found in the netgroup. The return value is @code{0} is the netgroup
itself is not found, the netgroup does not contain the triple or
internal errors occured.
@end deftypefun
@node Database Example, , Netgroup Database, Users and Groups
@section User and Group Database Example
Here is an example program showing the use of the system database inquiry

View File

@ -1,24 +1,24 @@
/* Declarations for math functions.
Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Copyright (C) 1991, 92, 93, 95, 96 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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.5 MATHEMATICS <math.h>
* ISO C Standard: 4.5 MATHEMATICS <math.h>
*/
#ifndef _MATH_H

View File

@ -1,21 +1,21 @@
/* err.h --- 4.4BSD utility functions for error messages.
Copyright (C) 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
/* err.h -- 4.4BSD utility functions for error messages.
Copyright (C) 1995, 1996 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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _ERR_H_
#define _ERR_H_ 1
@ -30,25 +30,25 @@ Cambridge, MA 02139, USA. */
__BEGIN_DECLS
/* Print FORMAT on stderr. */
extern void warn __P ((const char *__format, ...))
extern void warn __P ((__const char *__format, ...))
__attribute__ ((format (printf, 1, 2)));
extern void vwarn __P ((const char *__format, __gnuc_va_list))
extern void vwarn __P ((__const char *__format, __gnuc_va_list))
__attribute__ ((format (printf, 1, 0)));
/* Print "program: ", and FORMAT, and a newline, on stderr. */
extern void warnx __P ((const char *__format, ...))
extern void warnx __P ((__const char *__format, ...))
__attribute__ ((format (printf, 1, 2)));
extern void vwarnx __P ((const char *__format, __gnuc_va_list))
extern void vwarnx __P ((__const char *__format, __gnuc_va_list))
__attribute__ ((format (printf, 1, 0)));
/* Likewise, and then exit with STATUS. */
extern void err __P ((int __status, const char *__format, ...))
extern void err __P ((int __status, __const char *__format, ...))
__attribute__ ((noreturn, format (printf, 2, 3)));
extern void verr __P ((int __status, const char *__format, __gnuc_va_list))
extern void verr __P ((int __status, __const char *__format, __gnuc_va_list))
__attribute__ ((noreturn, format (printf, 2, 0)));
extern void errx __P ((int __status, const char *__format, ...))
extern void errx __P ((int __status, __const char *__format, ...))
__attribute__ ((noreturn, format (printf, 2, 3)));
extern void verrx __P ((int __status, const char *, __gnuc_va_list))
extern void verrx __P ((int __status, __const char *, __gnuc_va_list))
__attribute__ ((noreturn, format (printf, 2, 0)));
__END_DECLS

View File

@ -23,6 +23,7 @@ Cambridge, MA 02139, USA. */
#include <features.h>
#define __need_FILE
#include <stdio.h>
#include <paths.h>
/* File listing canonical interesting mount points. */

View File

@ -60,16 +60,21 @@ Boston, MA 02111-1307, USA. */
/* Prototype for reentrant version we use here. */
extern LOOKUP_TYPE *INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *result,
char *buffer, int buflen
H_ERRNO_PARM);
extern int INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf,
char *buffer, size_t buflen,
LOOKUP_TYPE **result H_ERRNO_PARM);
LOOKUP_TYPE *
FUNCTION_NAME (ADD_PARAMS)
{
static LOOKUP_TYPE result;
static char buffer[BUFLEN];
static LOOKUP_TYPE resbuf;
LOOKUP_TYPE *result;
return INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &result, buffer,
BUFLEN H_ERRNO_VAR);
if (INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
BUFLEN, &result H_ERRNO_VAR) != 0)
/* Error occured. */
return NULL;
return result;
}

View File

@ -82,9 +82,9 @@ extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp);
LOOKUP_TYPE *
INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *result, char *buffer,
int buflen H_ERRNO_PARM)
int
INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM)
{
static service_user *startp = NULL;
static lookup_function start_fct;
@ -122,13 +122,14 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *result, char *buffer,
while (no_more == 0)
{
status = (*fct) (ADD_VARIABLES, result, buffer, buflen H_ERRNO_VAR);
status = (*fct) (ADD_VARIABLES, resbuf, buffer, buflen H_ERRNO_VAR);
no_more = __nss_next (&nip, REENTRANT_NAME_STRING,
(void **) &fct, status, 0);
}
return status == NSS_STATUS_SUCCESS ? result : NULL;
*result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
return status == NSS_STATUS_SUCCESS ? 0 : -1;
}
#define do_weak_alias(n1, n2) weak_alias ((n1), (n2))

View File

@ -51,15 +51,22 @@ Boston, MA 02111-1307, USA. */
#endif
/* Prototype of the reentrant version. */
LOOKUP_TYPE *INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *result, char *buffer,
int buflen H_ERRNO_PARM);
extern int INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer,
size_t buflen, LOOKUP_TYPE **result
H_ERRNO_PARM);
LOOKUP_TYPE *
GETFUNC_NAME (void)
{
static char buffer[BUFLEN];
static LOOKUP_TYPE result;
static LOOKUP_TYPE resbuf;
LOOKUP_TYPE *result;
return INTERNAL (REENTRANT_GETNAME) (&result, buffer, BUFLEN H_ERRNO_VAR);
if (INTERNAL (REENTRANT_GETNAME) (&resbuf, buffer, BUFLEN, &result
H_ERRNO_VAR) != 0)
/* Errors occured. */
return NULL;
return result;
}

View File

@ -187,9 +187,9 @@ ENDFUNC_NAME (void)
}
LOOKUP_TYPE *
INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *result, char *buffer, int buflen
H_ERRNO_PARM)
int
INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
LOOKUP_TYPE **result H_ERRNO_PARM)
{
get_function fct;
int no_more;
@ -214,7 +214,7 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *result, char *buffer, int buflen
no_more = setup ((void **) &fct, GETFUNC_NAME_STRING, 0);
while (! no_more)
{
status = (*fct) (result, buffer, buflen H_ERRNO_VAR);
status = (*fct) (resbuf, buffer, buflen H_ERRNO_VAR);
no_more = __nss_next (&nip, GETFUNC_NAME_STRING, (void **) &fct,
status, 0);
@ -222,7 +222,8 @@ INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *result, char *buffer, int buflen
__libc_lock_unlock (lock);
return status == NSS_STATUS_SUCCESS ? result : NULL;
*result = NSS_STATUS_SUCCESS ? resbuf : NULL;
return status == NSS_STATUS_SUCCESS ? 0 : -1;
}
#define do_weak_alias(n1, n2) weak_alias (n1, n2)
do_weak_alias (INTERNAL (REENTRANT_GETNAME), REENTRANT_GETNAME)

View File

@ -52,7 +52,7 @@ _nss_db_setnetgrent (const char *group)
db = dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
if (db == NULL)
status = errno = EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
}
if (status == NSS_STATUS_SUCCESS)

2355
po/es.po

File diff suppressed because it is too large Load Diff

917
po/fr.po

File diff suppressed because it is too large Load Diff

View File

@ -15,13 +15,13 @@ License along with this library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Enable GNU extensions in fnmatch.h. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
# define _GNU_SOURCE 1
#endif
#include <errno.h>
@ -40,9 +40,18 @@ Cambridge, MA 02139, USA. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#ifndef errno
# if defined (STDC_HEADERS) || !defined (isascii)
# define ISASCII(c) 1
# else
# define ISASCII(c) isascii(c)
# endif
# define ISUPPER(c) (ISASCII (c) && isupper (c))
# ifndef errno
extern int errno;
#endif
# endif
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
@ -56,7 +65,7 @@ fnmatch (pattern, string, flags)
register char c;
/* Note that this evalutes C many times. */
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
while ((c = *p++) != '\0')
{
@ -225,6 +234,8 @@ fnmatch (pattern, string, flags)
return 0;
return FNM_NOMATCH;
# undef FOLD
}
#endif /* _LIBC or not __GNU_LIBRARY__. */

View File

@ -1144,7 +1144,7 @@ typedef struct
char *destination; \
/* Must be int, so when we don't save any registers, the arithmetic \
of 0 + -1 isn't done as unsigned. */ \
int this_reg; \
unsigned this_reg; \
\
DEBUG_STATEMENT (failure_id++); \
DEBUG_STATEMENT (nfailure_points_pushed++); \
@ -1257,7 +1257,7 @@ typedef struct
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
{ \
DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
int this_reg; \
unsigned this_reg; \
const unsigned char *string_temp; \
\
assert (!FAIL_STACK_EMPTY ()); \
@ -5436,7 +5436,8 @@ regerror (errcode, preg, errbuf, errbuf_size)
size_t msg_size;
if (errcode < 0
|| errcode >= (sizeof (re_error_msgid) / sizeof (re_error_msgid[0])))
|| errcode >= (int) (sizeof (re_error_msgid)
/ sizeof (re_error_msgid[0])))
/* Only error codes returned by the rest of the code should be passed
to this routine. If we are given anything else, or if other regex
code generates an invalid error code, then the program has a bug.

View File

@ -513,8 +513,8 @@ extern char *ttyname __P ((int __fd));
#ifdef __USE_REENTRANT
/* Store at most BUFLEN characters of the pathname of the terminal FD is
open on in BUF. Return 0 on success, -1 otherwise. */
extern int __ttyname_r __P ((int __fd, char *__buf, int __buflen));
extern int ttyname_r __P ((int __fd, char *__buf, int __buflen));
extern int __ttyname_r __P ((int __fd, char *__buf, size_t __buflen));
extern int ttyname_r __P ((int __fd, char *__buf, size_t __buflen));
#endif
/* Return 1 if FD is a valid descriptor associated

View File

@ -25,7 +25,11 @@ struct passwd *
fgetpwent (FILE *stream)
{
static char buffer[BUFSIZ];
static struct passwd result;
static struct passwd resbuf;
struct passwd *result;
return __fgetpwent_r (stream, &result, buffer, sizeof buffer);
if (__fgetpwent_r (stream, &resbuf, buffer, sizeof buffer, &result) != 0)
return NULL;
return result;
}

View File

@ -49,8 +49,9 @@ LINE_PARSER
/* Read one entry from the given stream. */
struct passwd *
__fgetpwent_r (FILE *stream, struct passwd *result, char *buffer, int buflen)
int
__fgetpwent_r (FILE *stream, struct passwd *resbuf, char *buffer,
size_t buflen, struct passwd **result)
{
char *p;
@ -58,7 +59,10 @@ __fgetpwent_r (FILE *stream, struct passwd *result, char *buffer, int buflen)
{
p = fgets (buffer, buflen, stream);
if (p == NULL)
return NULL;
{
*result = NULL;
return errno;
}
/* Skip leading blanks. */
while (isspace (*p))
@ -66,8 +70,9 @@ __fgetpwent_r (FILE *stream, struct passwd *result, char *buffer, int buflen)
} while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */
! parse_line (p, result, (void *) buffer, buflen));
! parse_line (p, resbuf, (void *) buffer, buflen));
return result;
*result = resbuf;
return 0;
}
weak_alias (__fgetpwent_r, fgetpwent_r)

View File

@ -54,7 +54,7 @@ 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));
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));
@ -80,10 +80,10 @@ extern struct passwd *getpwent __P ((void));
#ifdef __USE_SVID
/* Read an entry from STREAM. */
extern struct passwd *fgetpwent __P ((FILE * __stream));
extern struct passwd *fgetpwent __P ((FILE *__stream));
/* Write the given entry onto the given stream. */
extern int putpwent __P ((__const struct passwd * __p, FILE * __f));
extern int putpwent __P ((__const struct passwd *__p, FILE *__f));
#endif
/* Search for an entry with a matching user ID. */
@ -103,35 +103,35 @@ extern struct passwd *getpwnam __P ((__const char *__name));
may change in later versions of this library. */
#if defined(__USE_SVID) || defined(__USE_MISC)
extern struct passwd *__getpwent_r __P ((struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern struct passwd *getpwent_r __P ((struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern int __getpwent_r __P ((struct passwd *__resultbuf, char *__buffer,
size_t __buflen, struct passwd **__result));
extern int getpwent_r __P ((struct passwd *__resultbuf, char *__buffer,
size_t __buflen, struct passwd **__result));
#endif
extern struct passwd *__getpwuid_r __P ((__uid_t __uid,
struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern struct passwd *getpwuid_r __P ((__uid_t __uid,
struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern int __getpwuid_r __P ((__uid_t __uid, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
extern int getpwuid_r __P ((__uid_t __uid, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
extern struct passwd *__getpwnam_r __P ((__const char *__name,
struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern struct passwd *getpwnam_r __P ((__const char *__name,
struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern int __getpwnam_r __P ((__const char *__name, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
extern int getpwnam_r __P ((__const char *__name, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
#ifdef __USE_SVID
/* Read an entry from STREAM. */
extern struct passwd *__fgetpwent_r __P ((FILE * __stream,
struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern struct passwd *fgetpwent_r __P ((FILE * __stream,
struct passwd *__resultbuf,
char *__buffer, int __buflen));
extern int __fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
extern int fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf,
char *__buffer, size_t __buflen,
struct passwd **__result));
#endif
#endif /* reentrant */

View File

@ -455,7 +455,7 @@ gethostbyname2(name, af)
break;
default:
__set_h_errno (NETDB_INTERNAL);
errno = EAFNOSUPPORT;
__set_errno (EAFNOSUPPORT);
return (NULL);
}

View File

@ -28,6 +28,8 @@
/* This is necessary to make this include file properly replace the
Sun version. */
#include <rpc/netdb.h>
#define __need_size_t
#include <stddef.h>
/* Absolute file name for network data base files. */
#define _PATH_HEQUIV "/etc/hosts.equiv"
@ -43,23 +45,30 @@ __BEGIN_DECLS
/* Error status for non-reentrant lookup functions. */
extern int h_errno;
#if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
/* Function to access thread specific `h_errno' variable. */
/* Function to get address of global `h_errno' variable. */
extern int *__h_errno_location __P ((void)) __attribute__ ((__const__));
/* An alias name for above variable. */
extern int __h_errno;
/* Use a macro to access always the thread specific `h_errno' variable. */
#define h_errno (*__h_errno_location ())
#ifdef _LIBC
/* Retain some binary compatibility with old libraries by having both the
global variable and the per-thread variable set on error. */
#define __set_h_errno(x) (h_errno = __h_errno = (x))
#else
#define __set_h_errno(x) (h_errno = (x))
# ifdef _LIBC_REENTRANT
static inline int
__set_h_errno (int __err)
{
return *__h_errno_location () = h_errno = __err;
}
# else
# define __set_h_errno(x) (h_errno = (x))
# endif /* _LIBC_REENTRANT */
#endif /* _LIBC */
#if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
/* Use a macro to access always the thread specific `h_errno' variable. */
# define h_errno (*__h_errno_location ())
#endif
/* Possible values left in `h_errno'. */
#define NETDB_INTERNAL -1 /* See errno. */
#define NETDB_SUCCESS 0 /* No problem. */
@ -122,41 +131,39 @@ extern struct hostent *gethostbyname2 __P ((__const char *__name, int __af));
argument is a pointer to a variable which gets the value which
would be stored in the global variable `herrno' by the
non-reentrant functions. */
extern struct hostent *__gethostent_r __P ((struct hostent *__result_buf,
char *__buf, int __buf_len,
int *__h_errnop));
extern struct hostent *gethostent_r __P ((struct hostent *__result_buf,
char *__buf, int __buf_len,
int *__h_errnop));
extern int __gethostent_r __P ((struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern int gethostent_r __P ((struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern struct hostent *__gethostbyaddr_r __P ((__const char *__addr, int __len,
int __type,
struct hostent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern struct hostent *gethostbyaddr_r __P ((__const char *__addr, int __len,
int __type,
struct hostent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern int __gethostbyaddr_r __P ((__const char *__addr, int __len, int __type,
struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern int gethostbyaddr_r __P ((__const char *__addr, int __len, int __type,
struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern struct hostent *__gethostbyname_r __P ((__const char *__name,
struct hostent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern struct hostent *gethostbyname_r __P ((__const char *__name,
struct hostent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern int __gethostbyname_r __P ((__const char *__name,
struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern int gethostbyname_r __P ((__const char *__name,
struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern struct hostent *__gethostbyname2_r __P ((__const char *__name, int __af,
struct hostent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern struct hostent *gethostbyname2_r __P ((__const char *__name, int __af,
struct hostent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern int __gethostbyname2_r __P ((__const char *__name, int __af,
struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
extern int gethostbyname2_r __P ((__const char *__name, int __af,
struct hostent *__result_buf, char *__buf,
size_t __buflen, struct hostent **__result,
int *__h_errnop));
#endif /* reentrant */
@ -196,32 +203,30 @@ extern struct netent *getnetbyname __P ((__const char *__name));
argument is a pointer to a variable which gets the value which
would be stored in the global variable `herrno' by the
non-reentrant functions. */
extern struct netent *__getnetent_r __P ((struct netent *__result_buf,
char *__buf, int __buf_len,
int *__h_errnop));
extern struct netent *getnetent_r __P ((struct netent *__result_buf,
char *__buf, int __buf_len,
int *__h_errnop));
extern int __getnetent_r __P ((struct netent *__result_buf, char *__buf,
size_t __buflen, struct netent **__result,
int *__h_errnop));
extern int getnetent_r __P ((struct netent *__result_buf, char *__buf,
size_t __buflen, struct netent **__result,
int *__h_errnop));
extern struct netent *__getnetbyaddr_r __P ((unsigned long int __net,
int __type,
struct netent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern struct netent *getnetbyaddr_r __P ((unsigned long int __net,
int __type,
struct netent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern int __getnetbyaddr_r __P ((unsigned long int __net, int __type,
struct netent *__result_buf, char *__buf,
size_t __buflen, struct netent **__result,
int *__h_errnop));
extern int getnetbyaddr_r __P ((unsigned long int __net, int __type,
struct netent *__result_buf, char *__buf,
size_t __buflen, struct netent **__result,
int *__h_errnop));
extern struct netent *__getnetbyname_r __P ((__const char *__name,
struct netent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern struct netent *getnetbyname_r __P ((__const char *__name,
struct netent *__result_buf,
char *__buf, int __buflen,
int *__h_errnop));
extern int __getnetbyname_r __P ((__const char *__name,
struct netent *__result_buf, char *__buf,
size_t __buflen, struct netent **__result,
int *__h_errnop));
extern int getnetbyname_r __P ((__const char *__name,
struct netent *__result_buf, char *__buf,
size_t __buflen, struct netent **__result,
int *__h_errnop));
#endif /* reentrant */
@ -258,27 +263,26 @@ extern struct servent *getservbyport __P ((int __port, __const char *__proto));
#ifdef __USE_REENTRANT
/* Reentrant versions of the functions above. The additional
arguments specify a buffer of BUFLEN starting at BUF. */
extern struct servent *__getservent_r __P ((struct servent *__result_buf,
char *__buf, int __buf_len));
extern struct servent *getservent_r __P ((struct servent *__result_buf,
char *__buf, int __buf_len));
extern int __getservent_r __P ((struct servent *__result_buf, char *__buf,
size_t __buflen, struct servent **__result));
extern int getservent_r __P ((struct servent *__result_buf, char *__buf,
size_t __buflen, struct servent **__result));
extern struct servent *__getservbyname_r __P ((__const char *__name,
__const char *__proto,
struct servent *__result_buf,
char *__buf, int __buflen));
extern struct servent *getservbyname_r __P ((__const char *__name,
__const char *__proto,
struct servent *__result_buf,
char *__buf, int __buflen));
extern int __getservbyname_r __P ((__const char *__name, __const char *__proto,
struct servent *__result_buf, char *__buf,
size_t __buflen,
struct servent **__result));
extern int getservbyname_r __P ((__const char *__name, __const char *__proto,
struct servent *__result_buf, char *__buf,
size_t __buflen, struct servent **__result));
extern struct servent *__getservbyport_r __P ((int __port,
__const char *__proto,
struct servent *__result_buf,
char *__buf, int __buflen));
extern struct servent *getservbyport_r __P ((int __port, __const char *__proto,
struct servent *__result_buf,
char *__buf, int __buflen));
extern int __getservbyport_r __P ((int __port, __const char *__proto,
struct servent *__result_buf, char *__buf,
size_t __buflen,
struct servent **__result));
extern int getservbyport_r __P ((int __port, __const char *__proto,
struct servent *__result_buf, char *__buf,
size_t __buflen, struct servent **__result));
#endif /* reentrant */
@ -311,24 +315,26 @@ extern struct protoent *getprotobynumber __P ((int __proto));
#ifdef __USE_REENTRANT
/* Reentrant versions of the functions above. The additional
arguments specify a buffer of BUFLEN starting at BUF. */
extern struct protoent *__getprotoent_r __P ((struct protoent *__result_buf,
char *__buf, int __buf_len));
extern struct protoent *getprotoent_r __P ((struct protoent *__result_buf,
char *__buf, int __buf_len));
extern int __getprotoent_r __P ((struct protoent *__result_buf, char *__buf,
size_t __buflen, struct protoent **__result));
extern int getprotoent_r __P ((struct protoent *__result_buf, char *__buf,
size_t __buflen, struct protoent **__result));
extern struct protoent *__getprotobyname_r __P ((__const char *__name,
struct protoent *__result_buf,
char *__buf, int __buflen));
extern struct protoent *getprotobyname_r __P ((__const char *__name,
struct protoent *__result_buf,
char *__buf, int __buflen));
extern int __getprotobyname_r __P ((__const char *__name,
struct protoent *__result_buf, char *__buf,
size_t __buflen,
struct protoent **__result));
extern int getprotobyname_r __P ((__const char *__name,
struct protoent *__result_buf, char *__buf,
size_t __buflen,
struct protoent **__result));
extern struct protoent *__getprotobynumber_r __P ((int __proto,
struct protoent *__res_buf,
char *__buf, int __buflen));
extern struct protoent *getprotobynumber_r __P ((int __proto,
struct protoent *__result_buf,
char *__buf, int __buflen));
extern int __getprotobynumber_r __P ((int __proto, struct protoent *__res_buf,
char *__buf, size_t __buflen,
struct protoent **__result));
extern int getprotobynumber_r __P ((int __proto, struct protoent *__result_buf,
char *__buf, size_t __buflen,
struct protoent **__result));
#endif /* reentrant */
@ -351,10 +357,10 @@ extern int innetgr __P ((__const char *__netgroup, __const char *__host,
/* Reentrant version of `getnetgrent' where result is placed in BUFFER. */
extern int __getnetgrent_r __P ((char **__hostp, char **__userp,
char **__domainp,
char *__buffer, int __buflen));
char *__buffer, size_t __buflen));
extern int getnetgrent_r __P ((char **__hostp, char **__userp,
char **__domainp,
char *__buffer, int __buflen));
char *__buffer, size_t __buflen));
#endif

View File

@ -23,20 +23,9 @@ Cambridge, MA 02139, USA. */
__BEGIN_DECLS
/* Get the system-dependent definitions of RLIM_*. */
/* Get the system-dependent definitions of structures and bit values. */
#include <resourcebits.h>
struct rlimit
{
/* The current (soft) limit. */
int rlim_cur;
/* The hard limit. */
int rlim_max;
};
/* Value used to indicate that there is no limit. */
#define RLIM_INFINITY 0x7fffffff
/* Put the soft and hard limits for RESOURCE in *RLIMITS.
Returns 0 if successful, -1 if not (and sets errno). */
extern int __getrlimit __P ((enum __rlimit_resource __resource,
@ -50,66 +39,6 @@ extern int getrlimit __P ((enum __rlimit_resource __resource,
extern int setrlimit __P ((enum __rlimit_resource __resource,
struct rlimit *__rlimits));
/* Whose usage statistics do you want? */
enum __rusage_who
/* The macro definitions are necessary because some programs want
to test for operating system features with #ifdef RUSAGE_SELF.
In ANSI C the reflexive definition is a no-op. */
{
/* The calling process. */
RUSAGE_SELF = 0,
#define RUSAGE_SELF RUSAGE_SELF
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
};
#include <sys/time.h> /* For `struct timeval'. */
/* Structure which says how much of each resource has been used. */
struct rusage
{
/* Total amount of user time used. */
struct timeval ru_utime;
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
long ru_maxrss;
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
long ru_ixrss;
/* Amount of data segment memory used (kilobyte-seconds). */
long ru_idrss;
/* Amount of stack memory used (kilobyte-seconds). */
long ru_isrss;
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
long ru_minflt;
/* Number of hard page faults (i.e. those that required I/O). */
long ru_majflt;
/* Number of times a process was swapped out of physical memory. */
long ru_nswap;
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
long ru_inblock;
/* Number of output operations via the file system. */
long ru_oublock;
/* Number of IPC messages sent. */
long ru_msgsnd;
/* Number of IPC messages received. */
long ru_msgrcv;
/* Number of signals delivered. */
long ru_nsignals;
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
long ru_nvcsw;
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
long ru_nivcsw;
};
/* Return resource usage information on process indicated by WHO
and put it in *USAGE. Returns 0 for success, -1 for failure. */
extern int __getrusage __P ((enum __rusage_who __who, struct rusage *__usage));
@ -125,20 +54,6 @@ extern int getrusage __P ((enum __rusage_who __who, struct rusage *__usage));
extern long int __ulimit __P ((int __cmd, long int __newlimit));
extern long int ulimit __P ((int __cmd, long int __newlimit));
/* Priority limits. */
#define PRIO_MIN -20 /* Minimum priority a process can have. */
#define PRIO_MAX 20 /* Maximum priority a process can have. */
/* The type of the WHICH argument to `getpriority' and `setpriority',
indicating what flavor of entity the WHO argument specifies. */
enum __priority_which
{
PRIO_PROCESS = 0, /* WHO is a process ID. */
PRIO_PGRP = 1, /* WHO is a process group ID. */
PRIO_USER = 2 /* WHO is a user ID. */
};
/* Return the highest priority of any process specified by WHICH and WHO
(see above); if WHO is zero, the current process, process group, or user
(as specified by WHO) is used. A lower priority number means higher

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.6 NON-LOCAL JUMPS <setjmp.h>
* ISO C Standard: 4.6 NON-LOCAL JUMPS <setjmp.h>
*/
#ifndef _SETJMP_H

View File

@ -25,7 +25,9 @@ struct spwd *
fgetspent (FILE *stream)
{
static char buffer[BUFSIZ];
static struct spwd result;
static struct spwd resbuf;
struct spwd *result;
return __fgetspent_r (stream, &result, buffer, sizeof buffer);
return __fgetspent_r (stream, &resbuf, buffer, sizeof buffer, &result)
? NULL : result;
}

View File

@ -32,8 +32,9 @@ struct spent_data {};
/* Read one shadow entry from the given stream. */
struct spwd *
__fgetspent_r (FILE *stream, struct spwd *result, char *buffer, int buflen)
int
__fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
struct spwd **result)
{
char *p;
@ -41,7 +42,7 @@ __fgetspent_r (FILE *stream, struct spwd *result, char *buffer, int buflen)
{
p = fgets (buffer, buflen, stream);
if (p == NULL)
return NULL;
return errno;
/* Skip leading blanks. */
while (isspace (*p))
@ -49,8 +50,9 @@ __fgetspent_r (FILE *stream, struct spwd *result, char *buffer, int buflen)
} while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */
! parse_line (buffer, (void *) result, NULL, 0));
! parse_line (buffer, (void *) resbuf, NULL, 0));
return result;
*result = resbuf;
return 0;
}
weak_alias (__fgetspent_r, fgetspent_r)

View File

@ -28,9 +28,10 @@ Cambridge, MA 02139, USA. */
struct spwd *
sgetspent (const char *string)
{
static struct spwd result;
static struct spwd resbuf;
static int max_size = 0;
static char *buffer = NULL;
struct spwd *result;
int len;
len = strlen (string) + 1;
@ -42,5 +43,6 @@ sgetspent (const char *string)
return NULL;
}
return __sgetspent_r (string, &result, buffer, max_size);
return __sgetspent_r (string, &resbuf, buffer, max_size, &result)
? NULL : result;
}

View File

@ -68,11 +68,13 @@ LINE_PARSER
/* Read one shadow entry from the given stream. */
struct spwd *
__sgetspent_r (const char *string, struct spwd *result, char *buffer,
int buflen)
int
__sgetspent_r (const char *string, struct spwd *resbuf, char *buffer,
size_t buflen, struct spwd **result)
{
return parse_line (strncpy (buffer, string, buflen), result, NULL, 0)
? result : NULL;
*result = parse_line (strncpy (buffer, string, buflen), resbuf, NULL, 0)
? resbuf : NULL;
return *result == NULL ? errno : 0;
}
weak_alias (__sgetspent_r, sgetspent_r)

View File

@ -74,31 +74,31 @@ extern int putspent __P ((__const struct spwd *__p, FILE *__stream));
#ifdef __USE_REENTRANT
/* Reentrant versions of some of the functions above. */
extern struct spwd *__getspent_r __P ((struct spwd *__result_buf,
char *__buffer, int __buflen));
extern struct spwd *getspent_r __P ((struct spwd *__result_buf,
char *__buffer, int __buflen));
extern int __getspent_r __P ((struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result));
extern int getspent_r __P ((struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result));
extern struct spwd *__getspnam_r __P ((__const char *__name,
struct spwd *__result_buf,
char *__buffer, int __buflen));
extern struct spwd *getspnam_r __P ((__const char *__name,
struct spwd *__result_buf,
char *__buffer, int __buflen));
extern int __getspnam_r __P ((__const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result));
extern int getspnam_r __P ((__const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result));
extern struct spwd *__sgetspent_r __P ((__const char *__string,
struct spwd *__result_buf,
char *__buffer, int __buflen));
extern struct spwd *sgetspent_r __P ((__const char *__string,
struct spwd *__result_buf,
char *__buffer, int __buflen));
extern int __sgetspent_r __P ((__const char *__string,
struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result));
extern int sgetspent_r __P ((__const char *__string, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result));
extern struct spwd *__fgetspent_r __P ((FILE *__stream,
struct spwd *__result_buf,
char *__buffer, int __buflen));
extern struct spwd *fgetspent_r __P ((FILE *__stream,
struct spwd *__result_buf,
char *__buffer, int __buflen));
extern int __fgetspent_r __P ((FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result));
extern int fgetspent_r __P ((FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result));
#endif /* reentrant */

View File

@ -19,13 +19,13 @@ m68k-*-linux* libc=6
alpha-*-linux* libc=6
# libmachuser.so.1 corresponds to mach/*.defs as of Utah's UK22 release.
*-*-gnu* libmachuser=1
*-*-gnu?* libmachuser=1
# libhurduser.so.0.0 corresponds to hurd/*.defs as of 7 May 1996.
*-*-gnu* libhurduser=0.0
*-*-gnu?* libhurduser=0.0
# libc.so.0.2 is for the Hurd alpha release 0.2.
*-*-gnu* libc=0.2
*-*-gnu?* libc=0.2
# The dynamic loader also requires different names.
i?86-*-linux* ld=ld-linux.so.2
@ -53,5 +53,5 @@ i?86-*-linux* ld=ld-linux.so.2
# We use libdb.so.2 for the interface in version 1.85 of the Berkeley DB code.
*-*-* libdb=2
# This file defines the shared library version numbers we will install.
# This defines the shared library version numbers we will install.
*-*-* libcrypt=1

View File

@ -25,7 +25,7 @@ headers := signal.h sys/signal.h signum.h sigcontext.h sigaction.h sigset.h
routines := signal raise killpg \
sigaction sigprocmask kill \
sigpending sigsuspend \
sigpending sigsuspend sigwait \
sigblock sigsetmask sigpause sigvec \
sigstack sigaltstack sigintr \
sigsetops sigempty sigfillset sigaddset sigdelset sigismem \

View File

@ -177,6 +177,11 @@ extern int sigaction __P ((int __sig, __const struct sigaction *__act,
/* Put in SET all signals that are blocked and waiting to be delivered. */
extern int sigpending __P ((sigset_t *__set));
/* Select any of pending signals from SET or wait for any to arrive. */
extern int __sigwait __P ((__const sigset_t *__set, int *__sig));
extern int sigwait __P ((__const sigset_t *__set, int *__sig));
#endif /* <signal.h> included. */
#endif /* Use POSIX. */

View File

@ -50,6 +50,7 @@ include ../Rules
CFLAGS-_itoa.c = -Wno-unused
CFLAGS-tst-printf.c = -Wno-format
CFLAGS-tstdiomisc.c = -Wno-format
ifeq ($(stdio),libio)
ifneq (,$(filter %REENTRANT, $(defines)))

View File

@ -3,7 +3,6 @@
exhibits itself, outfile will be missing the 2nd through 1023rd
characters. */
#include <ansidecl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -11,14 +10,15 @@
static char buf[8192];
int
DEFUN_VOID(main)
main (void)
{
FILE *in;
FILE *out;
static char inname[] = "/tmp/bug5.in";
static char outname[] = "/tmp/bug5.out";
char *printbuf;
int i, result;
size_t i;
int result;
/* Create a test file. */
in = fopen (inname, "w+");
@ -28,7 +28,7 @@ DEFUN_VOID(main)
return 1;
}
for (i = 0; i < 1000; ++i)
fprintf (in, "%d\n", i);
fprintf (in, "%u\n", i);
out = fopen (outname, "w");
if (out == NULL)

View File

@ -156,7 +156,7 @@ __printf_fp (FILE *fp,
position. */
mp_limb_t fp_input[(LDBL_MANT_DIG + BITS_PER_MP_LIMB - 1) / BITS_PER_MP_LIMB];
/* We need to shift the contents of fp_input by this amount of bits. */
int to_shift;
int to_shift = 0;
/* The significant of the floting-point value in question */
MPN_VAR(frac);

View File

@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@ -24,11 +23,11 @@ Cambridge, MA 02139, USA. */
int
DEFUN(main, (argc, argv), int argc AND char **argv)
main (int argc, char **argv)
{
static CONST char hello[] = "Hello, world.\n";
static CONST char replace[] = "Hewwo, world.\n";
static CONST size_t replace_from = 2, replace_to = 4;
static const char hello[] = "Hello, world.\n";
static const char replace[] = "Hewwo, world.\n";
static const size_t replace_from = 2, replace_to = 4;
char filename[FILENAME_MAX];
char *name = strrchr(*argv, '/');
char buf[BUFSIZ];
@ -78,7 +77,7 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
{
long int where = ftell(f);
if (where == replace_from)
if (where == (long int) replace_from)
{
register size_t i;
for (i = replace_from; i < replace_to; ++i)

View File

@ -145,9 +145,9 @@ extern void __funlockfile (FILE *);
#define outstring(String, Len) \
do \
{ \
if (PUT (s, String, Len) != Len) \
if ((size_t) PUT (s, (String), (Len)) != (size_t) (Len)) \
return -1; \
done += Len; \
done += (Len); \
} \
while (0)
@ -1075,7 +1075,7 @@ do_positional:
size_t max_ref_arg = 0;
/* Just a counter. */
int cnt;
size_t cnt;
if (grouping == (const char *) -1)
@ -1194,7 +1194,7 @@ do_positional:
}
/* Now walk through all format specifiers and process them. */
for (; nspecs_done < nspecs; ++nspecs_done)
for (; (size_t) nspecs_done < nspecs; ++nspecs_done)
{
#undef REF
#define REF(Name) &&do2_##Name
@ -1501,7 +1501,7 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
/* Now flush anything from the helper to the S. */
if ((to_flush = hp->_IO_write_ptr - hp->_IO_write_base) > 0)
{
if (_IO_sputn (s, hp->_IO_write_base, to_flush) != to_flush)
if ((int) _IO_sputn (s, hp->_IO_write_base, to_flush) != to_flush)
return -1;
}

View File

@ -172,8 +172,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
unsigned long int ul;
} num;
/* Character-buffer pointer. */
register char *str, **strptr;
size_t strsize;
char *str = NULL;
char **strptr = NULL;
size_t strsize = 0;
/* We must not react on white spaces immediately because they can
possibly be matched even if in the input stream no character is
available anymore. */

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
* ISO C Standard: 4.9 INPUT/OUTPUT <stdio.h>
*/
#ifndef _STDIO_H

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1996 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
@ -16,16 +16,16 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <libc-lock.h>
#include <stdlib.h>
#include "exit.h"
/* Register FUNC to be executed by `exit'. */
int
DEFUN(atexit, (func), void EXFUN((*func), (NOARGS)))
atexit (void (*func) (void))
{
struct exit_function *new = __new_exitfn();
struct exit_function *new = __new_exitfn ();
if (new == NULL)
return -1;
@ -36,30 +36,55 @@ DEFUN(atexit, (func), void EXFUN((*func), (NOARGS)))
}
/* We change global data, so we need locking. */
__libc_lock_define_initialized (static, lock)
static struct exit_function_list fnlist = { NULL, 0, };
struct exit_function_list *__exit_funcs = &fnlist;
struct exit_function *
DEFUN_VOID(__new_exitfn)
__new_exitfn (void)
{
register struct exit_function_list *l;
struct exit_function_list *l;
size_t i = 0;
__libc_lock_lock (lock)
for (l = __exit_funcs; l != NULL; l = l->next)
{
register size_t i;
for (i = 0; i < l->idx; ++i)
if (l->fns[i].flavor == ef_free)
return &l->fns[i];
if (l->idx < sizeof(l->fns) / sizeof(l->fns[0]))
return &l->fns[l->idx++];
break;
if (i < l->idx)
break;
if (l->idx < sizeof (l->fns) / sizeof (l->fns[0]))
{
i = l->idx++;
break;
}
}
l = (struct exit_function_list *) malloc(sizeof(struct exit_function_list));
if (l == NULL)
return NULL;
l->next = __exit_funcs;
__exit_funcs = l;
{
l = (struct exit_function_list *)
malloc (sizeof (struct exit_function_list));
if (l != NULL)
{
l->next = __exit_funcs;
__exit_funcs = l;
l->idx = 1;
return &l->fns[0];
l->idx = 1;
i = 0;
}
}
/* Mark entry as used, but we don't know the flavor now. */
if (l != NULL)
l->fns[i].flavor = ef_us;
__libc_lock_unlock (lock)
return l == NULL ? NULL : &l->fns[i];
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995, 1996 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
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -32,25 +31,26 @@ DEFINE_HOOK (__libc_atexit, (void))
in the reverse of the order in which they were registered
perform stdio cleanup, and terminate program execution with STATUS. */
void
DEFUN(exit, (status), int status)
exit (int status)
{
register CONST struct exit_function_list *l;
const struct exit_function_list *l;
for (l = __exit_funcs; l != NULL; l = l->next)
{
register size_t i = l->idx;
size_t i = l->idx;
while (i-- > 0)
{
CONST struct exit_function *CONST f = &l->fns[i];
const struct exit_function *const f = &l->fns[i];
switch (f->flavor)
{
case ef_free:
case ef_us:
break;
case ef_on:
(*f->func.on.fn)(status, f->func.on.arg);
(*f->func.on.fn) (status, f->func.on.arg);
break;
case ef_at:
(*f->func.at)();
(*f->func.at) ();
break;
}
}
@ -60,11 +60,10 @@ DEFUN(exit, (status), int status)
RUN_HOOK (__libc_atexit, ());
#else
{
extern void EXFUN(_cleanup, (NOARGS));
_cleanup();
extern void _cleanup (void);
_cleanup ();
}
#endif
_exit(status);
_exit (status);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1996 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,14 +20,14 @@ Cambridge, MA 02139, USA. */
struct exit_function
{
enum { ef_free, ef_on, ef_at } flavor; /* `ef_free' MUST be zero! */
enum { ef_free, ef_us, ef_on, ef_at } flavor; /* `ef_free' MUST be zero! */
union
{
void EXFUN((*at), (NOARGS));
void (*at) (void);
struct
{
void EXFUN((*fn), (int status, PTR arg));
PTR arg;
void (*fn) (int status, void *arg);
void *arg;
} on;
} func;
};
@ -39,6 +39,6 @@ struct exit_function_list
};
extern struct exit_function_list *__exit_funcs;
extern struct exit_function *EXFUN(__new_exitfn, (NOARGS));
extern struct exit_function *__new_exitfn (void);
#endif /* exit.h */

View File

@ -22,6 +22,7 @@
* Rewritten to use reentrant functions by Ulrich Drepper, 1995.
*/
#include <libc-lock.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
@ -162,6 +163,11 @@ static struct random_data unsafe_state =
end_ptr : &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
};
/* POSIX.1c requires that there is mutual exclusion for the `rand' and
`srand' functions to prevent concurrent calls from modifying common
data. */
__libc_lock_define_initialized (static, lock)
/* Initialize the random number generator based on the given seed. If the
type is the trivial no-state-information type, just remember the seed.
Otherwise, initializes state[] based on the given "seed" via a linear
@ -174,7 +180,9 @@ void
__srandom (x)
unsigned int x;
{
__libc_lock_lock (lock)
(void) __srandom_r (x, &unsafe_state);
__libc_lock_unlock (lock)
}
weak_alias (__srandom, srandom)
@ -197,10 +205,16 @@ __initstate (seed, arg_state, n)
void *arg_state;
size_t n;
{
void *ostate = (void *) &unsafe_state.state[-1];
void *ostate;
__libc_lock_lock (lock)
ostate = (void *) &unsafe_state.state[-1];
__initstate_r (seed, arg_state, n, &unsafe_state);
__libc_lock_unlock (lock)
return ostate;
}
@ -218,10 +232,16 @@ void *
__setstate (arg_state)
void *arg_state;
{
void *ostate = (void *) &unsafe_state.state[-1];
void *ostate;
__libc_lock_lock (lock)
ostate = (void *) &unsafe_state.state[-1];
if (__setstate_r (arg_state, &unsafe_state) < 0)
return NULL;
ostate = NULL;
__libc_lock_unlock (lock)
return ostate;
}
@ -244,8 +264,12 @@ __random ()
{
int32_t retval;
__libc_lock_lock (lock)
(void) __random_r (&unsafe_state, &retval);
__libc_lock_unlock (lock)
return retval;
}

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.10 GENERAL UTILITIES <stdlib.h>
* ISO S Standard: 4.10 GENERAL UTILITIES <stdlib.h>
*/
#ifndef _STDLIB_H

View File

@ -110,7 +110,7 @@ extern char *argz_next __P ((char *argz, size_t __argz_len,
#if defined (__OPTIMIZE__) && __GNUC__ >= 2
extern inline char *
__argz_next (char *__argz, size_t __argz_len, const char *__entry)
__argz_next (char *__argz, size_t __argz_len, __const char *__entry)
{
if (__entry)
{
@ -120,13 +120,10 @@ __argz_next (char *__argz, size_t __argz_len, const char *__entry)
return __entry >= __argz + __argz_len ? NULL : (char *) __entry;
}
else
if (__argz_len > 0)
return __argz;
else
return 0;
return __argz_len > 0 ? __argz : 0;
}
extern inline char *
argz_next (char *__argz, size_t __argz_len, const char *__entry)
argz_next (char *__argz, size_t __argz_len, __const char *__entry)
{
return __argz_next (__argz, __argz_len, __entry);
}

View File

@ -14,12 +14,14 @@ int
main (int argc, char *argv[])
{
size_t size = sysconf (_SC_PAGESIZE);
char *adr;
char *adr, *dest;
int result = 0;
adr = (char *) mmap (NULL, size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (adr == NULL)
adr = (char *) mmap (NULL, 3 * size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
dest = (char *) mmap (NULL, 3*size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (adr == (char *)-1L || dest == (char *)-1L)
{
if (errno == ENOSYS)
puts ("No test, mmap not available.");
@ -31,9 +33,16 @@ main (int argc, char *argv[])
}
else
{
char dest[size];
int inner, middle, outer;
mprotect(adr, size, PROT_NONE);
mprotect(adr+2*size, size, PROT_NONE);
adr += size;
mprotect(dest, size, PROT_NONE);
mprotect(dest+2*size, size, PROT_NONE);
dest += size;
memset (adr, 'T', size);
/* strlen test */

View File

@ -1,23 +1,23 @@
/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
/*
* ANSI Standard: 4.11 STRING HANDLING <string.h>
* ISO C Standard: 4.11 STRING HANDLING <string.h>
*/
#ifndef _STRING_H

View File

@ -38,27 +38,33 @@
#define _RPC_NETDB_H 1
#include <features.h>
#define __need_size_t
#include <stddef.h>
__BEGIN_DECLS
struct rpcent {
char *r_name; /* name of server for this rpc program */
char **r_aliases; /* alias list */
int r_number; /* rpc program number */
struct rpcent
{
char *r_name; /* Name of server for this rpc program. */
char **r_aliases; /* Alias list. */
int r_number; /* RPC program number. */
};
struct rpcent *getrpcbyname __P ((const char *__name));
struct rpcent *getrpcbynumber __P ((int __number));
struct rpcent *getrpcent __P ((void));
extern struct rpcent *getrpcbyname __P ((__const char *__name));
extern struct rpcent *getrpcbynumber __P ((int __number));
extern struct rpcent *getrpcent __P ((void));
#ifdef __USE_REENTRANT
struct rpcent *getrpcbyname_r __P ((const char *__name,
struct rpcent *__result,
char *__buffer, int __buflen));
struct rpcent *getrpcbynumber_r __P ((int __number,
struct rpcent *__result,
char *__buffer, int __buflen));
struct rpcent *getrpcent_r __P ((struct rpcent *__result, char *__buffer,
int __buflen));
extern int getrpcbyname_r __P ((__const char *__name,
struct rpcent *__result_buf, char *__buffer,
size_t __buflen, struct rpcent **__result));
extern int getrpcbynumber_r __P ((int __number, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result));
extern int getrpcent_r __P ((struct rpcent *__result_buf, char *__buffer,
size_t __buflen, struct rpcent **__result));
#endif
__END_DECLS

View File

@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@ -42,6 +42,7 @@ static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
*/
#include <stdio.h>
#include <endian.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
@ -51,6 +52,8 @@ static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
* This routine works on Suns (Sky / 68000's) and Vaxen.
*/
#define LSW (__BYTE_ORDER == __BIG_ENDIAN)
#ifdef vax
/* What IEEE single precision floating point looks like on a Vax */
@ -96,9 +99,7 @@ xdr_float(xdrs, fp)
switch (xdrs->x_op) {
case XDR_ENCODE:
#ifndef vax
return (XDR_PUTLONG(xdrs, (long *)fp));
#else
#ifdef vax
vs = *((struct vax_single *)fp);
for (i = 0, lim = sgl_limits;
i < sizeof(sgl_limits)/sizeof(struct sgl_limits);
@ -115,12 +116,18 @@ xdr_float(xdrs, fp)
shipit:
is.sign = vs.sign;
return (XDR_PUTLONG(xdrs, (long *)&is));
#else
if (sizeof(float) == sizeof(long))
return (XDR_PUTLONG(xdrs, (long *)fp));
else if (sizeof(float) == sizeof(int)) {
long tmp = *(int *)fp;
return (XDR_PUTLONG(xdrs, &tmp));
}
break;
#endif
case XDR_DECODE:
#ifndef vax
return (XDR_GETLONG(xdrs, (long *)fp));
#else
#ifdef vax
vsp = (struct vax_single *)fp;
if (!XDR_GETLONG(xdrs, (long *)&is))
return (FALSE);
@ -139,6 +146,17 @@ xdr_float(xdrs, fp)
doneit:
vsp->sign = is.sign;
return (TRUE);
#else
if (sizeof(float) == sizeof(long))
return (XDR_GETLONG(xdrs, (long *)fp));
else if (sizeof(float) == sizeof(int)) {
long tmp;
if (XDR_GETLONG(xdrs, &tmp)) {
*(int *)fp = tmp;
return (TRUE);
}
}
break;
#endif
case XDR_FREE:
@ -192,7 +210,6 @@ xdr_double(xdrs, dp)
register XDR *xdrs;
double *dp;
{
register long *lp;
#ifdef vax
struct ieee_double id;
struct vax_double vd;
@ -203,9 +220,7 @@ xdr_double(xdrs, dp)
switch (xdrs->x_op) {
case XDR_ENCODE:
#ifndef vax
lp = (long *)dp;
#else
#ifdef vax
vd = *((struct vax_double *)dp);
for (i = 0, lim = dbl_limits;
i < sizeof(dbl_limits)/sizeof(struct dbl_limits);
@ -226,15 +241,24 @@ xdr_double(xdrs, dp)
((vd.mantissa4 >> 3) & MASK(13));
shipit:
id.sign = vd.sign;
lp = (long *)&id;
dp = (double *)&id;
#endif
return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp));
if (2*sizeof(long) == sizeof(double)) {
long *lp = (long *)dp;
return (XDR_PUTLONG(xdrs, lp+!LSW) &&
XDR_PUTLONG(xdrs, lp+LSW));
} else if (2*sizeof(int) == sizeof(double)) {
int *ip = (int *)dp;
long tmp[2];
tmp[0] = ip[!LSW];
tmp[1] = ip[LSW];
return (XDR_PUTLONG(xdrs, tmp) &&
XDR_PUTLONG(xdrs, tmp+1));
}
break;
case XDR_DECODE:
#ifndef vax
lp = (long *)dp;
return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
#else
#ifdef vax
lp = (long *)&id;
if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
return (FALSE);
@ -258,6 +282,22 @@ xdr_double(xdrs, dp)
vd.sign = id.sign;
*dp = *((double *)&vd);
return (TRUE);
#else
if (2*sizeof(long) == sizeof(double)) {
long *lp = (long *)dp;
return (XDR_GETLONG(xdrs, lp+!LSW) &&
XDR_GETLONG(xdrs, lp+LSW));
} else if (2*sizeof(int) == sizeof(double)) {
int *ip = (int *)dp;
long tmp[2];
if (XDR_GETLONG(xdrs, tmp+!LSW) &&
XDR_GETLONG(xdrs, tmp+LSW)) {
ip[0] = tmp[0];
ip[1] = tmp[1];
return (TRUE);
}
}
break;
#endif
case XDR_FREE:

View File

@ -48,7 +48,7 @@ crypt_r (key, salt, data)
return md5_crypt_r (key, salt, (char *) data, sizeof (struct crypt_data));
/* We don't have DES encryption. */
errno = ENOSYS;
__set_errno (ENOSYS);
return NULL;
}
@ -63,6 +63,6 @@ crypt (key, salt)
return md5_crypt (key, salt);
/* We don't have DES encryption. */
errno = ENOSYS;
__set_errno (ENOSYS);
return NULL;
}

View File

@ -1,4 +1,4 @@
/* Bit values for resource limits. 4.4 BSD/generic GNU version.
/* Bit values & structures for resource limits. 4.4 BSD/generic GNU version.
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -59,5 +59,88 @@ enum __rlimit_resource
#define RLIMIT_NOFILE RLIMIT_NOFILE
RLIMIT_NLIMITS, /* Number of limit flavors. */
RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same. */
RLIM_NLIMITS = RLIMIT_NLIMITS, /* Traditional name for same. */
RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit. */
#define RLIM_INFINITY RLIM_INFINITY
};
struct rlimit
{
/* The current (soft) limit. */
int rlim_cur;
/* The hard limit. */
int rlim_max;
};
/* Whose usage statistics do you want? */
enum __rusage_who
/* The macro definitions are necessary because some programs want
to test for operating system features with #ifdef RUSAGE_SELF.
In ISO C the reflexive definition is a no-op. */
{
/* The calling process. */
RUSAGE_SELF = 0,
#define RUSAGE_SELF RUSAGE_SELF
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
};
#include <sys/time.h> /* For `struct timeval'. */
/* Structure which says how much of each resource has been used. */
struct rusage
{
/* Total amount of user time used. */
struct timeval ru_utime;
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
long int ru_maxrss;
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
long int ru_ixrss;
/* Amount of data segment memory used (kilobyte-seconds). */
long int ru_idrss;
/* Amount of stack memory used (kilobyte-seconds). */
long int ru_isrss;
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
long int ru_minflt;
/* Number of hard page faults (i.e. those that required I/O). */
long int ru_majflt;
/* Number of times a process was swapped out of physical memory. */
long int ru_nswap;
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
long int ru_inblock;
/* Number of output operations via the file system. */
long int ru_oublock;
/* Number of IPC messages sent. */
long int ru_msgsnd;
/* Number of IPC messages received. */
long int ru_msgrcv;
/* Number of signals delivered. */
long int ru_nsignals;
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
long int ru_nvcsw;
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
long int ru_nivcsw;
};
/* Priority limits. */
#define PRIO_MIN -20 /* Minimum priority a process can have. */
#define PRIO_MAX 20 /* Maximum priority a process can have. */
/* The type of the WHICH argument to `getpriority' and `setpriority',
indicating what flavor of entity the WHO argument specifies. */
enum __priority_which
{
PRIO_PROCESS = 0, /* WHO is a process ID. */
PRIO_PGRP = 1, /* WHO is a process group ID. */
PRIO_USER = 2 /* WHO is a user ID. */
};

View File

@ -44,7 +44,7 @@ uname (name)
{
/* Hostname is meaningless for this machine. */
name->nodename[0] = '\0';
errno = save;
__set_errno (save);
}
#ifdef ENAMETOOLONG
else if (errno == ENAMETOOLONG)

View File

@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@ -53,7 +53,7 @@ static float zero = 0.0000000000e+00;
ix = 0x7fffffff&hx;
/* if J(n,NaN) is NaN */
if(ix>0x7f800000) return x+x;
if(n<0){
if(n<0){
n = -n;
x = -x;
hx ^= 0x80000000;
@ -64,7 +64,7 @@ static float zero = 0.0000000000e+00;
x = fabsf(x);
if(ix==0||ix>=0x7f800000) /* if x is 0 or inf */
b = zero;
else if((float)n<=x) {
else if((float)n<=x) {
/* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
a = __ieee754_j0f(x);
b = __ieee754_j1f(x);
@ -75,7 +75,7 @@ static float zero = 0.0000000000e+00;
}
} else {
if(ix<0x30800000) { /* x < 2**-29 */
/* x is tiny, return the first Taylor expansion of J(n,x)
/* x is tiny, return the first Taylor expansion of J(n,x)
* J(n,x) = 1/n!*(x/2)^n - ...
*/
if(n>33) /* underflow */
@ -90,14 +90,14 @@ static float zero = 0.0000000000e+00;
}
} else {
/* use backward recurrence */
/* x x^2 x^2
/* x x^2 x^2
* J(n,x)/J(n-1,x) = ---- ------ ------ .....
* 2n - 2(n+1) - 2(n+2)
*
* 1 1 1
* 1 1 1
* (for large x) = ---- ------ ------ .....
* 2n 2(n+1) 2(n+2)
* -- - ------ - ------ -
* -- - ------ - ------ -
* x x x
*
* Let w = 2n/x and h=2/x, then the above quotient
@ -113,9 +113,9 @@ static float zero = 0.0000000000e+00;
* To determine how many terms needed, let
* Q(0) = w, Q(1) = w(w+h) - 1,
* Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
* When Q(k) > 1e4 good for single
* When Q(k) > 1e9 good for double
* When Q(k) > 1e17 good for quadruple
* When Q(k) > 1e4 good for single
* When Q(k) > 1e9 good for double
* When Q(k) > 1e17 good for quadruple
*/
/* determine k */
float t,v;
@ -137,7 +137,7 @@ static float zero = 0.0000000000e+00;
* single 8.8722839355e+01
* double 7.09782712893383973096e+02
* long double 1.1356523406294143949491931077970765006170e+04
* then recurrent value may overflow and the result is
* then recurrent value may overflow and the result is
* likely underflow to zero
*/
tmp = n;
@ -173,13 +173,14 @@ static float zero = 0.0000000000e+00;
}
#ifdef __STDC__
float __ieee754_ynf(int n, float x)
float __ieee754_ynf(int n, float x)
#else
float __ieee754_ynf(n,x)
float __ieee754_ynf(n,x)
int n; float x;
#endif
{
int32_t i,hx,ix,ib;
int32_t i,hx,ix;
u_int32_t ib;
int32_t sign;
float a, b, temp;
@ -202,7 +203,7 @@ static float zero = 0.0000000000e+00;
b = __ieee754_y1f(x);
/* quit if b is -inf */
GET_FLOAT_WORD(ib,b);
for(i=1;i<n&&ib!=0xff800000;i++){
for(i=1;i<n&&ib!=0xff800000;i++){
temp = b;
b = ((float)(i+i)/x)*b - a;
GET_FLOAT_WORD(ib,b);

View File

@ -5,7 +5,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@ -21,7 +21,7 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $";
* 1. Compute and return log2(x) in two pieces:
* log2(x) = w1 + w2,
* where w1 has 53-24 = 29 bit trailing zeros.
* 2. Perform y*log2(x) = n+y' by simulating muti-precision
* 2. Perform y*log2(x) = n+y' by simulating muti-precision
* arithmetic, where |y'|<=0.5.
* 3. Return x**y = 2**n*exp(y'*log2)
*
@ -49,13 +49,13 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $";
* Accuracy:
* pow(x,y) returns x**y nearly rounded. In particular
* pow(integer,integer)
* always returns the correct integer provided it is
* always returns the correct integer provided it is
* representable.
*
* Constants :
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/
@ -63,9 +63,9 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $";
#include "math_private.h"
#ifdef __STDC__
static const double
static const double
#else
static double
static double
#endif
bp[] = {1.0, 1.5,},
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
@ -117,12 +117,12 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
ix = hx&0x7fffffff; iy = hy&0x7fffffff;
/* y==zero: x**0 = 1 */
if((iy|ly)==0) return one;
if((iy|ly)==0) return one;
/* +-NaN return x+y */
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
return x+y;
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
return x+y;
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer
@ -130,22 +130,22 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
* yisint = 2 ... y is an even int
*/
yisint = 0;
if(hx<0) {
if(hx<0) {
if(iy>=0x43400000) yisint = 2; /* even integer y */
else if(iy>=0x3ff00000) {
k = (iy>>20)-0x3ff; /* exponent */
if(k>20) {
j = ly>>(52-k);
if((j<<(52-k))==ly) yisint = 2-(j&1);
if((u_int32_t)(j<<(52-k))==ly) yisint = 2-(j&1);
} else if(ly==0) {
j = iy>>(20-k);
if((j<<(20-k))==iy) yisint = 2-(j&1);
if((int32_t)(j<<(20-k))==iy) yisint = 2-(j&1);
}
}
}
}
}
/* special value of y */
if(ly==0) {
if(ly==0) {
if (iy==0x7ff00000) { /* y is +-inf */
if(((ix-0x3ff00000)|lx)==0)
return y - y; /* inf**+-1 is NaN */
@ -153,14 +153,14 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
return (hy>=0)? y: zero;
else /* (|x|<1)**-,+inf = inf,0 */
return (hy<0)?-y: zero;
}
}
if(iy==0x3ff00000) { /* y is +-1 */
if(hy<0) return one/x; else return x;
}
if(hy==0x40000000) return x*x; /* y is 2 */
if(hy==0x3fe00000) { /* y is 0.5 */
if(hx>=0) /* x >= +0 */
return __ieee754_sqrt(x);
return __ieee754_sqrt(x);
}
}
@ -173,13 +173,13 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
if(hx<0) {
if(((ix-0x3ff00000)|yisint)==0) {
z = (z-z)/(z-z); /* (-1)**non-int is NaN */
} else if(yisint==1)
} else if(yisint==1)
z = -z; /* (x<0)**odd = -(|x|**odd) */
}
return z;
}
}
/* (x<0)**(non-int) is NaN */
if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
@ -192,7 +192,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
/* over/underflow if x is not close to one */
if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
/* now |1-x| is tiny <= 2**-20, suffice to compute
/* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */
t = x-1; /* t has 20 trailing zeros */
w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
@ -289,7 +289,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
n = ((n&0x000fffff)|0x00100000)>>(20-k);
if(j<0) n = -n;
p_h -= t;
}
}
t = p_l+p_h;
SET_LOW_WORD(t,0);
u = t*lg2_h;

View File

@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@ -74,12 +74,12 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
ix = hx&0x7fffffff; iy = hy&0x7fffffff;
/* y==zero: x**0 = 1 */
if(iy==0) return one;
if(iy==0) return one;
/* +-NaN return x+y */
if(ix > 0x7f800000 ||
iy > 0x7f800000)
return x+y;
return x+y;
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer
@ -87,14 +87,14 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
* yisint = 2 ... y is an even int
*/
yisint = 0;
if(hx<0) {
if(hx<0) {
if(iy>=0x4b800000) yisint = 2; /* even integer y */
else if(iy>=0x3f800000) {
k = (iy>>23)-0x7f; /* exponent */
j = iy>>(23-k);
if((j<<(23-k))==iy) yisint = 2-(j&1);
}
}
}
}
/* special value of y */
if (iy==0x7f800000) { /* y is +-inf */
@ -104,14 +104,14 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
return (hy>=0)? y: zero;
else /* (|x|<1)**-,+inf = inf,0 */
return (hy<0)?-y: zero;
}
}
if(iy==0x3f800000) { /* y is +-1 */
if(hy<0) return one/x; else return x;
}
if(hy==0x40000000) return x*x; /* y is 2 */
if(hy==0x3f000000) { /* y is 0.5 */
if(hx>=0) /* x >= +0 */
return __ieee754_sqrtf(x);
return __ieee754_sqrtf(x);
}
ax = fabsf(x);
@ -122,12 +122,12 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
if(hx<0) {
if(((ix-0x3f800000)|yisint)==0) {
z = (z-z)/(z-z); /* (-1)**non-int is NaN */
} else if(yisint==1)
} else if(yisint==1)
z = -z; /* (x<0)**odd = -(|x|**odd) */
}
return z;
}
/* (x<0)**(non-int) is NaN */
if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
@ -136,7 +136,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
/* over/underflow if x is not close to one */
if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny;
if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny;
/* now |1-x| is tiny <= 2**-20, suffice to compute
/* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */
t = x-1; /* t has 20 trailing zeros */
w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25));
@ -217,7 +217,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
}
else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */
return s*tiny*tiny; /* underflow */
else if (j==0xc3160000){ /* z == -150 */
else if ((u_int32_t) j==0xc3160000){ /* z == -150 */
if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */
}
/*
@ -233,7 +233,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
n = ((n&0x007fffff)|0x00800000)>>(23-k);
if(j<0) n = -n;
p_h -= t;
}
}
t = p_l+p_h;
GET_FLOAT_WORD(is,t);
SET_FLOAT_WORD(t,is&0xfffff000);

View File

@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@ -18,8 +18,8 @@ static char rcsid[] = "$NetBSD: e_rem_pio2f.c,v 1.5 1995/05/10 20:46:03 jtc Exp
#endif
/* __ieee754_rem_pio2f(x,y)
*
* return the remainder of x rem pi/2 in y[0]+y[1]
*
* return the remainder of x rem pi/2 in y[0]+y[1]
* use __kernel_rem_pio2f()
*/
@ -27,7 +27,7 @@ static char rcsid[] = "$NetBSD: e_rem_pio2f.c,v 1.5 1995/05/10 20:46:03 jtc Exp
#include "math_private.h"
/*
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
*/
#ifdef __STDC__
static const int32_t two_over_pi[] = {
@ -35,27 +35,27 @@ static const int32_t two_over_pi[] = {
static int32_t two_over_pi[] = {
#endif
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63,
0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A,
0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A,
0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09,
0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29,
0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29,
0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44,
0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41,
0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41,
0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C,
0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8,
0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8,
0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11,
0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF,
0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF,
0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E,
0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5,
0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5,
0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92,
0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08,
0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08,
0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0,
0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3,
0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3,
0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85,
0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80,
0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80,
0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA,
0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B,
0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B,
};
/* This array is like the one in e_rem_pio2.c, but the numbers are
@ -84,9 +84,9 @@ static int32_t npio2_hw[] = {
*/
#ifdef __STDC__
static const float
static const float
#else
static float
static float
#endif
zero = 0.0000000000e+00, /* 0x00000000 */
half = 5.0000000000e-01, /* 0x3f000000 */
@ -115,7 +115,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */
{y[0] = x; y[1] = 0; return 0;}
if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */
if(hx>0) {
if(hx>0) {
z = x - pio2_1;
if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */
y[0] = z - pio2_1t;
@ -145,27 +145,27 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
fn = (float)n;
r = t-fn*pio2_1;
w = fn*pio2_1t; /* 1st round good to 40 bit */
if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) {
if(n<32&&(int32_t)(ix&0xffffff00)!=npio2_hw[n-1]) {
y[0] = r-w; /* quick check no cancellation */
} else {
u_int32_t high;
j = ix>>23;
y[0] = r-w;
y[0] = r-w;
GET_FLOAT_WORD(high,y[0]);
i = j-((high>>23)&0xff);
if(i>8) { /* 2nd iteration needed, good to 57 */
t = r;
w = fn*pio2_2;
w = fn*pio2_2;
r = t-w;
w = fn*pio2_2t-((t-r)-w);
w = fn*pio2_2t-((t-r)-w);
y[0] = r-w;
GET_FLOAT_WORD(high,y[0]);
i = j-((high>>23)&0xff);
if(i>25) { /* 3rd iteration need, 74 bits acc */
t = r; /* will cover all possible cases */
w = fn*pio2_3;
w = fn*pio2_3;
r = t-w;
w = fn*pio2_3t-((t-r)-w);
w = fn*pio2_3t-((t-r)-w);
y[0] = r-w;
}
}
@ -174,7 +174,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
else return n;
}
/*
/*
* all other (large) arguments
*/
if(ix>=0x7f800000) { /* x is inf or NaN */

View File

@ -287,6 +287,10 @@ static int gaih_inet(const char *name, const struct gaih_service *service,
struct gaih_servtuple *st2;
struct gaih_addrtuple *at2 = at;
int j;
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 128
#endif /* MAXHOSTNAMELEN */
char buffer[MAXHOSTNAMELEN];
while(at2) {
if (req->ai_flags & AI_CANONNAME) {
@ -308,9 +312,9 @@ static int gaih_inet(const char *name, const struct gaih_service *service,
sizeof(struct in_addr), at2->family);
#endif /* HOSTTABLE */
if (!h) {
c = inet_ntop(at2->family, at2->addr, NULL, 0);
} else
if (!h)
c = inet_ntop(at2->family, at2->addr, buffer, sizeof(buffer));
else
c = h->h_name;
if (!c) {

View File

@ -31,7 +31,7 @@ rename (old, new)
{
if (errno == EEXIST)
{
errno = save;
__set_errno (save);
/* Race condition, required for 1003.1 conformance. */
if (__unlink (new) < 0 ||
__link (old, new) < 0)

92
sysdeps/posix/sigwait.c Normal file
View File

@ -0,0 +1,92 @@
/* sigwait - implementation of sigwait function from POSIX.1c.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 <assert.h>
#include <errno.h>
#include <signal.h>
/* This is our dummy signal handler we use here. */
static void ignore_signal (int sig);
/* Place where to remember which signal we got. Please note that this
implementation cannot be used for the threaded libc. The
libpthread must provide an own version. */
static int was_sig;
int
__sigwait (const sigset_t *set, int *sig)
{
sigset_t tmp_mask;
struct sigaction saved[NSIG];
struct sigaction action;
int save_errno;
int this;
/* Prepare set. */
sigfillset (&tmp_mask);
/* Unblock all signals in the SET and register our nice handler. */
action.sa_handler = ignore_signal;
action.sa_flags = 0;
sigfillset (&action.sa_mask); /* Block all signals for handler. */
/* Make sure we recognize error conditions by setting WAS_SIG to a
value which does not describe a legal signal number. */
was_sig = -1;
for (this = 0; this < NSIG; ++this)
if (sigismember (set, this))
{
/* Unblock this signal. */
sigdelset (&tmp_mask, this);
/* Register temporary action handler. */
if (sigaction (this, &action, &saved[this]) != 0)
goto restore_handler;
}
/* Now we can wait for signals. */
sigsuspend (&tmp_mask);
restore_handler:
save_errno = errno;
while (--this >= 0)
if (sigismember (set, this))
/* We ignore errors here since we must restore all handlers. */
sigaction (this, &saved[this], NULL);
__set_errno (save_errno);
/* Store the result and return. */
*sig = was_sig;
return was_sig == -1 ? -1 : 0;
}
weak_alias (__sigwait, sigwait)
static void
ignore_signal (int sig)
{
/* Remember the signal. */
was_sig = sig;
}

View File

@ -36,7 +36,7 @@ int
__ttyname_r (fd, buf, buflen)
int fd;
char *buf;
int buflen;
size_t buflen;
{
static const char dev[] = "/dev";
struct stat st;
@ -50,21 +50,24 @@ __ttyname_r (fd, buf, buflen)
the loop. */
if (buflen < (int) (sizeof (dev) + 1))
{
__set_errno (EINVAL);
return -1;
__set_errno (ERANGE);
return ERANGE;
}
if (!__isatty (fd))
return -1;
{
__set_errno (ENOTTY);
return ENOTTY;
}
if (fstat (fd, &st) < 0)
return -1;
return errno;
mydev = st.st_dev;
myino = st.st_ino;
dirstream = opendir (dev);
if (dirstream == NULL)
return -1;
return errno;
/* Prepare the result buffer. */
memcpy (buf, dev, sizeof (dev) - 1);
@ -75,9 +78,16 @@ __ttyname_r (fd, buf, buflen)
if ((ino_t) d->d_fileno == myino)
{
char *cp;
size_t needed = _D_EXACT_NAMLEN (d) + 1;
cp = __stpncpy (&buf[sizeof (dev)], d->d_name,
MIN ((int) (_D_EXACT_NAMLEN (d) + 1), buflen));
if (needed > buflen)
{
(void) closedir (dirstream);
__set_errno (ERANGE);
return ERANGE;
}
cp = __stpncpy (&buf[sizeof (dev)], d->d_name, needed);
cp[0] = '\0';
if (stat (buf, &st) == 0 && st.st_dev == mydev)
@ -90,6 +100,8 @@ __ttyname_r (fd, buf, buflen)
(void) closedir (dirstream);
__set_errno (save);
return -1;
/* It is not clear what to return in this case. `isatty' says FD
refers to a TTY but no entry in /dev has this inode. */
return ENOTTY;
}
weak_alias (__ttyname_r, ttyname_r)

View File

@ -27,7 +27,7 @@ setrlimit (resource, rlimits)
enum __rlimit_resource resource;
struct rlimit *rlimits;
{
errno = ENOSYS;
__set_errno (ENOSYS);
return -1;
}

31
sysdeps/stub/sigwait.c Normal file
View File

@ -0,0 +1,31 @@
/* sigwait - implementation of sigwait function from POSIX.1c.
Copyright (C) 1996 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 <signal.h>
int
__sigwait (const sigset_t *set, int *sig)
{
__set_errno (ENOSYS);
return -1;
}
weak_alias (__sigwait, sigwait)
stub_warning (sigwait)

View File

@ -52,5 +52,88 @@ enum __rlimit_resource
#defin RLIMIT_NOFILE RLIMIT_NOFILE
#defin RLIMIT_OFILE RLIMIT_OFILE
RLIM_NLIMITS
RLIM_NLIMITS,
RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit. */
#define RLIM_INFINITY RLIM_INFINITY
};
struct rlimit
{
/* The current (soft) limit. */
int rlim_cur;
/* The hard limit. */
int rlim_max;
};
/* Whose usage statistics do you want? */
enum __rusage_who
/* The macro definitions are necessary because some programs want
to test for operating system features with #ifdef RUSAGE_SELF.
In ISO C the reflexive definition is a no-op. */
{
/* The calling process. */
RUSAGE_SELF = 0,
#define RUSAGE_SELF RUSAGE_SELF
/* All of its terminated child processes. */
RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
};
#include <sys/time.h> /* For `struct timeval'. */
/* Structure which says how much of each resource has been used. */
struct rusage
{
/* Total amount of user time used. */
struct timeval ru_utime;
/* Total amount of system time used. */
struct timeval ru_stime;
/* Maximum resident set size (in kilobytes). */
long int ru_maxrss;
/* Amount of sharing of text segment memory
with other processes (kilobyte-seconds). */
long int ru_ixrss;
/* Amount of data segment memory used (kilobyte-seconds). */
long int ru_idrss;
/* Amount of stack memory used (kilobyte-seconds). */
long int ru_isrss;
/* Number of soft page faults (i.e. those serviced by reclaiming
a page from the list of pages awaiting reallocation. */
long int ru_minflt;
/* Number of hard page faults (i.e. those that required I/O). */
long int ru_majflt;
/* Number of times a process was swapped out of physical memory. */
long int ru_nswap;
/* Number of input operations via the file system. Note: This
and `ru_oublock' do not include operations with the cache. */
long int ru_inblock;
/* Number of output operations via the file system. */
long int ru_oublock;
/* Number of IPC messages sent. */
long int ru_msgsnd;
/* Number of IPC messages received. */
long int ru_msgrcv;
/* Number of signals delivered. */
long int ru_nsignals;
/* Number of voluntary context switches, i.e. because the process
gave up the process before it had to (usually to wait for some
resource to be available). */
long int ru_nvcsw;
/* Number of involuntary context switches, i.e. a higher priority process
became runnable or the current process used up its time slice. */
long int ru_nivcsw;
};
/* Priority limits. */
#define PRIO_MIN -20 /* Minimum priority a process can have. */
#define PRIO_MAX 20 /* Maximum priority a process can have. */
/* The type of the WHICH argument to `getpriority' and `setpriority',
indicating what flavor of entity the WHO argument specifies. */
enum __priority_which
{
PRIO_PROCESS = 0, /* WHO is a process ID. */
PRIO_PGRP = 1, /* WHO is a process group ID. */
PRIO_USER = 2 /* WHO is a user ID. */
};

View File

@ -72,8 +72,18 @@ getlogin_r (name, name_len)
}
else
{
strncpy (name, ut->ut_line, name_len);
result = 0;
size_t needed = strlen (ut->ut_line) + 1;
if (needed < name_len)
{
__set_errno (ERANGE);
result = ERANGE;
}
else
{
memcpy (name, ut->ut_line, needed);
result = 0;
}
}
endutent_r (&utmp_data);

View File

@ -19,34 +19,40 @@ Boston, MA 02111-1307, USA. */
#ifdef _ERRNO_H
#undef EDOM
#undef ERANGE
#include <linux/errno.h>
# undef EDOM
# undef ERANGE
# include <linux/errno.h>
#ifndef __ASSEMBLER__
#if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
/* Declare alias of `errno' variable so it is accessible even if macro
with name `errno' is defined. */
extern int __errno;
# ifndef __ASSEMBLER__
# ifdef _LIBC
/* We now need a declaration of the `errno' variable. */
extern int errno;
/* When using threads, errno is a per-thread value. */
/* Function to get address of global `errno' variable. */
extern int *__errno_location __P ((void)) __attribute__ ((__const__));
#define errno (*__errno_location ())
#define __set_errno(val) errno = __errno = (val)
# ifdef _LIBC_REENTRANT
static inline int
__set_errno (int __err)
{
return *__errno_location () = errno = __err;
}
# else /* !_LIBC_REENTRANT */
# define __set_errno(val) errno = (val)
# endif /* _LIBC_REENTRANT */
# endif /* _LIBC */
#else /* !__USE_REENTRENT || (_LIBC && !_LIBC_REENTRANT) */
#define __set_errno(val) errno = (val)
#endif /* __USE_REENTRANT && (!_LIBC || _LIBC_REENTRANT) */
#endif /* !__ASSEMBLER */
# if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
/* When using threads, errno is a per-thread value. */
# define errno (*__errno_location ())
# endif
# endif /* !__ASSEMBLER__ */
#endif /* _ERRNO_H */
#if !defined (_ERRNO_H) && defined (__need_Emath)
/* This is ugly but the kernel header is not clean enough. We must
define only the values EDOM and ERANGE in case __need_Emath is
defined. The value is the same for all Linux ports. */
#define EDOM 33 /* Math argument out of domain of function. */
#define ERANGE 34 /* Math result not representable. */
# define EDOM 33 /* Math argument out of domain of function. */
# define ERANGE 34 /* Math result not representable. */
#endif /* !_ERRNO_H && __need_Emath */

View File

@ -32,10 +32,7 @@ Cambridge, MA 02139, USA. */
errno: .zero 4
.globl _errno
.type _errno,@object
_errno = errno /* This name is expected by hj libc.so.5 startup code. */
.globl __errno
.type __errno,@object
__errno = errno /* This name is expected by the MT code. */
_errno = errno /* This name is expected by hj's libc.so.5 startup code. */
.text
/* The following code is only used in the shared library when we

View File

@ -32,10 +32,7 @@ errno: .space 4
.size errno,4
.globl _errno
.type _errno,@object
_errno = errno /* This name is expected by hj libc.so.5 startup code. */
.globl __errno
.type __errno,@object
__errno = errno /* This name is expected by the MT code. */
_errno = errno /* This name is expected by hj's libc.so.5 startup code. */
.text
/* The following code is only used in the shared library when we

View File

@ -21,7 +21,7 @@ main(int argc, char ** argv)
int errors = 0;
struct tm tm;
time_t t;
int i;
unsigned int i;
memset (&tm, 0, sizeof (tm));
tm.tm_isdst = 0;
@ -39,7 +39,7 @@ main(int argc, char ** argv)
t = mktime(&tm);
if (t != tests[i].expected)
{
printf ("%s: flunked test %d (expected %lu, got %lu)\n",
printf ("%s: flunked test %u (expected %lu, got %lu)\n",
argv[0], i, (long) tests[i].expected, (long) t);
++errors;
}

Some files were not shown because too many files have changed in this diff Show More