1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
1998-02-10 23:57  Ulrich Drepper  <drepper@happy.cygnus.com>

	* misc/tst-efgcvt.c: Add more tests.
	* misc/efgcvt_r.c: Correct result for above new tests.

1998-02-06 17:22  H.J. Lu  <hjl@gnu.org>

	* misc/efgcvt_r.c (fcvt_r, ecvt_r): Correctly handle
	NDIGIT <= 0.

1998-02-10 16:48  Philip Blundell  <pb@nexus.co.uk>

	* Makerules (install-no-libc.a-nosubdir): Don't install-bin (etc)
	if the programs weren't built.

1998-02-09 10:12  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/libm-ieee754/s_exp2.c (__ieee754_exp2): If we don't have
	FE_TONEAREST, soldier on regardless and do the best we can.
	* sysdeps/libm-ieee754/s_exp2f.c (__ieee754_exp2f): likewise.

1998-02-5 17:20  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/standalone/filedesc.h: Define __need_FOPEN_MAX, not
	_STDIO_H, before including <bits/stdio_lim.h>.

	* sysdeps/standalone/arm/bits/errno.h (EOVERFLOW): Added.

	* io/fts.c (fts_build): Don't try to use d_type if it doesn't
	exist.
	
	* sysdeps/arm/sys/ucontext.h: New file.

1998-02-04 10:11  Philip Blundell  <pb@nexus.co.uk>

	* manual/stdio.texi (Formatted Output Functions): Explicitly say
	that the return value from snprintf() does not count the
	terminating NUL as a character.
	
1998-02-10 16:57  Ulrich Drepper  <drepper@happy.cygnus.com>

	* manual/users.texi: Rewrite to describe correct POSIX behaviour,
	add description for sete[ug]id and general cleanup.
	Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.

1998-01-04  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile (parent-clean): Don't remove makefile fragments here.
	(postclean): New variable.
	(clean): Remove makefile fragments here.
	(realclean distclean): Likewise.  Pass sysdep-subdirs to sub-make.
	(generated): Add isomac and isomanc.out.
	* Makeconfig ($(common-objpfx)soversions.mk): Don't generate if
	avoid-generated is set.
	(postclean-generated): Add soversion.mk.
	($(common-objpfx)version.mk): Don't include if avoid-generated is
	set.
	* Makerules: Still need to include $(+sysdir_pfx)sysd-Makefile if
	avoid-generated is set.
	(common-generated): Add libc.so and libc.so$(libc.so-version).
	(generated): Add versioned libraries.
	(common-mostlyclean): Also remove %.so and %_pic.a.
	* csu/Makefile (generated): Add abi-tag.h.
	* db2/Makefile (extra-objs): Add getlong.o.
	* elf/Makefile (generated): Add ld.so, ldd and
	$(rtld-installed-name).
	(others): Add ldconfig here instead of ldconfig.o to extra-objs.
	* malloc/Makefile (generated): Add mtrace.
	* po/Makefile: Don't include version.mk, not needed any more.
	* sunrpc/Makefile (generated): Add rpc-proto.d and rpcgen.
	* sysdeps/unix/Makefile: Fix local_lim.h -> bits/local_lim.h,
	syscall.h -> sys/syscall.h.
	(common-generated): Add s-proto.d.
	(postclean-generated): Add sysd-syscalls.
	* localedata/Makefile (test-output): Add all output files.
	(generated): Add test-input and test-output.
	(generated-dirs): Add all the dirs.

1998-01-04  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile (test-output, generated, generated-dirs): New
	variables.

1998-02-10 16:57  Ulrich Drepper  <drepper@happy.cygnus.com>

	* resolv/nss_dns/dns-host.c: Various code cleanups.
	
1998-02-09 08:10  H.J. Lu  <hjl@gnu.org>

	* resolv/gethnamaddr.c (getanswer): Fix the PTR/CNAME bug.
	From Philip Blundell <pb@nexus.co.uk>.
	* resolv/nss_dns/dns-host.c (getanswer_r): Ditto.

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

	* libc.map: Add .rem, .div, .mul, .udiv, .umul, .urem for Sparc.
	Suggested by debian/sparc porters.

1998-02-07  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* misc/tst-efgcvt.c: Totally rewritten, added a lot of new tests
	for ecvt and fcvt.

1998-02-10 16:32  Ulrich Drepper  <drepper@happy.cygnus.com>

	* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Use __xstat and
	__fxstat instead of stat and fstat.  Use namespace clean __stpcpy.

	* signal/signal.h: Always define sigset_t if __need_sigset_t is
	defined even if __USE_POSIX is not defined.

1998-02-02 20:51  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Correct last patch
	to support obsolete tty major numbers correctly.
	
1998-02-02 08:47  H.J. Lu  <hjl@gnu.org>

	* login/Makefile ($(inst_libexecdir)/pt_chown): Make the target
	directory first and ignore install error.

	* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Substract
	128 from ptyno and fix a typo for the BSD style pty.

1998-02-01  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/Makefile ($(common-objpfx)s-proto.d): Depend on all
	syscalls.list's.

1998-02-01  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
	getresuid and getresgid.

	* sysdeps/unix/sysv/linux/getresuid.c: New file.
	* sysdeps/unix/sysv/linux/getresgid.c: New file.

	* sysdeps/unix/sysv/linux/syscalls.list: Remove getres[ug]id, add
	s_getres[ug]id.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Add getres[ug]id.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise.

1998-02-02 08:11  H.J. Lu  <hjl@gnu.org>

	* nscd/grpcache.c: Include <stdlib.h>.

1998-02-01 16:01  H.J. Lu  <hjl@gnu.org>

	* stdlib/atoll.c: Fix comments.

	* sysdeps/posix/ttyname.c: Ignore stdin/stdout/stderr.
	* sysdeps/posix/ttyname_r.c: Ditto.

1998-02-03  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* io/sys/stat.h: Define S_IFLNK and S_IFSOCK if __USE_BSD or
	__USE_MISC, independent of __USE_UNIX98.

1998-02-10 19:18  Ulrich Drepper  <drepper@happy.cygnus.com>

	* sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_missing_rt_sigs):
	Rename from __libc_have_rt_sigs and leave as COMMON data.
	
1998-02-04 11:58  Richard Henderson  <rth@twiddle.rth.home>

	* Makeconfig (CFLAGS-.os): Kill -fno-common.
	* Makerules (libc.so): Prelink libc_pic.a, allocating commons.

	* libc.map (GLIBC_2.1): Add Linux/Alpha tv64 symbols.
	* elf/rtld.map: New file.  Needed to define the GLIBC_2.* 
	version symbols.
	* include/libc-symbols.h (symbol_version, default_symbol_version):
	Provide asm versions and correct !DO_VERSIONING versions.
	* sysdeps/unix/make-syscalls.sh: Recognize version symbols in
	the weak symbol list.
	
	* sysdeps/unix/sysv/linux/sigaction.c (__libc_missing_rt_sigs):
	Rename from __libc_have_rt_sigs and leave as COMMON data.
	* sysdeps/unix/sysv/linux/sigpending.c: Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c: Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c: Likewise.

1998-02-04 16:41  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* sunrpc/Makefile: Correct dependencies of rpcgen.

1998-02-10 03:00  Ulrich Drepper  <drepper@happy.cygnus.com>

	* nscd/Makefile: Fix test for available linuxthreads add-on.
	Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.

1998-02-05  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/unix/sysv/linux/syscalls.list: Fix typo in lchown.

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

	* sysdeps/gnu/Makefile: Respect with-cvs variable.

	* manual/errno.texi (Error Messages): Correct description of
	strerror_r.  Pointed out by jonas@bagge.se.

1998-01-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* manual/socket.texi (Host Address Functions): Clarify description 
	of inet_network.

1998-02-07  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/grantpt.c (argv): Move const to toplevel.
	(grantpt): Delete superfluous cast.

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

	* Makefile ($(inst_slibdir)/libc-$(version).so): Depend on
	elf/ldso_install instead of elf/subdir_install.
	(elf/ldso_install): New target.

	* elf/Makefile (ldso_install): New target.

1998-02-07  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/powerpc/socket.S: Really do the change
	of 1998-01-06.

1998-02-07  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* string/bits/string2.h (strcmp): Use __string2_1bptr_p only for
	constant expressions.

1998-02-07  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* nss/test-netdb.c: Include <unistd.h> for gethostname and "nss.h"
	for __nss_configure_lookup.
	(output_hostent): Remove unused variable.

1998-02-07  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* string/tst-inlcall.c: Fix format string.

1998-02-09  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* inet/netinet/in.h: Rename second parameter of bindresvport to
	avoid buggy gcc warning. [PR libc/412]
This commit is contained in:
Ulrich Drepper
1998-02-10 20:06:30 +00:00
parent eca3eb3b9c
commit da2d1bc5ad
60 changed files with 1153 additions and 381 deletions

248
ChangeLog
View File

@ -1,3 +1,251 @@
1998-02-10 23:57 Ulrich Drepper <drepper@happy.cygnus.com>
* misc/tst-efgcvt.c: Add more tests.
* misc/efgcvt_r.c: Correct result for above new tests.
1998-02-06 17:22 H.J. Lu <hjl@gnu.org>
* misc/efgcvt_r.c (fcvt_r, ecvt_r): Correctly handle
NDIGIT <= 0.
1998-02-10 16:48 Philip Blundell <pb@nexus.co.uk>
* Makerules (install-no-libc.a-nosubdir): Don't install-bin (etc)
if the programs weren't built.
1998-02-09 10:12 Philip Blundell <pb@nexus.co.uk>
* sysdeps/libm-ieee754/s_exp2.c (__ieee754_exp2): If we don't have
FE_TONEAREST, soldier on regardless and do the best we can.
* sysdeps/libm-ieee754/s_exp2f.c (__ieee754_exp2f): likewise.
1998-02-5 17:20 Philip Blundell <pb@nexus.co.uk>
* sysdeps/standalone/filedesc.h: Define __need_FOPEN_MAX, not
_STDIO_H, before including <bits/stdio_lim.h>.
* sysdeps/standalone/arm/bits/errno.h (EOVERFLOW): Added.
* io/fts.c (fts_build): Don't try to use d_type if it doesn't
exist.
* sysdeps/arm/sys/ucontext.h: New file.
1998-02-04 10:11 Philip Blundell <pb@nexus.co.uk>
* manual/stdio.texi (Formatted Output Functions): Explicitly say
that the return value from snprintf() does not count the
terminating NUL as a character.
1998-02-10 16:57 Ulrich Drepper <drepper@happy.cygnus.com>
* manual/users.texi: Rewrite to describe correct POSIX behaviour,
add description for sete[ug]id and general cleanup.
Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
1998-01-04 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (parent-clean): Don't remove makefile fragments here.
(postclean): New variable.
(clean): Remove makefile fragments here.
(realclean distclean): Likewise. Pass sysdep-subdirs to sub-make.
(generated): Add isomac and isomanc.out.
* Makeconfig ($(common-objpfx)soversions.mk): Don't generate if
avoid-generated is set.
(postclean-generated): Add soversion.mk.
($(common-objpfx)version.mk): Don't include if avoid-generated is
set.
* Makerules: Still need to include $(+sysdir_pfx)sysd-Makefile if
avoid-generated is set.
(common-generated): Add libc.so and libc.so$(libc.so-version).
(generated): Add versioned libraries.
(common-mostlyclean): Also remove %.so and %_pic.a.
* csu/Makefile (generated): Add abi-tag.h.
* db2/Makefile (extra-objs): Add getlong.o.
* elf/Makefile (generated): Add ld.so, ldd and
$(rtld-installed-name).
(others): Add ldconfig here instead of ldconfig.o to extra-objs.
* malloc/Makefile (generated): Add mtrace.
* po/Makefile: Don't include version.mk, not needed any more.
* sunrpc/Makefile (generated): Add rpc-proto.d and rpcgen.
* sysdeps/unix/Makefile: Fix local_lim.h -> bits/local_lim.h,
syscall.h -> sys/syscall.h.
(common-generated): Add s-proto.d.
(postclean-generated): Add sysd-syscalls.
* localedata/Makefile (test-output): Add all output files.
(generated): Add test-input and test-output.
(generated-dirs): Add all the dirs.
1998-01-04 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (test-output, generated, generated-dirs): New
variables.
1998-02-10 16:57 Ulrich Drepper <drepper@happy.cygnus.com>
* resolv/nss_dns/dns-host.c: Various code cleanups.
1998-02-09 08:10 H.J. Lu <hjl@gnu.org>
* resolv/gethnamaddr.c (getanswer): Fix the PTR/CNAME bug.
From Philip Blundell <pb@nexus.co.uk>.
* resolv/nss_dns/dns-host.c (getanswer_r): Ditto.
1998-02-08 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* libc.map: Add .rem, .div, .mul, .udiv, .umul, .urem for Sparc.
Suggested by debian/sparc porters.
1998-02-07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* misc/tst-efgcvt.c: Totally rewritten, added a lot of new tests
for ecvt and fcvt.
1998-02-10 16:32 Ulrich Drepper <drepper@happy.cygnus.com>
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Use __xstat and
__fxstat instead of stat and fstat. Use namespace clean __stpcpy.
* signal/signal.h: Always define sigset_t if __need_sigset_t is
defined even if __USE_POSIX is not defined.
1998-02-02 20:51 Zack Weinberg <zack@rabi.phys.columbia.edu>
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Correct last patch
to support obsolete tty major numbers correctly.
1998-02-02 08:47 H.J. Lu <hjl@gnu.org>
* login/Makefile ($(inst_libexecdir)/pt_chown): Make the target
directory first and ignore install error.
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Substract
128 from ptyno and fix a typo for the BSD style pty.
1998-02-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/Makefile ($(common-objpfx)s-proto.d): Depend on all
syscalls.list's.
1998-02-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
getresuid and getresgid.
* sysdeps/unix/sysv/linux/getresuid.c: New file.
* sysdeps/unix/sysv/linux/getresgid.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list: Remove getres[ug]id, add
s_getres[ug]id.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Add getres[ug]id.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise.
1998-02-02 08:11 H.J. Lu <hjl@gnu.org>
* nscd/grpcache.c: Include <stdlib.h>.
1998-02-01 16:01 H.J. Lu <hjl@gnu.org>
* stdlib/atoll.c: Fix comments.
* sysdeps/posix/ttyname.c: Ignore stdin/stdout/stderr.
* sysdeps/posix/ttyname_r.c: Ditto.
1998-02-03 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/sys/stat.h: Define S_IFLNK and S_IFSOCK if __USE_BSD or
__USE_MISC, independent of __USE_UNIX98.
1998-02-10 19:18 Ulrich Drepper <drepper@happy.cygnus.com>
* sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_missing_rt_sigs):
Rename from __libc_have_rt_sigs and leave as COMMON data.
1998-02-04 11:58 Richard Henderson <rth@twiddle.rth.home>
* Makeconfig (CFLAGS-.os): Kill -fno-common.
* Makerules (libc.so): Prelink libc_pic.a, allocating commons.
* libc.map (GLIBC_2.1): Add Linux/Alpha tv64 symbols.
* elf/rtld.map: New file. Needed to define the GLIBC_2.*
version symbols.
* include/libc-symbols.h (symbol_version, default_symbol_version):
Provide asm versions and correct !DO_VERSIONING versions.
* sysdeps/unix/make-syscalls.sh: Recognize version symbols in
the weak symbol list.
* sysdeps/unix/sysv/linux/sigaction.c (__libc_missing_rt_sigs):
Rename from __libc_have_rt_sigs and leave as COMMON data.
* sysdeps/unix/sysv/linux/sigpending.c: Likewise.
* sysdeps/unix/sysv/linux/sigprocmask.c: Likewise.
* sysdeps/unix/sysv/linux/sigsuspend.c: Likewise.
1998-02-04 16:41 Zack Weinberg <zack@rabi.phys.columbia.edu>
* sunrpc/Makefile: Correct dependencies of rpcgen.
1998-02-10 03:00 Ulrich Drepper <drepper@happy.cygnus.com>
* nscd/Makefile: Fix test for available linuxthreads add-on.
Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
1998-02-05 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/unix/sysv/linux/syscalls.list: Fix typo in lchown.
1998-02-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/gnu/Makefile: Respect with-cvs variable.
* manual/errno.texi (Error Messages): Correct description of
strerror_r. Pointed out by jonas@bagge.se.
1998-01-29 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* manual/socket.texi (Host Address Functions): Clarify description
of inet_network.
1998-02-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/grantpt.c (argv): Move const to toplevel.
(grantpt): Delete superfluous cast.
1998-02-06 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile ($(inst_slibdir)/libc-$(version).so): Depend on
elf/ldso_install instead of elf/subdir_install.
(elf/ldso_install): New target.
* elf/Makefile (ldso_install): New target.
1998-02-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/powerpc/socket.S: Really do the change
of 1998-01-06.
1998-02-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* string/bits/string2.h (strcmp): Use __string2_1bptr_p only for
constant expressions.
1998-02-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* nss/test-netdb.c: Include <unistd.h> for gethostname and "nss.h"
for __nss_configure_lookup.
(output_hostent): Remove unused variable.
1998-02-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* string/tst-inlcall.c: Fix format string.
1998-02-09 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* inet/netinet/in.h: Rename second parameter of bindresvport to
avoid buggy gcc warning. [PR libc/412]
1998-02-04 18:04 Richard Henderson <rth@cygnus.com> 1998-02-04 18:04 Richard Henderson <rth@cygnus.com>
* sysdeps/unix/sysv/linux/alpha/clone.S: Elide terminal ldgp for PROF. * sysdeps/unix/sysv/linux/alpha/clone.S: Elide terminal ldgp for PROF.

50
FAQ.in
View File

@ -223,20 +223,19 @@ some problems of this kind. The setting of CFLAGS is checked at the
very beginning and if it is not usable `configure' will bark. very beginning and if it is not usable `configure' will bark.
?? Why do I get messages about missing thread functions when I use ?? Why do I get messages about missing thread functions when I use
the librt? I don't even use threads. librt? I don't even use threads.
{UD} In this case you probably mixed up your installation of the libc. {UD} In this case you probably mixed up your installation. librt uses
The librt internally uses threads and it has implicit references to threads internally and has implicit references to the thread library.
the thread library. Normally these references are satisfied Normally these references are satisfied automatically but if the
automatically but if the thread library belonging to the librt is not thread library is not in the expected place you must tell the linker
in the expected place one has to specify this place. When using GNU where it is. When using GNU ld it works like this:
ld it works like this:
gcc -o foo foo.c -Wl,-rpath-link=/some/other/dir -lrt gcc -o foo foo.c -Wl,-rpath-link=/some/other/dir -lrt
The `/some/other/dir' should contain the matching thread library and The `/some/other/dir' should contain the thread library. `ld' will
`ld' will use the given path to find the implicitly referenced library use the given path to find the implicitly referenced library while not
while not disturbing any other link path order. disturbing any other link path.
?? What's the problem with configure --enable-omitfp? ?? What's the problem with configure --enable-omitfp?
@ -509,6 +508,19 @@ catalog files to the XPG4 form:
} }
----------------------------------------------------------------------- -----------------------------------------------------------------------
?? Programs using libc have their messages translated, but other
behavior is not localized (e.g. collating order); why?
{ZW} Translated messages are automatically installed, but the locale
database that controls other behaviors is not. You need to run
localedef to install this database, after you have run `make
install'. For example, to set up the French Canadian locale, simply
issue the command
localedef -i fr_CA -f ISO-8859-1 fr_CA
Please see localedata/README in the source tree for further details.
?? I have set up /etc/nis.conf, and the Linux libc 5 with NYS ?? I have set up /etc/nis.conf, and the Linux libc 5 with NYS
works great. But the glibc NIS+ doesn't seem to work. works great. But the glibc NIS+ doesn't seem to work.
@ -520,13 +532,13 @@ client (the NIS_COLD_START file is byte order independent) or generate
it with nisinit from the nis-tools package (available at it with nisinit from the nis-tools package (available at
http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html). http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
?? I have killed ypbind to stop using NIS, but glibc will ?? I have killed ypbind to stop using NIS, but glibc
continue using NIS. continues using NIS.
{TK} For faster NIS lookups, glibc uses the /var/yp/binding/ files {TK} For faster NIS lookups, glibc uses the /var/yp/binding/ files
from ypbind. ypbind 3.3 and older versions don't always remove these from ypbind. ypbind 3.3 and older versions don't always remove these
files, so glibc will use them furthermore. Other BSD versions seem to files, so glibc will continue to use them. Other BSD versions seem to
work correct. Until ypbind 3.4 is released, you can find a patch at work correctly. Until ypbind 3.4 is released, you can find a patch at
ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc2.diff. ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc2.diff.
?? After installing glibc name resolving doesn't work properly. ?? After installing glibc name resolving doesn't work properly.
@ -586,6 +598,15 @@ might be possible that a symbol changed size when that should not have
happened. So in case of doubt report such a warning message as a happened. So in case of doubt report such a warning message as a
problem. problem.
?? What do I need for C++ development?
{HJ,AJ} You need either egcs 1.0.1 or gcc-2.8.0 with libstdc++
2.8.0. libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work very
well with the GNU C library due to vtable thunks.
If you're upgrading from glibc 2.0.x to 2.1 you have to recompile
libstc++ the library compiled for 2.0 is not compatible due to the new
Large File Support (LFS) in version 2.1.
? Source and binary incompatibilities, and what to do about them ? Source and binary incompatibilities, and what to do about them
?? I expect GNU libc to be 100% source code compatible with ?? I expect GNU libc to be 100% source code compatible with
@ -876,6 +897,7 @@ Answers were given by:
{ZW} Zack Weinberg, <zack@rabi.phys.columbia.edu> {ZW} Zack Weinberg, <zack@rabi.phys.columbia.edu>
{TK} Thorsten Kukuk, <kukuk@vt.uni-paderborn.de> {TK} Thorsten Kukuk, <kukuk@vt.uni-paderborn.de>
{GK} Geoffrey Keating, <Geoff.Keating@anu.edu.au> {GK} Geoffrey Keating, <Geoff.Keating@anu.edu.au>
{HJ} H.J. Lu, <hjl@gnu.org>
Local Variables: Local Variables:
mode:outline mode:outline

View File

@ -127,7 +127,11 @@ include Makerules
install: subdir_install install: subdir_install
# Make sure that the dynamic linker is installed before libc. # Make sure that the dynamic linker is installed before libc.
$(inst_slibdir)/libc-$(version).so: elf/subdir_install $(inst_slibdir)/libc-$(version).so: elf/ldso_install
.PHONY: elf/ldso_install
elf/ldso_install:
$(MAKE) -C $(@D) $(@F)
# Create links for shared libraries using the `ldconfig' program is possible. # Create links for shared libraries using the `ldconfig' program is possible.
# Ignore the error if we cannot update /etc/ld.so.cache. # Ignore the error if we cannot update /etc/ld.so.cache.
@ -186,7 +190,6 @@ $(objpfx)version-info.h: $(+sysdir_pfx)config.make $(all-Banner-files)
echo "\""; \ echo "\""; \
fi) > $@T fi) > $@T
mv -f $@T $@ mv -f $@T $@
generated += version-info.h
version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes)) version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
$(version.c-objects): $(objpfx)version-info.h $(version.c-objects): $(objpfx)version-info.h
@ -261,8 +264,9 @@ parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
$(common-objpfx)$(patsubst %,$(libtype$o),c)) \ $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
$(addprefix $(objpfx),$(install-lib)) $(addprefix $(objpfx),$(install-lib))
parent-clean: parent-mostlyclean common-clean parent-clean: parent-mostlyclean common-clean
-rm -f $(addprefix $(common-objpfx),$(common-generated))
-rm -f $(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules) postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
$(addprefix $(objpfx),sysd-Makefile sysd-dirs sysd-rules)
clean: parent-clean clean: parent-clean
# This is done this way rather than having `subdir_clean' be a # This is done this way rather than having `subdir_clean' be a
@ -272,6 +276,7 @@ clean: parent-clean
@$(MAKE) subdir_clean no_deps=t @$(MAKE) subdir_clean no_deps=t
mostlyclean: parent-mostlyclean mostlyclean: parent-mostlyclean
@$(MAKE) subdir_mostlyclean no_deps=t @$(MAKE) subdir_mostlyclean no_deps=t
-rm -f $(postclean)
# The realclean target is just like distclean for the parent, but we want # The realclean target is just like distclean for the parent, but we want
# the subdirs to know the difference in case they care. # the subdirs to know the difference in case they care.
@ -280,7 +285,9 @@ realclean distclean: parent-clean
# dependency of this target so that libc.a will be removed before the # dependency of this target so that libc.a will be removed before the
# subdirectories are dealt with and so they won't try to remove object # subdirectories are dealt with and so they won't try to remove object
# files from it when it's going to be removed anyway. # files from it when it's going to be removed anyway.
@$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
sysdep-subdirs="$(sysdep-subdirs)"
-rm -f $(postclean)
# Subroutine of distclean and realclean. # Subroutine of distclean and realclean.
distclean-1: subdir_$(distclean-1) distclean-1: subdir_$(distclean-1)
@ -312,6 +319,8 @@ parent-tests: $(objpfx)isomac
$(objpfx)isomac: isomac.c $(objpfx)isomac: isomac.c
$(native-compile) $(native-compile)
generated += isomac isomac.out
# Make the distribution tarfile. # Make the distribution tarfile.

View File

@ -103,8 +103,8 @@ vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
# being included individually by a subdir makefile (hurd/Makefile needs this). # being included individually by a subdir makefile (hurd/Makefile needs this).
in-Makerules := yes in-Makerules := yes
ifndef avoid-generated
-include $(+sysdir_pfx)sysd-Makefile -include $(+sysdir_pfx)sysd-Makefile
ifndef avoid-generated
ifneq ($(sysd-Makefile-sysdirs),$(config-sysdirs)) ifneq ($(sysd-Makefile-sysdirs),$(config-sysdirs))
sysd-Makefile-force = FORCE sysd-Makefile-force = FORCE
FORCE: FORCE:
@ -383,15 +383,25 @@ LDLIBS-c.so = $(gnulib)
LDFLAGS-c.so += -e __libc_main LDFLAGS-c.so += -e __libc_main
# We have a versioning file for libc.so. # We have a versioning file for libc.so.
libc-map = $(..)libc.map libc-map = $(..)libc.map
# Pre-link the objects of libc_pic.a so that we can locally resolve
# COMMON symbols before we link against ld.so. This is because ld.so
# contains some of libc_pic.a already, which will prevent the COMMONs
# from being allocated in libc.so, which introduces evil dependencies
# between libc.so and ld.so, which can make it impossible to upgrade.
$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
-Wl,-d -Wl,--whole-archive $^
# Use our own special initializer and finalizer files for libc.so. # Use our own special initializer and finalizer files for libc.so.
$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \ $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
$(common-objpfx)libc_pic.a \ $(common-objpfx)libc_pic.os \
$(elfobjdir)/sofini.os $(elfobjdir)/ld.so \ $(elfobjdir)/sofini.os $(elfobjdir)/ld.so \
$(libc-map) $(libc-map)
$(build-shlib) $(build-shlib)
common-generated += libc.so
ifdef libc.so-version ifdef libc.so-version
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
$(make-link) $(make-link)
common-generated += libc.so$(libc.so-version)
endif endif
endif endif
@ -719,6 +729,7 @@ endef
object-suffixes-left := $(versioned) object-suffixes-left := $(versioned)
include $(o-iterator) include $(o-iterator)
generated += $(foreach o,$(versioned),$o$($o-version))
ifeq (,$($(subdir)-version)) ifeq (,$($(subdir)-version))
define o-iterator-doit define o-iterator-doit
@ -824,10 +835,15 @@ install-others-nosubdir: $(install-others)
install-%:: install-%-nosubdir ; install-%:: install-%-nosubdir ;
.PHONY: install install-no-libc.a-nosubdir .PHONY: install install-no-libc.a-nosubdir
ifeq ($(build-programs),yes)
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\ install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
install-bin-nosubdir install-lib-nosubdir \ install-bin-nosubdir install-lib-nosubdir \
install-others-nosubdir install-rootsbin-nosubdir \ install-others-nosubdir install-rootsbin-nosubdir \
install-sbin-nosubdir install-sbin-nosubdir
else
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
install-lib-nosubdir install-others-nosubdir
endif
install: install-no-libc.a-nosubdir install: install-no-libc.a-nosubdir
# Command to compile $< in $(objdir) using the native libraries. # Command to compile $< in $(objdir) using the native libraries.
@ -880,7 +896,9 @@ common-mostlyclean:
$(addsuffix .o,$(tests) $(test-srcs) \ $(addsuffix .o,$(tests) $(test-srcs) \
$(others)) \ $(others)) \
$(addsuffix .out,$(tests) $(test-srcs))) $(addsuffix .out,$(tests) $(test-srcs)))
-rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib)) -rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib) \
$(install-lib.so) \
$(install-lib.so:%.so=%_pic.a))
-rm -f core $(common-objpfx)stub-$(subdir) -rm -f core $(common-objpfx)stub-$(subdir)
$(rmobjs) $(rmobjs)
define rmobjs define rmobjs

11
NEWS
View File

@ -1,6 +1,6 @@
GNU C Library NEWS -- history of user-visible changes. 1997-09-27 GNU C Library NEWS -- history of user-visible changes. 1998-02-09
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc. Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
See the end for copying conditions. See the end for copying conditions.
Please send GNU C library bug reports using the `glibcbug' script to Please send GNU C library bug reports using the `glibcbug' script to
@ -9,6 +9,13 @@ Please send GNU C library bug reports using the `glibcbug' script to
Version 2.1 Version 2.1
* Richard Henderson corrected size of struct timeval on Linux/Alpha to
conform to POSIX member type requirements. Symbol versions have been
adjusted as needed within the library, and for direct use by applications,
but there is potential for problems if third-party libraries use
struct timeval as part of their interface. This does not present
a problem for X and other "essential" system libraries.
* An additional locale model to support C++ Standard Library locale * An additional locale model to support C++ Standard Library locale
model and probably more was implemented by Ulrich Drepper. model and probably more was implemented by Ulrich Drepper.

View File

@ -1,6 +1,6 @@
# Makefile for csu code for GNU C library. # Makefile for csu code for GNU C library.
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. # Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -44,6 +44,7 @@ include ../Makeconfig
ifeq ($(elf),yes) ifeq ($(elf),yes)
before-compile = $(objpfx)abi-tag.h before-compile = $(objpfx)abi-tag.h
generated += abi-tag.h
endif endif
ifeq ($(have-initfini),yes) ifeq ($(have-initfini),yes)

View File

@ -53,6 +53,7 @@ vpath %.c $(subdir-dirs)
extra-libs := libdb extra-libs := libdb
extra-libs-others := $(extra-libs) extra-libs-others := $(extra-libs)
extra-objs = getlong.o
libdb-routines := bt_close bt_compare bt_conv bt_cursor bt_delete \ libdb-routines := bt_close bt_compare bt_conv bt_cursor bt_delete \
bt_open bt_page bt_put bt_rec bt_recno bt_rsearch bt_search \ bt_open bt_page bt_put bt_rec bt_recno bt_rsearch bt_search \

View File

@ -1,6 +1,6 @@
# Makefile for elf subdirectory of GNU C Library. # Makefile for elf subdirectory of GNU C Library.
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. # Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -35,6 +35,7 @@ elide-routines.os = $(dl-routines) dl-support enbl-secure
# ld.so uses those routines, plus some special stuff for being the program # ld.so uses those routines, plus some special stuff for being the program
# interpreter and operating independent of libc. # interpreter and operating independent of libc.
rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal
rtld-map := rtld.map
distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \ distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \ dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \
genrtldtbl.awk atomicity.h dl-procinfo.h genrtldtbl.awk atomicity.h dl-procinfo.h
@ -53,13 +54,14 @@ include ../Makeconfig
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
extra-objs = $(rtld-routines:=.os) soinit.os sofini.os eval.os extra-objs = $(rtld-routines:=.os) soinit.os sofini.os eval.os
generated = librtld.os dl-allobjs.os trusted-dirs.h rtldtbl.h generated = librtld.os dl-allobjs.os ld.so trusted-dirs.h rtldtbl.h
install-others = $(inst_slibdir)/$(rtld-installed-name) install-others = $(inst_slibdir)/$(rtld-installed-name)
install-bin = ldd install-bin = ldd
generated += ldd
endif endif
ifeq (yes,$(has-ldconfig)) ifeq (yes,$(has-ldconfig))
extra-objs += ldconfig.o others += ldconfig
install-rootsbin = ldconfig install-rootsbin = ldconfig
$(objpfx)ldconfig: $(objpfx)ldconfig.o $(objpfx)ldconfig: $(objpfx)ldconfig.o
@ -111,7 +113,8 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
define rtld-link define rtld-link
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \ -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
$(filter-out $(objpfx)rtld-ldscript,$^) $(filter-out $(objpfx)rtld-ldscript,$^) \
-Wl,--version-script=$(rtld-map)
endef endef
else else
$(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)ld.so: $(objpfx)librtld.os
@ -119,7 +122,8 @@ $(objpfx)ld.so: $(objpfx)librtld.os
define rtld-link define rtld-link
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $^ -Wl,-rpath=$(default-rpath) $^ \
-Wl,--version-script=$(rtld-map)
endef endef
endif endif
@ -132,6 +136,7 @@ ifneq (ld.so,$(rtld-installed-name))
$(objpfx)$(rtld-installed-name): $(objpfx)ld.so $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
rm -f $@ rm -f $@
ln -s $(<F) $@ ln -s $(<F) $@
generated += $(rtld-installed-name)
endif endif
# Build a file mentioning all trustworthy directories to look for shared # Build a file mentioning all trustworthy directories to look for shared
@ -163,6 +168,10 @@ $(inst_slibdir)/$(rtld-installed-name): \
$(inst_slibdir)/$(rtld-version-installed-name) $(inst_slibdir)/$(rtld-version-installed-name)
$(make-shlib-link) $(make-shlib-link)
# Special target called by parent to install just the dynamic linker.
.PHONY: ldso_install
ldso_install: $(inst_slibdir)/$(rtld-installed-name)
ifneq ($(have-bash2),yes) ifneq ($(have-bash2),yes)
$(objpfx)ldd: ldd.sh.in $(common-objpfx)version.mk \ $(objpfx)ldd: ldd.sh.in $(common-objpfx)version.mk \
$(common-objpfx)soversions.mk $(common-objpfx)config.make $(common-objpfx)soversions.mk $(common-objpfx)config.make

12
elf/rtld.map Normal file
View File

@ -0,0 +1,12 @@
GLIBC_2.0 {
global:
# Not right, but I'll figure it out.
*;
# local:
# *;
};
GLIBC_2.1 {
} GLIBC_2.0;

View File

@ -1,6 +1,6 @@
/* Support macros for making weak and strong aliases for symbols, /* Support macros for making weak and strong aliases for symbols,
and for using symbol sets and linker warnings with GNU ld. and for using symbol sets and linker warnings with GNU ld.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -326,13 +326,21 @@ extern const char _libc_intl_domainname[];
#endif /* Have GNU ld. */ #endif /* Have GNU ld. */
#if DO_VERSIONING #if DO_VERSIONING
# ifdef ASSEMBLER
# define symbol_version(real, name, version) \
.symver real, name##@##version
# define default_symbol_version(real, name, version) \
.symver real, name##@##@##version
# else
# define symbol_version(real, name, version) \ # define symbol_version(real, name, version) \
__asm__ (".symver " #real "," #name "@" #version) __asm__ (".symver " #real "," #name "@" #version)
# define default_symbol_version(real, name, version) \ # define default_symbol_version(real, name, version) \
__asm__ (".symver " #real "," #name "@@" #version) __asm__ (".symver " #real "," #name "@@" #version)
# endif
#else #else
# define symbol_version(real, name, version) # define symbol_version(real, name, version)
# define default_symbol_version(real, name, version) # define default_symbol_version(real, name, version) \
strong_alias(real, name)
#endif #endif
#endif /* libc-symbols.h */ #endif /* libc-symbols.h */

View File

@ -274,7 +274,7 @@ extern uint16_t htons __P ((uint16_t __hostshort));
(((uint32_t *) (a))[3] == ((uint32_t *) (b))[3])) (((uint32_t *) (a))[3] == ((uint32_t *) (b))[3]))
/* Bind socket to a privileged IP port. */ /* Bind socket to a privileged IP port. */
extern int bindresvport __P ((int __sockfd, struct sockaddr_in *__sin)); extern int bindresvport __P ((int __sockfd, struct sockaddr_in *__sock_in));
/* IPv6 packet information. */ /* IPv6 packet information. */

View File

@ -703,7 +703,7 @@ mem1: saved_errno = errno;
p->fts_info = FTS_NSOK; p->fts_info = FTS_NSOK;
p->fts_accpath = cur->fts_accpath; p->fts_accpath = cur->fts_accpath;
} else if (nlinks == 0 } else if (nlinks == 0
#ifdef DT_DIR #if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
|| nlinks > 0 && || nlinks > 0 &&
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1991, 92, 95, 96, 97, 98 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 The GNU C Library is free software; you can redistribute it and/or
@ -92,7 +92,7 @@ __BEGIN_DECLS
# ifdef __S_IFIFO # ifdef __S_IFIFO
# define S_IFIFO __S_IFIFO # define S_IFIFO __S_IFIFO
# endif # endif
# ifndef __USE_UNIX98 # if defined __USE_BSD || defined __USE_MISC
# ifdef __S_IFLNK # ifdef __S_IFLNK
# define S_IFLNK __S_IFLNK # define S_IFLNK __S_IFLNK
# endif # endif

View File

@ -20,6 +20,9 @@ GLIBC_2.0 {
# This is for ix86 only. # This is for ix86 only.
_fp_hw; _fp_hw;
# This is for sparc only.
.div; .mul; .rem; .udiv; .umul; .urem;
# helper functions # helper functions
__errno_location; __libc_init_first; __h_errno_location; __errno_location; __libc_init_first; __h_errno_location;
__libc_current_sigrtmin; __libc_current_sigrtmax; __libc_allocate_rtsig; __libc_current_sigrtmin; __libc_current_sigrtmax; __libc_allocate_rtsig;
@ -443,4 +446,12 @@ GLIBC_2.1 {
# Since we have new signals this structure changed. # Since we have new signals this structure changed.
_sys_siglist; sys_siglist; sys_sigabbrev; _sys_siglist; sys_siglist; sys_sigabbrev;
# Linux/Alpha 64-bit timeval functions.
__select; select;
__gettimeofday; gettimeofday; settimeofday;
getitimer; setitimer;
utimes;
getrusage;
wait4;
} GLIBC_2.0; } GLIBC_2.0;

View File

@ -1,4 +1,4 @@
# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -32,6 +32,10 @@ locales := $(filter-out $(addprefix locales/, CVS RCS %~), \
test-srcs := collate-test xfrm-test tst-fmon test-srcs := collate-test xfrm-test tst-fmon
test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1 test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1
test-output := $(foreach s, .out .xout, \
$(addsuffix $s, $(basename $(test-input))))
generated := $(test-input) $(test-output)
generated-dirs := $(basename $(test-input)) en_US
distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \ distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \
README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \ README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \

View File

@ -54,7 +54,8 @@ include ../Rules
# pt_chown needs to be setuid root. # pt_chown needs to be setuid root.
$(inst_libexecdir)/pt_chown: $(objpfx)pt_chown $(inst_libexecdir)/pt_chown: $(objpfx)pt_chown
$(INSTALL) -m 4755 -o root $< $@ $(make-target-directory)
-$(INSTALL) -m 4755 -o root $< $@
$(objpfx)utmpd: $(utmpd-routines:%=$(objpfx)%.o) $(objpfx)utmpd: $(utmpd-routines:%=$(objpfx)%.o)

View File

@ -1,4 +1,4 @@
# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. # Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 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 # The GNU C Library is free software; you can redistribute it and/or
@ -47,6 +47,7 @@ aux := set-freeres
# The AWK script to analyze the output of the mtrace functions. # The AWK script to analyze the output of the mtrace functions.
ifneq ($(PERL),no) ifneq ($(PERL),no)
install-bin = mtrace install-bin = mtrace
generated = mtrace
# The Perl script will print addresses and to do this nicely we must know # The Perl script will print addresses and to do this nicely we must know
# whether we are on a 32 or 64 bit machine. # whether we are on a 32 or 64 bit machine.

View File

@ -1231,8 +1231,10 @@ The function @code{strerror} is declared in @file{string.h}.
@deftypefun {char *} strerror_r (int @var{errnum}, char *@var{buf}, size_t @var{n}) @deftypefun {char *} strerror_r (int @var{errnum}, char *@var{buf}, size_t @var{n})
The @code{strerror_r} function works like @code{strerror} but instead of The @code{strerror_r} function works like @code{strerror} but instead of
returning the error message in a statically allocated buffer shared by returning the error message in a statically allocated buffer shared by
all threads in the process, it writes the message string in the user all threads in the process, it returns a private copy for the
supplied buffer starting at @var{buf} with the length of @var{n} bytes. thread. This might be either some permanent global data or a message
string in the user supplied buffer starting at @var{buf} with the
length of @var{n} bytes.
At most @var{n} characters are written (including the NUL byte) so it is At most @var{n} characters are written (including the NUL byte) so it is
up to the user to select the buffer large enough. up to the user to select the buffer large enough.

View File

@ -897,8 +897,9 @@ indicate error return.
@comment BSD @comment BSD
@deftypefun {unsigned long int} inet_network (const char *@var{name}) @deftypefun {unsigned long int} inet_network (const char *@var{name})
This function extracts the network number from the address @var{name}, This function extracts the network number from the address @var{name},
given in the standard numbers-and-dots notation. given in the standard numbers-and-dots notation. The returned address is
If the input is not valid, @code{inet_network} returns @code{-1}. in host order. If the input is not valid, @code{inet_network} returns
@code{-1}.
@end deftypefun @end deftypefun
@comment arpa/inet.h @comment arpa/inet.h

View File

@ -1516,10 +1516,10 @@ produce. The trailing null character is counted towards this limit, so
you should allocate at least @var{size} characters for the string @var{s}. you should allocate at least @var{size} characters for the string @var{s}.
The return value is the number of characters which would be generated The return value is the number of characters which would be generated
for the given input. If this value is greater or equal to @var{size}, for the given input, excluding the trailing null. If this value is
not all characters from the result have been stored in @var{s}. You greater or equal to @var{size}, not all characters from the result have
should try again with a bigger output string. Here is an example of been stored in @var{s}. You should try again with a bigger output
doing this: string. Here is an example of doing this:
@smallexample @smallexample
@group @group

View File

@ -49,9 +49,9 @@ can use to examine these databases.
accessing the user database. accessing the user database.
* Group Database:: Functions and data structures for * Group Database:: Functions and data structures for
accessing the group database. accessing the group database.
* Netgroup Database:: Functions for accessing the netgroup database. * Database Example:: Example program showing the use of database
* Database Example:: Example program showing use of database
inquiry functions. inquiry functions.
* Netgroup Database:: Functions for accessing the netgroup database.
@end menu @end menu
@node User and Group IDs @node User and Group IDs
@ -68,32 +68,33 @@ in a data base which you can access as described in @ref{User Database}.
@cindex group name @cindex group name
@cindex group ID @cindex group ID
Users are classified in @dfn{groups}. Each user name also belongs to Users are classified in @dfn{groups}. Each user name belongs to one
one or more groups, and has one @dfn{default group}. Users who are @dfn{default group} and may also belong to any number of
members of the same group can share resources (such as files) that are @dfn{supplementary groups}. Users who are members of the same group can
not accessible to users who are not a member of that group. Each group share resources (such as files) that are not accessible to users who are
has a @dfn{group name} and @dfn{group ID}. @xref{Group Database}, not a member of that group. Each group has a @dfn{group name} and
for how to find information about a group ID or group name. @dfn{group ID}. @xref{Group Database}, for how to find information
about a group ID or group name.
@node Process Persona @node Process Persona
@section The Persona of a Process @section The Persona of a Process
@cindex persona @cindex persona
@cindex effective user ID @cindex effective user ID
@cindex effective group ID @cindex effective group ID
@cindex supplementary group IDs
@c !!! bogus; not single ID. set of effective group IDs (and, in GNU, @c When Hurd is more widely used, explain multiple effective user IDs
@c set of effective UIDs) determines privilege. lying here and then @c here. -zw
@c telling the truth below is confusing. At any time, each process has an @dfn{effective user ID}, a @dfn{effective
At any time, each process has a single user ID and a group ID which group ID}, and a set of @dfn{supplementary group IDs}. These IDs
determine the privileges of the process. These are collectively called determine the privileges of the process. They are collectively
the @dfn{persona} of the process, because they determine ``who it is'' called the @dfn{persona} of the process, because they determine ``who it
for purposes of access control. These IDs are also called the is'' for purposes of access control.
@dfn{effective user ID} and @dfn{effective group ID} of the process.
Your login shell starts out with a persona which consists of your user Your login shell starts out with a persona which consists of your user
ID and your default group ID. ID, your default group ID, and your supplementary group IDs (if you are
@c !!! also supplementary group IDs. in more than one group). In normal circumstances, all your other processes
In normal circumstances, all your other processes inherit these values. inherit these values.
@cindex real user ID @cindex real user ID
@cindex real group ID @cindex real group ID
@ -106,16 +107,19 @@ also important.
Both the real and effective user ID can be changed during the lifetime Both the real and effective user ID can be changed during the lifetime
of a process. @xref{Why Change Persona}. of a process. @xref{Why Change Persona}.
@cindex supplementary group IDs For details on how a process's effective user ID and group IDs affect
In addition, a user can belong to multiple groups, so the persona
includes @dfn{supplementary group IDs} that also contribute to access
permission.
For details on how a process's effective user IDs and group IDs affect
its permission to access files, see @ref{Access Permission}. its permission to access files, see @ref{Access Permission}.
The user ID of a process also controls permissions for sending signals The effective user ID of a process also controls permissions for sending
using the @code{kill} function. @xref{Signaling Another Process}. signals using the @code{kill} function. @xref{Signaling Another
Process}.
Finally, there are many operations which can only be performed by a
process whose effective user ID is zero. A process with this user ID is
a @dfn{privileged process}. Commonly the user name @code{root} is
associated with user ID 0, but there may be other user names with this
ID.
@c !!! should mention POSIX capabilities here.
@node Why Change Persona @node Why Change Persona
@section Why Change the Persona of a Process? @section Why Change the Persona of a Process?
@ -152,6 +156,9 @@ adopt the persona of @code{games} so it can write the scores file.
@node How Change Persona @node How Change Persona
@section How an Application Can Change Persona @section How an Application Can Change Persona
@cindex @code{setuid} programs @cindex @code{setuid} programs
@cindex saved set-user-ID
@cindex saved set-group-ID
@cindex @code{_POSIX_SAVED_IDS}
The ability to change the persona of a process can be a source of The ability to change the persona of a process can be a source of
unintentional privacy violations, or even intentional abuse. Because of unintentional privacy violations, or even intentional abuse. Because of
@ -164,22 +171,28 @@ program to change its persona is that it has been set up in advance to
change to a particular user or group. This is the function of the setuid change to a particular user or group. This is the function of the setuid
and setgid bits of a file's access mode. @xref{Permission Bits}. and setgid bits of a file's access mode. @xref{Permission Bits}.
When the setuid bit of an executable file is set, executing that file When the setuid bit of an executable file is on, executing that file
automatically changes the effective user ID to the user that owns the gives the process a third user ID: the @dfn{file user ID}. This ID is
file. Likewise, executing a file whose setgid bit is set changes the set to the owner ID of the file. The system then changes the effective
effective group ID to the group of the file. @xref{Executing a File}. user ID to the file user ID. The real user ID remains as it was.
Creating a file that changes to a particular user or group ID thus Likewise, if the setgid bit is on, the process is given a @dfn{file
requires full access to that user or group ID. group ID} equal to the group ID of the file, and its effective group ID
is changed to the file group ID.
If a process has a file ID (user or group), then it can at any time
change its effective ID to its real ID and back to its file ID.
Programs use this feature to relinquish their special privileges except
when they actually need them. This makes it less likely that they can
be tricked into doing something inappropriate with their privileges.
@strong{Portability Note:} Older systems do not have file IDs.
To determine if a system has this feature, you can test the compiler
define @code{_POSIX_SAVED_IDS}. (In the POSIX standard, file IDs are
known as saved IDs.)
@xref{File Attributes}, for a more general discussion of file modes and @xref{File Attributes}, for a more general discussion of file modes and
accessibility. accessibility.
A process can always change its effective user (or group) ID back to its
real ID. Programs do this so as to turn off their special privileges
when they are not needed, which makes for more robustness.
@c !!! talk about _POSIX_SAVED_IDS
@node Reading Persona @node Reading Persona
@section Reading the Persona of a Process @section Reading the Persona of a Process
@ -276,18 +289,15 @@ include the header files @file{sys/types.h} and @file{unistd.h}.
@comment unistd.h @comment unistd.h
@comment POSIX.1 @comment POSIX.1
@deftypefun int setuid (uid_t @var{newuid}) @deftypefun int seteuid(uid_t @var{neweuid})
This function sets both the real and effective user ID of the process This function sets the effective user ID of a process to @var{newuid},
to @var{newuid}, provided that the process has appropriate privileges. provided that the process is allowed to change its effective user ID. A
@c !!! also sets saved-id privileged process (effective user ID zero) can change its effective
user ID to any legal value. An unprivileged process with a file user ID
can change its effective user ID to its real user ID or to its file user
ID. Otherwise, a process may not change its effective user ID at all.
If the process is not privileged, then @var{newuid} must either be equal The @code{seteuid} function returns a value of @code{0} to indicate
to the real user ID or the saved user ID (if the system supports the
@code{_POSIX_SAVED_IDS} feature). In this case, @code{setuid} sets only
the effective user ID and not the real user ID.
@c !!! xref to discussion of _POSIX_SAVED_IDS
The @code{setuid} function returns a value of @code{0} to indicate
successful completion, and a value of @code{-1} to indicate an error. successful completion, and a value of @code{-1} to indicate an error.
The following @code{errno} error conditions are defined for this The following @code{errno} error conditions are defined for this
function: function:
@ -297,9 +307,27 @@ function:
The value of the @var{newuid} argument is invalid. The value of the @var{newuid} argument is invalid.
@item EPERM @item EPERM
The process does not have the appropriate privileges; you do not The process may not change to the specified ID.
have permission to change to the specified ID.
@end table @end table
Older systems (those without the @code{_POSIX_SAVED_IDS} feature) do not
have this function.
@end deftypefun
@comment unistd.h
@comment POSIX.1
@deftypefun int setuid (uid_t @var{newuid})
If the calling process is privileged, this function sets both the real
and effective user ID of the process to @var{newuid}. It also deletes
the file user ID of the process, if any. @var{newuid} may be any
legal value. (Once this has been done, there is no way to recover the
old effective user ID.)
If the process is not privileged, and the system supports the
@code{_POSIX_SAVED_IDS} feature, then this function behaves like
@code{seteuid}.
The return values and error conditions are the same as for @code{seteuid}.
@end deftypefun @end deftypefun
@comment unistd.h @comment unistd.h
@ -311,9 +339,9 @@ not to change the real user ID; likewise if @var{euid} is @code{-1}, it
means not to change the effective user ID. means not to change the effective user ID.
The @code{setreuid} function exists for compatibility with 4.3 BSD Unix, The @code{setreuid} function exists for compatibility with 4.3 BSD Unix,
which does not support saved IDs. You can use this function to swap the which does not support file IDs. You can use this function to swap the
effective and real user IDs of the process. (Privileged processes are effective and real user IDs of the process. (Privileged processes are
not limited to this particular usage.) If saved IDs are supported, you not limited to this particular usage.) If file IDs are supported, you
should use that feature instead of this function. @xref{Enable/Disable should use that feature instead of this function. @xref{Enable/Disable
Setuid}. Setuid}.
@ -337,33 +365,51 @@ the header files @file{sys/types.h} and @file{unistd.h}.
@pindex unistd.h @pindex unistd.h
@pindex sys/types.h @pindex sys/types.h
@comment unistd.h
@comment POSIX.1
@deftypefun int setegid (gid_t @var{newgid})
This function sets the effective group ID of the process to
@var{newgid}, provided that the process is allowed to change its group
ID. Just as with @code{seteuid}, if the process is privileged it may
change its effective group ID to any value; if it isn't, but it has a
file group ID, then it may change to its real group ID or file group ID;
otherwise it may not change its effective group ID.
Note that a process is only privileged if its effective @emph{user} ID
is zero. The effective group ID only affects access permissions.
The return values and error conditions for @code{setegid} are the same
as those for @code{seteuid}.
This function is only present if @code{_POSIX_SAVED_IDS} is defined.
@end deftypefun
@comment unistd.h @comment unistd.h
@comment POSIX.1 @comment POSIX.1
@deftypefun int setgid (gid_t @var{newgid}) @deftypefun int setgid (gid_t @var{newgid})
This function sets both the real and effective group ID of the process This function sets both the real and effective group ID of the process
to @var{newgid}, provided that the process has appropriate privileges. to @var{newgid}, provided that the process is privileged. It also
@c !!! also sets saved-id deletes the file group ID, if any.
If the process is not privileged, then @var{newgid} must either be equal If the process is not privileged, then @code{setgid} behaves like
to the real group ID or the saved group ID. In this case, @code{setgid} @code{setegid}.
sets only the effective group ID and not the real group ID.
The return values and error conditions for @code{setgid} are the same The return values and error conditions for @code{setgid} are the same
as those for @code{setuid}. as those for @code{seteuid}.
@end deftypefun @end deftypefun
@comment unistd.h @comment unistd.h
@comment BSD @comment BSD
@deftypefun int setregid (gid_t @var{rgid}, fid_t @var{egid}) @deftypefun int setregid (gid_t @var{rgid}, gid_t @var{egid})
This function sets the real group ID of the process to @var{rgid} and This function sets the real group ID of the process to @var{rgid} and
the effective group ID to @var{egid}. If @var{rgid} is @code{-1}, it the effective group ID to @var{egid}. If @var{rgid} is @code{-1}, it
means not to change the real group ID; likewise if @var{egid} is means not to change the real group ID; likewise if @var{egid} is
@code{-1}, it means not to change the effective group ID. @code{-1}, it means not to change the effective group ID.
The @code{setregid} function is provided for compatibility with 4.3 BSD The @code{setregid} function is provided for compatibility with 4.3 BSD
Unix, which does not support saved IDs. You can use this function to Unix, which does not support file IDs. You can use this function to
swap the effective and real group IDs of the process. (Privileged swap the effective and real group IDs of the process. (Privileged
processes are not limited to this usage.) If saved IDs are supported, processes are not limited to this usage.) If file IDs are supported,
you should use that feature instead of using this function. you should use that feature instead of using this function.
@xref{Enable/Disable Setuid}. @xref{Enable/Disable Setuid}.
@ -371,7 +417,19 @@ The return values and error conditions for @code{setregid} are the same
as those for @code{setreuid}. as those for @code{setreuid}.
@end deftypefun @end deftypefun
The GNU system also lets privileged processes change their supplementary @code{setuid} and @code{setgid} behave differently depending on whether
the effective user ID at the time is zero. If it is not zero, they
behave like @code{seteuid} and @code{setegid}. If it is, they change
both effective and real IDs and delete the file ID. To avoid confusion,
we recommend you always use @code{seteuid} and @code{setegid} except
when you know the effective user ID is zero and your intent is to change
the persona permanently. This case is rare---most of the programs that
need it, such as @code{login} and @code{su}, have already been written.
Note that if your program is setuid to some user other than @code{root},
there is no way to drop privileges permanently.
The system also lets privileged processes change their supplementary
group IDs. To use @code{setgroups} or @code{initgroups}, your programs group IDs. To use @code{setgroups} or @code{initgroups}, your programs
should include the header file @file{grp.h}. should include the header file @file{grp.h}.
@pindex grp.h @pindex grp.h
@ -396,11 +454,16 @@ The calling process is not privileged.
@comment grp.h @comment grp.h
@comment BSD @comment BSD
@deftypefun int initgroups (const char *@var{user}, gid_t @var{gid}) @deftypefun int initgroups (const char *@var{user}, gid_t @var{gid})
The @code{initgroups} function effectively calls @code{setgroups} to The @code{initgroups} function sets the process's supplementary group
set the process's supplementary group IDs to be the normal default for IDs to be the normal default for the user name @var{user}. If @var{gid}
the user name @var{user}. The group ID @var{gid} is also included. is not -1, it includes that group also.
@c !!! explain that this works by reading the group file looking for
@c groups USER is a member of. This function works by scanning the group database for all the groups
@var{user} belongs to. It then calls @code{setgroups} with the list it
has constructed.
The return values and error conditions are the same as for
@code{setgroups}.
@end deftypefun @end deftypefun
@node Enable/Disable Setuid @node Enable/Disable Setuid
@ -410,11 +473,11 @@ A typical setuid program does not need its special access all of the
time. It's a good idea to turn off this access when it isn't needed, time. It's a good idea to turn off this access when it isn't needed,
so it can't possibly give unintended access. so it can't possibly give unintended access.
If the system supports the saved user ID feature, you can accomplish If the system supports the @code{_POSIX_SAVED_IDS} feature, you can
this with @code{setuid}. When the game program starts, its real user ID accomplish this with @code{seteuid}. When the game program starts, its
is @code{jdoe}, its effective user ID is @code{games}, and its saved real user ID is @code{jdoe}, its effective user ID is @code{games}, and
user ID is also @code{games}. The program should record both user ID its saved user ID is also @code{games}. The program should record both
values once at the beginning, like this: user ID values once at the beginning, like this:
@smallexample @smallexample
user_user_id = getuid (); user_user_id = getuid ();
@ -424,22 +487,22 @@ game_user_id = geteuid ();
Then it can turn off game file access with Then it can turn off game file access with
@smallexample @smallexample
setuid (user_user_id); seteuid (user_user_id);
@end smallexample @end smallexample
@noindent @noindent
and turn it on with and turn it on with
@smallexample @smallexample
setuid (game_user_id); seteuid (game_user_id);
@end smallexample @end smallexample
@noindent @noindent
Throughout this process, the real user ID remains @code{jdoe} and the Throughout this process, the real user ID remains @code{jdoe} and the
saved user ID remains @code{games}, so the program can always set its file user ID remains @code{games}, so the program can always set its
effective user ID to either one. effective user ID to either one.
On other systems that don't support the saved user ID feature, you can On other systems that don't support file user IDs, you can
turn setuid access on and off by using @code{setreuid} to swap the real turn setuid access on and off by using @code{setreuid} to swap the real
and effective user IDs of the process, as follows: and effective user IDs of the process, as follows:
@ -475,12 +538,12 @@ feature with a preprocessor conditional, like this:
Here's an example showing how to set up a program that changes its Here's an example showing how to set up a program that changes its
effective user ID. effective user ID.
This is part of a game program called @code{caber-toss} that This is part of a game program called @code{caber-toss} that manipulates
manipulates a file @file{scores} that should be writable only by the game a file @file{scores} that should be writable only by the game program
program itself. The program assumes that its executable itself. The program assumes that its executable file will be installed
file will be installed with the set-user-ID bit set and owned by the with the setuid bit set and owned by the same user as the @file{scores}
same user as the @file{scores} file. Typically, a system file. Typically, a system administrator will set up an account like
administrator will set up an account like @code{games} for this purpose. @code{games} for this purpose.
The executable file is given mode @code{4755}, so that doing an The executable file is given mode @code{4755}, so that doing an
@samp{ls -l} on it produces output like: @samp{ls -l} on it produces output like:
@ -490,7 +553,7 @@ The executable file is given mode @code{4755}, so that doing an
@end smallexample @end smallexample
@noindent @noindent
The set-user-ID bit shows up in the file modes as the @samp{s}. The setuid bit shows up in the file modes as the @samp{s}.
The scores file is given mode @code{644}, and doing an @samp{ls -l} on The scores file is given mode @code{644}, and doing an @samp{ls -l} on
it shows: it shows:
@ -501,7 +564,7 @@ it shows:
Here are the parts of the program that show how to set up the changed Here are the parts of the program that show how to set up the changed
user ID. This program is conditionalized so that it makes use of the user ID. This program is conditionalized so that it makes use of the
saved IDs feature if it is supported, and otherwise uses @code{setreuid} file IDs feature if it is supported, and otherwise uses @code{setreuid}
to swap the effective and real user IDs. to swap the effective and real user IDs.
@smallexample @smallexample
@ -511,7 +574,7 @@ to swap the effective and real user IDs.
#include <stdlib.h> #include <stdlib.h>
/* @r{Save the effective and real UIDs.} */ /* @r{Remember the effective and real UIDs.} */
static uid_t euid, ruid; static uid_t euid, ruid;
@ -524,7 +587,7 @@ do_setuid (void)
int status; int status;
#ifdef _POSIX_SAVED_IDS #ifdef _POSIX_SAVED_IDS
status = setuid (euid); status = seteuid (euid);
#else #else
status = setreuid (ruid, euid); status = setreuid (ruid, euid);
#endif #endif
@ -544,7 +607,7 @@ undo_setuid (void)
int status; int status;
#ifdef _POSIX_SAVED_IDS #ifdef _POSIX_SAVED_IDS
status = setuid (ruid); status = seteuid (ruid);
#else #else
status = setreuid (euid, ruid); status = setreuid (euid, ruid);
#endif #endif
@ -560,7 +623,7 @@ undo_setuid (void)
int int
main (void) main (void)
@{ @{
/* @r{Save the real and effective user IDs.} */ /* @r{Remember the real and effective user IDs.} */
ruid = getuid (); ruid = getuid ();
euid = geteuid (); euid = geteuid ();
undo_setuid (); undo_setuid ();
@ -574,8 +637,8 @@ Notice how the first thing the @code{main} function does is to set the
effective user ID back to the real user ID. This is so that any other effective user ID back to the real user ID. This is so that any other
file accesses that are performed while the user is playing the game use file accesses that are performed while the user is playing the game use
the real user ID for determining permissions. Only when the program the real user ID for determining permissions. Only when the program
needs to open the scores file does it switch back to the original needs to open the scores file does it switch back to the file user ID,
effective user ID, like this: like this:
@smallexample @smallexample
/* @r{Record the score.} */ /* @r{Record the score.} */
@ -623,15 +686,16 @@ Don't have @code{setuid} programs with privileged user IDs such as
@code{root} unless it is absolutely necessary. If the resource is @code{root} unless it is absolutely necessary. If the resource is
specific to your particular program, it's better to define a new, specific to your particular program, it's better to define a new,
nonprivileged user ID or group ID just to manage that resource. nonprivileged user ID or group ID just to manage that resource.
It's better if you can write your program to use a special group than a
special user.
@item @item
Be cautious about using the @code{system} and @code{exec} functions in Be cautious about using the @code{exec} functions in combination with
combination with changing the effective user ID. Don't let users of changing the effective user ID. Don't let users of your program execute
your program execute arbitrary programs under a changed user ID. arbitrary programs under a changed user ID. Executing a shell is
Executing a shell is especially bad news. Less obviously, the especially bad news. Less obviously, the @code{execlp} and @code{execvp}
@code{execlp} and @code{execvp} functions are a potential risk (since functions are a potential risk (since the program they execute depends
the program they execute depends on the user's @code{PATH} environment on the user's @code{PATH} environment variable).
variable).
If you must @code{exec} another program under a changed ID, specify an If you must @code{exec} another program under a changed ID, specify an
absolute file name (@pxref{File Name Resolution}) for the executable, absolute file name (@pxref{File Name Resolution}) for the executable,
@ -639,6 +703,14 @@ and make sure that the protections on that executable and @emph{all}
containing directories are such that ordinary users cannot replace it containing directories are such that ordinary users cannot replace it
with some other program. with some other program.
You should also check the arguments passed to the program to make sure
they do not have unexpected effects. Likewise, you should examine the
environment variables. Decide which arguments and variables are safe,
and reject all others.
You should never use @code{system} in a privileged program, because it
invokes a shell.
@item @item
Only use the user ID controlling the resource in the part of the program Only use the user ID controlling the resource in the part of the program
that actually uses that resource. When you're finished with it, restore that actually uses that resource. When you're finished with it, restore
@ -692,7 +764,8 @@ This string is statically allocated and might be overwritten on
subsequent calls to this function or to @code{getlogin}. subsequent calls to this function or to @code{getlogin}.
The use of this function is deprecated since it is marked to be The use of this function is deprecated since it is marked to be
withdrawn in XPG4.2 and it is already removed in POSIX.1. withdrawn in XPG4.2 and has already been removed from newer revisions of
POSIX.1.
@end deftypefun @end deftypefun
@comment stdio.h @comment stdio.h
@ -1077,7 +1150,7 @@ This macro is used to specify the user accounting log file.
The @code{utmpname} function returns a value of @code{0} if the new name The @code{utmpname} function returns a value of @code{0} if the new name
was successfully stored, and a value of @code{-1} to indicate an error. was successfully stored, and a value of @code{-1} to indicate an error.
Note that @code{utmpname} does not try open the database, and that Note that @code{utmpname} does not try to open the database, and that
therefore the return value does not say anything about whether the therefore the return value does not say anything about whether the
database can be successfully opened. database can be successfully opened.
@end deftypefun @end deftypefun
@ -1321,10 +1394,10 @@ members. Older systems do not even have the @code{ut_host} member.
@cindex password database @cindex password database
@pindex /etc/passwd @pindex /etc/passwd
This section describes all about how to search and scan the database of This section describes how to search and scan the database of registered
registered users. The database itself is kept in the file users. The database itself is kept in the file @file{/etc/passwd} on
@file{/etc/passwd} on most systems, but on some systems a special most systems, but on some systems a special network server gives access
network server gives access to it. to it.
@menu @menu
* User Data Structure:: What each user record contains. * User Data Structure:: What each user record contains.
@ -1397,21 +1470,20 @@ user ID @var{uid}.
@comment pwd.h @comment pwd.h
@comment POSIX.1c @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}) @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 This function is similar to @code{getpwuid} in that it returns
information about the user whose user ID is @var{uid}. But the result information about the user whose user ID is @var{uid}. However, it
is not placed in a static buffer. Instead the user supplied structure fills the user supplied structure pointed to by @var{result_buf} with
pointed to by @var{result_buf} is filled with the information. The the information instead of using a static buffer. The first
first @var{buflen} bytes of the additional buffer pointed to by @var{buflen} bytes of the additional buffer pointed to by @var{buffer}
@var{buffer} are used to contain additional information, normally are used to contain additional information, normally strings which are
strings which are pointed to by the elements of the result structure. pointed to by the elements of the result structure.
If the return value is @code{0} the pointer returned in @var{result} 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} 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 contains the value @var{result_buf}). If it is nonzero, there is no
null there is no user in the data base with user ID @var{uid} or the user in the data base with user ID @var{uid}, or the buffer @var{buffer}
buffer @var{buffer} is too small to contain all the needed information. is too small to contain all the needed information. In the latter case,
In the later case the global @var{errno} variable is set to @var{errno} is set to @code{ERANGE}.
@code{ERANGE}.
@end deftypefun @end deftypefun
@ -1423,27 +1495,19 @@ containing information about the user whose user name is @var{name}.
This structure may be overwritten on subsequent calls to This structure may be overwritten on subsequent calls to
@code{getpwnam}. @code{getpwnam}.
A null pointer value indicates there is no user named @var{name}. A null pointer return indicates there is no user named @var{name}.
@end deftypefun @end deftypefun
@comment pwd.h @comment pwd.h
@comment POSIX.1c @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}) @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 This function is similar to @code{getpwnam} in that is returns
information about the user whose user name is @var{name}. But the result information about the user whose user name is @var{name}. However, like
is not placed in a static buffer. Instead the user supplied structure @code{getpwuid_r}, it fills the user supplied buffers in
pointed to by @var{result_buf} is filled with the information. The @var{result_buf} and @var{buffer} with the information instead of using
first @var{buflen} bytes of the additional buffer pointed to by a static buffer.
@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} The return values are the same as for @code{getpwuid_r}.
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 @end deftypefun
@ -1466,8 +1530,8 @@ pointer to the entry. The structure is statically allocated and is
rewritten on subsequent calls to @code{fgetpwent}. You must copy the rewritten on subsequent calls to @code{fgetpwent}. You must copy the
contents of the structure if you wish to save the information. contents of the structure if you wish to save the information.
This stream must correspond to a file in the same format as the standard The stream must correspond to a file in the same format as the standard
password database file. This function comes from System V. password database file.
@end deftypefun @end deftypefun
@comment pwd.h @comment pwd.h
@ -1480,12 +1544,12 @@ first @var{buflen} bytes of the additional buffer pointed to by
@var{buffer} are used to contain additional information, normally @var{buffer} are used to contain additional information, normally
strings which are pointed to by the elements of the result structure. 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 The stream must correspond to a file in the same format as the standard
password database file. password database file.
If the function returns null @var{result} points to the structure with If the function returns zero @var{result} points to the structure with
the wanted data (normally this is in @var{result_buf}). If errors the wanted data (normally this is in @var{result_buf}). If errors
occurred the return value is non-null and @var{result} contains a null occurred the return value is nonzero and @var{result} contains a null
pointer. pointer.
@end deftypefun @end deftypefun
@ -1508,24 +1572,19 @@ structure is statically allocated and is rewritten on subsequent calls
to @code{getpwent}. You must copy the contents of the structure if you to @code{getpwent}. You must copy the contents of the structure if you
wish to save the information. wish to save the information.
A null pointer is returned in case no further entry is available. A null pointer is returned when no more entries are available.
@end deftypefun @end deftypefun
@comment pwd.h @comment pwd.h
@comment GNU @comment GNU
@deftypefun int getpwent_r (struct passwd *@var{result_buf}, char *@var{buffer}, int @var{buflen}, struct passwd **@var{result}) @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 This function is similar to @code{getpwent} in that it returns the next
entry from the stream initialized by @code{setpwent}. But in contrast entry from the stream initialized by @code{setpwent}. Like
to the @code{getpwent} function this function is reentrant since the @code{fgetpwent_r}, it uses the user-supplied buffers in
result is placed in the user supplied structure pointed to by @var{result_buf} and @var{buffer} to return the information requested.
@var{result_buf}. Additional data, normally the strings pointed to by
the elements of the result structure, are placed in the additional The return values are the same as for @code{fgetpwent_r}.
buffer or length @var{buflen} starting at @var{buffer}.
If the function returns zero @var{result} points to the structure with
the wanted data (normally this is in @var{result_buf}). If errors
occurred the return value is non-zero and @var{result} contains a null
pointer.
@end deftypefun @end deftypefun
@comment pwd.h @comment pwd.h
@ -1551,6 +1610,7 @@ avoid using it, because it makes sense only on the assumption that the
on a system which merges the traditional Unix data base with other on a system which merges the traditional Unix data base with other
extended information about users, adding an entry using this function extended information about users, adding an entry using this function
would inevitably leave out much of the important information. would inevitably leave out much of the important information.
@c Then how are programmers to modify the password file? -zw
The function @code{putpwent} is declared in @file{pwd.h}. The function @code{putpwent} is declared in @file{pwd.h}.
@end deftypefun @end deftypefun
@ -1560,7 +1620,7 @@ The function @code{putpwent} is declared in @file{pwd.h}.
@cindex group database @cindex group database
@pindex /etc/group @pindex /etc/group
This section describes all about how to search and scan the database of This section describes how to search and scan the database of
registered groups. The database itself is kept in the file registered groups. The database itself is kept in the file
@file{/etc/group} on most systems, but on some systems a special network @file{/etc/group} on most systems, but on some systems a special network
service provides access to it. service provides access to it.
@ -1621,21 +1681,20 @@ A null pointer indicates there is no group with ID @var{gid}.
@comment grp.h @comment grp.h
@comment POSIX.1c @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}) @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 This function is similar to @code{getgrgid} in that it returns
information about the group whose group ID is @var{gid}. But the result information about the group whose group ID is @var{gid}. However, it
is not placed in a static buffer. Instead the user supplied structure fills the user supplied structure pointed to by @var{result_buf} with
pointed to by @var{result_buf} is filled with the information. The the information instead of using a static buffer. The first
first @var{buflen} bytes of the additional buffer pointed to by @var{buflen} bytes of the additional buffer pointed to by @var{buffer}
@var{buffer} are used to contain additional information, normally are used to contain additional information, normally strings which are
strings which are pointed to by the elements of the result structure. pointed to by the elements of the result structure.
If the return value is @code{0} the pointer returned in @var{result} 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} points to the requested data (i.e., @var{result} contains the value
contains the value @var{result_buf}). If the return value is non-zero @var{result_buf}). If it is nonzero, there is no group in the data base
there is no group in the data base with group ID @var{gid} or the with group ID @var{gid}, or the buffer @var{buffer} is too small to
buffer @var{buffer} is too small to contain all the needed information. contain all the needed information. In the latter case, @var{errno} is
In the later case the global @var{errno} variable is set to set to @code{ERANGE}.
@code{ERANGE}.
@end deftypefun @end deftypefun
@comment grp.h @comment grp.h
@ -1653,19 +1712,11 @@ A null pointer indicates there is no group named @var{name}.
@comment POSIX.1c @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}) @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 This function is similar to @code{getgrnam} in that is returns
information about the group whose group name is @var{name}. But the result information about the group whose group name is @var{name}. Like
is not placed in a static buffer. Instead the user supplied structure @code{getgrgid_r}, it uses the user supplied buffers in
pointed to by @var{result_buf} is filled with the information. The @var{result_buf} and @var{buffer}, not a static buffer.
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} The return values are the same as for @code{getgrgid_r}
points to the record which contains the wanted data (i.e., @var{result}
contains the value @var{result_buf}). If the return value is non-zero
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}. @code{ERANGE}.
@end deftypefun @end deftypefun
@ -1685,7 +1736,7 @@ particular file.
@deftypefun {struct group *} fgetgrent (FILE *@var{stream}) @deftypefun {struct group *} fgetgrent (FILE *@var{stream})
The @code{fgetgrent} function reads the next entry from @var{stream}. The @code{fgetgrent} function reads the next entry from @var{stream}.
It returns a pointer to the entry. The structure is statically It returns a pointer to the entry. The structure is statically
allocated and is rewritten on subsequent calls to @code{fgetgrent}. You allocated and is overwritten on subsequent calls to @code{fgetgrent}. You
must copy the contents of the structure if you wish to save the must copy the contents of the structure if you wish to save the
information. information.
@ -1698,10 +1749,10 @@ group database file.
@deftypefun int fgetgrent_r (FILE *@var{stream}, struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result}) @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 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 user entry from @var{stream}. But the result is returned in the
structure pointed to by @var{result_buf}. The structure pointed to by @var{result_buf}. The first @var{buflen} bytes
first @var{buflen} bytes of the additional buffer pointed to by of the additional buffer pointed to by @var{buffer} are used to contain
@var{buffer} are used to contain additional information, normally additional information, normally strings which are pointed to by the
strings which are pointed to by the elements of the result structure. elements of the result structure.
This stream must correspond to a file in the same format as the standard This stream must correspond to a file in the same format as the standard
group database file. group database file.
@ -1727,7 +1778,7 @@ You use this stream by calling @code{getgrent} or @code{getgrent_r}.
@deftypefun {struct group *} getgrent (void) @deftypefun {struct group *} getgrent (void)
The @code{getgrent} function reads the next entry from the stream The @code{getgrent} function reads the next entry from the stream
initialized by @code{setgrent}. It returns a pointer to the entry. The initialized by @code{setgrent}. It returns a pointer to the entry. The
structure is statically allocated and is rewritten on subsequent calls structure is statically allocated and is overwritten on subsequent calls
to @code{getgrent}. You must copy the contents of the structure if you to @code{getgrent}. You must copy the contents of the structure if you
wish to save the information. wish to save the information.
@end deftypefun @end deftypefun
@ -1736,17 +1787,13 @@ wish to save the information.
@comment GNU @comment GNU
@deftypefun int getgrent_r (struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result}) @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 This function is similar to @code{getgrent} in that it returns the next
entry from the stream initialized by @code{setgrent}. But in contrast entry from the stream initialized by @code{setgrent}. Like
to the @code{getgrent} function this function is reentrant since the @code{fgetgrent_r}, it places the result in user-supplied buffers
result is placed in the user supplied structure pointed to by pointed to @var{result_buf} and @var{buffer}.
@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 zero @var{result} points to the structure with If the function returns zero @var{result} contains a pointer to the data
the wanted data (normally this is in @var{result_buf}). If errors (normally equal to @var{result_buf}). If errors occurred the return
occurred the return value is non-zero and @var{result} contains a null value is non-zero and @var{result} contains a null pointer.
pointer.
@end deftypefun @end deftypefun
@comment grp.h @comment grp.h
@ -1756,6 +1803,31 @@ This function closes the internal stream used by @code{getgrent} or
@code{getgrent_r}. @code{getgrent_r}.
@end deftypefun @end deftypefun
@node Database Example
@section User and Group Database Example
Here is an example program showing the use of the system database inquiry
functions. The program prints some information about the user running
the program.
@smallexample
@include db.c.texi
@end smallexample
Here is some output from this program:
@smallexample
I am Throckmorton Snurd.
My login name is snurd.
My uid is 31093.
My home directory is /home/fsg/snurd.
My default shell is /bin/sh.
My default group is guest (12).
The members of this group are:
friedman
tami
@end smallexample
@node Netgroup Database @node Netgroup Database
@section Netgroup Database @section Netgroup Database
@ -1903,27 +1975,3 @@ itself is not found, the netgroup does not contain the triple or
internal errors occurred. internal errors occurred.
@end deftypefun @end deftypefun
@node Database Example
@section User and Group Database Example
Here is an example program showing the use of the system database inquiry
functions. The program prints some information about the user running
the program.
@smallexample
@include db.c.texi
@end smallexample
Here is some output from this program:
@smallexample
I am Throckmorton Snurd.
My login name is snurd.
My uid is 31093.
My home directory is /home/fsg/snurd.
My default shell is /bin/sh.
My default group is guest (12).
The members of this group are:
friedman
tami
@end smallexample

View File

@ -23,6 +23,7 @@
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/param.h>
#ifndef FLOAT_TYPE #ifndef FLOAT_TYPE
#define FLOAT_TYPE double #define FLOAT_TYPE double
@ -60,19 +61,20 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
*sign = signbit (value) != 0; *sign = signbit (value) != 0;
if (*sign) if (*sign)
value = -value; value = -value;
if (ndigit < 0)
{
/* Rounding to the left of the decimal point. */
for (i = ndigit; i < 0; i++)
value *= 0.1;
ndigit = 0;
}
} }
else else
/* Value is Inf or NaN. */ /* Value is Inf or NaN. */
*sign = 0; *sign = 0;
if (ndigit <= 0)
{
if (len > 0)
buf[0] = '\0';
*decpt = 0;
return 0;
}
n = snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", ndigit, value); n = snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", ndigit, value);
if (n < 0) if (n < 0)
return -1; return -1;
@ -91,8 +93,21 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
do do
++i; ++i;
while (i < n && !isdigit (buf[i])); while (i < n && !isdigit (buf[i]));
memmove (&buf[*decpt], &buf[i], n - i);
buf[n - (i - *decpt)] = '\0'; if (*decpt == 1 && buf[0] == '0')
{
/* We must not have leading zeroes. Strip them all out and
adjust *DECPT if necessary. */
--*decpt;
while (i < n && buf[i] == '0')
{
--*decpt;
++i;
}
}
memmove (&buf[MAX (*decpt, 0)], &buf[i], n - i);
buf[n - (i - MAX (*decpt, 0))] = '\0';
} }
return 0; return 0;
@ -136,7 +151,7 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
do do
{ {
d *= 10.0; d *= 10.0;
exponent--; --exponent;
} }
while (d < 1.0); while (d < 1.0);
} }
@ -145,7 +160,7 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
do do
{ {
d *= 0.1; d *= 0.1;
exponent++; ++exponent;
} }
while (d >= 10.0); while (d >= 10.0);
} }
@ -155,9 +170,22 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
value = d; value = d;
} }
} }
else if (value == 0.0)
/* SUSv2 leaves it unspecified whether *DECPT is 0 or 1 for 0.0.
This could be changed to -1 if we want to return 0. */
exponent = 0;
if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit - 1, decpt, sign, buf, len)) if (ndigit <= 0 && len > 0)
{
buf[0] = '\0';
*decpt = 1;
*sign = isfinite (value) ? signbit (value) != 0 : 0;
}
else
if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit - 1, decpt, sign,
buf, len))
return -1; return -1;
*decpt += exponent; *decpt += exponent;
return 0; return 0;
} }

View File

@ -16,19 +16,117 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int int error_count;
main (void)
typedef struct
{
double value;
int ndigit;
int decpt;
char result[30];
} testcase;
typedef char * ((*efcvt_func) (double, int, int *, int *));
static testcase ecvt_tests[] =
{
{ 0.0, 0, 1, "" },
{ 10.0, 0, 2, "" },
{ 10.0, 1, 2, "1" },
{ 10.0, 5, 2, "10000" },
{ -12.0, 5, 2, "12000" },
{ 0.2, 4, 0, "2000" },
{ 0.02, 4, -1, "2000" },
{ 5.5, 1, 1, "6" },
{ 1.0, -1, 1, "" },
{ 0.01, 2, -1, "10" },
/* -1.0 is end marker. */
{ -1.0, 0, 0, "" }
};
static testcase fcvt_tests[] =
{
{ 0.0, 0, 1, "0" },
{ 10.0, 0, 2, "10" },
{ 10.0, 1, 2, "100" },
{ 10.0, 4, 2, "100000" },
{ -12.0, 5, 2, "1200000" },
{ 0.2, 4, 0, "2000" },
{ 0.02, 4, -1, "200" },
{ 5.5, 1, 1, "55" },
{ 5.5, 0, 1, "6" },
{ 0.01, 2, -1, "1" },
/* -1.0 is end marker. */
{ -1.0, 0, 0, "" }
};
void
output_error (const char *name, double value, int ndigit,
const char *exp_p, int exp_decpt, int exp_sign,
char *res_p, int res_decpt, int res_sign)
{
printf ("%s returned wrong result for value: %f, ndigits: %d\n",
name, value, ndigit);
printf ("Result was p: \"%s\", decpt: %d, sign: %d\n",
res_p, res_decpt, res_sign);
printf ("Should be p: \"%s\", decpt: %d, sign: %d\n",
exp_p, exp_decpt, exp_sign);
++error_count;
}
void
test (testcase tests[], efcvt_func efcvt, const char *name)
{
int no = 0;
int decpt, sign;
char *p;
while (tests[no].value != -1.0)
{
p = efcvt (tests[no].value, tests[no].ndigit, &decpt, &sign);
if (decpt != tests[no].decpt
|| sign != (tests[no].value < 0)
|| strcmp (p, tests[no].result) != 0)
output_error (name, tests[no].value, tests[no].ndigit,
tests[no].result, tests[no].decpt,
(tests[no].value < 0),
p, decpt, sign);
++no;
}
}
void
special (void)
{ {
int decpt, sign; int decpt, sign;
char *p; char *p;
p = ecvt (0.0, 0, &decpt, &sign); p = ecvt (NAN, 10, &decpt, &sign);
printf ("p: \"%s\", decpt: %d, sign: %d\n", p, decpt, sign); if (sign != 0 || strcmp (p, "nan") != 0)
if (p[0] != '\0') output_error ("ecvt", NAN, 10, "nan", 0, 0, p, decpt, sign);
return 1;
p = ecvt (INFINITY, 10, &decpt, &sign);
if (sign != 0 || strcmp (p, "inf") != 0)
output_error ("ecvt", NAN, 10, "inf", 0, 0, p, decpt, sign);
return 0; }
int
main (void)
{
test (ecvt_tests, ecvt, "ecvt");
test (fcvt_tests, fcvt, "fcvt");
special ();
return error_count;
} }

View File

@ -23,18 +23,20 @@ subdir := nscd
routines := nscd_getpw_r nscd_getgr_r routines := nscd_getpw_r nscd_getgr_r
include ../Makeconfig
# We can later add the names of other thread packages here. # We can later add the names of other thread packages here.
ifeq (,$(findstring linuxthreads,$(add-ons))) ifneq (,$(findstring linuxthreads,$(add-ons)))
others := nscd others := nscd
install-sbin := nscd install-sbin := nscd
endif
nscd-routines := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \ nscd-routines := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
getgrnam_r getgrgid_r dbg_log nscd_conf nscd_stat getgrnam_r getgrgid_r dbg_log nscd_conf nscd_stat
extra-objs := $(nscd-routines:=.o) extra-objs := $(nscd-routines:=.o)
endif
distribute := nscd.h dbg_log.h $(nscd-routines:=.c) TODO nscd.conf nscd.init \ distribute := nscd.h dbg_log.h $(nscd-routines:=.c) TODO nscd.conf nscd.init \
nscd_proto.h nscd_proto.h

View File

@ -19,8 +19,8 @@
#include <errno.h> #include <errno.h>
#include <grp.h> #include <grp.h>
#include <malloc.h>
#include <pthread.h> #include <pthread.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <rpcsvc/nis.h> #include <rpcsvc/nis.h>
#include <sys/types.h> #include <sys/types.h>

View File

@ -37,6 +37,8 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h>
#include "nss.h"
/* /*
The following define is neccessary for glibc 2.0.6 The following define is neccessary for glibc 2.0.6
@ -104,7 +106,6 @@ test_services (void)
void void
output_hostent (const char *call, struct hostent *hptr) output_hostent (const char *call, struct hostent *hptr)
{ {
int i;
char **pptr; char **pptr;
char buf[INET6_ADDRSTRLEN]; char buf[INET6_ADDRSTRLEN];

View File

@ -36,9 +36,7 @@ domainname = libc
all: # Make this the default target; it will be defined in Rules. all: # Make this the default target; it will be defined in Rules.
# Get $(version) defined.
include ../Makeconfig include ../Makeconfig
-include $(common-objpfx)version.mk
# Pattern for where message catalog object for language % gets installed. # Pattern for where message catalog object for language % gets installed.
mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo

View File

@ -286,7 +286,7 @@ getanswer(answer, anslen, qname, qtype)
} }
if (qtype == T_PTR && type == T_CNAME) { if (qtype == T_PTR && type == T_CNAME) {
n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
if (n < 0 || !res_hnok(tbuf)) { if (n < 0 || !res_dnok(tbuf)) {
had_error++; had_error++;
continue; continue;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996. Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -87,8 +87,8 @@
#include "nsswitch.h" #include "nsswitch.h"
/* Get implementation for some internal functions. */ /* Get implementation for some internal functions. */
#include "../resolv/mapv4v6addr.h" #include <resolv/mapv4v6addr.h>
#include "../resolv/mapv4v6hostent.h" #include <resolv/mapv4v6hostent.h>
/* Maximum number of aliases we allow. */ /* Maximum number of aliases we allow. */
#define MAX_NR_ALIASES 48 #define MAX_NR_ALIASES 48
@ -429,8 +429,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
++had_error; ++had_error;
continue; continue;
} }
strcpy (bp, tbuf); /* Cannot overflow. */ result->h_name = strcpy (bp, tbuf); /* Cannot overflow. */
result->h_name = bp;
bp += n; bp += n;
linebuflen -= n; linebuflen -= n;
continue; continue;
@ -439,7 +438,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (qtype == T_PTR && type == T_CNAME) if (qtype == T_PTR && type == T_CNAME)
{ {
n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
if (n < 0 || res_hnok (tbuf) == 0) if (n < 0 || res_dnok (tbuf) == 0)
{ {
++had_error; ++had_error;
continue; continue;
@ -452,8 +451,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
++had_error; ++had_error;
continue; continue;
} }
strcpy (bp, tbuf); /* Cannot overflow. */ tname = strcpy (bp, tbuf); /* Cannot overflow. */
tname = bp;
bp += n; bp += n;
linebuflen -= n; linebuflen -= n;
continue; continue;
@ -570,7 +568,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
{ {
*ap = NULL; *ap = NULL;
*hap = NULL; *hap = NULL;
#if defined(RESOLVSORT) #if defined RESOLVSORT
/* /*
* Note: we sort even if host can take only one address * Note: we sort even if host can take only one address
* in its return structures - should give it the "best" * in its return structures - should give it the "best"
@ -585,8 +583,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
n = strlen (qname) + 1; /* For the \0. */ n = strlen (qname) + 1; /* For the \0. */
if (n > linebuflen || n >= MAXHOSTNAMELEN) if (n > linebuflen || n >= MAXHOSTNAMELEN)
goto no_recovery; goto no_recovery;
strcpy (bp, qname); /* Cannot overflow. */ result->h_name = strcpy (bp, qname); /* Cannot overflow. */
result->h_name = bp;
bp += n; bp += n;
linebuflen -= n; linebuflen -= n;
} }

View File

@ -167,15 +167,15 @@ typedef __sighandler_t sig_t;
#endif /* <signal.h> included. */ #endif /* <signal.h> included. */
#ifdef __USE_POSIX
# if !defined __sigset_t_defined \ # if !defined __sigset_t_defined \
&& (defined _SIGNAL_H || defined __need_sigset_t) && ((defined _SIGNAL_H && defined __USE_POSIX) || defined __need_sigset_t)
typedef __sigset_t sigset_t; typedef __sigset_t sigset_t;
# define __sigset_t_defined 1 # define __sigset_t_defined 1
# endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */ # endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */
# undef __need_sigset_t # undef __need_sigset_t
#ifdef __USE_POSIX
# ifdef _SIGNAL_H # ifdef _SIGNAL_H
/* We need `struct timespec' later on. */ /* We need `struct timespec' later on. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. /* Copyright (C) 1991, 1997, 1998 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 The GNU C Library is free software; you can redistribute it and/or
@ -21,7 +21,7 @@
#undef atoll #undef atoll
/* Convert a string to a long int. */ /* Convert a string to a long long int. */
long long int long long int
atoll (const char *nptr) atoll (const char *nptr)
{ {

View File

@ -86,7 +86,8 @@ __STRING2_COPY_TYPE (8);
#endif #endif
/* Dereferencing a pointer arg to run sizeof on it fails for the /* Dereferencing a pointer arg to run sizeof on it fails for the
void pointer case, so we use this instead. */ void pointer case, so we use this instead. Note that the argument
must not contain any side effects. */
#define __string2_1bptr_p(x) (((size_t) ((x) + 1) - (size_t) (x)) == 1) #define __string2_1bptr_p(x) (((size_t) ((x) + 1) - (size_t) (x)) == 1)
@ -430,13 +431,13 @@ __STRING2_COPY_TYPE (8);
? memcmp (s1, s2, (strlen (s1) < strlen (s2) \ ? memcmp (s1, s2, (strlen (s1) < strlen (s2) \
? strlen (s1) : strlen (s2)) + 1) \ ? strlen (s1) : strlen (s2)) + 1) \
: (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \
&& __string2_1bptr_p (s2) && strlen (s1) < 4 \ && strlen (s1) < 4 \
? (__builtin_constant_p (s2) \ ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \
? __strcmp_cc (s1, s2, strlen (s1)) \ ? __strcmp_cc (s1, s2, strlen (s1)) \
: __strcmp_cg (s1, s2, strlen (s1))) \ : __strcmp_cg (s1, s2, strlen (s1))) \
: (__builtin_constant_p (s2) && __string2_1bptr_p (s1) \ : (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \
&& __string2_1bptr_p (s2) && strlen (s2) < 4 \ && strlen (s2) < 4 \
? (__builtin_constant_p (s1) \ ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1)\
? __strcmp_cc (s1, s2, strlen (s2)) \ ? __strcmp_cc (s1, s2, strlen (s2)) \
: __strcmp_gc (s1, s2, strlen (s2))) \ : __strcmp_gc (s1, s2, strlen (s2))) \
: strcmp (s1, s2))))) : strcmp (s1, s2)))))

View File

@ -70,7 +70,7 @@ main (void)
else else
{ {
status = EXIT_FAILURE; status = EXIT_FAILURE;
printf ("%Zd errors.\n", errors); printf ("%d errors.\n", errors);
} }
exit (status); exit (status);
} }

View File

@ -1,4 +1,4 @@
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. # Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -56,7 +56,7 @@ headers = $(addprefix rpc/,auth.h auth_unix.h clnt.h netdb.h pmap_clnt.h \
install-others = $(inst_sysconfdir)/rpc install-others = $(inst_sysconfdir)/rpc
generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \ generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \
$(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) \ $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) \
rpc-proto.c rpc-proto.c rpc-proto.d rpcgen
routines := auth_none auth_unix authuxprot bindrsvprt \ routines := auth_none auth_unix authuxprot bindrsvprt \
clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \ clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
@ -111,7 +111,9 @@ CFLAGS-xkey_prot.c = -Wno-unused
include ../Rules include ../Rules
$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
$(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
$(+link) $(+link)
# Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the # Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the

View File

@ -0,0 +1,95 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* System V/ARM ABI compliant context switching support. */
#ifndef _SYS_UCONTEXT_H
#define _SYS_UCONTEXT_H 1
#include <features.h>
#include <signal.h>
typedef int greg_t;
/* Number of general registers. */
#define NGREG 16
/* Container for all general registers. */
typedef greg_t gregset_t[NGREG];
/* Number of each register is the `gregset_t' array. */
enum
{
R0 = 0,
#define R0 R0
R1 = 1,
#define R1 R1
R2 = 2,
#define R2 R2
R3 = 3,
#define R3 R3
R4 = 4,
#define R4 R4
R5 = 5,
#define R5 R5
R6 = 6,
#define R6 R6
R7 = 7,
#define R7 R7
R8 = 8,
#define R8 R8
R9 = 9,
#define R9 R9
R10 = 10,
#define R10 R10
R11 = 11,
#define R11 R11
R12 = 12,
#define R12 R12
R13 = 13,
#define R13 R13
R14 = 14,
#define R14 R14
R15 = 15,
#define R15 R15
};
/* Structure to describe FPU registers. */
typedef struct fpregset
{
} fpregset_t;
/* Context to describe whole processor state. */
typedef struct
{
gregset_t gregs;
fpregset_t fpregs;
} mcontext_t;
/* Userlevel context. */
typedef struct ucontext
{
unsigned long int uc_flags;
struct ucontext *uc_links;
__sigset_t uc_sigmask;
stack_t uc_stack;
mcontext_t uc_mcontext;
long int uc_filler[5];
} ucontext_t;
#endif /* sys/ucontext.h */

View File

@ -1,4 +1,4 @@
# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -25,4 +25,6 @@ $(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \
# Make it unwritable so noone will edit it by mistake. # Make it unwritable so noone will edit it by mistake.
-chmod a-w $@-tmp -chmod a-w $@-tmp
mv -f $@-tmp $@ mv -f $@-tmp $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs commit -m'Regenerated from $^' $@ test ! -d CVS || cvs commit -m'Regenerated from $^' $@
endif

View File

@ -1,5 +1,5 @@
/* Double-precision floating point 2^x. /* Double-precision floating point 2^x.
Copyright (C) 1997 Free Software Foundation, Inc. Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au> Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@ -54,7 +54,10 @@ __ieee754_exp2 (double x)
fenv_t oldenv; fenv_t oldenv;
feholdexcept (&oldenv); feholdexcept (&oldenv);
#ifdef FE_TONEAREST
/* If we don't have this, it's too bad. */
fesetround (FE_TONEAREST); fesetround (FE_TONEAREST);
#endif
/* 1. Argument reduction. /* 1. Argument reduction.
Choose integers ex, -256 <= t < 256, and some real Choose integers ex, -256 <= t < 256, and some real

View File

@ -1,5 +1,5 @@
/* Single-precision floating point 2^x. /* Single-precision floating point 2^x.
Copyright (C) 1997 Free Software Foundation, Inc. Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Geoffrey Keating <geoffk@ozemail.com.au> Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
@ -55,7 +55,10 @@ __ieee754_exp2f (float x)
fenv_t oldenv; fenv_t oldenv;
feholdexcept (&oldenv); feholdexcept (&oldenv);
#ifdef FE_TONEAREST
/* If we don't have this, it's too bad. */
fesetround (FE_TONEAREST); fesetround (FE_TONEAREST);
#endif
/* 1. Argument reduction. /* 1. Argument reduction.
Choose integers ex, -128 <= t < 128, and some real Choose integers ex, -128 <= t < 128, and some real

View File

@ -55,7 +55,10 @@ getttyname (fd, mydev, myino, save, dostat)
} }
while ((d = readdir (dirstream)) != NULL) while ((d = readdir (dirstream)) != NULL)
if ((ino_t) d->d_fileno == myino || *dostat) if (((ino_t) d->d_fileno == myino || *dostat)
&& strcmp (d->d_name, "stdin")
&& strcmp (d->d_name, "stdout")
&& strcmp (d->d_name, "stderr"))
{ {
size_t dlen = _D_ALLOC_NAMLEN (d); size_t dlen = _D_ALLOC_NAMLEN (d);
if (sizeof (dev) + dlen > namelen) if (sizeof (dev) + dlen > namelen)

View File

@ -59,7 +59,10 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
} }
while ((d = readdir (dirstream)) != NULL) while ((d = readdir (dirstream)) != NULL)
if ((ino_t) d->d_fileno == myino || *dostat) if (((ino_t) d->d_fileno == myino || *dostat)
&& strcmp (d->d_name, "stdin")
&& strcmp (d->d_name, "stdout")
&& strcmp (d->d_name, "stderr"))
{ {
char *cp; char *cp;
size_t needed = _D_EXACT_NAMLEN (d) + 1; size_t needed = _D_EXACT_NAMLEN (d) + 1;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1991, 1994, 1996, 1997, 1998 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 The GNU C Library is free software; you can redistribute it and/or
@ -57,6 +57,7 @@
# define ENOSPC 29 # define ENOSPC 29
# define EEXIST 30 # define EEXIST 30
# define EBUSY 31 # define EBUSY 31
# define EOVERFLOW 32
#endif #endif
#define __set_errno(val) errno = (val) #define __set_errno(val) errno = (val)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. /* Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil, Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
On-Line Applications Research Corporation. On-Line Applications Research Corporation.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -26,7 +26,7 @@
#ifndef __FILEDESC_h #ifndef __FILEDESC_h
#define __FILEDESC_h #define __FILEDESC_h
#define _STDIO_H #define __need_FOPEN_MAX
#include <bits/stdio_lim.h> #include <bits/stdio_lim.h>
#ifndef __DECLARE_FILE_DESCRIPTORS__ #ifndef __DECLARE_FILE_DESCRIPTORS__

View File

@ -1,4 +1,4 @@
# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. # Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 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 # The GNU C Library is free software; you can redistribute it and/or
@ -38,8 +38,8 @@ $(common-objpfx)bits/local_lim.h: $(common-objpfx)mk-local_lim
$(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c $(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c
$(common-objdir-compile) $(common-objdir-compile)
before-compile := $(before-compile) $(common-objpfx)bits/local_lim.h before-compile += $(common-objpfx)bits/local_lim.h
common-generated := $(common-generated) local_lim.h mk-local_lim common-generated += bits/local_lim.h mk-local_lim
endif endif
@ -263,8 +263,8 @@ $(common-objpfx)sys/syscall.h: $(syscall.h)
> $@-tmp > $@-tmp
mv $@-tmp $@ mv $@-tmp $@
before-compile := $(before-compile) $(common-objpfx)syscall.h before-compile += $(common-objpfx)sys/syscall.h
common-generated := $(common-generated) syscall.h common-generated += sys/syscall.h
endif endif
@ -304,7 +304,11 @@ ifndef no_deps
endif endif
endif endif
$(common-objpfx)s-proto.d: $(common-objpfx)%.d: $(..)sysdeps/unix/%.S $(common-objpfx)s-proto.d: $(common-objpfx)%.d: $(..)sysdeps/unix/%.S \
$(wildcard $(+sysdep_dirs:%=%/syscalls.list))
$(+make-deps) $(+make-deps)
common-generated += s-proto.d
postclean-generated += sysd-syscalls
endif endif

View File

@ -36,7 +36,7 @@
/* This "generic Unix" implementation works because we provide the program /* This "generic Unix" implementation works because we provide the program
/usr/libexec/pt_chown, and it only depends on ptsname() working. */ /usr/libexec/pt_chown, and it only depends on ptsname() working. */
static const char helper[] = LIBEXECDIR "/pt_chown"; static const char helper[] = LIBEXECDIR "/pt_chown";
static const char *argv[] = { "pt_chown", NULL }; static char *const argv[] = { "pt_chown", NULL };
int int
grantpt (fd) grantpt (fd)
@ -71,7 +71,7 @@ grantpt (fd)
if (dup2 (fd, PTY_FD) == -1) if (dup2 (fd, PTY_FD) == -1)
_exit (FAIL_EBADF); _exit (FAIL_EBADF);
execve (helper, (char *const *) argv, 0); execve (helper, argv, 0);
_exit (FAIL_EXEC); _exit (FAIL_EXEC);
} }
else else

View File

@ -64,9 +64,44 @@ EOF
echo ' ret'; \\ echo ' ret'; \\
echo 'PSEUDO_END($strong)'; \\" echo 'PSEUDO_END($strong)'; \\"
# Append any weak aliases defined for this syscall function. # Append any weak aliases or versions defined for this syscall function.
# A shortcoming in the current gas is that it will only allow one
# version-alias per symbol. So we create new strong aliases as needed.
vcount=""
for name in $weak; do for name in $weak; do
case $name in
*@@*)
base=`echo $name | sed 's/@.*//'`
ver=`echo $name | sed 's/@.*//'`
if test -z "$vcount" ; then
source=$strong
vcount=1
else
source="${strong}_${vcount}"
vcount=`expr $vcount + 1`
echo " echo 'strong_alias ($strong, $source)'; \\"
fi
echo " echo 'default_symbol_version($source, $base, $ver)'; \\"
;;
*@*)
base=`echo $name | sed 's/@.*//'`
ver=`echo $name | sed 's/.*@//'`
if test -z "$vcount" ; then
source=$strong
vcount=1
else
source="${strong}_${vcount}"
vcount=`expr $vcount + 1`
echo " echo 'strong_alias ($strong, $source)'; \\"
fi
echo " echo 'symbol_version($source, $base, $ver)'; \\"
;;
*)
echo " echo 'weak_alias ($strong, $name)'; \\" echo " echo 'weak_alias ($strong, $name)'; \\"
;;
esac
done done
# And finally, pipe this all into the compiler. # And finally, pipe this all into the compiler.

View File

@ -9,7 +9,7 @@ CPPFLAGS += -DHAVE_LLSEEK=1
endif endif
ifeq ($(subdir),misc) ifeq ($(subdir),misc)
sysdep_routines += sysctl clone llseek sysdep_routines += sysctl clone llseek getresuid getresgid
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
sys/io.h sys/klog.h sys/kdaemon.h \ sys/io.h sys/klog.h sys/kdaemon.h \

View File

@ -54,6 +54,9 @@ shutdown - shutdown 2 __shutdown shutdown
socketpair - socketpair 4 __socketpair socketpair socketpair - socketpair 4 __socketpair socketpair
sysctl - _sysctl 6 sysctl sysctl - _sysctl 6 sysctl
getresuid - getresuid 3 getresuid
getresgid - getresgid 3 getresuid
# access pci space protected from machine checks: # access pci space protected from machine checks:
pciconfig_read EXTRA pciconfig_read 5 pciconfig_read pciconfig_read EXTRA pciconfig_read 5 pciconfig_read
pciconfig_write EXTRA pciconfig_write 5 pciconfig_write pciconfig_write EXTRA pciconfig_write 5 pciconfig_write

View File

@ -0,0 +1,39 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <unistd.h>
#include <sys/types.h>
#include <linux/posix_types.h>
extern int __syscall_getresgid (__kernel_gid_t *rgid, __kernel_gid_t *egid,
__kernel_gid_t *sgid);
int
getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
{
__kernel_gid_t k_rgid, k_egid, k_sgid;
if (__syscall_getresgid (&k_rgid, &k_egid, &k_sgid) < 0)
return -1;
*rgid = (gid_t) k_rgid;
*egid = (gid_t) k_egid;
*sgid = (gid_t) k_sgid;
return 0;
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <unistd.h>
#include <sys/types.h>
#include <linux/posix_types.h>
extern int __syscall_getresuid (__kernel_uid_t *ruid, __kernel_uid_t *euid,
__kernel_uid_t *suid);
int
getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
{
__kernel_uid_t k_ruid, k_euid, k_suid;
if (__syscall_getresuid (&k_ruid, &k_euid, &k_suid) < 0)
return -1;
*ruid = (uid_t) k_ruid;
*euid = (uid_t) k_euid;
*suid = (uid_t) k_suid;
return 0;
}

View File

@ -1,5 +1,5 @@
/* POSIX.1 `sigaction' call for Linux/i386. /* POSIX.1 `sigaction' call for Linux/i386.
Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1991, 1995, 1996, 1997, 1998 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 The GNU C Library is free software; you can redistribute it and/or
@ -33,7 +33,7 @@ extern int __syscall_rt_sigaction (int, const struct sigaction *,
/* The variable is shared between all wrappers around signal handling /* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. */ functions which have RT equivalents. */
int __libc_have_rt_sigs = -1; int __libc_missing_rt_sigs;
/* If ACT is not NULL, change the action for SIG to *ACT. /* If ACT is not NULL, change the action for SIG to *ACT.
@ -45,7 +45,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
int result; int result;
/* First try the RT signals. */ /* First try the RT signals. */
if (__libc_have_rt_sigs) if (!__libc_missing_rt_sigs)
{ {
struct sigaction nact, *nactp; struct sigaction nact, *nactp;
@ -69,7 +69,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
if (result >= 0 || errno != ENOSYS) if (result >= 0 || errno != ENOSYS)
return result; return result;
__libc_have_rt_sigs = 0; __libc_missing_rt_sigs = 1;
} }
if (act) if (act)

View File

@ -34,6 +34,9 @@ shutdown - shutdown 2 __shutdown shutdown
socket - socket 3 __socket socket socket - socket 3 __socket socket
socketpair - socketpair 4 __socketpair socketpair socketpair - socketpair 4 __socketpair socketpair
getresuid - getresuid 3 getresuid
getresgid - getresgid 3 getresuid
# #
# There are defined locally because the caller is also defined in this dir. # There are defined locally because the caller is also defined in this dir.
# #

View File

@ -41,8 +41,12 @@
#define stackblock 20 #define stackblock 20
#ifndef __socket
#define __socket P(__,socket)
#endif
.text .text
ENTRY(P(__,socket)) ENTRY(__socket)
stwu %r1,-48(%r1) stwu %r1,-48(%r1)
#if NARGS >= 1 #if NARGS >= 1
stw %r3,stackblock(%r1) stw %r3,stackblock(%r1)
@ -76,6 +80,6 @@ ENTRY(P(__,socket))
DO_CALL(SYS_ify(socketcall)) DO_CALL(SYS_ify(socketcall))
addi %r1,%r1,48 addi %r1,%r1,48
PSEUDO_RET PSEUDO_RET
PSEUDO_END (P(__,socket)) PSEUDO_END (__socket)
weak_alias (P(__,socket), socket) weak_alias (__socket, socket)

View File

@ -1,3 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names # File name Caller Syscall name # args Strong name Weak names
s_llseek llseek _llseek 5 __sys_llseek s_llseek llseek _llseek 5 __sys_llseek
getresuid - getresuid 3 getresuid
getresgid - getresgid 3 getresuid

View File

@ -34,7 +34,7 @@
of the associated slave. */ of the associated slave. */
static char namebuf[PTYNAMELEN]; static char namebuf[PTYNAMELEN];
extern const char __ptyname1[], __ptyname2[]; /* defined in getpt.c */ extern const char __ptyname1[], __ptyname2[]; /* Defined in getpt.c. */
char * char *
ptsname (fd) ptsname (fd)
@ -57,7 +57,7 @@ __ptsname_r (fd, buf, len)
static int tiocgptn_works = 1; static int tiocgptn_works = 1;
if (tiocgptn_works) if (tiocgptn_works)
{ {
if (!ioctl (fd, TIOCGPTN, &ptyno)) if (ioctl (fd, TIOCGPTN, &ptyno) == 0)
goto gotit; goto gotit;
else else
{ {
@ -70,10 +70,12 @@ __ptsname_r (fd, buf, len)
#endif #endif
/* /dev/ptmx will make it into the kernel before 32 bit dev_t, so /* /dev/ptmx will make it into the kernel before 32 bit dev_t, so
this should be safe. */ this should be safe. */
if (fstat (fd, &st)) if (__fxstat (_STAT_VER, fd, &st))
return 0; return 0;
ptyno = minor (st.st_rdev); ptyno = minor (st.st_rdev);
if (major (st.st_rdev) == 4)
ptyno -= 128;
#ifdef TIOCGPTN #ifdef TIOCGPTN
gotit: gotit:
@ -82,27 +84,24 @@ gotit:
the SVr4 way. */ the SVr4 way. */
idbuf[5] = '\0'; idbuf[5] = '\0';
stpcpy (stpcpy (nbuf, "/dev/pts/"), __stpcpy (__stpcpy (nbuf, "/dev/pts/"),
_itoa_word (ptyno, &idbuf[4], 10, 0)); _itoa_word (ptyno, &idbuf[4], 10, 0));
if (!stat (nbuf, &st)) if (!__xstat (_STAT_VER, nbuf, &st))
{ return strncpy (buf, nbuf, len);
strncpy (buf, nbuf, len);
return buf;
}
else else
if (errno != ENOENT) if (errno != ENOENT)
return NULL; return NULL;
/* ...and the BSD way. */ /* ...and the BSD way. */
nbuf[5] = 't';
nbuf[7] = 'y'; nbuf[7] = 'y';
nbuf[8] = __ptyname1[ptyno / 16]; nbuf[8] = __ptyname1[ptyno / 16];
nbuf[9] = __ptyname2[ptyno % 16]; nbuf[9] = __ptyname2[ptyno % 16];
nbuf[10] = '\0'; nbuf[10] = '\0';
if (stat (nbuf, &st)) if (__xstat (_STAT_VER, nbuf, &st))
return NULL; return NULL;
strncpy (buf, nbuf, len); return strncpy (buf, nbuf, len);
return buf;
} }
weak_alias (__ptsname_r, ptsname_r) weak_alias (__ptsname_r, ptsname_r)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 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 The GNU C Library is free software; you can redistribute it and/or
@ -31,7 +31,7 @@ extern int __syscall_rt_sigaction (int, const struct sigaction *,
/* The variable is shared between all wrappers around signal handling /* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. */ functions which have RT equivalents. */
int __libc_have_rt_sigs = -1; int __libc_missing_rt_sigs;
/* If ACT is not NULL, change the action for SIG to *ACT. /* If ACT is not NULL, change the action for SIG to *ACT.
@ -46,7 +46,7 @@ __sigaction (sig, act, oact)
int error; int error;
/* First try the RT signals. */ /* First try the RT signals. */
if (__libc_have_rt_sigs) if (!__libc_missing_rt_sigs)
{ {
/* XXX The size argument hopefully will have to be changed to the /* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */ real size of the user-level sigset_t. */
@ -55,7 +55,7 @@ __sigaction (sig, act, oact)
if (result >= 0 || errno != ENOSYS) if (result >= 0 || errno != ENOSYS)
return result; return result;
__libc_have_rt_sigs = 0; __libc_missing_rt_sigs = 1;
} }
if (act) if (act)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 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 The GNU C Library is free software; you can redistribute it and/or
@ -25,8 +25,8 @@ extern int __syscall_rt_sigpending (sigset_t *, size_t);
/* The variable is shared between all wrappers around signal handling /* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. It is defined in sigaction.c. */ functions which have RT equivalents. */
extern int __libc_have_rt_sigs; int __libc_missing_rt_sigs;
/* Change the set of blocked signals to SET, /* Change the set of blocked signals to SET,
@ -36,7 +36,7 @@ sigpending (set)
sigset_t *set; sigset_t *set;
{ {
/* First try the RT signals. */ /* First try the RT signals. */
if (__libc_have_rt_sigs) if (!__libc_missing_rt_sigs)
{ {
/* XXX The size argument hopefully will have to be changed to the /* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */ real size of the user-level sigset_t. */
@ -45,7 +45,7 @@ sigpending (set)
if (result >= 0 || errno != ENOSYS) if (result >= 0 || errno != ENOSYS)
return result; return result;
__libc_have_rt_sigs = 0; __libc_missing_rt_sigs = 1;
} }
return __syscall_sigpending (set); return __syscall_sigpending (set);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 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 The GNU C Library is free software; you can redistribute it and/or
@ -25,8 +25,8 @@ extern int __syscall_rt_sigprocmask (int, const sigset_t *, sigset_t *,
size_t); size_t);
/* The variable is shared between all wrappers around signal handling /* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. It is defined in sigaction.c. */ functions which have RT equivalents. */
extern int __libc_have_rt_sigs; int __libc_missing_rt_sigs;
/* Get and/or change the set of blocked signals. */ /* Get and/or change the set of blocked signals. */
@ -37,7 +37,7 @@ __sigprocmask (how, set, oset)
sigset_t *oset; sigset_t *oset;
{ {
/* First try the RT signals. */ /* First try the RT signals. */
if (__libc_have_rt_sigs) if (!__libc_missing_rt_sigs)
{ {
/* XXX The size argument hopefully will have to be changed to the /* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */ real size of the user-level sigset_t. */
@ -46,7 +46,7 @@ __sigprocmask (how, set, oset)
if (result >= 0 || errno != ENOSYS) if (result >= 0 || errno != ENOSYS)
return result; return result;
__libc_have_rt_sigs = 0; __libc_missing_rt_sigs = 1;
} }
return __syscall_sigprocmask (how, set, oset); return __syscall_sigprocmask (how, set, oset);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -25,8 +25,8 @@ extern int __syscall_rt_sigsuspend (const sigset_t *, size_t);
/* The variable is shared between all wrappers around signal handling /* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. It is defined in sigaction.c. */ functions which have RT equivalents. */
extern int __libc_have_rt_sigs; int __libc_missing_rt_sigs;
/* Change the set of blocked signals to SET, /* Change the set of blocked signals to SET,
@ -36,7 +36,7 @@ __sigsuspend (set)
const sigset_t *set; const sigset_t *set;
{ {
/* First try the RT signals. */ /* First try the RT signals. */
if (__libc_have_rt_sigs) if (!__libc_missing_rt_sigs)
{ {
/* XXX The size argument hopefully will have to be changed to the /* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */ real size of the user-level sigset_t. */
@ -45,7 +45,7 @@ __sigsuspend (set)
if (result >= 0 || errno != ENOSYS) if (result >= 0 || errno != ENOSYS)
return result; return result;
__libc_have_rt_sigs = 0; __libc_missing_rt_sigs = 1;
} }
return __syscall_sigsuspend (0, 0, set->__val[0]); return __syscall_sigsuspend (0, 0, set->__val[0]);

View File

@ -30,3 +30,6 @@ sendto - sendto 6 __libc_sendto __sendto sendto
setsockopt - setsockopt 5 __setsockopt setsockopt setsockopt - setsockopt 5 __setsockopt setsockopt
shutdown - shutdown 2 __shutdown shutdown shutdown - shutdown 2 __shutdown shutdown
socketpair - socketpair 4 __socketpair socketpair socketpair - socketpair 4 __socketpair socketpair
getresuid - getresuid 3 getresuid
getresgid - getresgid 3 getresuid

View File

@ -13,15 +13,13 @@ geteuid - geteuid 0 __geteuid geteuid
getpgid - getpgid 1 __getpgid getpgid getpgid - getpgid 1 __getpgid getpgid
getpgrp - getpgrp 0 getpgrp getpgrp - getpgrp 0 getpgrp
getppid - getppid 0 __getppid getppid getppid - getppid 0 __getppid getppid
getresgid EXTRA getresgid 3 getresgid
getresuid EXTRA getresuid 3 getresuid
getsid - getsid 1 getsid getsid - getsid 1 getsid
init_module EXTRA init_module 5 init_module init_module EXTRA init_module 5 init_module
ioperm - ioperm 3 ioperm ioperm - ioperm 3 ioperm
iopl - iopl 1 iopl iopl - iopl 1 iopl
ipc msgget ipc 5 __ipc ipc msgget ipc 5 __ipc
klogctl EXTRA syslog 3 klogctl klogctl EXTRA syslog 3 klogctl
lchown EXATR lchown 3 __lchown lchown lchown EXTRA lchown 3 __lchown lchown
mlock EXTRA mlock 2 __mlock mlock mlock EXTRA mlock 2 __mlock mlock
mlockall EXTRA mlockall 1 __mlockall mlockall mlockall EXTRA mlockall 1 __mlockall mlockall
mount EXTRA mount 5 __mount mount mount EXTRA mount 5 __mount mount
@ -44,6 +42,8 @@ rt_sigsuspend - rt_sigsuspend 2 __syscall_rt_sigsuspend
rt_sigtimedwait - rt_sigtimedwait 4 __syscall_rt_sigtimedwait rt_sigtimedwait - rt_sigtimedwait 4 __syscall_rt_sigtimedwait
s_getdents EXTRA getdents 3 __getdents s_getdents EXTRA getdents 3 __getdents
s_getpriority getpriority getpriority 2 __syscall_getpriority s_getpriority getpriority getpriority 2 __syscall_getpriority
s_getresgid getresgid getresgid 3 __syscall_getresgid
s_getresuid getresuid getresuid 3 __syscall_getresuid
s_poll poll poll 3 __syscall_poll s_poll poll poll 3 __syscall_poll
s_pread64 EXTRA pread 5 __syscall_pread64 s_pread64 EXTRA pread 5 __syscall_pread64
s_ptrace ptrace ptrace 4 __syscall_ptrace s_ptrace ptrace ptrace 4 __syscall_ptrace