summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog248
-rw-r--r--FAQ.in50
-rw-r--r--Makefile19
-rw-r--r--Makerules24
-rw-r--r--NEWS11
-rw-r--r--csu/Makefile3
-rw-r--r--db2/Makefile1
-rw-r--r--elf/Makefile19
-rw-r--r--elf/rtld.map12
-rw-r--r--include/libc-symbols.h16
-rw-r--r--inet/netinet/in.h2
-rw-r--r--io/fts.c2
-rw-r--r--io/sys/stat.h4
-rw-r--r--libc.map11
-rw-r--r--localedata/Makefile6
-rw-r--r--login/Makefile3
-rw-r--r--malloc/Makefile3
-rw-r--r--manual/errno.texi6
-rw-r--r--manual/socket.texi5
-rw-r--r--manual/stdio.texi8
-rw-r--r--manual/users.texi476
-rw-r--r--misc/efgcvt_r.c56
-rw-r--r--misc/tst-efgcvt.c112
-rw-r--r--nscd/Makefile8
-rw-r--r--nscd/grpcache.c2
-rw-r--r--nss/test-netdb.c3
-rw-r--r--po/Makefile2
-rw-r--r--resolv/gethnamaddr.c2
-rw-r--r--resolv/nss_dns/dns-host.c23
-rw-r--r--signal/signal.h6
-rw-r--r--stdlib/atoll.c4
-rw-r--r--string/bits/string2.h13
-rw-r--r--string/tst-inlcall.c2
-rw-r--r--sunrpc/Makefile8
-rw-r--r--sysdeps/arm/sys/ucontext.h95
-rw-r--r--sysdeps/gnu/Makefile4
-rw-r--r--sysdeps/libm-ieee754/s_exp2.c5
-rw-r--r--sysdeps/libm-ieee754/s_exp2f.c5
-rw-r--r--sysdeps/posix/ttyname.c5
-rw-r--r--sysdeps/posix/ttyname_r.c5
-rw-r--r--sysdeps/standalone/arm/bits/errno.h3
-rw-r--r--sysdeps/standalone/filedesc.h4
-rw-r--r--sysdeps/unix/Makefile16
-rw-r--r--sysdeps/unix/grantpt.c4
-rw-r--r--sysdeps/unix/make-syscalls.sh39
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/getresgid.c39
-rw-r--r--sysdeps/unix/sysv/linux/getresuid.c39
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c8
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/ptsname.c27
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c8
-rw-r--r--sysdeps/unix/sysv/linux/sigpending.c10
-rw-r--r--sysdeps/unix/sysv/linux/sigprocmask.c10
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list6
60 files changed, 1154 insertions, 382 deletions
diff --git a/ChangeLog b/ChangeLog
index abbc7166e4..96ff260c02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* sysdeps/unix/sysv/linux/alpha/clone.S: Elide terminal ldgp for PROF.
diff --git a/FAQ.in b/FAQ.in
index bc7d3de276..70121cfc6e 100644
--- a/FAQ.in
+++ b/FAQ.in
@@ -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.
 
 ??	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.
-The librt internally uses threads and it has implicit references to
-the thread library.  Normally these references are satisfied
-automatically but if the thread library belonging to the librt is not
-in the expected place one has to specify this place.  When using GNU
-ld it works like this:
+{UD} In this case you probably mixed up your installation.  librt uses
+threads internally and has implicit references to the thread library.
+Normally these references are satisfied automatically but if the
+thread library is not in the expected place you must tell the linker
+where it is.  When using GNU ld it works like this:
 
 	gcc -o foo foo.c -Wl,-rpath-link=/some/other/dir -lrt
 
-The `/some/other/dir' should contain the matching thread library and
-`ld' will use the given path to find the implicitly referenced library
-while not disturbing any other link path order.
+The `/some/other/dir' should contain the thread library.  `ld' will
+use the given path to find the implicitly referenced library while not
+disturbing any other link path.
 
 ??	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
 	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
 http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
 
-??	I have killed ypbind to stop using NIS, but glibc will
-        continue using NIS.
+??	I have killed ypbind to stop using NIS, but glibc
+        continues using NIS.
 
 {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
-files, so glibc will use them furthermore.  Other BSD versions seem to
-work correct.  Until ypbind 3.4 is released, you can find a patch at
+files, so glibc will continue to use them.  Other BSD versions seem to
+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.
 
 ??	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
 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
 
 ??	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>
 {TK} Thorsten Kukuk, <kukuk@vt.uni-paderborn.de>
 {GK} Geoffrey Keating, <Geoff.Keating@anu.edu.au>
+{HJ} H.J. Lu, <hjl@gnu.org>
 
 Local Variables:
  mode:outline
diff --git a/Makefile b/Makefile
index 84e31d307e..02c4a6e909 100644
--- a/Makefile
+++ b/Makefile
@@ -127,7 +127,11 @@ include Makerules
 install: subdir_install
 
 # 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.
 # 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 "\"";						\
 	 fi) > $@T
 	mv -f $@T $@
-generated += version-info.h
 
 version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
 $(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)) \
 	       $(addprefix $(objpfx),$(install-lib))
 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
 # 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
 mostlyclean: parent-mostlyclean
 	@$(MAKE) subdir_mostlyclean no_deps=t
+	-rm -f $(postclean)
 
 # The realclean target is just like distclean for the parent, but we want
 # 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
 # subdirectories are dealt with and so they won't try to remove object
 # 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.
 distclean-1: subdir_$(distclean-1)
@@ -312,6 +319,8 @@ parent-tests: $(objpfx)isomac
 
 $(objpfx)isomac: isomac.c
 	$(native-compile)
+
+generated += isomac isomac.out
 
 # Make the distribution tarfile.
 
diff --git a/Makerules b/Makerules
index 563c528b93..27e6a3a378 100644
--- a/Makerules
+++ b/Makerules
@@ -103,8 +103,8 @@ vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
 # being included individually by a subdir makefile (hurd/Makefile needs this).
 in-Makerules := yes
 
-ifndef avoid-generated
 -include $(+sysdir_pfx)sysd-Makefile
+ifndef avoid-generated
 ifneq ($(sysd-Makefile-sysdirs),$(config-sysdirs))
 sysd-Makefile-force = FORCE
 FORCE:
@@ -383,15 +383,25 @@ LDLIBS-c.so = $(gnulib)
 LDFLAGS-c.so += -e __libc_main
 # We have a versioning file for libc.so.
 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.
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
-			 $(common-objpfx)libc_pic.a \
+			 $(common-objpfx)libc_pic.os \
 			 $(elfobjdir)/sofini.os $(elfobjdir)/ld.so \
 			 $(libc-map)
 	$(build-shlib)
+common-generated += libc.so
 ifdef libc.so-version
 $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
 	$(make-link)
+common-generated += libc.so$(libc.so-version)
 endif
 endif
 
@@ -719,6 +729,7 @@ endef
 object-suffixes-left := $(versioned)
 include $(o-iterator)
 
+generated += $(foreach o,$(versioned),$o$($o-version))
 
 ifeq (,$($(subdir)-version))
 define o-iterator-doit
@@ -824,10 +835,15 @@ install-others-nosubdir: $(install-others)
 install-%:: install-%-nosubdir ;
 
 .PHONY: install install-no-libc.a-nosubdir
+ifeq ($(build-programs),yes)
 install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
 			    install-bin-nosubdir install-lib-nosubdir	\
 			    install-others-nosubdir install-rootsbin-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
 
 # Command to compile $< in $(objdir) using the native libraries.
@@ -880,7 +896,9 @@ common-mostlyclean:
 				     $(addsuffix .o,$(tests) $(test-srcs) \
 						    $(others)) \
 				     $(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)
 	$(rmobjs)
 define rmobjs
diff --git a/NEWS b/NEWS
index 71159014b0..3456d1d501 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
 
 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
 
+* 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
   model and probably more was implemented by Ulrich Drepper.
 
diff --git a/csu/Makefile b/csu/Makefile
index 681366a274..37ce7ccb7e 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -1,6 +1,6 @@
 # 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.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -44,6 +44,7 @@ include ../Makeconfig
 
 ifeq ($(elf),yes)
 before-compile = $(objpfx)abi-tag.h
+generated += abi-tag.h
 endif
 
 ifeq ($(have-initfini),yes)
diff --git a/db2/Makefile b/db2/Makefile
index 02f1b300e6..fb25bb6de1 100644
--- a/db2/Makefile
+++ b/db2/Makefile
@@ -53,6 +53,7 @@ vpath %.c $(subdir-dirs)
 
 extra-libs := libdb
 extra-libs-others := $(extra-libs)
+extra-objs = getlong.o
 
 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 \
diff --git a/elf/Makefile b/elf/Makefile
index c49916cec8..eb3ff48caf 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,6 +1,6 @@
 # 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.
 
 # 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
 # interpreter and operating independent of libc.
 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 \
 		  dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \
 		  genrtldtbl.awk atomicity.h dl-procinfo.h
@@ -53,13 +54,14 @@ include ../Makeconfig
 
 ifeq (yes,$(build-shared))
 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-bin	= ldd
+generated      += ldd
 endif
 
 ifeq (yes,$(has-ldconfig))
-extra-objs	+= ldconfig.o
+others		+= ldconfig
 install-rootsbin = ldconfig
 
 $(objpfx)ldconfig: $(objpfx)ldconfig.o
@@ -111,7 +113,8 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
 define rtld-link
 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
 	  -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
-	  $(filter-out $(objpfx)rtld-ldscript,$^)
+	  $(filter-out $(objpfx)rtld-ldscript,$^) \
+	  -Wl,--version-script=$(rtld-map)
 endef
 else
 $(objpfx)ld.so: $(objpfx)librtld.os
@@ -119,7 +122,8 @@ $(objpfx)ld.so: $(objpfx)librtld.os
 
 define rtld-link
 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-	  -Wl,-rpath=$(default-rpath) $^
+	  -Wl,-rpath=$(default-rpath) $^ \
+	  -Wl,--version-script=$(rtld-map)
 endef
 endif
 
@@ -132,6 +136,7 @@ ifneq (ld.so,$(rtld-installed-name))
 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
 	rm -f $@
 	ln -s $(<F) $@
+generated += $(rtld-installed-name)
 endif
 
 # 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)
 	$(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)
 $(objpfx)ldd: ldd.sh.in $(common-objpfx)version.mk \
 	      $(common-objpfx)soversions.mk $(common-objpfx)config.make
diff --git a/elf/rtld.map b/elf/rtld.map
new file mode 100644
index 0000000000..8daf2aa97a
--- /dev/null
+++ b/elf/rtld.map
@@ -0,0 +1,12 @@
+GLIBC_2.0 {
+  global:
+    # Not right, but I'll figure it out.
+    *;
+
+#  local:
+#    *;
+};
+
+GLIBC_2.1 {
+
+} GLIBC_2.0;
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4a0349b666..dee8865ba3 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -1,6 +1,6 @@
 /* Support macros for making weak and strong aliases for symbols,
    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.
 
    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.  */
 
 #if DO_VERSIONING
-# define symbol_version(real, name, version) \
+# 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) \
      __asm__ (".symver " #real "," #name "@" #version)
-# define default_symbol_version(real, name, version) \
+#  define default_symbol_version(real, name, version) \
      __asm__ (".symver " #real "," #name "@@" #version)
+# endif
 #else
 # 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 /* libc-symbols.h */
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index faaf7e8a63..6b59930008 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -274,7 +274,7 @@ extern uint16_t htons __P ((uint16_t __hostshort));
 	 (((uint32_t *) (a))[3] == ((uint32_t *) (b))[3]))
 
 /* 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.  */
diff --git a/io/fts.c b/io/fts.c
index 2ddb295c03..73f502fc26 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -703,7 +703,7 @@ mem1:				saved_errno = errno;
 				p->fts_info = FTS_NSOK;
 			p->fts_accpath = cur->fts_accpath;
 		} else if (nlinks == 0
-#ifdef DT_DIR
+#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
 		    || nlinks > 0 &&
 		    dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
 #endif
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 76ef3c5f28..944c436d8c 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -92,7 +92,7 @@ __BEGIN_DECLS
 # ifdef __S_IFIFO
 #  define S_IFIFO	__S_IFIFO
 # endif
-# ifndef __USE_UNIX98
+# if defined __USE_BSD || defined __USE_MISC
 #  ifdef __S_IFLNK
 #   define S_IFLNK	__S_IFLNK
 #  endif
diff --git a/libc.map b/libc.map
index d6f235f407..15f6e62205 100644
--- a/libc.map
+++ b/libc.map
@@ -20,6 +20,9 @@ GLIBC_2.0 {
     # This is for ix86 only.
     _fp_hw;
 
+    # This is for sparc only.
+    .div; .mul; .rem; .udiv; .umul; .urem;
+
     # helper functions
     __errno_location; __libc_init_first; __h_errno_location;
     __libc_current_sigrtmin; __libc_current_sigrtmax; __libc_allocate_rtsig;
@@ -443,4 +446,12 @@ GLIBC_2.1 {
     # Since we have new signals this structure changed.
     _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;
diff --git a/localedata/Makefile b/localedata/Makefile
index 68bdf15bab..ff3e9f07a0 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -32,6 +32,10 @@ locales := $(filter-out $(addprefix locales/, CVS RCS %~), \
 
 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-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 \
 	      README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in	 \
diff --git a/login/Makefile b/login/Makefile
index ce321cba97..e203e9a692 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -54,7 +54,8 @@ include ../Rules
 
 # pt_chown needs to be setuid root.
 $(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)
 
diff --git a/malloc/Makefile b/malloc/Makefile
index ca651d6b03..22049713d7 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -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.
 
 # 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.
 ifneq ($(PERL),no)
 install-bin = mtrace
+generated = mtrace
 
 # The Perl script will print addresses and to do this nicely we must know
 # whether we are on a 32 or 64 bit machine.
diff --git a/manual/errno.texi b/manual/errno.texi
index c073deb7f8..86b4c74e7a 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -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})
 The @code{strerror_r} function works like @code{strerror} but instead of
 returning the error message in a statically allocated buffer shared by
-all threads in the process, it writes the message string in the user
-supplied buffer starting at @var{buf} with the length of @var{n} bytes.
+all threads in the process, it returns a private copy for the
+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
 up to the user to select the buffer large enough.
diff --git a/manual/socket.texi b/manual/socket.texi
index 45b9bbb892..1135230cb0 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -897,8 +897,9 @@ indicate error return.
 @comment BSD
 @deftypefun {unsigned long int} inet_network (const char *@var{name})
 This function extracts the network number from the address @var{name},
-given in the standard numbers-and-dots notation.
-If the input is not valid, @code{inet_network} returns @code{-1}.
+given in the standard numbers-and-dots notation. The returned address is
+in host order. If the input is not valid, @code{inet_network} returns
+@code{-1}.
 @end deftypefun
 
 @comment arpa/inet.h
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 40d9f227b4..58605702e0 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -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}.
 
 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},
-not all characters from the result have been stored in @var{s}.  You
-should try again with a bigger output string.  Here is an example of
-doing this:
+for the given input, excluding the trailing null.  If this value is
+greater or equal to @var{size}, not all characters from the result have
+been stored in @var{s}.  You should try again with a bigger output
+string.  Here is an example of doing this:
 
 @smallexample
 @group
diff --git a/manual/users.texi b/manual/users.texi
index e6e358f44a..5ee2e64deb 100644
--- a/manual/users.texi
+++ b/manual/users.texi
@@ -49,9 +49,9 @@ can use to examine these databases.
                         	 accessing the user database.
 * Group Database::              Functions and data structures for
                         	 accessing the group database.
-* Netgroup Database::           Functions for accessing the netgroup database.
-* Database Example::            Example program showing use of database
+* Database Example::            Example program showing the use of database
 				 inquiry functions.
+* Netgroup Database::           Functions for accessing the netgroup database.
 @end menu
 
 @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 ID
-Users are classified in @dfn{groups}.  Each user name also belongs to
-one or more groups, and has one @dfn{default group}.  Users who are
-members of the same group can share resources (such as files) that are
-not accessible to users who are not a member of that group.  Each group
-has a @dfn{group name} and @dfn{group ID}.  @xref{Group Database},
-for how to find information about a group ID or group name.
+Users are classified in @dfn{groups}.  Each user name belongs to one
+@dfn{default group} and may also belong to any number of
+@dfn{supplementary groups}. Users who are members of the same group can
+share resources (such as files) that are not accessible to users who are
+not a member of that group.  Each group has a @dfn{group name} and
+@dfn{group ID}.  @xref{Group Database}, for how to find information
+about a group ID or group name.
 
 @node Process Persona
 @section The Persona of a Process
 @cindex persona
 @cindex effective user ID
 @cindex effective group ID
+@cindex supplementary group IDs
 
-@c !!! bogus; not single ID.  set of effective group IDs (and, in GNU,
-@c set of effective UIDs) determines privilege.  lying here and then
-@c telling the truth below is confusing.
-At any time, each process has a single user ID and a group ID which
-determine the privileges of the process.  These are collectively called
-the @dfn{persona} of the process, because they determine ``who it is''
-for purposes of access control.  These IDs are also called the
-@dfn{effective user ID} and @dfn{effective group ID} of the process.
+@c When Hurd is more widely used, explain multiple effective user IDs
+@c here. -zw
+At any time, each process has an @dfn{effective user ID}, a @dfn{effective
+group ID}, and a set of @dfn{supplementary group IDs}.  These IDs 
+determine the privileges of the process.  They are collectively
+called the @dfn{persona} of the process, because they determine ``who it
+is'' for purposes of access control.
 
 Your login shell starts out with a persona which consists of your user
-ID and your default group ID.
-@c !!! also supplementary group IDs.
-In normal circumstances, all your other processes inherit these values.
+ID, your default group ID, and your supplementary group IDs (if you are
+in more than one group).  In normal circumstances, all your other processes
+inherit these values.
 
 @cindex real user ID
 @cindex real group ID
@@ -106,16 +107,19 @@ also important.
 Both the real and effective user ID can be changed during the lifetime
 of a process.  @xref{Why Change Persona}.
 
-@cindex supplementary group IDs
-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
+For details on how a process's effective user ID and group IDs affect
 its permission to access files, see @ref{Access Permission}.
 
-The user ID of a process also controls permissions for sending signals
-using the @code{kill} function.  @xref{Signaling Another Process}.
+The effective user ID of a process also controls permissions for sending
+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
 @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
 @section How an Application Can Change Persona
 @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
 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
 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
-automatically changes the effective user ID to the user that owns the
-file.  Likewise, executing a file whose setgid bit is set changes the
-effective group ID to the group of the file.  @xref{Executing a File}.
-Creating a file that changes to a particular user or group ID thus
-requires full access to that user or group ID.
+When the setuid bit of an executable file is on, executing that file
+gives the process a third user ID: the @dfn{file user ID}.  This ID is
+set to the owner ID of the file.  The system then changes the effective
+user ID to the file user ID.  The real user ID remains as it was.
+Likewise, if the setgid bit is on, the process is given a @dfn{file
+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
 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
 @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 POSIX.1
-@deftypefun int setuid (uid_t @var{newuid})
-This function sets both the real and effective user ID of the process
-to @var{newuid}, provided that the process has appropriate privileges.
-@c !!! also sets saved-id
-
-If the process is not privileged, then @var{newuid} must either be equal
-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
+@deftypefun int seteuid(uid_t @var{neweuid})
+This function sets the effective user ID of a process to @var{newuid},
+provided that the process is allowed to change its effective user ID.  A
+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.
+
+The @code{seteuid} function returns a value of @code{0} to indicate
 successful completion, and a value of @code{-1} to indicate an error.
 The following @code{errno} error conditions are defined for this
 function:
@@ -297,9 +307,27 @@ function:
 The value of the @var{newuid} argument is invalid.
 
 @item EPERM
-The process does not have the appropriate privileges; you do not
-have permission to change to the specified ID.
+The process may not change to the specified ID.
 @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
 
 @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.
 
 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
-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
 Setuid}.
 
@@ -339,31 +367,49 @@ the header files @file{sys/types.h} and @file{unistd.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 POSIX.1
 @deftypefun int setgid (gid_t @var{newgid})
 This function sets both the real and effective group ID of the process
-to @var{newgid}, provided that the process has appropriate privileges.
-@c !!! also sets saved-id
+to @var{newgid}, provided that the process is privileged.  It also
+deletes the file group ID, if any.
 
-If the process is not privileged, then @var{newgid} must either be equal
-to the real group ID or the saved group ID.  In this case, @code{setgid}
-sets only the effective group ID and not the real group ID.
+If the process is not privileged, then @code{setgid} behaves like
+@code{setegid}. 
 
 The return values and error conditions for @code{setgid} are the same
-as those for @code{setuid}.
+as those for @code{seteuid}.
 @end deftypefun
 
 @comment unistd.h
 @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
 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
 @code{-1}, it means not to change the effective group ID.
 
 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
-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.
 @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}.
 @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
 should include the header file @file{grp.h}.
 @pindex grp.h
@@ -396,11 +454,16 @@ The calling process is not privileged.
 @comment grp.h
 @comment BSD
 @deftypefun int initgroups (const char *@var{user}, gid_t @var{gid})
-The @code{initgroups} function effectively calls @code{setgroups} to
-set the process's supplementary group IDs to be the normal default for
-the user name @var{user}.  The group ID @var{gid} is also included.
-@c !!! explain that this works by reading the group file looking for
-@c groups USER is a member of.
+The @code{initgroups} function sets the process's supplementary group
+IDs to be the normal default for the user name @var{user}. If @var{gid}
+is not -1, it includes that group also.
+
+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
 
 @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,
 so it can't possibly give unintended access.
 
-If the system supports the saved user ID feature, you can accomplish
-this with @code{setuid}.  When the game program starts, its real user ID
-is @code{jdoe}, its effective user ID is @code{games}, and its saved
-user ID is also @code{games}.  The program should record both user ID
-values once at the beginning, like this:
+If the system supports the @code{_POSIX_SAVED_IDS} feature, you can
+accomplish this with @code{seteuid}.  When the game program starts, its
+real user ID is @code{jdoe}, its effective user ID is @code{games}, and
+its saved user ID is also @code{games}.  The program should record both
+user ID values once at the beginning, like this:
 
 @smallexample
 user_user_id = getuid ();
@@ -424,22 +487,22 @@ game_user_id = geteuid ();
 Then it can turn off game file access with
 
 @smallexample
-setuid (user_user_id);
+seteuid (user_user_id);
 @end smallexample
 
 @noindent
 and turn it on with
 
 @smallexample
-setuid (game_user_id);
+seteuid (game_user_id);
 @end smallexample
 
 @noindent
 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.
 
-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
 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
 effective user ID.
 
-This is part of a game program called @code{caber-toss} that
-manipulates a file @file{scores} that should be writable only by the game
-program itself.  The program assumes that its executable
-file will be installed with the set-user-ID bit set and owned by the
-same user as the @file{scores} file.  Typically, a system
-administrator will set up an account like @code{games} for this purpose.
+This is part of a game program called @code{caber-toss} that manipulates
+a file @file{scores} that should be writable only by the game program
+itself.  The program assumes that its executable file will be installed
+with the setuid bit set and owned by the same user as the @file{scores}
+file.  Typically, a system administrator will set up an account like
+@code{games} for this purpose.
 
 The executable file is given mode @code{4755}, so that doing an
 @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
 
 @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
 it shows:
@@ -501,7 +564,7 @@ it shows:
 
 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
-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.
 
 @smallexample
@@ -511,7 +574,7 @@ to swap the effective and real user IDs.
 #include <stdlib.h>
 
 
-/* @r{Save the effective and real UIDs.} */
+/* @r{Remember the effective and real UIDs.} */
 
 static uid_t euid, ruid;
 
@@ -524,7 +587,7 @@ do_setuid (void)
   int status;
 
 #ifdef _POSIX_SAVED_IDS
-  status = setuid (euid);
+  status = seteuid (euid);
 #else
   status = setreuid (ruid, euid);
 #endif
@@ -544,7 +607,7 @@ undo_setuid (void)
   int status;
 
 #ifdef _POSIX_SAVED_IDS
-  status = setuid (ruid);
+  status = seteuid (ruid);
 #else
   status = setreuid (euid, ruid);
 #endif
@@ -560,7 +623,7 @@ undo_setuid (void)
 int
 main (void)
 @{
-  /* @r{Save the real and effective user IDs.}  */
+  /* @r{Remember the real and effective user IDs.}  */
   ruid = getuid ();
   euid = geteuid ();
   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
 file accesses that are performed while the user is playing the game use
 the real user ID for determining permissions.  Only when the program
-needs to open the scores file does it switch back to the original
-effective user ID, like this:
+needs to open the scores file does it switch back to the file user ID,
+like this:
 
 @smallexample
 /* @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
 specific to your particular program, it's better to define a new,
 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
-Be cautious about using the @code{system} and @code{exec} functions in
-combination with changing the effective user ID.  Don't let users of
-your program execute arbitrary programs under a changed user ID.
-Executing a shell is especially bad news.  Less obviously, the
-@code{execlp} and @code{execvp} functions are a potential risk (since
-the program they execute depends on the user's @code{PATH} environment
-variable).
+Be cautious about using the @code{exec} functions in combination with
+changing the effective user ID.  Don't let users of your program execute
+arbitrary programs under a changed user ID.  Executing a shell is
+especially bad news. Less obviously, the @code{execlp} and @code{execvp}
+functions are a potential risk (since the program they execute depends
+on the user's @code{PATH} environment variable).
 
 If you must @code{exec} another program under a changed ID, specify an
 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
 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
 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
@@ -692,7 +764,8 @@ This string is statically allocated and might be overwritten on
 subsequent calls to this function or to @code{getlogin}.
 
 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
 
 @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
 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
 database can be successfully opened.
 @end deftypefun
@@ -1321,10 +1394,10 @@ members.  Older systems do not even have the @code{ut_host} member.
 @cindex password database
 @pindex /etc/passwd
 
-This section describes all about how to search and scan the database of
-registered users.  The database itself is kept in the file
-@file{/etc/passwd} on most systems, but on some systems a special
-network server gives access to it.
+This section describes how to search and scan the database of registered
+users.  The database itself is kept in the file @file{/etc/passwd} on
+most systems, but on some systems a special network server gives access
+to it.
 
 @menu
 * User Data Structure::         What each user record contains.
@@ -1397,21 +1470,20 @@ user ID @var{uid}.
 @comment pwd.h
 @comment POSIX.1c
 @deftypefun int getpwuid_r (uid_t @var{uid}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
-This function is similar to @code{getpwuid} in that is returns
-information about the user whose user ID is @var{uid}.  But the result
-is not placed in a static buffer.  Instead the user supplied structure
-pointed to by @var{result_buf} is filled with the information.  The
-first @var{buflen} bytes of the additional buffer pointed to by
-@var{buffer} are used to contain additional information, normally
-strings which are pointed to by the elements of the result structure.
+This function is similar to @code{getpwuid} in that it returns
+information about the user whose user ID is @var{uid}.  However, it
+fills the user supplied structure pointed to by @var{result_buf} with
+the information instead of using a static buffer.  The first
+@var{buflen} bytes of the additional buffer pointed to by @var{buffer}
+are used to contain additional information, normally strings which are
+pointed to by the elements of the result structure.
 
 If the return value is @code{0} the pointer returned in @var{result}
 points to the record which contains the wanted data (i.e., @var{result}
-contains the value @var{result_buf}).  In case the return value is non
-null there is no user in the data base with user ID @var{uid} or the
-buffer @var{buffer} is too small to contain all the needed information.
-In the later case the global @var{errno} variable is set to
-@code{ERANGE}.
+contains the value @var{result_buf}).  If it is nonzero, there is no
+user in the data base with user ID @var{uid}, or the buffer @var{buffer}
+is too small to contain all the needed information.  In the latter case,
+@var{errno} is set to @code{ERANGE}.
 @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
 @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
 
 @comment pwd.h
 @comment POSIX.1c
 @deftypefun int getpwnam_r (const char *@var{name}, struct passwd *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct passwd **@var{result})
 This function is similar to @code{getpwnam} in that is returns
-information about the user whose user name is @var{name}.  But the result
-is not placed in a static buffer.  Instead the user supplied structure
-pointed to by @var{result_buf} is filled with the information.  The
-first @var{buflen} bytes of the additional buffer pointed to by
-@var{buffer} are used to contain additional information, normally
-strings which are pointed to by the elements of the result structure.
+information about the user whose user name is @var{name}.  However, like
+@code{getpwuid_r}, it fills the user supplied buffers in
+@var{result_buf} and @var{buffer} with the information instead of using
+a static buffer.
 
-If the return value is @code{0} the pointer returned in @var{result}
-points to the record which contains the wanted data (i.e., @var{result}
-contains the value @var{result_buf}).  In case the return value is non
-null there is no user in the data base with user name @var{name} or the
-buffer @var{buffer} is too small to contain all the needed information.
-In the later case the global @var{errno} variable is set to
-@code{ERANGE}.
+The return values are the same as for @code{getpwuid_r}.
 @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
 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
-password database file.  This function comes from System V.
+The stream must correspond to a file in the same format as the standard
+password database file.
 @end deftypefun
 
 @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
 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.
 
-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
-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.
 @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
 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
 
 @comment pwd.h
 @comment GNU
 @deftypefun int getpwent_r (struct passwd *@var{result_buf}, char *@var{buffer}, int @var{buflen}, struct passwd **@var{result})
 This function is similar to @code{getpwent} in that it returns the next
-entry from the stream initialized by @code{setpwent}.  But in contrast
-to the @code{getpwent} function this function is reentrant since the
-result is placed in the user supplied structure pointed to by
-@var{result_buf}.  Additional data, normally the strings pointed to by
-the elements of the result structure, are placed in the additional
-buffer or length @var{buflen} starting at @var{buffer}.
+entry from the stream initialized by @code{setpwent}.  Like
+@code{fgetpwent_r}, it uses the user-supplied buffers in
+@var{result_buf} and @var{buffer} to return the information requested.
+
+The return values are the same as for @code{fgetpwent_r}.
 
-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
 
 @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
 extended information about users, adding an entry using this function
 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}.
 @end deftypefun
@@ -1560,7 +1620,7 @@ The function @code{putpwent} is declared in @file{pwd.h}.
 @cindex group database
 @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
 @file{/etc/group} on most systems, but on some systems a special network
 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 POSIX.1c
 @deftypefun int getgrgid_r (gid_t @var{gid}, struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
-This function is similar to @code{getgrgid} in that is returns
-information about the group whose group ID is @var{gid}.  But the result
-is not placed in a static buffer.  Instead the user supplied structure
-pointed to by @var{result_buf} is filled with the information.  The
-first @var{buflen} bytes of the additional buffer pointed to by
-@var{buffer} are used to contain additional information, normally
-strings which are pointed to by the elements of the result structure.
+This function is similar to @code{getgrgid} in that it returns
+information about the group whose group ID is @var{gid}.  However, it
+fills the user supplied structure pointed to by @var{result_buf} with
+the information instead of using a static buffer.  The first
+@var{buflen} bytes of the additional buffer pointed to by @var{buffer}
+are used to contain additional information, normally strings which are
+pointed to by the elements of the result structure.
 
 If the return value is @code{0} the pointer returned in @var{result}
-points to the record which contains the wanted data (i.e., @var{result}
-contains the value @var{result_buf}).  If the return value is non-zero
-there is no group in the data base with group ID @var{gid} or the
-buffer @var{buffer} is too small to contain all the needed information.
-In the later case the global @var{errno} variable is set to
-@code{ERANGE}.
+points to the requested data (i.e., @var{result} contains the value
+@var{result_buf}).  If it is nonzero, there is no group in the data base
+with group ID @var{gid}, or the buffer @var{buffer} is too small to
+contain all the needed information.  In the latter case, @var{errno} is
+set to @code{ERANGE}.
 @end deftypefun
 
 @comment grp.h
@@ -1653,19 +1712,11 @@ A null pointer indicates there is no group named @var{name}.
 @comment POSIX.1c
 @deftypefun int getgrnam_r (const char *@var{name}, struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
 This function is similar to @code{getgrnam} in that is returns
-information about the group whose group name is @var{name}.  But the result
-is not placed in a static buffer.  Instead the user supplied structure
-pointed to by @var{result_buf} is filled with the information.  The
-first @var{buflen} bytes of the additional buffer pointed to by
-@var{buffer} are used to contain additional information, normally
-strings which are pointed to by the elements of the result structure.
+information about the group whose group name is @var{name}.  Like
+@code{getgrgid_r}, it uses the user supplied buffers in
+@var{result_buf} and @var{buffer}, not a static buffer.
 
-If the return value is @code{0} the pointer returned in @var{result}
-points to the record which contains the wanted data (i.e., @var{result}
-contains the value @var{result_buf}).  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
+The return values are the same as for @code{getgrgid_r}
 @code{ERANGE}.
 @end deftypefun
 
@@ -1685,7 +1736,7 @@ particular file.
 @deftypefun {struct group *} fgetgrent (FILE *@var{stream})
 The @code{fgetgrent} function reads the next entry from @var{stream}.
 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
 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})
 This function is similar to @code{fgetgrent} in that it reads the next
 user entry from @var{stream}.  But the result is returned in the
-structure pointed to by @var{result_buf}.  The
-first @var{buflen} bytes of the additional buffer pointed to by
-@var{buffer} are used to contain additional information, normally
-strings which are pointed to by the elements of the result structure.
+structure pointed to by @var{result_buf}.  The first @var{buflen} bytes
+of the additional buffer pointed to by @var{buffer} are used to contain
+additional information, normally strings which are pointed to by the
+elements of the result structure.
 
 This stream must correspond to a file in the same format as the standard
 group database file.
@@ -1727,7 +1778,7 @@ You use this stream by calling @code{getgrent} or @code{getgrent_r}.
 @deftypefun {struct group *} getgrent (void)
 The @code{getgrent} function reads the next entry from the stream
 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
 wish to save the information.
 @end deftypefun
@@ -1736,17 +1787,13 @@ wish to save the information.
 @comment GNU
 @deftypefun int getgrent_r (struct group *@var{result_buf}, char *@var{buffer}, size_t @var{buflen}, struct group **@var{result})
 This function is similar to @code{getgrent} in that it returns the next
-entry from the stream initialized by @code{setgrent}.  But in contrast
-to the @code{getgrent} function this function is reentrant since the
-result is placed in the user supplied structure pointed to by
-@var{result_buf}.  Additional data, normally the strings pointed to by
-the elements of the result structure, are placed in the additional
-buffer or length @var{buflen} starting at @var{buffer}.
+entry from the stream initialized by @code{setgrent}.  Like
+@code{fgetgrent_r}, it places the result in user-supplied buffers
+pointed to @var{result_buf} and @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.
+If the function returns zero @var{result} contains a pointer to the data
+(normally equal to @var{result_buf}).  If errors occurred the return
+value is non-zero and @var{result} contains a null pointer.
 @end deftypefun
 
 @comment grp.h
@@ -1756,6 +1803,31 @@ This function closes the internal stream used by @code{getgrent} or
 @code{getgrent_r}.
 @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
 @section Netgroup Database
 
@@ -1903,27 +1975,3 @@ itself is not found, the netgroup does not contain the triple or
 internal errors occurred.
 @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
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c
index 2dd0c9f02a..f6bd98888b 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -23,6 +23,7 @@
 #include <ctype.h>
 #include <math.h>
 #include <stdlib.h>
+#include <sys/param.h>
 
 #ifndef FLOAT_TYPE
 #define FLOAT_TYPE double
@@ -60,19 +61,20 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
       *sign = signbit (value) != 0;
       if (*sign)
 	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
     /* Value is Inf or NaN.  */
     *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);
   if (n < 0)
     return -1;
@@ -91,8 +93,21 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
       do
 	++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;
@@ -136,7 +151,7 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
 	      do
 		{
 		  d *= 10.0;
-		  exponent--;
+		  --exponent;
 		}
 	      while (d < 1.0);
 	    }
@@ -145,7 +160,7 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
 	      do
 		{
 		  d *= 0.1;
-		  exponent++;
+		  ++exponent;
 		}
 	      while (d >= 10.0);
 	    }
@@ -155,9 +170,22 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
 	    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 (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;
 
-  if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit - 1, decpt, sign, buf, len))
-    return -1;
   *decpt += exponent;
   return 0;
 }
diff --git a/misc/tst-efgcvt.c b/misc/tst-efgcvt.c
index 537f6da8a6..65c588badd 100644
--- a/misc/tst-efgcvt.c
+++ b/misc/tst-efgcvt.c
@@ -16,19 +16,117 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE	1
+#endif
+
+#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-int
-main (void)
+int error_count;
+
+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;
   char *p;
 
-  p = ecvt (0.0, 0, &decpt, &sign);
-  printf ("p: \"%s\", decpt: %d, sign: %d\n", p, decpt, sign);
-  if (p[0] != '\0')
-    return 1;
+  p = ecvt (NAN, 10, &decpt, &sign);
+  if (sign != 0 || strcmp (p, "nan") != 0)
+    output_error ("ecvt", NAN, 10, "nan", 0, 0, p, decpt, sign);
 
-  return 0;
+  p = ecvt (INFINITY, 10, &decpt, &sign);
+  if (sign != 0 || strcmp (p, "inf") != 0)
+    output_error ("ecvt", NAN, 10, "inf", 0, 0, p, decpt, sign);
+
+}
+
+  
+int
+main (void)
+{
+  test (ecvt_tests, ecvt, "ecvt");
+  test (fcvt_tests, fcvt, "fcvt");
+  special ();
+  
+  return error_count;
 }
diff --git a/nscd/Makefile b/nscd/Makefile
index d8df770fa7..79db5abd37 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -23,18 +23,20 @@ subdir	:= nscd
 
 routines := nscd_getpw_r nscd_getgr_r
 
+include ../Makeconfig
+
 # We can later add the names of other thread packages here.
-ifeq (,$(findstring linuxthreads,$(add-ons)))
+ifneq (,$(findstring linuxthreads,$(add-ons)))
 
 others := nscd
 install-sbin := nscd
 
-endif
-
 nscd-routines := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
 		 getgrnam_r getgrgid_r dbg_log nscd_conf nscd_stat
 extra-objs := $(nscd-routines:=.o)
 
+endif
+
 distribute := nscd.h dbg_log.h $(nscd-routines:=.c) TODO nscd.conf nscd.init \
 	      nscd_proto.h
 
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 71309f464f..9734d08510 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -19,8 +19,8 @@
 
 #include <errno.h>
 #include <grp.h>
-#include <malloc.h>
 #include <pthread.h>
+#include <stdlib.h>
 #include <string.h>
 #include <rpcsvc/nis.h>
 #include <sys/types.h>
diff --git a/nss/test-netdb.c b/nss/test-netdb.c
index 918bbeb7c3..46cf52409b 100644
--- a/nss/test-netdb.c
+++ b/nss/test-netdb.c
@@ -37,6 +37,8 @@
 #include <netinet/in.h>
 #include <sys/param.h>
 #include <sys/socket.h>
+#include <unistd.h>
+#include "nss.h"
 
 /*
   The following define is neccessary for glibc 2.0.6
@@ -104,7 +106,6 @@ test_services (void)
 void
 output_hostent (const char *call, struct hostent *hptr)
 {
-  int i;
   char **pptr;
   char buf[INET6_ADDRSTRLEN];
 
diff --git a/po/Makefile b/po/Makefile
index 2c6de2f58c..d0711952b0 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -36,9 +36,7 @@ domainname = libc
 
 all: # Make this the default target; it will be defined in Rules.
 
-# Get $(version) defined.
 include ../Makeconfig
--include $(common-objpfx)version.mk
 
 # Pattern for where message catalog object for language % gets installed.
 mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 5b9950af1f..7352ed8871 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -286,7 +286,7 @@ getanswer(answer, anslen, qname, qtype)
 		}
 		if (qtype == T_PTR && type == T_CNAME) {
 			n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
-			if (n < 0 || !res_hnok(tbuf)) {
+			if (n < 0 || !res_dnok(tbuf)) {
 				had_error++;
 				continue;
 			}
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index ee3f7e8d79..f8345bb591 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -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.
    Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -87,8 +87,8 @@
 #include "nsswitch.h"
 
 /* Get implementation for some internal functions.  */
-#include "../resolv/mapv4v6addr.h"
-#include "../resolv/mapv4v6hostent.h"
+#include <resolv/mapv4v6addr.h>
+#include <resolv/mapv4v6hostent.h>
 
 /* Maximum number of aliases we allow.  */
 #define MAX_NR_ALIASES	48
@@ -245,7 +245,7 @@ _nss_dns_gethostbyaddr_r (const char *addr, int len, int af,
       qp = qbuf;
       for (n = IN6ADDRSZ - 1; n >= 0; n--)
 	qp += sprintf (qp, "%x.%x.", uaddr[n] & 0xf, (uaddr[n] >> 4) & 0xf);
-      strcpy(qp, "ip6.int");
+      strcpy (qp, "ip6.int");
       break;
     default:
       /* Cannot happen.  */
@@ -429,8 +429,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
 	      ++had_error;
 	      continue;
 	    }
-	  strcpy (bp, tbuf);		/* Cannot overflow.  */
-	  result->h_name = bp;
+	  result->h_name = strcpy (bp, tbuf);	/* Cannot overflow.  */
 	  bp += n;
 	  linebuflen -= n;
 	  continue;
@@ -439,21 +438,20 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
       if (qtype == T_PTR && type == T_CNAME)
 	{
 	  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;
 	      continue;
 	    }
 	  cp += n;
-	  /* Get canonical name. */
+	  /* Get canonical name.  */
 	  n = strlen (tbuf) + 1;   /* For the \0.  */
 	  if ((size_t) n > buflen || n >= MAXHOSTNAMELEN)
 	    {
 	      ++had_error;
 	      continue;
 	    }
-	  strcpy (bp, tbuf);		/* Cannot overflow.  */
-	  tname = bp;
+	  tname = strcpy (bp, tbuf);	/* Cannot overflow.  */
 	  bp += n;
 	  linebuflen -= n;
 	  continue;
@@ -570,7 +568,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
     {
       *ap = NULL;
       *hap = NULL;
-#if defined(RESOLVSORT)
+#if defined RESOLVSORT
       /*
        * Note: we sort even if host can take only one address
        * 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.  */
 	  if (n > linebuflen || n >= MAXHOSTNAMELEN)
 	    goto no_recovery;
-	  strcpy (bp, qname);		/* Cannot overflow.  */
-	  result->h_name = bp;
+	  result->h_name = strcpy (bp, qname);	/* Cannot overflow.  */
 	  bp += n;
 	  linebuflen -= n;
 	}
diff --git a/signal/signal.h b/signal/signal.h
index 864a49b6e1..819a81803d 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -167,15 +167,15 @@ typedef __sighandler_t sig_t;
 #endif /* <signal.h> included.  */
 
 
-#ifdef __USE_POSIX
-
 # 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;
 #  define __sigset_t_defined	1
 # endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'.  */
 # undef __need_sigset_t
 
+#ifdef __USE_POSIX
+
 # ifdef _SIGNAL_H
 
 /* We need `struct timespec' later on.  */
diff --git a/stdlib/atoll.c b/stdlib/atoll.c
index b85a888a1f..812e51e05c 100644
--- a/stdlib/atoll.c
+++ b/stdlib/atoll.c
@@ -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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
 #undef	atoll
 
 
-/* Convert a string to a long int.  */
+/* Convert a string to a long long int.  */
 long long int
 atoll (const char *nptr)
 {
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 8779e35817..403bcca77c 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -86,7 +86,8 @@ __STRING2_COPY_TYPE (8);
 #endif
 
 /* 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)
 
 
@@ -430,13 +431,13 @@ __STRING2_COPY_TYPE (8);
 		  ? memcmp (s1, s2, (strlen (s1) < strlen (s2)		      \
 				     ? strlen (s1) : strlen (s2)) + 1)	      \
 		  : (__builtin_constant_p (s1) && __string2_1bptr_p (s1)      \
-		     && __string2_1bptr_p (s2) && strlen (s1) < 4	      \
-		     ? (__builtin_constant_p (s2)			      \
+		     && strlen (s1) < 4					      \
+		     ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2)   \
 			? __strcmp_cc (s1, s2, strlen (s1))		      \
 			: __strcmp_cg (s1, s2, strlen (s1)))		      \
-		     : (__builtin_constant_p (s2) && __string2_1bptr_p (s1)   \
-			&& __string2_1bptr_p (s2) && strlen (s2) < 4	      \
-			? (__builtin_constant_p (s1)			      \
+		     : (__builtin_constant_p (s2) && __string2_1bptr_p (s2)   \
+			&& strlen (s2) < 4				      \
+			? (__builtin_constant_p (s1) && __string2_1bptr_p (s1)\
 			   ? __strcmp_cc (s1, s2, strlen (s2))		      \
 			   : __strcmp_gc (s1, s2, strlen (s2)))		      \
 			: strcmp (s1, s2)))))
diff --git a/string/tst-inlcall.c b/string/tst-inlcall.c
index 3682e88ff6..1e39ee4870 100644
--- a/string/tst-inlcall.c
+++ b/string/tst-inlcall.c
@@ -70,7 +70,7 @@ main (void)
   else
     {
       status = EXIT_FAILURE;
-      printf ("%Zd errors.\n", errors);
+      printf ("%d errors.\n", errors);
     }
   exit (status);
 }
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index db5278ff5e..efc826530f 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -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.
 
 # 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
 generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \
 	    $(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 \
 	    clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
@@ -111,7 +111,9 @@ CFLAGS-xkey_prot.c = -Wno-unused
 
 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)
 
 # Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the
diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/sys/ucontext.h
new file mode 100644
index 0000000000..70af80fa47
--- /dev/null
+++ b/sysdeps/arm/sys/ucontext.h
@@ -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 */
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index d9d36429b7..e491fa2be4 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -25,4 +25,6 @@ $(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $@-tmp
 	mv -f $@-tmp $@
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs commit -m'Regenerated from $^' $@
+endif
diff --git a/sysdeps/libm-ieee754/s_exp2.c b/sysdeps/libm-ieee754/s_exp2.c
index e10fae5492..fc3fd2507b 100644
--- a/sysdeps/libm-ieee754/s_exp2.c
+++ b/sysdeps/libm-ieee754/s_exp2.c
@@ -1,5 +1,5 @@
 /* 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.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
@@ -54,7 +54,10 @@ __ieee754_exp2 (double x)
       fenv_t oldenv;
 
       feholdexcept (&oldenv);
+#ifdef FE_TONEAREST
+      /* If we don't have this, it's too bad.  */
       fesetround (FE_TONEAREST);
+#endif
 
       /* 1. Argument reduction.
 	 Choose integers ex, -256 <= t < 256, and some real
diff --git a/sysdeps/libm-ieee754/s_exp2f.c b/sysdeps/libm-ieee754/s_exp2f.c
index 92c1f16c5a..05e79c9f5a 100644
--- a/sysdeps/libm-ieee754/s_exp2f.c
+++ b/sysdeps/libm-ieee754/s_exp2f.c
@@ -1,5 +1,5 @@
 /* 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.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
@@ -55,7 +55,10 @@ __ieee754_exp2f (float x)
       fenv_t oldenv;
 
       feholdexcept (&oldenv);
+#ifdef FE_TONEAREST
+      /* If we don't have this, it's too bad.  */
       fesetround (FE_TONEAREST);
+#endif
 
       /* 1. Argument reduction.
 	 Choose integers ex, -128 <= t < 128, and some real
diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c
index 6a046ea652..5ad45ae2a6 100644
--- a/sysdeps/posix/ttyname.c
+++ b/sysdeps/posix/ttyname.c
@@ -55,7 +55,10 @@ getttyname (fd, mydev, myino, save, dostat)
     }
 
   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);
 	if (sizeof (dev) + dlen > namelen)
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index ad747ad35b..ae427f1aef 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -59,7 +59,10 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
     }
 
   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;
 	size_t needed = _D_EXACT_NAMLEN (d) + 1;
diff --git a/sysdeps/standalone/arm/bits/errno.h b/sysdeps/standalone/arm/bits/errno.h
index 373d701bc3..7d628b1a2d 100644
--- a/sysdeps/standalone/arm/bits/errno.h
+++ b/sysdeps/standalone/arm/bits/errno.h
@@ -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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,6 +57,7 @@
 # define ENOSPC		29
 # define EEXIST		30
 # define EBUSY		31
+# define EOVERFLOW	32
 #endif
 
 #define __set_errno(val) errno = (val)
diff --git a/sysdeps/standalone/filedesc.h b/sysdeps/standalone/filedesc.h
index d6a12a606a..088c3bbacb 100644
--- a/sysdeps/standalone/filedesc.h
+++ b/sysdeps/standalone/filedesc.h
@@ -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,
      On-Line Applications Research Corporation.
    This file is part of the GNU C Library.
@@ -26,7 +26,7 @@
 #ifndef __FILEDESC_h
 #define __FILEDESC_h
 
-#define _STDIO_H
+#define __need_FOPEN_MAX
 #include <bits/stdio_lim.h>
 
 #ifndef __DECLARE_FILE_DESCRIPTORS__
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index f8cdb0277a..4863556332 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -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.
 
 # 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-objdir-compile)
 
-before-compile := $(before-compile) $(common-objpfx)bits/local_lim.h
-common-generated := $(common-generated) local_lim.h mk-local_lim
+before-compile += $(common-objpfx)bits/local_lim.h
+common-generated += bits/local_lim.h mk-local_lim
 
 endif
 
@@ -263,8 +263,8 @@ $(common-objpfx)sys/syscall.h: $(syscall.h)
 	> $@-tmp
 	mv $@-tmp $@
 
-before-compile := $(before-compile) $(common-objpfx)syscall.h
-common-generated := $(common-generated) syscall.h
+before-compile += $(common-objpfx)sys/syscall.h
+common-generated += sys/syscall.h
 
 endif
 
@@ -304,7 +304,11 @@ ifndef no_deps
 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)
 
+common-generated += s-proto.d
+postclean-generated += sysd-syscalls
+
 endif
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index 4837a7a128..5625c165b4 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -36,7 +36,7 @@
 /* This "generic Unix" implementation works because we provide the program
    /usr/libexec/pt_chown, and it only depends on ptsname() working. */
 static const char helper[] = LIBEXECDIR "/pt_chown";
-static const char *argv[] = { "pt_chown", NULL };
+static char *const argv[] = { "pt_chown", NULL };
 
 int
 grantpt (fd)
@@ -71,7 +71,7 @@ grantpt (fd)
 	if (dup2 (fd, PTY_FD) == -1)
 	  _exit (FAIL_EBADF);
 
-      execve (helper, (char *const *) argv, 0);
+      execve (helper, argv, 0);
       _exit (FAIL_EXEC);
     }
   else
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh
index f00ce5bf37..74b15231bf 100644
--- a/sysdeps/unix/make-syscalls.sh
+++ b/sysdeps/unix/make-syscalls.sh
@@ -64,9 +64,44 @@ EOF
 	 echo '	ret'; \\
 	 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
-    echo "	 echo 'weak_alias ($strong, $name)'; \\"
+    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)'; \\"
+	;;
+    esac
   done
 
   # And finally, pipe this all into the compiler.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 0dece5642a..5173b2122d 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -9,7 +9,7 @@ CPPFLAGS += -DHAVE_LLSEEK=1
 endif
 
 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 \
 		  sys/io.h sys/klog.h sys/kdaemon.h \
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 3166531d2b..59c0cb8a09 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -54,6 +54,9 @@ shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
 sysctl		-	_sysctl		6	sysctl
 
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
+
 # access pci space protected from machine checks:
 pciconfig_read	EXTRA	pciconfig_read	5	pciconfig_read
 pciconfig_write	EXTRA	pciconfig_write	5	pciconfig_write
diff --git a/sysdeps/unix/sysv/linux/getresgid.c b/sysdeps/unix/sysv/linux/getresgid.c
new file mode 100644
index 0000000000..2fe461a787
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getresgid.c
@@ -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;
+}
diff --git a/sysdeps/unix/sysv/linux/getresuid.c b/sysdeps/unix/sysv/linux/getresuid.c
new file mode 100644
index 0000000000..89b8fa7cfe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getresuid.c
@@ -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;
+}
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index 90818c1dff..6e26a5e6e2 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -1,5 +1,5 @@
 /* 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.
 
    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
    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.
@@ -45,7 +45,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
   int result;
 
   /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
+  if (!__libc_missing_rt_sigs)
     {
       struct sigaction nact, *nactp;
 
@@ -69,7 +69,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   if (act)
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index d026910ee2..c00ee6bed4 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -34,6 +34,9 @@ shutdown	-	shutdown	2	__shutdown	shutdown
 socket		-	socket		3	__socket	socket
 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.
 #
diff --git a/sysdeps/unix/sysv/linux/powerpc/socket.S b/sysdeps/unix/sysv/linux/powerpc/socket.S
index 681f7e6445..d6306bbf01 100644
--- a/sysdeps/unix/sysv/linux/powerpc/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/socket.S
@@ -41,8 +41,12 @@
 
 #define stackblock 20
 
+#ifndef __socket
+#define __socket P(__,socket)
+#endif
+
 	.text
-ENTRY(P(__,socket))
+ENTRY(__socket)
 	stwu %r1,-48(%r1)
 #if NARGS >= 1
 	stw  %r3,stackblock(%r1)
@@ -76,6 +80,6 @@ ENTRY(P(__,socket))
 	DO_CALL(SYS_ify(socketcall))
 	addi	%r1,%r1,48
 	PSEUDO_RET
-PSEUDO_END (P(__,socket))
+PSEUDO_END (__socket)
 
-weak_alias (P(__,socket), socket)
+weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
index 7883d70719..c5f7725269 100644
--- a/sysdeps/unix/sysv/linux/powerpc/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
@@ -1,3 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 s_llseek	llseek	_llseek		5	__sys_llseek
+
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c
index 04feadd436..77b6d80ac8 100644
--- a/sysdeps/unix/sysv/linux/ptsname.c
+++ b/sysdeps/unix/sysv/linux/ptsname.c
@@ -31,10 +31,10 @@
 #include <sys/sysmacros.h>
 
 /* Given the file descriptor of a master pty, return the pathname
-   of the associated slave. */
+   of the associated slave.  */
 
 static char namebuf[PTYNAMELEN];
-extern const char __ptyname1[], __ptyname2[]; /* defined in getpt.c */
+extern const char __ptyname1[], __ptyname2[]; /* Defined in getpt.c.  */
 
 char *
 ptsname (fd)
@@ -57,7 +57,7 @@ __ptsname_r (fd, buf, len)
   static int tiocgptn_works = 1;
   if (tiocgptn_works)
     {
-      if (!ioctl (fd, TIOCGPTN, &ptyno))
+      if (ioctl (fd, TIOCGPTN, &ptyno) == 0)
 	goto gotit;
       else
 	{
@@ -70,10 +70,12 @@ __ptsname_r (fd, buf, len)
 #endif
   /* /dev/ptmx will make it into the kernel before 32 bit dev_t, so
      this should be safe.  */
-  if (fstat (fd, &st))
+  if (__fxstat (_STAT_VER, fd, &st))
     return 0;
 
   ptyno = minor (st.st_rdev);
+  if (major (st.st_rdev) == 4)
+    ptyno -= 128;
 
 #ifdef TIOCGPTN
 gotit:
@@ -82,27 +84,24 @@ gotit:
      the SVr4 way.  */
 
   idbuf[5] = '\0';
-  stpcpy (stpcpy (nbuf, "/dev/pts/"),
-	  _itoa_word (ptyno, &idbuf[4], 10, 0));
-  if (!stat (nbuf, &st))
-    {
-      strncpy (buf, nbuf, len);
-      return buf;
-    }
+  __stpcpy (__stpcpy (nbuf, "/dev/pts/"),
+	    _itoa_word (ptyno, &idbuf[4], 10, 0));
+  if (!__xstat (_STAT_VER, nbuf, &st))
+    return strncpy (buf, nbuf, len);
   else
     if (errno != ENOENT)
       return NULL;
 
   /* ...and the BSD way.  */
+  nbuf[5]  = 't';
   nbuf[7]  = 'y';
   nbuf[8]  = __ptyname1[ptyno / 16];
   nbuf[9]  = __ptyname2[ptyno % 16];
   nbuf[10] = '\0';
 
-  if (stat (nbuf, &st))
+  if (__xstat (_STAT_VER, nbuf, &st))
     return NULL;
 
-  strncpy (buf, nbuf, len);
-  return buf;
+  return strncpy (buf, nbuf, len);
 }
 weak_alias (__ptsname_r, ptsname_r)
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 6b3d69d451..510cbe7040 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -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.
 
    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
    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.
@@ -46,7 +46,7 @@ __sigaction (sig, act, oact)
   int error;
 
   /* 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
 	 real size of the user-level sigset_t.  */
@@ -55,7 +55,7 @@ __sigaction (sig, act, oact)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   if (act)
diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
index fade020d26..4d5514a1bc 100644
--- a/sysdeps/unix/sysv/linux/sigpending.c
+++ b/sysdeps/unix/sysv/linux/sigpending.c
@@ -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.
 
    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
-   functions which have RT equivalents.  It is defined in sigaction.c.  */
-extern int __libc_have_rt_sigs;
+   functions which have RT equivalents.  */
+int __libc_missing_rt_sigs;
 
 
 /* Change the set of blocked signals to SET,
@@ -36,7 +36,7 @@ sigpending (set)
      sigset_t *set;
 {
   /* 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
 	 real size of the user-level sigset_t.  */
@@ -45,7 +45,7 @@ sigpending (set)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   return __syscall_sigpending (set);
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 63889a61dd..476f46a8e6 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -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.
 
    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);
 
 /* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  It is defined in sigaction.c.  */
-extern int __libc_have_rt_sigs;
+   functions which have RT equivalents.  */
+int __libc_missing_rt_sigs;
 
 
 /* Get and/or change the set of blocked signals.  */
@@ -37,7 +37,7 @@ __sigprocmask (how, set, oset)
      sigset_t *oset;
 {
   /* 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
 	 real size of the user-level sigset_t.  */
@@ -46,7 +46,7 @@ __sigprocmask (how, set, oset)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   return __syscall_sigprocmask (how, set, oset);
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 8d8fa8e709..197015401d 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,8 +25,8 @@ extern int __syscall_rt_sigsuspend (const sigset_t *, size_t);
 
 
 /* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  It is defined in sigaction.c.  */
-extern int __libc_have_rt_sigs;
+   functions which have RT equivalents.  */
+int __libc_missing_rt_sigs;
 
 
 /* Change the set of blocked signals to SET,
@@ -36,7 +36,7 @@ __sigsuspend (set)
      const sigset_t *set;
 {
   /* 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
 	 real size of the user-level sigset_t.  */
@@ -45,7 +45,7 @@ __sigsuspend (set)
       if (result >= 0 || errno != ENOSYS)
 	return result;
 
-      __libc_have_rt_sigs = 0;
+      __libc_missing_rt_sigs = 1;
     }
 
   return __syscall_sigsuspend (0, 0, set->__val[0]);
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 3f62a7cd53..5da202541f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -30,3 +30,6 @@ sendto		-	sendto		6	__libc_sendto	__sendto sendto
 setsockopt	-	setsockopt	5	__setsockopt	setsockopt
 shutdown	-	shutdown	2	__shutdown	shutdown
 socketpair	-	socketpair	4	__socketpair	socketpair
+
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresuid
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 3f1491f7bd..6bcd6dab18 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -13,15 +13,13 @@ geteuid		-	geteuid		0	__geteuid	geteuid
 getpgid		-	getpgid		1	__getpgid	getpgid
 getpgrp		-	getpgrp		0	getpgrp
 getppid		-	getppid		0	__getppid	getppid
-getresgid	EXTRA	getresgid	3	getresgid
-getresuid	EXTRA	getresuid	3	getresuid
 getsid		-	getsid		1	getsid
 init_module	EXTRA	init_module	5	init_module
 ioperm		-	ioperm		3	ioperm
 iopl		-	iopl		1	iopl
 ipc		msgget	ipc		5	__ipc
 klogctl		EXTRA	syslog		3	klogctl
-lchown		EXATR	lchown		3	__lchown	lchown
+lchown		EXTRA	lchown		3	__lchown	lchown
 mlock		EXTRA	mlock		2	__mlock	mlock
 mlockall	EXTRA	mlockall	1	__mlockall	mlockall
 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
 s_getdents	EXTRA	getdents	3	__getdents
 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_pread64	EXTRA	pread		5	__syscall_pread64
 s_ptrace	ptrace	ptrace		4	__syscall_ptrace