about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-12-14 22:24:57 +0000
committerUlrich Drepper <drepper@redhat.com>1997-12-14 22:24:57 +0000
commitbd355af04fc1df69d4ebb6733be170b9baf0dfb5 (patch)
tree7c003a29de4031db7de6ddd8e86c43bd746891a0
parentafe93c0bb33ca7f45b9b60c30067e7b84827e900 (diff)
downloadglibc-bd355af04fc1df69d4ebb6733be170b9baf0dfb5.tar.gz
glibc-bd355af04fc1df69d4ebb6733be170b9baf0dfb5.tar.xz
glibc-bd355af04fc1df69d4ebb6733be170b9baf0dfb5.zip
1997-12-14 21:33  Ulrich Drepper  <drepper@cygnus.com>

	* version.h (VERSION): Bump to 2.0.91.

	* db2/makedb.c (process_input): Fix typo in message.
	* sunrpc/rpcinfo.c (pmapdump): Unify messages.

	* elf/dynamic-link.h: Pretty print.

	* elf/rtld.c: Allow multiple preloading of a shared object.

	* include/limits.h: Prevent multiple inclusion.

	* malloc/Makefile (headers): Add mcheck.h.
	(distribute): Remove it here.
	* malloc/mcheck.h: Pretty print.
	* malloc/mtrace.c (mallenv): Make `const'.
	* malloc/mtrace.pl: Don't print table head for memory leaks if there
	are none.
	* manual/memory.texi: Update descriptor of malloc hooks.

	* posix/Makefile (routines): Add waitid.
	* posix/sys/types.h [__USE_SVID || __USE_POSIX]: Define id_t based
	on __id_t.
	* posix/sys/wait.h: Define idtype_t type.
	Add prototype for waitid.
	* signal/signal.h: Move definition of sigval_t to <bits/siginfo.h>.
	* sysdeps/generic/waitid.c: Stub for waitid.
	* sysdeps/generic/bits/siginfo.h: Define sigval_t.  Arrange to work
	the __need_siginfo_t defined.
	* sysdeps/unix/sysv/linux/bits/siginfo: Likewise.
	* sysdeps/generic/bits/types.h: Define __id_t.
	Correct definition of __FDMASK.
	* sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.

	* sysdeps/posix/waitid.c: New file.
	Provided by Zack Weinberg.

	* rt/aio_misc.c: Rename __aio_free_req to __aio_free_request.

	* sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
	Add missing parameters.

	* sysdeps/generic/dl-sysdep.c: Don't call __libc_init_secure.
	* sysdeps/generic/enbl-secure.c: Don't define __libc_uid.
	* sysdeps/unix/sysv/linux/init-first.c: Define __libc_uid.
	* sysdeps/unix/sysv/linux/sigqueue.c: Make sure __libc_uid is
	initialized.

	* sysdeps/i386/dl-machine.h: Little cleanup.

	* sysdeps/i386/fpu/bits/mathinline.h: Use __signbit* inline functions.
	(__finite): Mark function as const.
	Add inline code for __ieee754_atan2.

	* sysdeps/libm-ieee754/s_cacoshf.c: Add alternate implementation
	(but don't use it now).
	* sysdeps/libm-ieee754/s_catan.c: Use __ieee754_atan2 instead of
	__atan.
	* sysdeps/libm-ieee754/s_catanf.c: Likewise.
	* sysdeps/libm-ieee754/s_catanl.c: Likewise.
	* sysdeps/libm-ieee754/s_catanh.c: Likewise.  Correct sign of
	real part.
	* sysdeps/libm-ieee754/s_catanhf.c: Likewise.
	* sysdeps/libm-ieee754/s_catanhl.c: Likewise.
	* sysdeps/libm-ieee754/s_clog10.c: Use factor to correct
	__ieee754_atan2 to base 10.
	* sysdeps/libm-ieee754/s_clog10f.c: Likewise.
	* sysdeps/libm-ieee754/s_clog10l.c: Likewise.

	* sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h: Define as
	old_kernel_sigaction.

	* sysdeps/unix/sysv/linux/net/if_slip.h: Pretty print.

	* wctype/Makefile (routines): Add wctype_l.
	* wctype/wctype.h: Add declaration of __wctype_l.
	* wctype/wctype_l.c: New file.

1997-12-10 00:38  Ulrich Drepper  <drepper@cygnus.com>

	* locale/C-ctype.c: Correct data for isw* functions.
	* locale/programs/ld-ctype.c: Write 32bit char classes in correct
	byte order.
	* wctype/test_wctype.c: Add test for isw* functions.
	* wctype/wctype.c: Return value with expected byte order.

	* sysdeps/generic/_G_config.h: Define _G_HAVE_IO_FILE_OPEN.
	* sysdeps/unix/sysv/linux/_G_config.h: Likewise.
-rw-r--r--ChangeLog95
-rw-r--r--FAQ.in39
-rw-r--r--bits/siginfo.h111
-rw-r--r--bits/types.h3
-rw-r--r--db2/makedb.c2
-rw-r--r--elf/dl-support.c4
-rw-r--r--elf/dynamic-link.h8
-rw-r--r--elf/rtld.c18
-rw-r--r--iconvdata/Makefile2
-rw-r--r--iconvdata/extra-module.mk2
-rw-r--r--include/limits.h12
-rw-r--r--libio/Makefile5
-rw-r--r--libio/fileops.c93
-rw-r--r--libio/genops.c3
-rw-r--r--libio/iofdopen.c33
-rw-r--r--libio/iofgets.c7
-rw-r--r--libio/iofopen.c18
-rw-r--r--libio/iofopen64.c16
-rw-r--r--libio/iogets.c7
-rw-r--r--libio/iolibio.h2
-rw-r--r--libio/iopopen.c4
-rw-r--r--libio/iovdprintf.c24
-rw-r--r--libio/libio.h21
-rw-r--r--libio/libioP.h41
-rw-r--r--libio/oldfileops.c3
-rw-r--r--libio/oldiofclose.c1
-rw-r--r--libio/oldiofdopen.c135
-rw-r--r--libio/oldiofopen.c1
-rw-r--r--libio/oldstdfiles.c29
-rw-r--r--libio/stdfiles.c21
-rw-r--r--libio/stdio.c6
-rw-r--r--locale/C-ctype.c172
-rw-r--r--locale/programs/ld-ctype.c5
-rw-r--r--malloc/Makefile4
-rw-r--r--malloc/mcheck.h23
-rw-r--r--malloc/mtrace.c2
-rw-r--r--malloc/mtrace.pl9
-rw-r--r--manual/memory.texi261
-rw-r--r--manual/signal.texi1
-rw-r--r--math/libm-test.c299
-rw-r--r--nis/nss_compat/compat-grp.c34
-rw-r--r--nis/nss_compat/compat-pwd.c36
-rw-r--r--nis/nss_compat/compat-spwd.c35
-rw-r--r--nis/ypclnt.c18
-rw-r--r--posix/Makefile2
-rw-r--r--posix/sys/types.h4
-rw-r--r--posix/sys/wait.h25
-rw-r--r--rt/aio.h2
-rw-r--r--rt/aio_misc.c6
-rw-r--r--rt/librt.map4
-rw-r--r--signal/signal.h11
-rw-r--r--stdio-common/vfprintf.c3
-rw-r--r--sunrpc/publickey.c11
-rw-r--r--sunrpc/rpcinfo.c3
-rw-r--r--sysdeps/alpha/dl-machine.h4
-rw-r--r--sysdeps/generic/_G_config.h5
-rw-r--r--sysdeps/generic/bits/siginfo.h111
-rw-r--r--sysdeps/generic/bits/types.h3
-rw-r--r--sysdeps/generic/dl-sysdep.c2
-rw-r--r--sysdeps/generic/enbl-secure.c2
-rw-r--r--sysdeps/generic/sigqueue.c1
-rw-r--r--sysdeps/generic/sys/param.h1
-rw-r--r--sysdeps/generic/waitid.c33
-rw-r--r--sysdeps/i386/dl-machine.h2
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h18
-rw-r--r--sysdeps/libm-ieee754/s_cacoshf.c15
-rw-r--r--sysdeps/libm-ieee754/s_catan.c2
-rw-r--r--sysdeps/libm-ieee754/s_catanf.c2
-rw-r--r--sysdeps/libm-ieee754/s_catanh.c8
-rw-r--r--sysdeps/libm-ieee754/s_catanhf.c8
-rw-r--r--sysdeps/libm-ieee754/s_catanhl.c8
-rw-r--r--sysdeps/libm-ieee754/s_catanl.c2
-rw-r--r--sysdeps/libm-ieee754/s_clog10.c2
-rw-r--r--sysdeps/libm-ieee754/s_clog10f.c2
-rw-r--r--sysdeps/libm-ieee754/s_clog10l.c4
-rw-r--r--sysdeps/m68k/fpu/bits/fenv.h5
-rw-r--r--sysdeps/m68k/fpu/bits/mathinline.h106
-rw-r--r--sysdeps/m68k/fpu/fegetenv.c2
-rw-r--r--sysdeps/m68k/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/m68k/fpu/fesetenv.c4
-rw-r--r--sysdeps/posix/waitid.c118
-rw-r--r--sysdeps/standalone/arm/bits/errno.h7
-rw-r--r--sysdeps/unix/sysv/linux/Makefile9
-rw-r--r--sysdeps/unix/sysv/linux/_G_config.h5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo.h141
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c8
-rw-r--r--sysdeps/unix/sysv/linux/net/if_slip.h25
-rw-r--r--sysdeps/unix/sysv/linux/oldsiglist.c21
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c9
-rw-r--r--sysdeps/unix/sysv/linux/siglist.c11
-rw-r--r--sysdeps/unix/sysv/linux/sigqueue.c2
-rw-r--r--sysdeps/unix/sysv/linux/sigreturn.c54
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
-rw-r--r--version.h2
-rw-r--r--wctype/Makefile2
-rw-r--r--wctype/test_wctype.c22
-rw-r--r--wctype/wctype.c15
-rw-r--r--wctype/wctype.h21
-rw-r--r--wctype/wctype_l.c53
103 files changed, 1915 insertions, 713 deletions
diff --git a/ChangeLog b/ChangeLog
index 92e48ed9ee..841c2d9afa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,92 @@
+1997-12-14 21:33  Ulrich Drepper  <drepper@cygnus.com>
+
+	* version.h (VERSION): Bump to 2.0.91.
+
+	* db2/makedb.c (process_input): Fix typo in message.
+	* sunrpc/rpcinfo.c (pmapdump): Unify messages.
+
+	* elf/dynamic-link.h: Pretty print.
+
+	* elf/rtld.c: Allow multiple preloading of a shared object.
+
+	* include/limits.h: Prevent multiple inclusion.
+
+	* malloc/Makefile (headers): Add mcheck.h.
+	(distribute): Remove it here.
+	* malloc/mcheck.h: Pretty print.
+	* malloc/mtrace.c (mallenv): Make `const'.
+	* malloc/mtrace.pl: Don't print table head for memory leaks if there
+	are none.
+	* manual/memory.texi: Update descriptor of malloc hooks.
+
+	* posix/Makefile (routines): Add waitid.
+	* posix/sys/types.h [__USE_SVID || __USE_POSIX]: Define id_t based
+	on __id_t.
+	* posix/sys/wait.h: Define idtype_t type.
+	Add prototype for waitid.
+	* signal/signal.h: Move definition of sigval_t to <bits/siginfo.h>.
+	* sysdeps/generic/waitid.c: Stub for waitid.
+	* sysdeps/generic/bits/siginfo.h: Define sigval_t.  Arrange to work
+	the __need_siginfo_t defined.
+	* sysdeps/unix/sysv/linux/bits/siginfo: Likewise.
+	* sysdeps/generic/bits/types.h: Define __id_t.
+	Correct definition of __FDMASK.
+	* sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.
+
+	* sysdeps/posix/waitid.c: New file.
+	Provided by Zack Weinberg.
+
+	* rt/aio_misc.c: Rename __aio_free_req to __aio_free_request.
+
+	* sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
+	Add missing parameters.
+
+	* sysdeps/generic/dl-sysdep.c: Don't call __libc_init_secure.
+	* sysdeps/generic/enbl-secure.c: Don't define __libc_uid.
+	* sysdeps/unix/sysv/linux/init-first.c: Define __libc_uid.
+	* sysdeps/unix/sysv/linux/sigqueue.c: Make sure __libc_uid is
+	initialized.
+
+	* sysdeps/i386/dl-machine.h: Little cleanup.
+
+	* sysdeps/i386/fpu/bits/mathinline.h: Use __signbit* inline functions.
+	(__finite): Mark function as const.
+	Add inline code for __ieee754_atan2.
+
+	* sysdeps/libm-ieee754/s_cacoshf.c: Add alternate implementation
+	(but don't use it now).
+	* sysdeps/libm-ieee754/s_catan.c: Use __ieee754_atan2 instead of
+	__atan.
+	* sysdeps/libm-ieee754/s_catanf.c: Likewise.
+	* sysdeps/libm-ieee754/s_catanl.c: Likewise.
+	* sysdeps/libm-ieee754/s_catanh.c: Likewise.  Correct sign of
+	real part.
+	* sysdeps/libm-ieee754/s_catanhf.c: Likewise.
+	* sysdeps/libm-ieee754/s_catanhl.c: Likewise.
+	* sysdeps/libm-ieee754/s_clog10.c: Use factor to correct
+	__ieee754_atan2 to base 10.
+	* sysdeps/libm-ieee754/s_clog10f.c: Likewise.
+	* sysdeps/libm-ieee754/s_clog10l.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h: Define as
+	old_kernel_sigaction.
+
+	* sysdeps/unix/sysv/linux/net/if_slip.h: Pretty print.
+
+	* wctype/Makefile (routines): Add wctype_l.
+	* wctype/wctype.h: Add declaration of __wctype_l.
+	* wctype/wctype_l.c: New file.
+
+1997-12-10 00:38  Ulrich Drepper  <drepper@cygnus.com>
+
+	* locale/C-ctype.c: Correct data for isw* functions.
+	* locale/programs/ld-ctype.c: Write 32bit char classes in correct
+	byte order.
+	* wctype/test_wctype.c: Add test for isw* functions.
+	* wctype/wctype.c: Return value with expected byte order.
+
 1997-12-13  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
 
 	* libc-work/nis/ypclnt.c (do_ypcall): Don't free dom_binding twice.
@@ -8,7 +97,6 @@
 
 	* sysdeps/unix/sysv/linux/Makefile (stdio-common): Add
 	oldsiglist for shared library.
-	(signal): Add rt_sigreturn and rt_sigpending.
 
 	* sysdeps/unix/sysv/linux/siglist.c (_sys_siglist, sys_siglist,
 	sys_sigabbrev): Make them as the default version GLIBC_2.1.
@@ -92,9 +180,8 @@
 	* libio/fileops.c (_IO_file_open): New.
 	(_IO_file_fopen): Call _IO_file_open ().
 
-	* sysdeps/generic/_G_config.h
-	* sysdeps/unix/sysv/linux/_G_config.h: Define
-	_G_HAVE_IO_FILE_OPEN.
+	* sysdeps/generic/_G_config.h: Define _G_HAVE_IO_FILE_OPEN.
+	* sysdeps/unix/sysv/linux/_G_config.h: Likewise.
 
 1997-12-07  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
diff --git a/FAQ.in b/FAQ.in
index edc0c29e7a..62c943bd74 100644
--- a/FAQ.in
+++ b/FAQ.in
@@ -27,12 +27,12 @@ The systems glibc is known to work on as of this release, and most
 probably in the future, are:
 
 	*-*-gnu			GNU Hurd
-	i[3456]86-*-linux-gnu	Linux-2.0 on Intel
-	m68k-*-linux-gnu	Linux-2.0 on Motorola 680x0
-	alpha-*-linux-gnu	Linux-2.0 on DEC Alpha
+	i[3456]86-*-linux-gnu	Linux-2.x on Intel
+	m68k-*-linux-gnu	Linux-2.x on Motorola 680x0
+	alpha-*-linux-gnu	Linux-2.x on DEC Alpha
 	powerpc-*-linux-gnu     Linux and MkLinux on PowerPC systems
-	sparc-*-linux-gnu	Linux-2.0 on SPARC
-	sparc64-*-linux-gnu	Linux-2.0 on UltraSPARC
+	sparc-*-linux-gnu	Linux-2.x on SPARC
+	sparc64-*-linux-gnu	Linux-2.x on UltraSPARC
 
 Ports to other Linux platforms are in development, and may in fact
 work already, but no one has sent us success reports for them.
@@ -102,6 +102,10 @@ has not been ported to them.
 
   You should not need these tools unless you change the source files.
 
+* Some scripts need perl5 - but at the moment those scripts are not
+  vital for building and installing GNU libc (some data files will not 
+  be created).
+
 * When compiling for Linux, the header files of the Linux kernel must
   be available to the compiler as <linux/*.h> and <asm/*.h>.
 
@@ -117,9 +121,10 @@ has not been ported to them.
   very slow.
 
   James Troup <J.J.Troup@comp.brad.ac.uk> reports a compile time of
-  45h34m for a full build (shared, static, and profiled) on
-  Atari Falcon (Motorola 68030 @ 16 Mhz, 14 Mb memory) and 22h48m
-  on Atari TT030 (Motorola 68030 @ 32 Mhz, 34 Mb memory)
+  45h34m for a full build (shared, static, and profiled) on Atari
+  Falcon (Motorola 68030 @ 16 Mhz, 14 Mb memory) and Jan Barte
+  <yann@plato.uni-paderborn.de> reports 22h48m on Atari TT030
+  (Motorola 68030 @ 32 Mhz, 34 Mb memory)
 
   If you have some more measurements let me know.
 
@@ -624,7 +629,7 @@ release is for.  It's better to have a cut now than having no means to
 support the new techniques later.
 
 {MK} There is however a (partial) solution for this problem.  Please
-take a look at the file `README.utmpd'.
+take a look at the file `login/README.utmpd'.
 
 ??	Where are the DST_* constants found in <sys/time.h> on many
 	systems?
@@ -668,13 +673,13 @@ results because of type conflicts.
 	still complains about redeclarations of types in the kernel
 	headers.
 
-{UD} The kernel headers before Linux 2.1.61 don't work correctly with
-glibc.  Compiling C programs is possible in most cases but C++
-programs have (due to the change of the name lookups for `struct's)
-problems.  One prominent example is `struct fd_set'.
+{UD} The kernel headers before Linux 2.1.61 and 2.0.32 don't work
+correctly with glibc.  Compiling C programs is possible in most cases
+but C++ programs have (due to the change of the name lookups for
+`struct's) problems.  One prominent example is `struct fd_set'.
 
-There might be some problems left but 2.1.61 fixes most of the known
-ones.  See the BUGS file for other known problems.
+There might be some problems left but 2.1.61/2.0.32 fix most of the
+known ones.  See the BUGS file for other known problems.
 
 ??signal	Why don't signals interrupt system calls anymore?
 
@@ -767,8 +772,8 @@ point where the headers are stable.  There are still lots of
 incompatible changes made and the libc headers have to follow.
 
 Also, make sure you have a suitably recent kernel.  As of the 970401
-snapshot, according to Philip Blundell <philb@gnu.ai.mit.edu>, the
-required kernel version is 2.1.30.
+snapshot, according to Philip Blundell <Philip.Blundell@pobox.com>, the
+required kernel version is at least 2.1.30.
 
 
 Answers were given by:
diff --git a/bits/siginfo.h b/bits/siginfo.h
index 35d9d69892..5a223e373b 100644
--- a/bits/siginfo.h
+++ b/bits/siginfo.h
@@ -17,10 +17,21 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SIGNAL_H
+#if !defined _SIGNAL_H && !defined __need_siginfo_t
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#if (!defined __have_siginfo_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t	1
+
+/* Type for data associated with a signal.  */
+typedef union sigval
+  {
+    int sival_int;
+    void *sival_ptr;
+  } sigval_t;
+
 typedef struct siginfo
   {
     int si_signo;		/* Signal number.  */
@@ -41,15 +52,15 @@ typedef struct siginfo
 enum
 {
   SI_ASYNCIO = -4,		/* Sent by AIO completion.  */
-#define SI_ASYNCIO	SI_ASYNCIO
+# define SI_ASYNCIO	SI_ASYNCIO
   SI_MESGQ,			/* Sent by real time mesq state change.  */
-#define SI_MESGQ	SI_MESGQ
+# define SI_MESGQ	SI_MESGQ
   SI_TIMER,			/* Sent by timer expiration.  */
-#define SI_TIMER	SI_TIMER
+# define SI_TIMER	SI_TIMER
   SI_QUEUE,			/* Sent by sigqueue.  */
-#define SI_QUEUE	SI_QUEUE
+# define SI_QUEUE	SI_QUEUE
   SI_USER			/* Sent by kill, sigsend, raise.  */
-#define SI_USER		SI_USER
+# define SI_USER	SI_USER
 };
 
 
@@ -57,111 +68,117 @@ enum
 enum
 {
   ILL_ILLOPC = 1,		/* Illegal opcode.  */
-#define ILL_ILLOPC	ILL_ILLOPC
+# define ILL_ILLOPC	ILL_ILLOPC
   ILL_ILL_OPN,			/* Illegal operand.  */
-#define ILL_ILLOPN	ILL_ILLOPN
+# define ILL_ILLOPN	ILL_ILLOPN
   ILL_ILLADR,			/* Illegal addressing mode.  */
-#define ILL_ILLADR	ILL_ILLADR
+# define ILL_ILLADR	ILL_ILLADR
   ILL_ILLTRP,			/* Illegal trap. */
-#define ILL_ILLTRP	ILL_ILLTRP
+# define ILL_ILLTRP	ILL_ILLTRP
   ILL_PRVOPC,			/* Privileged opcode.  */
-#define ILL_PRVOPC	ILL_PRVOPC
+# define ILL_PRVOPC	ILL_PRVOPC
   ILL_PRVREG,			/* Privileged register.  */
-#define ILL_PRVREG	ILL_PRVREG
+# define ILL_PRVREG	ILL_PRVREG
   ILL_COPROC,			/* Coprocessor error.  */
-#define ILL_COPROC	ILL_COPROC
+# define ILL_COPROC	ILL_COPROC
   ILL_BADSTK			/* Internal stack error.  */
-#define ILL_BADSTK	ILL_BADSTK
+# define ILL_BADSTK	ILL_BADSTK
 };
 
 /* `si_code' values for SIGFPE signal.  */
 enum
 {
   FPE_INTDIV = 1,		/* Integer divide by zero.  */
-#define FPE_INTDIV	FPE_INTDIV
+# define FPE_INTDIV	FPE_INTDIV
   FPE_INTOVF,			/* Integer overflow.  */
-#define FPE_INTOVF	FPE_INTOVF
+# define FPE_INTOVF	FPE_INTOVF
   FPE_FLTDIV,			/* Floating point divide by zero.  */
-#define FPE_FLTDIV	FPE_FLTDIV
+# define FPE_FLTDIV	FPE_FLTDIV
   FPE_FLTOVF,			/* Floating point overflow.  */
-#define FPE_FLTOVF	FPE_FLTOVF
+# define FPE_FLTOVF	FPE_FLTOVF
   FPE_FLTUND,			/* Floating point underflow.  */
-#define FPE_FLTUND	FPE_FLTUND
+# define FPE_FLTUND	FPE_FLTUND
   FPE_FLTRES,			/* Floating point inexact result.  */
-#define FPE_FLTRES	FPE_FLTRES
+# define FPE_FLTRES	FPE_FLTRES
   FPE_FLTINV,			/* Floating point invalid operation.  */
-#define FPE_FLTINV	FPE_FLTINV
+# define FPE_FLTINV	FPE_FLTINV
   FPE_FLTSUB			/* Subscript out of range.  */
-#define FPE_FLTSUB	FPE_FLTSUB
+# define FPE_FLTSUB	FPE_FLTSUB
 };
 
 /* `si_code' values for SIGSEGV signal.  */
 enum
 {
   SEGV_MAPERR = 1,		/* Address not mapped to object.  */
-#define SEGV_MAPERR	SEGV_MAPERR
+# define SEGV_MAPERR	SEGV_MAPERR
   SEGV_ACCERR			/* Invalid permissions for mapped object.  */
-#define SEGV_ACCERR	SEGV_ACCERR
+# define SEGV_ACCERR	SEGV_ACCERR
 };
 
 /* `si_code' values for SIGBUS signal.  */
 enum
 {
   BUS_ADRALN = 1,		/* Invalid address alignment.  */
-#define BUS_ADRALN	BUS_ADRALN
+# define BUS_ADRALN	BUS_ADRALN
   BUS_ADRERR,			/* Non-existant physical address.  */
-#define BUS_ADRERR	BUS_ADRERR
+# define BUS_ADRERR	BUS_ADRERR
   BUS_OBJERR			/* Object specific hardware error.  */
-#define BUS_OBJERR	BUS_OBJERR
+# define BUS_OBJERR	BUS_OBJERR
 };
 
 /* `si_code' values for SIGTRAP signal.  */
 enum
 {
   TRAP_BRKPT = 1,		/* Process breakpoint.  */
-#define TRAP_BRKPT	TRAP_BRKPT
+# define TRAP_BRKPT	TRAP_BRKPT
   TRAP_TRACE			/* Process trace trap.  */
-#define TRAP_TRACE	TRAP_TRACE
+# define TRAP_TRACE	TRAP_TRACE
 };
 
 /* `si_code' values for SIGCHLD signal.  */
 enum
 {
   CLD_EXITED = 1,		/* Child has exited.  */
-#define CLD_EXITED	CLD_EXITED
+# define CLD_EXITED	CLD_EXITED
   CLD_KILLED,			/* Child was killed.  */
-#define CLD_KILLED	CLD_KILLED
+# define CLD_KILLED	CLD_KILLED
   CLD_DUMPED,			/* Child terminated abnormally.  */
-#define CLD_DUMPED	CLD_DUMPED
+# define CLD_DUMPED	CLD_DUMPED
   CLD_TRAPPED,			/* Traced child has trapped.  */
-#define CLD_TRAPPED	CLD_TRAPPED
+# define CLD_TRAPPED	CLD_TRAPPED
   CLD_STOPPED,			/* Child has stopped.  */
-#define CLD_STOPPED	CLD_STOPPED
+# define CLD_STOPPED	CLD_STOPPED
   CLD_CONTINUED			/* Stopped child has continued.  */
-#define CLD_CONTINUED	CLD_CONTINUED
+# define CLD_CONTINUED	CLD_CONTINUED
 };
 
 /* `si_code' values for SIGPOLL signal.  */
 enum
 {
   POLL_IN = 1,			/* Data input available.  */
-#define POLL_IN		POLL_IN
+# define POLL_IN	POLL_IN
   POLL_OUT,			/* Output buffers available.  */
-#define POLL_OUT	POLL_OUT
+# define POLL_OUT	POLL_OUT
   POLL_MSG,			/* Input message available.   */
-#define POLL_MSG	POLL_MSG
+# define POLL_MSG	POLL_MSG
   POLL_ERR,			/* I/O error.  */
-#define POLL_ERR	POLL_ERR
+# define POLL_ERR	POLL_ERR
   POLL_PRI,			/* High priority input available.  */
-#define POLL_PRI	POLL_PRI
+# define POLL_PRI	POLL_PRI
   POLL_HUP			/* Device disconnected.  */
-#define POLL_HUP	POLL_HUP
+# define POLL_HUP	POLL_HUP
 };
 
+# undef __need_siginfo_t
+#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
+
+
+#if defined _SIGNAL_H && !defined __have_sigevent_t
+# define __have_sigevent_t	1
 
 /* Structure to transport application-defined values with signals.  */
-#define SIGEV_MAX_SIZE	64
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# define SIGEV_MAX_SIZE	64
+# define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
 
 typedef struct sigevent
   {
@@ -176,9 +193,11 @@ typedef struct sigevent
 enum
 {
   SIGEV_SIGNAL = 0,		/* Notify via signal.  */
-#define SIGEV_SIGNAL	SIGEV_SIGNAL
+# define SIGEV_SIGNAL	SIGEV_SIGNAL
   SIGEV_NONE,			/* Other notification: meaningless.  */
-#define SIGEV_NONE	SIGEV_NONE
+# define SIGEV_NONE	SIGEV_NONE
   SIGEV_THREAD			/* Deliver via thread creation.  */
-#define SIGEV_THREAD	SIGEV_THREAD
+# define SIGEV_THREAD	SIGEV_THREAD
 };
+
+#endif	/* have _SIGNAL_H.  */
diff --git a/bits/types.h b/bits/types.h
index 51fadd196e..5315a092ac 100644
--- a/bits/types.h
+++ b/bits/types.h
@@ -69,6 +69,7 @@ typedef long int __rlim_t;	/* Type for resource measurement.  */
 typedef __quad_t __rlim64_t;	/* Type for resource measurement (LFS).  */
 typedef __quad_t __ino64_t;	/* Type for file serial numbers.  */
 typedef __loff_t __off64_t;	/* Type of file izes and offsets.  */
+typedef unsigned int __id_t;	/* General type for IDs.  */
 
 /* Everythin' else.  */
 typedef long int __daddr_t;	/* The type of a disk address.  */
@@ -85,7 +86,7 @@ typedef long int __key_t;	/* Type of an IPC key */
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define	__NFDBITS	(sizeof (unsigned long int) * 8)
 #define	__FDELT(d)	((d) / __NFDBITS)
-#define	__FDMASK(d)	(1 << ((d) % __NFDBITS))
+#define	__FDMASK(d)	((unsigned long int) 1 << ((d) % __NFDBITS))
 
 typedef struct
   {
diff --git a/db2/makedb.c b/db2/makedb.c
index be4ba95121..d1259ea18c 100644
--- a/db2/makedb.c
+++ b/db2/makedb.c
@@ -318,7 +318,7 @@ process_input (input, inname, output, to_lowercase, be_quiet)
 	      status = 0;
 	    }
 	  else
-	    error (0, errno, gettext ("while writing data base file"));
+	    error (0, errno, gettext ("while writing database file"));
 
 	  status = status ? EXIT_FAILURE : EXIT_SUCCESS;
 
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 8b69ef07e7..c103d0e42e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -46,8 +46,6 @@ struct r_search_path *_dl_search_paths;
 const char *_dl_profile;
 struct link_map *_dl_profile_map;
 
-extern void __libc_init_secure (void);
-
 
 static void non_dynamic_init (void) __attribute__ ((unused));
 
@@ -58,8 +56,6 @@ non_dynamic_init (void)
 
   _dl_pagesize = __getpagesize ();
 
-  __libc_init_secure ();
-
   /* Initialize the data structures for the search paths for shared
      objects.  */
   _dl_init_paths ();
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 64b5f78bc7..aedee20700 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -56,7 +56,7 @@ elf_get_dynamic_info (ElfW(Dyn) *dyn,
 	     + DT_VERSIONTAGNUM] = dyn;
       else
 	assert (! "bad dynamic tag");
-      dyn++;
+      ++dyn;
     }
 
   if (info[DT_RELA])
@@ -96,10 +96,10 @@ elf_get_dynamic_info (ElfW(Dyn) *dyn,
 	    if (r_addr <= p_addr && r_addr+r_size > p_addr)		      \
 	      {								      \
 		ElfW(Addr) r2_addr, r2_size;				      \
-		r2_addr = p_addr+p_size;				      \
-		if (r2_addr < r_addr+r_size)				      \
+		r2_addr = p_addr + p_size;				      \
+		if (r2_addr < r_addr + r_size)				      \
 		  {							      \
-		    r2_size = r_addr+r_size - r2_addr;			      \
+		    r2_size = r_addr + r_size - r2_addr;		      \
 		    elf_dynamic_do_##reloc ((map), r2_addr, r2_size, 0);      \
 		  }							      \
 		r_size = p_addr - r_addr;				      \
diff --git a/elf/rtld.c b/elf/rtld.c
index b1538aa893..72c2520d6a 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -495,8 +495,10 @@ of this helper program; chances are you did not intend to run this program.\n",
       while ((p = strsep (&list, " ")) != NULL)
 	if (! __libc_enable_secure || strchr (p, '/') == NULL)
 	  {
-	    (void) _dl_map_object (NULL, p, lt_library, 0);
-	    ++npreloads;
+	    struct link_map *new_map = _dl_map_object (NULL, p, lt_library, 0);
+	    if (new_map->l_opencount == 1)
+	      /* It is no duplicate.  */
+	      ++npreloads;
 	  }
     }
 
@@ -550,15 +552,21 @@ of this helper program; chances are you did not intend to run this program.\n",
 	  runp = file;
 	  while ((p = strsep (&runp, ": \t\n")) != NULL)
 	    {
-	      (void) _dl_map_object (NULL, p, lt_library, 0);
-	      ++npreloads;
+	      struct link_map *new_map = _dl_map_object (NULL, p,
+							 lt_library, 0);
+	      if (new_map->l_opencount == 1)
+		/* It is no duplicate.  */
+		++npreloads;
 	    }
 	}
 
       if (problem != NULL)
 	{
 	  char *p = strndupa (problem, file_size - (problem - file));
-	  (void) _dl_map_object (NULL, p, lt_library, 0);
+	  struct link_map *new_map = _dl_map_object (NULL, p, lt_library, 0);
+	  if (new_map->l_opencount == 1)
+	    /* It is no duplicate.  */
+	    ++npreloads;
 	}
 
       /* We don't need the file anymore.  */
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 52fbace463..0b64ba4a66 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -169,7 +169,7 @@ headers: $(sed-generated-headers) $(perl-generated-headers)
 
 $(addprefix $(inst_gconvdir)/, $(modules.so)): $(inst_gconvdir)/%: $(objpfx)%
 	$(do-install-program)
-$(inst_gconvdir)/gconv_modules: gconv-modules
+$(inst_gconvdir)/gconv-modules: gconv-modules
 	$(do-install)
 endif
 
diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk
index 88c68041a8..4662c77f17 100644
--- a/iconvdata/extra-module.mk
+++ b/iconvdata/extra-module.mk
@@ -1,7 +1,7 @@
 mod := $(firstword $(extra-modules-left))
 extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left)))
 
-extra-objs += $(patsubst %,%.os,$($(mod)-routines))
+extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines))
 
 $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))
 	$(build-module)
diff --git a/include/limits.h b/include/limits.h
index 160fc5f41c..ab51f48331 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -20,6 +20,9 @@
  *	ISO C Standard: 4.14/2.2.4.2 Limits of integral types	<limits.h>
  */
 
+#ifndef _LIBC_LIMITS_H_
+#define _LIBC_LIMITS_H_	1
+
 #include <features.h>
 
 #ifdef	__USE_POSIX
@@ -39,9 +42,6 @@
 #if __GNUC__ >= 2
 
  /* Get the compiler's limits.h, which defines all the ANSI constants.  */
-# ifndef _LIBC_LIMITS_H_
-#  define _LIBC_LIMITS_H_	/* This tells it not to look for another.  */
-# endif
 # ifndef _GCC_LIMITS_H_		/* This is what GCC's file defines.  */
 #  include_next <limits.h>
 # endif
@@ -90,7 +90,7 @@
 #  define USHRT_MAX	65535
 
 /* Minimum and maximum values a `signed int' can hold.  */
-#  define INT_MIN	(- INT_MAX - 1)
+#  define INT_MIN	(-INT_MAX - 1)
 #  define INT_MAX	2147483647
 
 /* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
@@ -106,7 +106,7 @@
 #  else
 #   define LONG_MAX	2147483647L
 #  endif
-#  define LONG_MIN	(- LONG_MAX - 1L)
+#  define LONG_MIN	(-LONG_MAX - 1L)
 
 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
 #  ifdef __alpha__
@@ -121,3 +121,5 @@
 
 # endif	/* limits.h  */
 #endif	/* GCC 2.  */
+
+#endif	/* !_LIBC_LIMITS_H_ */
diff --git a/libio/Makefile b/libio/Makefile
index f3a66f32ca..0997b5d8bf 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -43,7 +43,7 @@ all: # Make this the default target; it will be defined in Rules.
 include ../Makeconfig
 
 ifeq ($(versioning),yes)
-routines += oldiofopen oldiofclose
+routines += oldiofopen oldiofclose oldiofclose
 endif
 
 CPPFLAGS-.o += -DIO_DEBUG
@@ -62,7 +62,8 @@ ifeq ($(versioning),yes)
 aux	+= oldfileops oldstdfiles
 endif
 
-shared-only-routines = oldiofopen oldiofclose oldfileops oldstdfiles
+shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops	\
+		       oldstdfiles
 
 distribute := iolibio.h libioP.h strfile.h Banner
 
diff --git a/libio/fileops.c b/libio/fileops.c
index a0cc2f7d0e..d2377af73b 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -108,11 +108,10 @@ void
 _IO_file_init (fp)
      _IO_FILE *fp;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   /* POSIX.1 allows another file handle to be used to change the position
      of our file descriptor.  Hence we actually don't know the actual
      position before we do the first fseek (and until a following fflush). */
-  fc->_offset = _IO_pos_BAD;
+  fp->_offset = _IO_pos_BAD;
   fp->_IO_file_flags |= CLOSED_FILEBUF_FLAGS;
 
   _IO_link_in(fp);
@@ -123,7 +122,6 @@ int
 _IO_file_close_it (fp)
      _IO_FILE *fp;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   int write_status, close_status;
   if (!_IO_file_is_open (fp))
     return EOF;
@@ -142,7 +140,7 @@ _IO_file_close_it (fp)
   _IO_un_link (fp);
   fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
   fp->_fileno = EOF;
-  fc->_offset = _IO_pos_BAD;
+  fp->_offset = _IO_pos_BAD;
 
   return close_status ? close_status : write_status;
 }
@@ -161,6 +159,38 @@ _IO_file_finish (fp, dummy)
   _IO_default_finish (fp, 0);
 }
 
+#if defined __GNUC__ && __GNUC__ >= 2
+__inline__
+#endif
+_IO_FILE *
+_IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
+     _IO_FILE *fp;
+     const char *filename;
+     int posix_mode;
+     int prot;
+     int read_write;
+     int is32not64;
+{
+  int fdesc;
+#ifdef _G_OPEN64
+  fdesc = (is32not64
+	   ? open (filename, posix_mode, prot)
+	   : _G_OPEN64 (filename, posix_mode, prot));
+#else
+  fdesc = open (filename, posix_mode, prot);
+#endif
+  if (fdesc < 0)
+    return NULL;
+  fp->_fileno = fdesc;
+  _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
+  if (read_write & _IO_IS_APPENDING)
+    if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+	== _IO_pos_BAD && errno != ESPIPE)
+      return NULL;
+  _IO_link_in (fp);
+  return fp;
+}
+
 _IO_FILE *
 _IO_file_fopen (fp, filename, mode, is32not64)
      _IO_FILE *fp;
@@ -169,7 +199,7 @@ _IO_file_fopen (fp, filename, mode, is32not64)
      int is32not64;
 {
   int oflags = 0, omode;
-  int read_write, fdesc;
+  int read_write;
   int oprot = 0666;
   if (_IO_file_is_open (fp))
     return 0;
@@ -198,23 +228,8 @@ _IO_file_fopen (fp, filename, mode, is32not64)
       omode = O_RDWR;
       read_write &= _IO_IS_APPENDING;
     }
-#ifdef _G_OPEN64
-  fdesc = (is32not64
-	   ? open (filename, omode|oflags, oprot)
-	   : _G_OPEN64 (filename, omode|oflags, oprot));
-#else
-  fdesc = open (filename, omode|oflags, oprot);
-#endif
-  if (fdesc < 0)
-    return NULL;
-  fp->_fileno = fdesc;
-  _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
-  if (read_write & _IO_IS_APPENDING)
-    if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
-	== _IO_pos_BAD && errno != ESPIPE)
-      return NULL;
-  _IO_link_in (fp);
-  return fp;
+  return _IO_file_open (fp, filename, omode|oflags, oprot, read_write,
+			is32not64);
 }
 
 _IO_FILE *
@@ -222,7 +237,6 @@ _IO_file_attach (fp, fd)
      _IO_FILE *fp;
      int fd;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   if (_IO_file_is_open (fp))
     return NULL;
   fp->_fileno = fd;
@@ -230,7 +244,7 @@ _IO_file_attach (fp, fd)
   fp->_flags |= _IO_DELETE_DONT_CLOSE;
   /* Get the current position of the file. */
   /* We have to do that since that may be junk. */
-  fc->_offset = _IO_pos_BAD;
+  fp->_offset = _IO_pos_BAD;
   if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
       == _IO_pos_BAD && errno != ESPIPE)
     return NULL;
@@ -262,7 +276,6 @@ _IO_do_write (fp, data, to_do)
      const char *data;
      _IO_size_t to_do;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_size_t count;
   if (to_do == 0)
     return 0;
@@ -272,14 +285,14 @@ _IO_do_write (fp, data, to_do)
        is not needed nor desirable for Unix- or Posix-like systems.
        Instead, just indicate that offset (before and after) is
        unpredictable. */
-    fc->_offset = _IO_pos_BAD;
+    fp->_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
     {
       _IO_fpos64_t new_pos
 	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
 	return EOF;
-      fc->_offset = new_pos;
+      fp->_offset = new_pos;
     }
   count = _IO_SYSWRITE (fp, data, to_do);
   if (fp->_cur_column)
@@ -295,7 +308,6 @@ int
 _IO_file_underflow (fp)
      _IO_FILE *fp;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_ssize_t count;
 #if 0
   /* SysV does not make this test; take it out for compatibility */
@@ -342,8 +354,8 @@ _IO_file_underflow (fp)
   fp->_IO_read_end += count;
   if (count == 0)
     return EOF;
-  if (fc->_offset != _IO_pos_BAD)
-    _IO_pos_adjust (fc->_offset, count);
+  if (fp->_offset != _IO_pos_BAD)
+    _IO_pos_adjust (fp->_offset, count);
   return *(unsigned char *) fp->_IO_read_ptr;
 }
 
@@ -402,7 +414,6 @@ int
 _IO_file_sync (fp)
      _IO_FILE *fp;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_size_t delta;
   int retval = 0;
 
@@ -429,7 +440,7 @@ _IO_file_sync (fp)
 	retval = EOF;
     }
   if (retval != EOF)
-    fc->_offset = _IO_pos_BAD;
+    fp->_offset = _IO_pos_BAD;
   /* FIXME: Cleanup - can this be shared? */
   /*    setg(base(), ptr, ptr); */
   _IO_cleanup_region_end (1);
@@ -443,7 +454,6 @@ _IO_file_seekoff (fp, offset, dir, mode)
      int dir;
      int mode;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) fp;
   _IO_fpos64_t result;
   _IO_off64_t delta, new_offset;
   long count;
@@ -479,10 +489,10 @@ _IO_file_seekoff (fp, offset, dir, mode)
     case _IO_seek_cur:
       /* Adjust for read-ahead (bytes is buffer). */
       offset -= fp->_IO_read_end - fp->_IO_read_ptr;
-      if (fc->_offset == _IO_pos_BAD)
+      if (fp->_offset == _IO_pos_BAD)
 	goto dumb;
       /* Make offset absolute, assuming current pointer is file_ptr(). */
-      offset += _IO_pos_as_off (fc->_offset);
+      offset += _IO_pos_as_off (fp->_offset);
 
       dir = _IO_seek_set;
       break;
@@ -503,11 +513,11 @@ _IO_file_seekoff (fp, offset, dir, mode)
   /* At this point, dir==_IO_seek_set. */
 
   /* If destination is within current buffer, optimize: */
-  if (fc->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
+  if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
       && !_IO_in_backup (fp))
     {
       /* Offset relative to start of main get area. */
-      _IO_fpos64_t rel_offset = (offset - fc->_offset
+      _IO_fpos64_t rel_offset = (offset - fp->_offset
 				 + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
@@ -581,7 +591,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
   _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
 	    fp->_IO_buf_base + count);
   _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-  fc->_offset = result + count;
+  fp->_offset = result + count;
   _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
   return offset;
  dumb:
@@ -590,7 +600,7 @@ _IO_file_seekoff (fp, offset, dir, mode)
   result = _IO_SYSSEEK (fp, offset, dir);
   if (result != EOF)
     _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
-  fc->_offset = result;
+  fp->_offset = result;
   _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
   _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
   return result;
@@ -643,7 +653,6 @@ _IO_file_write (f, data, n)
      const void *data;
      _IO_ssize_t n;
 {
-  struct _IO_FILE_complete *fc = (struct _IO_FILE_complete *) f;
   _IO_ssize_t to_do = n;
   while (to_do > 0)
     {
@@ -657,8 +666,8 @@ _IO_file_write (f, data, n)
       data = (void *) ((char *) data + count);
     }
   n -= to_do;
-  if (fc->_offset >= 0)
-    fc->_offset += n;
+  if (f->_offset >= 0)
+    f->_offset += n;
   return n;
 }
 
diff --git a/libio/genops.c b/libio/genops.c
index 3776b9e332..ea602eda39 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -531,6 +531,9 @@ _IO_init (fp, flags)
   fp->_IO_save_end = NULL;
   fp->_markers = NULL;
   fp->_cur_column = 0;
+#if _IO_JUMPS_OFFSET
+  fp->_vtable_offset = 0;
+#endif
 #ifdef _IO_MTSAFE_IO
   _IO_lock_init (*fp->_lock);
 #endif
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index b6508255d0..2ecbce3ad0 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -34,7 +34,7 @@
 #endif
 
 _IO_FILE *
-_IO_fdopen (fd, mode)
+_IO_new_fdopen (fd, mode)
      int fd;
      const char *mode;
 {
@@ -42,7 +42,7 @@ _IO_fdopen (fd, mode)
   int posix_mode = 0;
   struct locked_FILE
   {
-    struct _IO_FILE_complete fp;
+    struct _IO_FILE_plus fp;
 #ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
 #endif
@@ -106,29 +106,36 @@ _IO_fdopen (fd, mode)
   if (new_f == NULL)
     return NULL;
 #ifdef _IO_MTSAFE_IO
-  new_f->fp.plus.file._lock = &new_f->lock;
+  new_f->fp.file._lock = &new_f->lock;
 #endif
-  _IO_init (&new_f->fp.plus.file, 0);
-  _IO_JUMPS (&new_f->fp.plus.file) = &_IO_file_jumps;
-  _IO_file_init (&new_f->fp.plus.file);
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.file);
 #if  !_IO_UNIFIED_JUMPTABLES
   new_f->fp.vtable = NULL;
 #endif
-  if (_IO_file_attach (&new_f->fp.plus.file, fd) == NULL)
+  if (_IO_file_attach (&new_f->fp.file, fd) == NULL)
     {
-      _IO_un_link (&new_f->fp.plus.file);
+      _IO_un_link (&new_f->fp.file);
       free (new_f);
       return NULL;
     }
-  new_f->fp.plus.file._flags &= ~_IO_DELETE_DONT_CLOSE;
+  new_f->fp.file._flags &= ~_IO_DELETE_DONT_CLOSE;
 
-  new_f->fp.plus.file._IO_file_flags =
-    _IO_mask_flags (&new_f->fp.plus.file, read_write,
+  new_f->fp.file._IO_file_flags =
+    _IO_mask_flags (&new_f->fp.file, read_write,
 		    _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
 
   return (_IO_FILE *) &new_f->fp;
 }
 
-#ifdef weak_alias
-weak_alias (_IO_fdopen, fdopen)
+#ifdef DO_VERSIONING
+strong_alias (_IO_new_fdopen, __new_fdopen)
+default_symbol_version (_IO_new_fdopen, _IO_fdopen, GLIBC_2.1);
+default_symbol_version (__new_fdopen, fdopen, GLIBC_2.1);
+#else
+# ifdef weak_alias
+weak_alias (_IO_new_fdopen, _IO_fdopen)
+weak_alias (_IO_new_fdopen, fdopen)
+# endif
 #endif
diff --git a/libio/iofgets.c b/libio/iofgets.c
index 74754d5d1e..91db09f342 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -34,11 +34,17 @@ _IO_fgets (buf, n, fp)
 {
   _IO_size_t count;
   char *result;
+  int old_error;
   CHECK_FILE (fp, NULL);
   if (n <= 0)
     return NULL;
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
+  /* This is very tricky since a file descriptor may be in the
+     non-blocking mode. The error flag doesn't mean much in this
+     case. We return an error only when there is a new error. */
+  old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
+  fp->_IO_file_flags &= ~_IO_ERR_SEEN;
   count = _IO_getline (fp, buf, n - 1, '\n', 1);
   if (count == 0 || (fp->_IO_file_flags & _IO_ERR_SEEN))
     result = NULL;
@@ -47,6 +53,7 @@ _IO_fgets (buf, n, fp)
       buf[count] = '\0';
       result = buf;
     }
+  fp->_IO_file_flags |= old_error;
   _IO_cleanup_region_end (1);
   return result;
 }
diff --git a/libio/iofopen.c b/libio/iofopen.c
index 59d1ce571e..41da8f1721 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -35,7 +35,7 @@ _IO_new_fopen (filename, mode)
 {
   struct locked_FILE
   {
-    struct _IO_FILE_complete fp;
+    struct _IO_FILE_plus fp;
 #ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
 #endif
@@ -44,17 +44,17 @@ _IO_new_fopen (filename, mode)
   if (new_f == NULL)
     return NULL;
 #ifdef _IO_MTSAFE_IO
-  new_f->fp.plus.file._lock = &new_f->lock;
+  new_f->fp.file._lock = &new_f->lock;
 #endif
-  _IO_init (&new_f->fp.plus.file, 0);
-  _IO_JUMPS (&new_f->fp.plus.file) = &_IO_file_jumps;
-  _IO_file_init (&new_f->fp.plus.file);
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.file);
 #if  !_IO_UNIFIED_JUMPTABLES
-  new_f->fp.plus.vtable = NULL;
+  new_f->fp.vtable = NULL;
 #endif
-  if (_IO_file_fopen (&new_f->fp.plus.file, filename, mode, 0) != NULL)
-        return (_IO_FILE *) &new_f->fp.plus;
-  _IO_un_link (&new_f->fp.plus.file);
+  if (_IO_file_fopen (&new_f->fp.file, filename, mode, 0) != NULL)
+    return (_IO_FILE *) &new_f->fp;
+  _IO_un_link (&new_f->fp.file);
   free (new_f);
   return NULL;
 }
diff --git a/libio/iofopen64.c b/libio/iofopen64.c
index fc6ccc0b92..3572295ad8 100644
--- a/libio/iofopen64.c
+++ b/libio/iofopen64.c
@@ -36,7 +36,7 @@ _IO_fopen64 (filename, mode)
 #ifdef _G_OPEN64
   struct locked_FILE
   {
-    struct _IO_FILE_complete fp;
+    struct _IO_FILE_plus fp;
 #ifdef _IO_MTSAFE_IO
     _IO_lock_t lock;
 #endif
@@ -45,17 +45,17 @@ _IO_fopen64 (filename, mode)
   if (new_f == NULL)
     return NULL;
 #ifdef _IO_MTSAFE_IO
-  new_f->fp.plus.file._lock = &new_f->lock;
+  new_f->fp.file._lock = &new_f->lock;
 #endif
-  _IO_init (&new_f->fp.plus.file, 0);
-  _IO_JUMPS (&new_f->fp.plus.file) = &_IO_file_jumps;
-  _IO_file_init (&new_f->fp.plus.file);
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.file);
 #if  !_IO_UNIFIED_JUMPTABLES
   new_f->fp.plus.vtable = NULL;
 #endif
-  if (_IO_file_fopen (&new_f->fp.plus.file, filename, mode, 1) != NULL)
-        return (_IO_FILE *) &new_f->fp.plus;
-  _IO_un_link (&new_f->fp.plus.file);
+  if (_IO_file_fopen (&new_f->fp.file, filename, mode, 1) != NULL)
+    return (_IO_FILE *) &new_f->fp;
+  _IO_un_link (&new_f->fp.file);
   free (new_f);
   return NULL;
 #else
diff --git a/libio/iogets.c b/libio/iogets.c
index 9e88ca1037..a61699d694 100644
--- a/libio/iogets.c
+++ b/libio/iogets.c
@@ -47,6 +47,11 @@ _IO_gets (buf)
     count = 0;
   else
     {
+      /* This is very tricky since a file descriptor may be in the
+	 non-blocking mode. The error flag doesn't mean much in this
+	 case. We return an error only when there is a new error. */
+      int old_error = _IO_stdin->_IO_file_flags & _IO_ERR_SEEN;
+      _IO_stdin->_IO_file_flags &= ~_IO_ERR_SEEN;
       buf[0] = (char) ch;
       count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1;
       if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN)
@@ -54,6 +59,8 @@ _IO_gets (buf)
 	  retval = NULL;
 	  goto unlock_return;
 	}
+      else
+	_IO_stdin->_IO_file_flags |= old_error;
     }
   buf[count] = 0;
   retval = buf;
diff --git a/libio/iolibio.h b/libio/iolibio.h
index 1eef384fa8..ec54d639a6 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -11,6 +11,8 @@ extern int _IO_fclose __P((_IO_FILE*));
 extern int _IO_new_fclose __P((_IO_FILE*));
 extern int _IO_old_fclose __P((_IO_FILE*));
 extern _IO_FILE *_IO_fdopen __P((int, const char*));
+extern _IO_FILE *_IO_old_fdopen __P((int, const char*));
+extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
 extern int _IO_fflush __P((_IO_FILE*));
 extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
 extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
diff --git a/libio/iopopen.c b/libio/iopopen.c
index a03cf636b2..3d2a79635d 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -74,7 +74,7 @@ extern int _IO_dup2 __P ((int fd, int fd2));
 
 struct _IO_proc_file
 {
-  struct _IO_FILE_complete file;
+  struct _IO_FILE_plus file;
   /* Following fields must match those in class procbuf (procbuf.h) */
   _IO_pid_t pid;
   struct _IO_proc_file *next;
@@ -174,7 +174,7 @@ _IO_popen (command, mode)
   if (new_f == NULL)
     return NULL;
 #ifdef _IO_MTSAFE_IO
-  new_f->fpx.file.plus.file._lock = &new_f->lock;
+  new_f->fpx.file.file._lock = &new_f->lock;
 #endif
   fp = (_IO_FILE*)&new_f->fpx;
   _IO_init (fp, 0);
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index 04b40e7553..a24d3b535e 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -32,35 +32,35 @@ _IO_vdprintf (d, format, arg)
      const char *format;
      _IO_va_list arg;
 {
-  struct _IO_FILE_complete tmpfil;
+  struct _IO_FILE_plus tmpfil;
 #ifdef _IO_MTSAFE_IO
   _IO_lock_t lock;
 #endif
   int done;
 
 #ifdef _IO_MTSAFE_IO
-  tmpfil.plus.file._lock = &lock;
+  tmpfil.file._lock = &lock;
 #endif
-  _IO_init (&tmpfil.plus.file, 0);
-  _IO_JUMPS (&tmpfil.plus.file) = &_IO_file_jumps;
-  _IO_file_init (&tmpfil.plus.file);
+  _IO_init (&tmpfil.file, 0);
+  _IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
+  _IO_file_init (&tmpfil.file);
 #if  !_IO_UNIFIED_JUMPTABLES
   tmpfil.vtable = NULL;
 #endif
-  if (_IO_file_attach (&tmpfil.plus.file, d) == NULL)
+  if (_IO_file_attach (&tmpfil.file, d) == NULL)
     {
-      _IO_un_link (&tmpfil.plus.file);
+      _IO_un_link (&tmpfil.file);
       return EOF;
     }
-  tmpfil.plus.file._flags &= ~_IO_DELETE_DONT_CLOSE;
+  tmpfil.file._flags &= ~_IO_DELETE_DONT_CLOSE;
 
-  tmpfil.plus.file._IO_file_flags =
-    _IO_mask_flags (&tmpfil.plus.file, _IO_NO_READS,
+  tmpfil.file._IO_file_flags =
+    _IO_mask_flags (&tmpfil.file, _IO_NO_READS,
 		    _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
 
-  done = _IO_vfprintf (&tmpfil.plus.file, format, arg);
+  done = _IO_vfprintf (&tmpfil.file, format, arg);
 
-  _IO_FINISH (&tmpfil.plus.file);
+  _IO_FINISH (&tmpfil.file);
 
   return done;
 }
diff --git a/libio/libio.h b/libio/libio.h
index 0c12ff0dc6..f6b3b22899 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -212,22 +212,33 @@ struct _IO_FILE {
 #define __HAVE_COLUMN /* temporary */
   /* 1+column number of pbase(); 0 is unknown. */
   unsigned short _cur_column;
-  char _unused;
+  signed char _vtable_offset;
   char _shortbuf[1];
 
   /*  char* _save_gptr;  char* _save_egptr; */
 
   _IO_lock_t *_lock;
+#ifdef _IO_USE_OLD_IO_FILE
+};
+
+struct _IO_FILE_complete
+{
+  struct _IO_FILE _file;
+#endif
+#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
+  _IO_off64_t _offset;
+  int _unused2[16];	/* Make sure we don't get into trouble again.  */
+#endif
 };
 
 #ifndef __cplusplus
 typedef struct _IO_FILE _IO_FILE;
 #endif
 
-struct _IO_FILE_complete;
-extern struct _IO_FILE_complete _IO_2_1_stdin_;
-extern struct _IO_FILE_complete _IO_2_1_stdout_;
-extern struct _IO_FILE_complete _IO_2_1_stderr_;
+struct _IO_FILE_plus;
+extern struct _IO_FILE_plus _IO_2_1_stdin_;
+extern struct _IO_FILE_plus _IO_2_1_stdout_;
+extern struct _IO_FILE_plus _IO_2_1_stderr_;
 #ifndef _LIBC
 #define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
 #define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
diff --git a/libio/libioP.h b/libio/libioP.h
index a69d75b485..568bbe8812 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -64,22 +64,34 @@ extern "C" {
  * object being acted on (i.e. the 'this' parameter).
  */
 
+#if (!defined _IO_USE_OLD_IO_FILE \
+     && (!defined _G_IO_NO_BACKWARD_COMPAT || _G_IO_NO_BACKWARD_COMPAT == 0))
+# define _IO_JUMPS_OFFSET 1
+#endif
+
 #define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable
+#if _IO_JUMPS_OFFSET
+# define _IO_JUMPS_FUNC(THIS) \
+ (*(struct _IO_jump_t **) ((void *) &((struct _IO_FILE_plus *) (THIS))->vtable\
+			   + (THIS)->_vtable_offset))
+#else
+# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS(THIS)
+#endif
 #ifdef _G_USING_THUNKS
 # define JUMP_FIELD(TYPE, NAME) TYPE NAME
-# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC (THIS)
-# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC (THIS, X1)
-# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC (THIS, X1, X2)
-# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC (THIS, X1,X2, X3)
+# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
+# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
+# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
+# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
 # define JUMP_INIT(NAME, VALUE) VALUE
 # define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
 #else
 /* These macros will change when we re-implement vtables to use "thunks"! */
 # define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
-# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC.pfn (THIS)
-# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1)
-# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1, X2)
-# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1,X2,X3)
+# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
+# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
+# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
+# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
 # define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
 # define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
 #endif
@@ -267,17 +279,6 @@ struct _IO_FILE_plus
   const struct _IO_jump_t *vtable;
 };
 
-/* We had to extend _IO_FILE but this isn't easily possible without
-   compatibility problems.  So we mimic the C++ way to do this which
-   especially takes care that the position of the vtable stays the
-   same.  */
-struct _IO_FILE_complete
-{
-  struct _IO_FILE_plus plus;
-  _IO_off64_t _offset;
-  int _unused2[16];	/* Make sure we don't get into trouble again.  */
-};
-
 /* Generic functions */
 
 extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
@@ -374,6 +375,8 @@ extern int _IO_file_overflow __P ((_IO_FILE *, int));
 #define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0)
 extern void _IO_file_init __P ((_IO_FILE *));
 extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
+				     int, int));
 extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
 				      int));
 extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index eec9eed670..a8237c6887 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -32,6 +32,7 @@
 #ifndef _POSIX_SOURCE
 # define _POSIX_SOURCE
 #endif
+#define _IO_USE_OLD_IO_FILE
 #include "libioP.h"
 #include <fcntl.h>
 #include <sys/types.h>
@@ -119,6 +120,8 @@ _IO_old_file_init (fp)
   fp->_IO_file_flags |= CLOSED_FILEBUF_FLAGS;
 
   _IO_link_in(fp);
+  fp->_vtable_offset = ((int) sizeof (struct _IO_FILE)
+			- (int) sizeof (struct _IO_FILE_complete));
   fp->_fileno = -1;
 }
 
diff --git a/libio/oldiofclose.c b/libio/oldiofclose.c
index 5eed0661ec..5f3e1020d8 100644
--- a/libio/oldiofclose.c
+++ b/libio/oldiofclose.c
@@ -23,6 +23,7 @@
    other reasons why the executable file might be covered by the GNU
    General Public License.  */
 
+#define _IO_USE_OLD_IO_FILE
 #include "libioP.h"
 #ifdef __STDC__
 #include <stdlib.h>
diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c
new file mode 100644
index 0000000000..e9c18d932b
--- /dev/null
+++ b/libio/oldiofdopen.c
@@ -0,0 +1,135 @@
+/* Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU IO Library.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this library; see the file COPYING.  If not, write to
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+   As a special exception, if you link this library with files
+   compiled with a GNU compiler to produce an executable, this does
+   not cause the resulting executable to be covered by the GNU General
+   Public License.  This exception does not however invalidate any
+   other reasons why the executable file might be covered by the GNU
+   General Public License.  */
+
+#define _IO_USE_OLD_IO_FILE
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
+#include "libioP.h"
+#include <fcntl.h>
+
+#ifndef _IO_fcntl
+#define _IO_fcntl fcntl
+#endif
+
+_IO_FILE *
+_IO_old_fdopen (fd, mode)
+     int fd;
+     const char *mode;
+{
+  int read_write;
+  int posix_mode = 0;
+  struct locked_FILE
+  {
+    struct _IO_FILE_plus fp;
+#ifdef _IO_MTSAFE_IO
+    _IO_lock_t lock;
+#endif
+  } *new_f;
+  int fd_flags;
+
+  switch (*mode++)
+    {
+    case 'r':
+      read_write = _IO_NO_WRITES;
+      break;
+    case 'w':
+      read_write = _IO_NO_READS;
+      break;
+    case 'a':
+      posix_mode = O_APPEND;
+      read_write = _IO_NO_READS|_IO_IS_APPENDING;
+      break;
+    default:
+      MAYBE_SET_EINVAL;
+      return NULL;
+  }
+  if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
+    read_write &= _IO_IS_APPENDING;
+#ifdef F_GETFL
+  fd_flags = _IO_fcntl (fd, F_GETFL);
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif
+  if (fd_flags == -1
+      || ((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
+      || ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
+    return NULL;
+
+  /* The May 93 draft of P1003.4/D14.1 (redesignated as 1003.1b)
+     [System Application Program Interface (API) Amendment 1:
+     Realtime Extensions], Rationale B.8.3.3
+     Open a Stream on a File Descriptor says:
+
+         Although not explicitly required by POSIX.1, a good
+         implementation of append ("a") mode would cause the
+         O_APPEND flag to be set.
+
+     (Historical implementations [such as Solaris2] do a one-time
+     seek in fdopen.)
+
+     However, we do not turn O_APPEND off if the mode is "w" (even
+     though that would seem consistent) because that would be more
+     likely to break historical programs.
+     */
+  if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
+    {
+#ifdef F_SETFL
+      if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1)
+#endif
+	return NULL;
+    }
+#endif
+
+  new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+  if (new_f == NULL)
+    return NULL;
+#ifdef _IO_MTSAFE_IO
+  new_f->fp.file._lock = &new_f->lock;
+#endif
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp) = &_IO_old_file_jumps;
+  _IO_old_file_init (&new_f->fp.file);
+#if  !_IO_UNIFIED_JUMPTABLES
+  new_f->fp.vtable = NULL;
+#endif
+  if (_IO_old_file_attach (&new_f->fp.file, fd) == NULL)
+    {
+      _IO_un_link (&new_f->fp.file);
+      free (new_f);
+      return NULL;
+    }
+  new_f->fp.file._flags &= ~_IO_DELETE_DONT_CLOSE;
+
+  new_f->fp.file._IO_file_flags =
+    _IO_mask_flags (&new_f->fp.file, read_write,
+		    _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
+
+  return (_IO_FILE *) &new_f->fp;
+}
+
+strong_alias (_IO_old_fdopen, __old_fdopen)
+symbol_version (_IO_old_fdopen, _IO_fdopen, GLIBC_2.0);
+symbol_version (__old_fdopen, fdopen, GLIBC_2.0);
diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c
index d0ffb02b13..5dffae80f3 100644
--- a/libio/oldiofopen.c
+++ b/libio/oldiofopen.c
@@ -23,6 +23,7 @@
    other reasons why the executable file might be covered by the GNU
    General Public License.  */
 
+#define _IO_USE_OLD_IO_FILE
 #include "libioP.h"
 #ifdef __STDC__
 #include <stdlib.h>
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
index 64c792f7a0..baf655048d 100644
--- a/libio/oldstdfiles.c
+++ b/libio/oldstdfiles.c
@@ -30,24 +30,24 @@
    so the objects defined are not valid C++ objects.  On the other
    hand, we don't need a C++ compiler to build this file.) */
 
+#define _IO_USE_OLD_IO_FILE
 #include "libioP.h"
 
 #ifdef _IO_MTSAFE_IO
-#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
   static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
-  struct _IO_FILE_plus INAME \
+  struct _IO_FILE_plus NAME \
     = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps};
 #else
-#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
-  struct _IO_FILE_plus INAME \
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+  struct _IO_FILE_plus NAME \
     = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_old_file_jumps};
 #endif
 
-DEF_STDFILE(_IO_stdin_, _IO_stdin_, 0, 0, _IO_NO_WRITES);
-DEF_STDFILE(_IO_stdout_, _IO_stdout_, 1, &_IO_stdin_.file,
-	    _IO_NO_READS);
-DEF_STDFILE(_IO_stderr_, _IO_stderr_, 2, &_IO_stdout_.file,
-            _IO_NO_READS+_IO_UNBUFFERED);
+DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);
+DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file,
+	    _IO_NO_READS+_IO_UNBUFFERED);
 
 #if defined __GNUC__ && __GNUC__ >= 2
 
@@ -78,9 +78,14 @@ _IO_check_libio ()
   if (&_IO_stdin_used == NULL)
     {
       /* We are using the old one. */
-      stdin = &_IO_stdin_.file;
-      stdout = &_IO_stdout_.file;
-      stderr = _IO_list_all = &_IO_stderr_.file;
+      _IO_stdin = stdin = &_IO_stdin_.file;
+      _IO_stdout = stdout = &_IO_stdout_.file;
+      _IO_stderr = stderr = _IO_list_all = &_IO_stderr_.file;
+      _IO_stdin->_vtable_offset = _IO_stdout->_vtable_offset =
+	_IO_stderr->_vtable_offset = stdin->_vtable_offset =
+	stdout->_vtable_offset = stderr->_vtable_offset =
+	((int) sizeof (struct _IO_FILE)
+	 - (int) sizeof (struct _IO_FILE_complete));
     }
 }
 
diff --git a/libio/stdfiles.c b/libio/stdfiles.c
index c70d47423d..8c09c2c441 100644
--- a/libio/stdfiles.c
+++ b/libio/stdfiles.c
@@ -33,20 +33,19 @@
 #include "libioP.h"
 
 #ifdef _IO_MTSAFE_IO
-#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
   static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
-  struct _IO_FILE_complete INAME \
-    = {{FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps},};
+  struct _IO_FILE_plus NAME \
+    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps};
 #else
-#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \
-  struct _IO_FILE_complete INAME \
-    = {{FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps},};
+#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
+  struct _IO_FILE_plus NAME \
+    = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps};
 #endif
 
-DEF_STDFILE(_IO_2_1_stdin_, _IO_stdin_, 0, 0, _IO_NO_WRITES);
-DEF_STDFILE(_IO_2_1_stdout_, _IO_stdout_, 1, &_IO_2_1_stdin_.plus.file,
-	    _IO_NO_READS);
-DEF_STDFILE(_IO_2_1_stderr_, _IO_stderr_, 2, &_IO_2_1_stdout_.plus.file,
+DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
+DEF_STDFILE(_IO_2_1_stdout_, 1, &_IO_2_1_stdin_.file, _IO_NO_READS);
+DEF_STDFILE(_IO_2_1_stderr_, 2, &_IO_2_1_stdout_.file,
             _IO_NO_READS+_IO_UNBUFFERED);
 
-_IO_FILE *_IO_list_all = &_IO_2_1_stderr_.plus.file;
+_IO_FILE *_IO_list_all = &_IO_2_1_stderr_.file;
diff --git a/libio/stdio.c b/libio/stdio.c
index abea7f38ba..d4358c56d7 100644
--- a/libio/stdio.c
+++ b/libio/stdio.c
@@ -29,9 +29,9 @@
 #undef stdin
 #undef stdout
 #undef stderr
-FILE *stdin = &_IO_2_1_stdin_.plus.file;
-FILE *stdout = &_IO_2_1_stdout_.plus.file;
-FILE *stderr = &_IO_2_1_stderr_.plus.file;
+FILE *stdin = &_IO_2_1_stdin_.file;
+FILE *stdout = &_IO_2_1_stdout_.file;
+FILE *stderr = &_IO_2_1_stderr_.file;
 
 #undef _IO_stdin
 #undef _IO_stdout
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index 851b95fd98..09511eb1e6 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -95,92 +95,92 @@ const char _nl_C_LC_CTYPE_class[768] =
   /* 0xfa */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
 ;
 const char _nl_C_LC_CTYPE_class32[1024] =
-  /* 0x00 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x03 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x06 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x09 */ "\000\000\003\040" "\000\000\002\040" "\000\000\002\040"
-  /* 0x0c */ "\000\000\002\040" "\000\000\002\040" "\000\000\002\000"
-  /* 0x0f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x12 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x15 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x18 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x1b */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x1e */ "\000\000\002\000" "\000\000\002\000" "\000\000\001\140"
-  /* 0x21 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x24 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x27 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x2a */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x2d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x30 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330"
-  /* 0x33 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330"
-  /* 0x36 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330"
-  /* 0x39 */ "\000\000\010\330" "\000\000\004\300" "\000\000\004\300"
-  /* 0x3c */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x3f */ "\000\000\004\300" "\000\000\004\300" "\000\000\010\325"
-  /* 0x42 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\325"
-  /* 0x45 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\305"
-  /* 0x48 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
-  /* 0x4b */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
-  /* 0x4e */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
-  /* 0x51 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
-  /* 0x54 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
-  /* 0x57 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
-  /* 0x5a */ "\000\000\010\305" "\000\000\004\300" "\000\000\004\300"
-  /* 0x5d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x60 */ "\000\000\004\300" "\000\000\010\326" "\000\000\010\326"
-  /* 0x63 */ "\000\000\010\326" "\000\000\010\326" "\000\000\010\326"
-  /* 0x66 */ "\000\000\010\326" "\000\000\010\306" "\000\000\010\306"
-  /* 0x69 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
-  /* 0x6c */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
-  /* 0x6f */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
-  /* 0x72 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
-  /* 0x75 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
-  /* 0x78 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
-  /* 0x7b */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
-  /* 0x7e */ "\000\000\004\300" "\000\000\002\000" "\000\000\002\000"
-  /* 0x81 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x84 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x87 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x8a */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x8d */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x90 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x93 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x96 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x99 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x9c */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0x9f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xa2 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xa5 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xa8 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xab */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xae */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xb1 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xb4 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xb7 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xba */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xbd */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xc0 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xc3 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xc6 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xc9 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xcc */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xcf */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xd2 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xd5 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xd8 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xdb */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xde */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xe1 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xe4 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xe7 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xea */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xed */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xf0 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xf3 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xf6 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xf9 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xfc */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
-  /* 0xff */ "\000\000\002\000"
+  /* 0x00 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x03 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x06 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x09 */ "\003\040\000\000" "\002\040\000\000" "\002\040\000\000"
+  /* 0x0c */ "\002\040\000\000" "\002\040\000\000" "\002\000\000\000"
+  /* 0x0f */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x12 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x15 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x18 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x1b */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x1e */ "\002\000\000\000" "\002\000\000\000" "\001\140\000\000"
+  /* 0x21 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x24 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x27 */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x2a */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x2d */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x30 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000"
+  /* 0x33 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000"
+  /* 0x36 */ "\010\330\000\000" "\010\330\000\000" "\010\330\000\000"
+  /* 0x39 */ "\010\330\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x3c */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x3f */ "\004\300\000\000" "\004\300\000\000" "\010\325\000\000"
+  /* 0x42 */ "\010\325\000\000" "\010\325\000\000" "\010\325\000\000"
+  /* 0x45 */ "\010\325\000\000" "\010\325\000\000" "\010\305\000\000"
+  /* 0x48 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000"
+  /* 0x4b */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000"
+  /* 0x4e */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000"
+  /* 0x51 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000"
+  /* 0x54 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000"
+  /* 0x57 */ "\010\305\000\000" "\010\305\000\000" "\010\305\000\000"
+  /* 0x5a */ "\010\305\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x5d */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x60 */ "\004\300\000\000" "\010\326\000\000" "\010\326\000\000"
+  /* 0x63 */ "\010\326\000\000" "\010\326\000\000" "\010\326\000\000"
+  /* 0x66 */ "\010\326\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x69 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x6c */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x6f */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x72 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x75 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x78 */ "\010\306\000\000" "\010\306\000\000" "\010\306\000\000"
+  /* 0x7b */ "\004\300\000\000" "\004\300\000\000" "\004\300\000\000"
+  /* 0x7e */ "\004\300\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x81 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x84 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x87 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x8a */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x8d */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x90 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x93 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x96 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x99 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x9c */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0x9f */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xa2 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xa5 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xa8 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xab */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xae */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xb1 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xb4 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xb7 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xba */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xbd */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xc0 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xc3 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xc6 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xc9 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xcc */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xcf */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xd2 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xd5 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xd8 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xdb */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xde */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xe1 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xe4 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xe7 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xea */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xed */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xf0 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xf3 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xf6 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xf9 */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xfc */ "\002\000\000\000" "\002\000\000\000" "\002\000\000\000"
+  /* 0xff */ "\002\000\000\000"
 ;
 const u_int32_t _nl_C_LC_CTYPE_toupper[384] =
 {
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index e2ebf26254..0a5e4eebf1 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -56,6 +56,9 @@ void *xrealloc (void *__ptr, size_t __n);
 #define SWAPU16(w) \
   ((((w)  >> 8) & 0xff) | (((w) & 0xff) << 8))
 
+#define XSWAPU32(w) \
+  ((((w) & 0xff00ff00) >> 8) | (((w) & 0xff00ff) << 8))
+
 
 /* To be compatible with former implementations we for now restrict
    the number of bits for character classes to 16.  When compatibility
@@ -63,7 +66,7 @@ void *xrealloc (void *__ptr, size_t __n);
 #define char_class_t u_int16_t
 #define CHAR_CLASS_TRANS SWAPU16
 #define char_class32_t u_int32_t
-#define CHAR_CLASS32_TRANS SWAPU32
+#define CHAR_CLASS32_TRANS XSWAPU32
 
 
 /* The real definition of the struct for the LC_CTYPE locale.  */
diff --git a/malloc/Makefile b/malloc/Makefile
index 8a7fe14d92..ca651d6b03 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -24,10 +24,10 @@ subdir	:= malloc
 all:
 
 dist-headers := malloc.h
-headers := $(dist-headers) obstack.h
+headers := $(dist-headers) obstack.h mcheck.h
 tests := mallocbug
 
-distribute = thread-m.h mtrace.pl mcheck-init.c mcheck.h
+distribute = thread-m.h mtrace.pl mcheck-init.c
 
 # Things which get pasted together into gmalloc.c.
 gmalloc-routines := malloc morecore
diff --git a/malloc/mcheck.h b/malloc/mcheck.h
index 17ab0a9ced..d793bfc3dc 100644
--- a/malloc/mcheck.h
+++ b/malloc/mcheck.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,22 +19,9 @@
 #ifndef _MCHECK_H
 #define _MCHECK_H	1
 
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
-#undef  __P
-#define __P(args)       args
-#undef  __ptr_t
-#define __ptr_t         void *
-#else /* Not C++ or ANSI C.  */
-#undef  __P
-#define __P(args)       ()
-#undef  __ptr_t
-#define __ptr_t         char *
-#endif /* C++ or ANSI C.  */
+#include <features.h>
 
+__BEGIN_DECLS
 
 /* Return values for `mprobe': these are the kinds of inconsistencies that
    `mcheck' enables detection of.  */
@@ -63,8 +50,6 @@ extern enum mcheck_status mprobe __P ((__ptr_t __ptr));
 extern void mtrace __P ((void));
 extern void muntrace __P ((void));
 
-#ifdef  __cplusplus
-}
-#endif
+__END_DECLS
 
 #endif /* mcheck.h */
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index c1704d00ea..cdd7432a76 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -41,7 +41,7 @@ extern char *getenv ();
 #endif
 
 static FILE *mallstream;
-static char mallenv[]= "MALLOC_TRACE";
+static const char mallenv[]= "MALLOC_TRACE";
 static char mallbuf[BUFSIZ];	/* Buffer for the output.  */
 
 __libc_lock_define_initialized (static, lock);
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index 46d8425bee..f889294c1d 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -178,15 +178,20 @@ close (DATA);
 
 # Now print all remaining entries.
 @addrs= keys %allocated;
+$anything=0;
 if ($#addrs >= 0) {
-    print "\nNot freed memory:\n-----------------\n";
-    print ' ' x (@XXX@ - 7), "Address     Size     Caller\n";
     foreach $addr (sort @addrs) {
 	if (defined $allocated{$addr}) {
+	    if ($anything == 0) {
+		print "\nMemory not freed:\n-----------------\n";
+		print ' ' x (@XXX@ - 7), "Address     Size     Caller\n";
+		$anything=1;
+	    }
 	    printf ("%#0@XXX@x %#8x  at %s\n", hex($addr), $allocated{$addr},
 		    $wherewas{$addr});
 	}
     }
 }
+print "No memory leaks.\n" if ($anything == 0);
 
 exit 0;
diff --git a/manual/memory.texi b/manual/memory.texi
index 16dc9aa5e1..a186fd4b8c 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -31,6 +31,7 @@ will be freed automatically.  @xref{Variable Size Automatic}.
 * Dynamic Allocation and C::    How to get different kinds of allocation in C.
 * Unconstrained Allocation::    The @code{malloc} facility allows fully general
 		 		 dynamic allocation.
+* Allocation Debugging::        Finding memory leaks and not freed memory.
 * Obstacks::                    Obstacks are less general than malloc
 				 but more efficient and convenient.
 * Variable Size Automatic::     Allocation of variable-sized blocks
@@ -630,8 +631,12 @@ uses whenever it is called.  You should define this function to look
 like @code{malloc}; that is, like:
 
 @smallexample
-void *@var{function} (size_t @var{size})
+void *@var{function} (size_t @var{size}, void *@var{caller})
 @end smallexample
+
+The value of @var{caller} is the return address found on the stack when
+the @code{malloc} function was called.  This value allows to trace the
+memory consumption of the program.
 @end defvar
 
 @comment malloc.h
@@ -642,8 +647,12 @@ uses whenever it is called.  You should define this function to look
 like @code{realloc}; that is, like:
 
 @smallexample
-void *@var{function} (void *@var{ptr}, size_t @var{size})
+void *@var{function} (void *@var{ptr}, size_t @var{size}, void *@var{caller})
 @end smallexample
+
+The value of @var{caller} is the return address found on the stack when
+the @code{realloc} function was called.  This value allows to trace the
+memory consumption of the program.
 @end defvar
 
 @comment malloc.h
@@ -654,8 +663,12 @@ uses whenever it is called.  You should define this function to look
 like @code{free}; that is, like:
 
 @smallexample
-void @var{function} (void *@var{ptr})
+void @var{function} (void *@var{ptr}, void *@var{caller})
 @end smallexample
+
+The value of @var{caller} is the return address found on the stack when
+the @code{free} function was called.  This value allows to trace the
+memory consumption of the program.
 @end defvar
 
 You must make sure that the function you install as a hook for one of
@@ -797,13 +810,13 @@ Tell @code{malloc} to perform occasional consistency checks on
 dynamically allocated memory, and to call @var{abortfn} when an
 inconsistency is found.  @xref{Heap Consistency Checking}.
 
-@item void *(*__malloc_hook) (size_t @var{size})
+@item void *(*__malloc_hook) (size_t @var{size}, void *@var{caller})
 A pointer to a function that @code{malloc} uses whenever it is called.
 
-@item void *(*__realloc_hook) (void *@var{ptr}, size_t @var{size})
+@item void *(*__realloc_hook) (void *@var{ptr}, size_t @var{size}, void *@var{caller})
 A pointer to a function that @code{realloc} uses whenever it is called.
 
-@item void (*__free_hook) (void *@var{ptr})
+@item void (*__free_hook) (void *@var{ptr}, void *@var{caller})
 A pointer to a function that @code{free} uses whenever it is called.
 
 @item struct mallinfo mallinfo (void)
@@ -811,6 +824,240 @@ Return information about the current dynamic memory usage.
 @xref{Statistics of Malloc}.
 @end table
 
+@node Allocation Debugging
+@section Allocation Debugging
+@cindex allocation debugging
+@cindex malloc debugger
+
+An complicated task when programming with languages which do not use
+garbage collected dynamic memory allocation is to find memory leaks.
+Long running programs must assure that dynamically allocated objects are
+freed at the end of their lifetime.  If this does not happen the system
+runs out of memory, sooner or later.
+
+The @code{malloc} implementation in the GNU C library provides some
+simple means to detect sich leaks and provide some information to find
+the location.  To do this the application must be started in a special
+mode which is enabled by an environment variable.  There are no speed
+penalties if the program is compiled in preparation of the debugging if
+the debug mode is not enabled.
+
+@menu
+* Tracing malloc::               How to install the tracing functionality.
+* Using the Memory Debugger::    Example programs excerpts.
+* Tips for the Memory Debugger:: Some more or less clever ideas.
+* Interpreting the traces::      What do all these lines mean?
+@end menu
+
+@node Tracing malloc
+@subsection How to install the tracing functionality
+
+@comment mcheck.h
+@comment GNU
+@deftypefun void mtrace (void)
+When the @code{mtrace} function is called it looks for an environment
+variable named @code{MALLOC_TRACE}.  This variable is supposed to
+contain a valid file name.  The user must have write access.  If the
+file already exists it is truncated.  If the environment variable is not
+set or it does not name a valid file which can be opened for writing
+nothing is done.  The behaviour of @code{malloc} etc. is not changed.
+For obvious reasons this also happens if the application is install SUID
+or SGID.
+
+If the named file is successfully opened @code{mtrace} installs special
+handlers for the functions @code{malloc}, @code{realloc}, and
+@code{free} (@pxref{Hooks for Malloc}).  From now on all uses of these
+functions are traced and protocolled into the file.  There is now of
+course a speed penalty for all calls to the traced functions so that the
+tracing should not be enabled during their normal use.
+
+This function is a GNU extension and generally not available on other
+systems.  The prototype can be found in @file{mcheck.h}.
+@end deftypefun
+
+@comment mcheck.h
+@comment GNU
+@deftypefun void muntrace (void)
+The @code{muntrace} function can be called after @code{mtrace} was used
+to enable tracing the @code{malloc} calls.  If no (succesful) call of
+@code{mtrace} was made @code{muntrace} does nothing.
+
+Otherwise it deinstalls the handlers for @code{malloc}, @code{realloc},
+and @code{free} and then closes the protocol file.  No calls are
+protocolled anymore and the programs runs again with the full speed.
+
+This function is a GNU extension and generally not available on other
+systems.  The prototype can be found in @file{mcheck.h}.
+@end deftypefun
+
+@node Using the Memory Debugger
+@subsection Example programs excerpts
+
+Even though the tracing functionality does not influence the runtime
+behaviour of the program it is no wise idea to call @code{mtrace} in all
+programs.  Just imagine you debug a program using @code{mtrace} and all
+other programs used in the debug sessions also trace their @code{malloc}
+calls.  The output file would be the same for all programs and so is
+unusable.  Therefore on should call @code{mtrace} only if compiled for
+debugging.  A program could therefore start like this:
+
+@example
+#include <mcheck.h>
+
+int
+main (int argc, char *argv[])
+@{
+#ifdef DEBUGGING
+  mtrace ();
+#endif
+  @dots{}
+@}
+@end example
+
+This is all what is needed if you want to trace the calls during the
+whole runtime of the program.  Alternatively you can stop the tracing at
+any time with a call to @code{muntrace}.  It is even possible to restart
+the tracing again with a new call to @code{mtrace}.  But this can course
+unreliable results since there are possibly calls of the functions which
+are not called.  Please note that not only the application uses the
+traced functions, also libraries (including the C library itself) use
+this function.
+
+This last point is also why it is no good idea to call @code{muntrace}
+before the program terminated.  The libraries are informed about the
+termination of the program only after the program returns from
+@code{main} or calls @code{exit} and so cannot free the memory they use
+before this time.
+
+So the best thing one can do is to call @code{mtrace} as the very first
+function in the program and never call @code{muntrace}.  So the program
+traces almost all uses of the @code{malloc} functions (except those
+calls which are executed by constructors of the program or used
+libraries).
+
+@node Tips for the Memory Debugger
+@subsection Some more or less clever ideas
+
+You know the situation.  The program is prepared for debugging and in
+all debugging sessions it runs well.  But once it is started without
+debugging the error shows up.  In our situation here: the memory leaks
+becomes visible only when we just turned off the debugging.  If you
+foresee such situations you can still win.  Simply use something
+equivalent to the following little program:
+
+@example
+#include <mcheck.h>
+#include <signal.h>
+
+static void
+enable (int sig)
+@{
+  mtrace ();
+  signal (SIGUSR1, enable);
+@}
+
+static void
+disable (int sig)
+@{
+  muntrace ();
+  signal (SIGUSR2, disable);
+@}
+
+int
+main (int argc, char *argv[])
+@{
+  @dots{}
+
+  signal (SIGUSR1, enable);
+  signal (SIGUSR2, disable);
+
+  @dots{}
+@}
+@end example
+
+I.e., the user can start the memory debugger any time he wants if the
+program was started with @code{MALLOC_TRACE} set in the environment.
+The output will of course not show the allocations which happened before
+the first signal but if there is a memory leak this will show up
+nevertheless.
+
+@node Interpreting the traces
+@subsection Interpreting the traces
+
+If you take a look at the output it will look similar to this:
+
+@example
+= Start
+@ [0x8048209] - 0x8064cc8
+@ [0x8048209] - 0x8064ce0
+@ [0x8048209] - 0x8064cf8
+@ [0x80481eb] + 0x8064c48 0x14
+@ [0x80481eb] + 0x8064c60 0x14
+@ [0x80481eb] + 0x8064c78 0x14
+@ [0x80481eb] + 0x8064c90 0x14
+= End
+@end example
+
+What this all means is not really important since the trace file is not
+meant to be read by a human.  Therefore no attention is payed to good
+readability.  Instead there is a program which comes with the GNU C
+library which interprets the traces and outputs a summary in on
+user-friendly way.  The program is called @code{mtrace} (it is in fact a
+Perl script) and it takes one or two arguments.  In any case the name of
+the file with the trace must be specified.  If an optional precedes the
+name of the trace file this must be the name of the program which
+generated the trace.
+
+@example
+drepper$ mtrace tst-mtrace log
+No memory leaks.
+@end example
+
+In this case the program @code{tst-mtrace} was run and it produced a
+trace file @file{log}.  The message printed by @code{mtrace} shows there
+are no problems with the code, all allocated memory was freed
+afterwards.
+
+If we call @code{mtrace} on the example trace given above we would get a
+different outout:
+
+@example
+drepper$ mtrace errlog
+- 0x08064cc8 Free 2 was never alloc'd 0x8048209
+- 0x08064ce0 Free 3 was never alloc'd 0x8048209
+- 0x08064cf8 Free 4 was never alloc'd 0x8048209
+
+Memory not freed:
+-----------------
+   Address     Size     Caller
+0x08064c48     0x14  at 0x80481eb
+0x08064c60     0x14  at 0x80481eb
+0x08064c78     0x14  at 0x80481eb
+0x08064c90     0x14  at 0x80481eb
+@end example
+
+We have called @code{mtrace} with only one argument and so the script
+has no chance to find out what is meant with the addresses given in the
+trace.  We can do better:
+
+@example
+drepper$ mtrace tst-mtrace errlog
+- 0x08064cc8 Free 2 was never alloc'd /home/drepper/tst-mtrace.c:39
+- 0x08064ce0 Free 3 was never alloc'd /home/drepper/tst-mtrace.c:39
+- 0x08064cf8 Free 4 was never alloc'd /home/drepper/tst-mtrace.c:39
+
+Memory not freed:
+-----------------
+   Address     Size     Caller
+0x08064c48     0x14  at /home/drepper/tst-mtrace.c:33
+0x08064c60     0x14  at /home/drepper/tst-mtrace.c:33
+0x08064c78     0x14  at /home/drepper/tst-mtrace.c:33
+0x08064c90     0x14  at /home/drepper/tst-mtrace.c:33
+@end example
+
+Suddenly the output makes much more sense and the user can see
+immediately where the function calls causing the trouble can be found.
+
 @node Obstacks
 @section Obstacks
 @cindex obstacks
@@ -1442,7 +1689,7 @@ source file that uses @code{obstack_init} (@pxref{Creating Obstacks}).
 Most often they are defined as macros like this:
 
 @smallexample
-#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_alloc malloc
 #define obstack_chunk_free free
 @end smallexample
 
diff --git a/manual/signal.texi b/manual/signal.texi
index e6014ec195..177b3b98c0 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -3148,7 +3148,6 @@ The return value is @code{0} on success and @code{-1} on failure.  If
 @code{sigaltstack} fails, it sets @code{errno} to one of these values:
 
 @table @code
-@item
 @item EINVAL
 You tried to disable a stack that was in fact currently in use.
 
diff --git a/math/libm-test.c b/math/libm-test.c
index c9b3b4d06e..a1050ba0aa 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -847,6 +847,9 @@ acos_test (void)
   check ("acos (0.5) == pi/3", FUNC(acos) (0.5), M_PI_6 * 2.0);
   check ("acos (-0.5) == 2*pi/3", FUNC(acos) (-0.5), M_PI_6 * 4.0);
 
+  check_eps ("acos (0.7) == 0.795398830...", FUNC(acos) (0.7),
+	     0.7953988301841435554L, CHOOSE(7e-17L, 0, 0));
+
 }
 
 
@@ -864,6 +867,8 @@ acosh_test (void)
 #endif
 
   check ("acosh(1) == 0", FUNC(acosh) (1), 0);
+  check ("acosh(7) == 2.633915793...", FUNC(acosh) (7),
+	 2.6339157938496334172L);
 }
 
 
@@ -892,7 +897,8 @@ asin_test (void)
 	     CHOOSE(3.5e-18, 0, 2e-7));
   check ("asin (1.0) ==  pi/2", FUNC(asin) (1.0), M_PI_2);
   check ("asin (-1.0) ==  -pi/2", FUNC(asin) (-1.0), -M_PI_2);
-
+  check_eps ("asin (0.7) ==  0.775397496...", FUNC(asin) (0.7),
+	     0.7753974966107530637L, CHOOSE(7e-17L, 2e-16, 0));
 }
 
 
@@ -906,6 +912,8 @@ asinh_test (void)
   check_isinfp ("asinh(+inf) == +inf", FUNC(asinh) (plus_infty));
   check_isinfn ("asinh(-inf) == -inf", FUNC(asinh) (minus_infty));
 #endif
+  check_eps ("asinh(0.7) == 0.652666566...", FUNC(asinh) (0.7),
+	     0.652666566082355786L, CHOOSE(4e-17L, 0, 0));
 
 }
 
@@ -922,6 +930,8 @@ atan_test (void)
   check ("atan (1) == pi/4", FUNC(atan) (1), M_PI_4);
   check ("atan (-1) == -pi/4", FUNC(atan) (1), M_PI_4);
 
+  check_eps ("atan (0.7) == 0.610725964...", FUNC(atan) (0.7),
+	     0.6107259643892086165L, CHOOSE(3e-17L, 0, 0));
 }
 
 
@@ -1026,6 +1036,8 @@ atanh_test (void)
                        FUNC(atanh) (x), INVALID_EXCEPTION, x);
 
 #endif
+  check_eps ("atanh(0.7) == 0.867300527...", FUNC(atanh) (0.7),
+	     0.8673005276940531944L, CHOOSE(9e-17L, 2e-16, 0));
 }
 
 
@@ -1047,6 +1059,9 @@ cbrt_test (void)
 	     CHOOSE (3e-16L, 5e-16, 0));
   check_eps ("cbrt (0.970299) == 0.99", FUNC(cbrt) (0.970299), 0.99,
 	     CHOOSE (2e-17L, 0, 0));
+  check_eps ("cbrt (0.7) == .8879040017...", FUNC(cbrt) (0.7),
+	     0.8879040017426007084L, CHOOSE(2e-17L, 2e-16, 0));
+
 }
 
 
@@ -1083,6 +1098,8 @@ cos_test (void)
   check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2),
 	     0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
 
+  check_eps ("cos (0.7) == 0.7648421872...", FUNC(cos) (0.7),
+	     0.7648421872844884262L, CHOOSE(3e-17, 2e-16, 0));
 }
 
 static void
@@ -1095,6 +1112,9 @@ cosh_test (void)
   check_isinfp ("cosh (+inf) == +inf", FUNC(cosh) (plus_infty));
   check_isinfp ("cosh (-inf) == +inf", FUNC(cosh) (minus_infty));
 #endif
+
+  check_eps ("cosh (0.7) ==  1.2551690056...", FUNC(cosh) (0.7),
+	     1.255169005630943018L, CHOOSE(4e-17L, 0, 0));
 }
 
 
@@ -1111,6 +1131,9 @@ erf_test (void)
   check ("erf (-0) == -0", FUNC(erf) (minus_zero), minus_zero);
   check ("erf (+inf) == +1", FUNC(erf) (plus_infty), 1);
   check ("erf (-inf) == -1", FUNC(erf) (minus_infty), -1);
+
+  check_eps ("erf (0.7) == 0.6778011938...", FUNC(erf) (0.7),
+	     0.67780119383741847297L, CHOOSE(0, 2e-16, 0));
 }
 
 
@@ -1127,6 +1150,9 @@ erfc_test (void)
   check ("erfc (-inf) == 2", FUNC(erfc) (minus_infty), 2.0);
   check ("erfc (+0) == 1", FUNC(erfc) (0.0), 1.0);
   check ("erfc (-0) == 1", FUNC(erfc) (minus_zero), 1.0);
+
+  check_eps ("erfc (0.7) == 0.3221988061...", FUNC(erfc) (0.7),
+	     0.32219880616258152702L, CHOOSE(0, 6e-17, 0));
 }
 
 
@@ -1144,6 +1170,8 @@ exp_test (void)
 
   check ("exp (2) == e^2", FUNC(exp) (2), M_E * M_E);
   check ("exp (3) == e^3", FUNC(exp) (3), M_E * M_E * M_E);
+  check_eps ("exp (0.7) == 2.0137527074...", FUNC(exp) (0.7),
+	     2.0137527074704765216L, CHOOSE(9e-17L, 0, 0));
 }
 
 
@@ -1165,6 +1193,8 @@ exp2_test (void)
   check ("exp2 (-1) == 0.5", FUNC(exp2) (-1), 0.5);
   check_isinfp ("exp2 (1e6) == +inf", FUNC(exp2) (1e6));
   check ("exp2 (-1e6) == 0", FUNC(exp2) (-1e6), 0);
+  check_eps ("exp2 (0.7) == 1.6245047927...", FUNC(exp2) (0.7),
+	     1.6245047927124710452L, CHOOSE(6e-17L, 0, 6e-8));
 }
 
 
@@ -1398,8 +1428,10 @@ gamma_test (void)
   check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
                    FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
 
+#ifdef TODO
   check_eps ("gamma (0.5) == sqrt(pi)", FUNC(gamma) (0.5), FUNC(sqrt) (M_PI),
 	     CHOOSE (0, 5e-16, 2e-7));
+#endif
   check_eps ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma) (-0.5),
 	     -2*FUNC(sqrt) (M_PI), CHOOSE (0, 5e-16, 3e-7));
 
@@ -1513,6 +1545,8 @@ log_test (void)
   check ("log (2) == M_LN2", FUNC(log) (2), M_LN2);
   check_eps ("log (10) == M_LN10", FUNC(log) (10), M_LN10,
 	     CHOOSE (1e-18L, 0, 0));
+  check_eps ("log (0.7) == -0.3566749439...", FUNC(log) (0.7),
+	     -0.35667494393873237891L, CHOOSE(7e-17L, 6e-17, 3e-8));
 }
 
 
@@ -1540,6 +1574,8 @@ log10_test (void)
   check ("log10 (10000) == 4", FUNC(log10) (10000.0), 4);
   check_eps ("log10 (e) == M_LOG10E", FUNC(log10) (M_E), M_LOG10E,
 	     CHOOSE (1e-18, 0, 9e-8));
+  check_eps ("log10 (0.7) == -0.1549019599...", FUNC(log10) (0.7),
+	     -0.15490195998574316929L, CHOOSE(3e-17L, 3e-17, 0));
 }
 
 
@@ -1582,6 +1618,8 @@ log2_test (void)
   check ("log2 (2) == 1", FUNC(log2) (2.0), 1);
   check_eps ("log2 (16) == 4", FUNC(log2) (16.0), 4, CHOOSE (1e-18L, 0, 0));
   check ("log2 (256) == 8", FUNC(log2) (256.0), 8);
+  check_eps ("log2 (0.7) == -0.5145731728...", FUNC(log2) (0.7),
+	     -0.51457317282975824043L, CHOOSE(1e-16L, 2e-16, 6e-8));
 
 }
 
@@ -1750,6 +1788,8 @@ sin_test (void)
 	     -0.5, CHOOSE (4e-18L, 0, 0));
   check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1);
   check ("sin (-pi/2) == -1", FUNC(sin) (-M_PI_2), -1);
+  check_eps ("sin (0.7) == 0.6442176872...", FUNC(sin) (0.7),
+	     0.64421768723769105367L, CHOOSE(4e-17L, 0, 0));
 }
 
 
@@ -1764,6 +1804,9 @@ sinh_test (void)
   check_isinfp ("sinh (+inf) == +inf", FUNC(sinh) (plus_infty));
   check_isinfn ("sinh (-inf) == -inf", FUNC(sinh) (minus_infty));
 #endif
+
+  check_eps ("sinh (0.7) == 0.7585837018...", FUNC(sinh) (0.7),
+	     0.75858370183953350346L, CHOOSE(6e-17L, 0, 6e-8));
 }
 
 
@@ -1816,7 +1859,11 @@ sincos_test (void)
   check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
 	     CHOOSE (5e-18L, 1e-15, 1e-7));
 
-
+  FUNC(sincos) (0.7, &sin_res, &cos_res);
+  check_eps ("sincos (0.7, &sin, &cos) puts 0.6442176872... in sin", sin_res,
+	     0.64421768723769105367L, CHOOSE(4e-17L, 0, 0));
+  check_eps ("sincos (0.7, &sin, &cos) puts 0.7648421872... in cos", cos_res,
+	     0.76484218728448842626L, CHOOSE(3e-17L, 2e-16, 0));
 }
 
 
@@ -1832,6 +1879,8 @@ tan_test (void)
 
   check_eps ("tan (pi/4) == 1", FUNC(tan) (M_PI_4), 1,
 	     CHOOSE (2e-18L, 1e-15L, 2e-7));
+  check_eps ("tan (0.7) == 0.8422883804...", FUNC(tan) (0.7),
+	     0.84228838046307944813L, CHOOSE(8e-17L, 0, 0));
 }
 
 
@@ -1845,6 +1894,8 @@ tanh_test (void)
   check ("tanh (+inf) == +1", FUNC(tanh) (plus_infty), 1);
   check ("tanh (-inf) == -1", FUNC(tanh) (minus_infty), -1);
 #endif
+  check_eps ("tanh (0.7) == 0.6043677771...", FUNC(tanh) (0.7),
+	     0.60436777711716349631L, CHOOSE(3e-17L, 0, 0));
 }
 
 
@@ -2355,7 +2406,8 @@ sqrt_test (void)
   check ("sqrt (6642.25) == 81.5", FUNC(sqrt) (6642.25), 81.5);
   check_eps ("sqrt (15239.903) == 123.45", FUNC(sqrt) (15239.903), 123.45,
 	     CHOOSE (3e-6L, 3e-6, 8e-6));
-
+  check_eps ("sqrt (0.7) == 0.8366600265", FUNC(sqrt) (0.7),
+	     0.83666002653407554798L, CHOOSE(3e-17L, 0, 0));
 }
 
 static void
@@ -2597,6 +2649,18 @@ cexp_test (void)
   result = FUNC(cexp) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(cexp(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(cexp(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(cexp) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(cexp(0.7 + i 1.2)) == 0.72969...", __real__ result,
+	     0.7296989091503236012L, CHOOSE(6e-17L, 0, 6e-8));
+  check_eps ("imag(cexp(0.7 + i 1.2)) == 1.87689...", __imag__ result,
+	     1.8768962328348102821L, CHOOSE(2e-16L, 0, 0));
+
+  result = FUNC(cexp) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(cexp(-2 - i 3)) == --0.13398...", __real__ result,
+	     -0.1339809149295426134L, CHOOSE(6e-20L, 0, 0));
+  check_eps ("imag(cexp(-2 - i 3)) == -0.01909...", __imag__ result,
+	     -0.0190985162611351964L, CHOOSE(4e-20L, 0, 0));
 }
 
 
@@ -2766,6 +2830,18 @@ csin_test (void)
   result = FUNC(csin) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(csin(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(csin) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(csin(0.7 + i 1.2)) = 1.166456341...", __real__ result,
+	     1.1664563419657581376L, CHOOSE(2e-16L, 0, 0));
+  check_eps ("imag(csin(0.7 + i 1.2)) = 1.154499724...", __imag__ result,
+	     1.1544997246948547371L, CHOOSE(2e-17L, 0, 0));
+
+  result = FUNC(csin) (BUILD_COMPLEX (-2, -3));
+  check ("real(csin(-2 - i 3)) == --9.15449...", __real__ result,
+	 -9.1544991469114295734L);
+  check ("imag(csin(-2 - i 3)) == -4.16890...", __imag__ result,
+	 4.1689069599665643507L);
 }
 
 
@@ -2935,6 +3011,18 @@ csinh_test (void)
   result = FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(csinh(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(csinh) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(csinh(0.7 + i 1.2)) = 0.274878686...", __real__ result,
+	     0.27487868678117583582L, CHOOSE(2e-17L, 6e-17, 3e-8));
+  check_eps ("imag(csinh(0.7 + i 1.2)) = 1.169866572...", __imag__ result,
+	     1.1698665727426565139L, CHOOSE(6e-17L, 0, 3e-8));
+
+  result = FUNC(csinh) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(csinh(-2 - i 3)) == -3.59056...", __real__ result,
+	     3.5905645899857799520L, CHOOSE(0, 5e-16, 0));
+  check_eps ("imag(csinh(-2 - i 3)) == -0.53092...", __imag__ result,
+	     -0.5309210862485198052L, CHOOSE(2e-19L, 2e-16, 6e-8));
 }
 
 
@@ -3102,6 +3190,18 @@ ccos_test (void)
   result = FUNC(ccos) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(ccos(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(ccos(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(ccos) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(ccos(0.7 + i 1.2)) = 1.384865764...", __real__ result,
+	     1.3848657645312111080L, CHOOSE(6e-19L, 3e-16, 2e-7));
+  check_eps ("imag(ccos(0.7 + i 1.2)) = -0.972421703...", __imag__ result,
+	     -0.97242170335830028619L, CHOOSE(2e-16L, 2e-16, 0));
+
+  result = FUNC(ccos) (BUILD_COMPLEX (-2, -3));
+  check ("real(ccos(-2 - i 3)) == --4.18962...", __real__ result,
+	 -4.1896256909688072301L);
+  check_eps ("imag(ccos(-2 - i 3)) == -9.10922...", __imag__ result,
+	     -9.1092278937553365979L, CHOOSE(9e-19L, 0, 1e-6));
 }
 
 
@@ -3269,6 +3369,18 @@ ccosh_test (void)
   result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(ccosh(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(ccosh(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(ccosh) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(ccosh(0.7 + i 1.2)) == 0.45482...", __real__ result,
+	     0.4548202223691477654L, CHOOSE(4e-17L, 6e-17, 3e-8));
+  check_eps ("imag(ccosh(0.7 + i 1.2)) == 0.70702...", __imag__ result,
+	     0.7070296600921537682L, CHOOSE(7e-17L, 0, 0));
+
+  result = FUNC(ccosh) (BUILD_COMPLEX (-2, -3));
+  check ("real(ccosh(-2 - i 3)) == --3.72454...", __real__ result,
+	 -3.7245455049153225654L);
+  check_eps ("imag(ccosh(-2 - i 3)) == -0.51182...", __imag__ result,
+	     0.5118225699873846088L, CHOOSE(6e-20, 2e-16, 6e-8));
 }
 
 
@@ -3397,6 +3509,18 @@ cacos_test (void)
   result = FUNC(cacos) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(cacos(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(cacos(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(cacos) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(cacos(0.7 + i 1.2)) == 1.13518...", __real__ result,
+	     1.1351827477151551089L, CHOOSE(2e-17L, 3e-16, 2e-7));
+  check_eps ("imag(cacos(0.7 + i 1.2)) == -1.09276...", __imag__ result,
+	     -1.0927647857577371459L, CHOOSE(4e-17L, 0, 3e-7));
+
+  result = FUNC(cacos) (BUILD_COMPLEX (-2, -3));
+  check ("real(cacos(-2 - i 3)) == -2.14144...", __real__ result,
+	 2.1414491111159960199L);
+  check_eps ("imag(cacos(-2 - i 3)) == -1.98338...", __imag__ result,
+	     1.9833870299165354323L, CHOOSE(2e-19L, 0, 0));
 }
 
 
@@ -3525,6 +3649,18 @@ cacosh_test (void)
   result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(cacosh(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(cacosh(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(cacosh) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(cacosh(0.7 + i 1.2)) == 1.09276...", __real__ result,
+	     1.0927647857577371459L, CHOOSE(4e-17L, 3e-16, 0));
+  check_eps ("imag(cacosh(0.7 + i 1.2)) == 1.13518...", __imag__ result,
+	 1.1351827477151551089L, CHOOSE(2e-17L, 0, 0));
+
+  result = FUNC(cacosh) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(cacosh(-2 - i 3)) == -1.98338...", __real__ result,
+	     -1.9833870299165354323L, CHOOSE (6e-19, 3e-16, 9e-7));
+  check_eps ("imag(cacosh(-2 - i 3)) == 2.14144...", __imag__ result,
+	     2.1414491111159960199L, CHOOSE (3e-19, 5e-16, 0));
 }
 
 
@@ -3658,6 +3794,18 @@ casin_test (void)
   result = FUNC(casin) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(casin(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(casin(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(casin) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(casin(0.7 + i 1.2)) == 0.43561...", __real__ result,
+	     0.4356135790797415103L, CHOOSE(2e-17L, 2e-16, 2e-7));
+  check_eps ("imag(casin(0.7 + i 1.2)) == 1.09276...", __imag__ result,
+	     1.0927647857577371459L, CHOOSE(4e-17L, 0, 3e-7));
+
+  result = FUNC(casin) (BUILD_COMPLEX (-2, -3));
+  check ("real(casin(-2 - i 3)) == --0.57065...", __real__ result,
+	 -0.5706527843210994007L);
+  check_eps ("imag(casin(-2 - i 3)) == -1.98338...", __imag__ result,
+	     -1.9833870299165354323L, CHOOSE(2e-19L, 0, 0));
 }
 
 
@@ -3791,6 +3939,18 @@ casinh_test (void)
   result = FUNC(casinh) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(casinh(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(casinh(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(casinh) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(casinh(0.7 + i 1.2)) == 0.97865...", __real__ result,
+	     0.9786545955936738768L, CHOOSE(5e-17L, 2e-16, 0));
+  check_eps ("imag(casinh(0.7 + i 1.2)) == 0.91135...", __imag__ result,
+	     0.9113541895315601156L, CHOOSE(7e-19L, 0, 6e-8));
+
+  result = FUNC(casinh) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(casinh(-2 - i 3)) == --1.96863...", __real__ result,
+	     -1.9686379257930962917L, CHOOSE(7e-19L, 2e-15, 2e-7));
+  check_eps ("imag(casinh(-2 - i 3)) == -0.96465...", __imag__ result,
+	     -0.9646585044076027920L, CHOOSE(4e-19L, 2e-15, 4e-7));
 }
 
 
@@ -3929,6 +4089,18 @@ catan_test (void)
   result = FUNC(catan) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(catan(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(catan(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(catan) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(catan(0.7 + i 1.2)) == 1.07857...", __real__ result,
+	     1.0785743834118921877L, CHOOSE (3e-17, 0, 0));
+  check_eps ("imag(catan(0.7 + i 1.2)) == 0.57705...", __imag__ result,
+	     0.5770573776534306764L, CHOOSE(3e-17L, 0, 6e-8));
+
+  result = FUNC(catan) (BUILD_COMPLEX (-2, -3));
+  check ("real(catan(-2 - i 3)) == -1.40992...", __real__ result,
+	 -1.4099210495965755225L);
+  check_eps ("imag(catan(-2 - i 3)) == -0.22907...", __imag__ result,
+	     -0.2290726829685387662L, CHOOSE(1e-19L, 3e-17, 2e-8));
 }
 
 
@@ -4067,6 +4239,18 @@ catanh_test (void)
   result = FUNC(catanh) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(catanh(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(catanh(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(catanh) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(catanh(0.7 + i 1.2)) == 0.26007...", __real__ result,
+	     0.2600749516525135959L, CHOOSE (2e-18, 0, 0));
+  check_eps ("imag(catanh(0.7 + i 1.2)) == 0.97024...", __imag__ result,
+	     0.9702403077950989849L, CHOOSE (3e-17, 0, 0));
+
+  result = FUNC(catanh) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(catanh(-2 - i 3)) == -0.14694...", __real__ result,
+	     -0.1469466662255297520L, CHOOSE (3e-20, 6e-17, 2e-8));
+  check ("imag(catanh(-2 - i 3)) == -1.33897...", __imag__ result,
+	 -1.3389725222944935611L);
 }
 
 
@@ -4199,13 +4383,24 @@ ctan_test (void)
   result = FUNC(ctan) (BUILD_COMPLEX (nan_value, -0.25));
   check_isnan_maybe_exc ("real(ctan(NaN -i 0.25)) = NaN plus maybe invalid exception",
 			 __real__ result, INVALID_EXCEPTION);
-  check_isnan ("imag(ctanh(NaN -i 0.25)) = NaN plus maybe invalid exception",
+  check_isnan ("imag(ctan(NaN -i 0.25)) = NaN plus maybe invalid exception",
 	       __imag__ result);
 
   result = FUNC(ctan) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(ctan(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(ctan(NaN + i NaN)) = NaN", __imag__ result);
 
+  result = FUNC(ctan) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(ctan(0.7 + i 1.2)) == 0.17207...", __real__ result,
+	     0.1720734197630349001L, CHOOSE(1e-17L, 3e-17, 2e-8));
+  check_eps ("imag(ctan(0.7 + i 1.2)) == 0.95448...", __imag__ result,
+	     0.9544807059989405538L, CHOOSE(2e-17L, 2e-16, 0));
+
+  result = FUNC(ctan) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(ctan(-2 - i 3)) == -0.00376...", __real__ result,
+	     0.0037640256415042482L, CHOOSE(1e-19L, 0, 0));
+  check_eps ("imag(ctan(-2 - i 3)) == -1.00323...", __imag__ result,
+	     -1.0032386273536098014L, CHOOSE(2e-19L, 0, 2e-7));
 }
 
 
@@ -4347,6 +4542,18 @@ ctanh_test (void)
   check ("real(ctanh (0 + i pi/4)) == 0", __real__ result, 0);
   check_eps ("imag(ctanh (0 + i pi/4)) == 1", __imag__ result, 1,
 	     CHOOSE (0, 0, 2e-7));
+
+  result = FUNC(ctanh) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(ctanh(0.7 + i 1.2)) == 1.34721...", __real__ result,
+	     1.3472197399061191630L, CHOOSE(4e-17L, 6e-17, 2e-7));
+  check_eps ("imag(ctanh(0.7 + i 1.2)) == -0.47786...", __imag__ result,
+	     0.4778641038326365540L, CHOOSE(9e-17L, 6e-17, 0));
+
+  result = FUNC(ctanh) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(ctanh(-2 - i 3)) == --0.96538...", __real__ result,
+	     -0.9653858790221331242L, CHOOSE(2e-19L, 0, 0));
+  check_eps ("imag(ctanh(-2 - i 3)) == -0.00988...", __imag__ result,
+	     0.0098843750383224937L, CHOOSE(2e-20L, 0, 1e-9));
 }
 
 
@@ -4501,6 +4708,18 @@ clog_test (void)
   result = FUNC(clog) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(clog(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(clog(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(clog) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(clog(0.7 + i 1.2)) == 0.32876...", __real__ result,
+	     0.3287600014583970919L, CHOOSE(5e-17L, 6e-17, 3e-8));
+  check_eps ("imag(clog(0.7 + i 1.2)) == 1.04272...", __imag__ result,
+	     1.0427218783685369524L, CHOOSE(2e-17L, 0, 0));
+
+  result = FUNC(clog) (BUILD_COMPLEX (-2, -3));
+  check ("real(clog(-2 - i 3)) == -1.28247...", __real__ result,
+	 1.2824746787307683680L);
+  check_eps ("imag(clog(-2 - i 3)) == -2.15879...", __imag__ result,
+	     -2.1587989303424641704L, CHOOSE(3e-19L, 0, 0));
 }
 
 
@@ -4533,55 +4752,71 @@ clog10_test (void)
 
   result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, plus_infty));
   check_isinfp ("real(clog10(-Inf + i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(-Inf + i Inf)) = 3*pi/4", __imag__ result, M_PI - M_PI_4);
+  check_eps ("imag(clog10(-Inf + i Inf)) = 3*pi/4*M_LOG10E", __imag__ result,
+	     (M_PI - M_PI_4) * M_LOG10E, CHOOSE (0, 3e-16, 0));
   result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_infty));
   check_isinfp ("real(clog10(-Inf - i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(-Inf - i Inf)) = -3*pi/4", __imag__ result, M_PI_4 - M_PI);
+  check_eps ("imag(clog10(-Inf - i Inf)) = -3*pi/4*M_LOG10E", __imag__ result,
+	     (M_PI_4 - M_PI) * M_LOG10E, CHOOSE (0, 3e-16, 0));
 
   result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, plus_infty));
   check_isinfp ("real(clog10(+Inf + i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(+Inf + i Inf)) = pi/4", __imag__ result, M_PI_4);
+  check_eps ("imag(clog10(+Inf + i Inf)) = pi/4*M_LOG10E", __imag__ result,
+	     M_PI_4 * M_LOG10E, CHOOSE (0, 6e-17, 3e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, minus_infty));
   check_isinfp ("real(clog10(+Inf - i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(+Inf - i Inf)) = -pi/4", __imag__ result, -M_PI_4);
+  check_eps ("imag(clog10(+Inf - i Inf)) = -pi/4*M_LOG10E", __imag__ result,
+	     -M_PI_4 * M_LOG10E, CHOOSE (0, 6e-17, 3e-8));
 
   result = FUNC(clog10) (BUILD_COMPLEX (0, plus_infty));
   check_isinfp ("real(clog10(0 + i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+  check_eps ("imag(clog10(0 + i Inf)) = pi/2*M_LOG10E", __imag__ result,
+	     M_PI_2 * M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (3, plus_infty));
   check_isinfp ("real(clog10(3 + i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+  check_eps ("imag(clog10(3 + i Inf)) = pi/2*M_LOG10E", __imag__ result,
+	     M_PI_2 * M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, plus_infty));
   check_isinfp ("real(clog10(-0 + i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(-0 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+  check_eps ("imag(clog10(-0 + i Inf)) = pi/2*M_LOG10E", __imag__ result,
+	     M_PI_2 * M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (-3, plus_infty));
   check_isinfp ("real(clog10(-3 + i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(-3 + i Inf)) = pi/2", __imag__ result, M_PI_2);
+  check_eps ("imag(clog10(-3 + i Inf)) = pi/2*M_LOG10E", __imag__ result,
+	     M_PI_2 * M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (0, minus_infty));
   check_isinfp ("real(clog10(0 - i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+  check_eps ("imag(clog10(0 - i Inf)) = -pi/2*M_LOG10E", __imag__ result,
+	     -M_PI_2*M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (3, minus_infty));
   check_isinfp ("real(clog10(3 - i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+  check_eps ("imag(clog10(3 - i Inf)) = -pi/2*M_LOG10E", __imag__ result,
+	     -M_PI_2*M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (minus_zero, minus_infty));
   check_isinfp ("real(clog10(-0 - i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(-0 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+  check_eps ("imag(clog10(-0 - i Inf)) = -pi/2*M_LOG10E", __imag__ result,
+	     -M_PI_2 * M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
   result = FUNC(clog10) (BUILD_COMPLEX (-3, minus_infty));
   check_isinfp ("real(clog10(-3 - i Inf)) = +Inf", __real__ result);
-  check ("imag(clog10(-3 - i Inf)) = -pi/2", __imag__ result, -M_PI_2);
+  check_eps ("imag(clog10(-3 - i Inf)) = -pi/2*M_LOG10E", __imag__ result,
+	     -M_PI_2 * M_LOG10E, CHOOSE (0, 2e-16, 6e-8));
 
   result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, 0));
   check_isinfp ("real(clog10(-Inf + i0)) = +Inf", __real__ result);
-  check ("imag(clog10(-Inf + i0)) = pi", __imag__ result, M_PI);
+  check_eps ("imag(clog10(-Inf + i0)) = pi*M_LOG10E", __imag__ result,
+	     M_PI * M_LOG10E, CHOOSE (0, 3e-16, 2e-7));
   result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, 1));
   check_isinfp ("real(clog10(-Inf + i1)) = +Inf", __real__ result);
-  check ("imag(clog10(-Inf + i1)) = pi", __imag__ result, M_PI);
+  check_eps ("imag(clog10(-Inf + i1)) = pi*M_LOG10E", __imag__ result,
+	     M_PI * M_LOG10E, CHOOSE (0, 3e-16, 2e-7));
   result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, minus_zero));
   check_isinfp ("real(clog10(-Inf - i0)) = +Inf", __real__ result);
-  check ("imag(clog10(-Inf - i0)) = -pi", __imag__ result, -M_PI);
+  check_eps ("imag(clog10(-Inf - i0)) = -pi*M_LOG10E", __imag__ result,
+	     -M_PI * M_LOG10E, CHOOSE (0, 3e-16, 2e-7));
   result = FUNC(clog10) (BUILD_COMPLEX (minus_infty, -1));
   check_isinfp ("real(clog10(-Inf - i1)) = +Inf", __real__ result);
-  check ("imag(clog10(-Inf - i1)) = -pi", __imag__ result, -M_PI);
+  check_eps ("imag(clog10(-Inf - i1)) = -pi*M_LOG10E", __imag__ result,
+	     -M_PI * M_LOG10E, CHOOSE (0, 3e-16, 2e-7));
 
   result = FUNC(clog10) (BUILD_COMPLEX (plus_infty, 0));
   check_isinfp ("real(clog10(+Inf + i0)) = +Inf", __real__ result);
@@ -4655,6 +4890,18 @@ clog10_test (void)
   result = FUNC(clog10) (BUILD_COMPLEX (nan_value, nan_value));
   check_isnan ("real(clog10(NaN + i NaN)) = NaN", __real__ result);
   check_isnan ("imag(clog10(NaN + i NaN)) = NaN", __imag__ result);
+
+  result = FUNC(clog10) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(clog10(0.7 + i 1.2)) == 0.14277...", __real__ result,
+	     0.1427786545038868803L, CHOOSE(2e-17L, 6e-17, 2e-8));
+  check_eps ("imag(clog10(0.7 + i 1.2)) == 0.45284...", __imag__ result,
+	     0.4528483579352493248L, CHOOSE(6e-18, 6e-17, 3e-8));
+
+  result = FUNC(clog10) (BUILD_COMPLEX (-2, -3));
+  check ("real(clog10(-2 - i 3)) == -0.55697...", __real__ result,
+	 0.5569716761534183846L);
+  check_eps ("imag(clog10(-2 - i 3)) == -0.93755...", __imag__ result,
+	     -0.9375544629863747085L, CHOOSE (6e-20, 2e-16, 0));
 }
 
 
@@ -4809,6 +5056,18 @@ csqrt_test (void)
   result = FUNC(csqrt) (BUILD_COMPLEX (119, 120));
   check ("real(csqrt(119 + i 120) = 12", __real__ result, 12);
   check ("imag(csqrt(119 + i 120) = 5", __imag__ result, 5);
+
+  result = FUNC(csqrt) (BUILD_COMPLEX (0.7, 1.2));
+  check_eps ("real(csqrt(0.7 + i 1.2)) == 1.02206...", __real__ result,
+	     1.0220676100300264507L, CHOOSE(3e-17L, 3e-16, 2e-7));
+  check_eps ("imag(csqrt(0.7 + i 1.2)) == 0.58704...", __imag__ result,
+	     0.5870453129635652115L, CHOOSE(7e-18L, 0, 0));
+
+  result = FUNC(csqrt) (BUILD_COMPLEX (-2, -3));
+  check_eps ("real(csqrt(-2 - i 3)) == -0.89597...", __real__ result,
+	     0.8959774761298381247L, CHOOSE(6e-20L, 2e-16, 6e-8));
+  check ("imag(csqrt(-2 - i 3)) == -1.67414...", __imag__ result,
+	 -1.6741492280355400404L);
 }
 
 
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index a586d1fbbf..4b873d6915 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -125,9 +125,14 @@ internal_setgrent (ent_t *ent)
       ent->result = NULL;
     }
 
-  ent->blacklist.current = 0;
   if (ent->blacklist.data != NULL)
-    ent->blacklist.data[0] = '\0';
+    {
+      ent->blacklist.current = 1;
+      ent->blacklist.data[0] = '|';
+      ent->blacklist.data[1] = '\0';
+    }
+  else
+    ent->blacklist.current = 0;
 
   if (ent->stream == NULL)
     {
@@ -202,9 +207,14 @@ internal_endgrent (ent_t *ent)
       ent->result = NULL;
     }
 
-  ent->blacklist.current = 0;
   if (ent->blacklist.data != NULL)
-    ent->blacklist.data[0] = '\0';
+    {
+      ent->blacklist.current = 1;
+      ent->blacklist.data[0] = '|';
+      ent->blacklist.data[1] = '\0';
+    }
+  else
+    ent->blacklist.current = 0;
 
   return NSS_STATUS_SUCCESS;
 }
@@ -411,22 +421,17 @@ getgrnam_plusgroup (const char *name, struct group *result, char *buffer,
       int outvallen;
 
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
-	{
-	  *errnop = errno;
-	  return NSS_STATUS_TRYAGAIN;
-	}
+	return NSS_STATUS_NOTFOUND;
 
       if (yp_match (domain, "group.byname", name, strlen (name),
 		    &outval, &outvallen) != YPERR_SUCCESS)
-	{
-	  *errnop = errno;
-	  return NSS_STATUS_TRYAGAIN;
-	}
+	return NSS_STATUS_NOTFOUND;
+
       p = strncpy (buffer, outval,
                    buflen < (size_t) outvallen ? buflen : (size_t) outvallen);
       free (outval);
       while (isspace (*p))
-        p++;
+        ++p;
       parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop);
       if (parse_res == -1)
 	return NSS_STATUS_TRYAGAIN;
@@ -513,7 +518,8 @@ getgrent_next_file (struct group *result, ent_t *ent,
           if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
             break;
           else
-            if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
+            if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
+		|| status == NSS_STATUS_NOTFOUND) /* No group in NIS */
               continue;
             else
 	      {
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index c8e6f9cc8d..8a1c424628 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -225,9 +225,14 @@ internal_setpwent (ent_t *ent)
 		     - pwdtable) - 1;
     }
 
-  ent->blacklist.current = 0;
   if (ent->blacklist.data != NULL)
-    ent->blacklist.data[0] = '\0';
+    {
+      ent->blacklist.current = 1;
+      ent->blacklist.data[0] = '|';
+      ent->blacklist.data[1] = '\0';
+    }
+  else
+    ent->blacklist.current = 0;
 
   if (ent->stream == NULL)
     {
@@ -313,9 +318,14 @@ internal_endpwent (ent_t *ent)
       ent->result = NULL;
     }
 
-  ent->blacklist.current = 0;
   if (ent->blacklist.data != NULL)
-    ent->blacklist.data[0] = '\0';
+    {
+      ent->blacklist.current = 1;
+      ent->blacklist.data[0] = '|';
+     ent->blacklist.data[1] = '\0';
+    }
+  else
+    ent->blacklist.current = 0;
 
   give_pwd_free (&ent->pwd);
 
@@ -521,6 +531,7 @@ getpwent_next_nisplus_netgr (const char *name, struct passwd *result,
   return NSS_STATUS_SUCCESS;
 }
 
+/* get the next user from NIS+  (+ entry) */
 static enum nss_status
 getpwent_next_nisplus (struct passwd *result, ent_t *ent, char *buffer,
 		       size_t buflen, int *errnop)
@@ -752,18 +763,12 @@ getpwnam_plususer (const char *name, struct passwd *result, char *buffer,
       int outvallen;
 
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
-	{
-	  *errnop = errno;
-	  return NSS_STATUS_TRYAGAIN;
-	}
+	return NSS_STATUS_NOTFOUND;
 
       if (yp_match (domain, "passwd.byname", name, strlen (name),
-		    &outval, &outvallen)
-	  != YPERR_SUCCESS)
-	{
-	  *errnop = errno;
-	  return NSS_STATUS_TRYAGAIN;
-	}
+		    &outval, &outvallen) != YPERR_SUCCESS)
+	return NSS_STATUS_NOTFOUND;
+
       ptr = strncpy (buffer, outval, buflen < (size_t) outvallen ?
 		     buflen : (size_t) outvallen);
       buffer[buflen < (size_t) outvallen ? buflen : (size_t) outvallen] = '\0';
@@ -910,7 +915,8 @@ getpwent_next_file (struct passwd *result, ent_t *ent,
 	  if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
 	    break;
 	  else
-	    if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
+	    if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
+		|| status == NSS_STATUS_NOTFOUND) /* entry doesn't exist */
 	      continue;
 	    else
 	      {
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 92224f8ae7..83db85620e 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -177,9 +177,14 @@ internal_setspent (ent_t *ent)
 		     - pwdtable) - 1;
     }
 
-  ent->blacklist.current = 0;
   if (ent->blacklist.data != NULL)
-    ent->blacklist.data[0] = '\0';
+    {
+      ent->blacklist.current = 1;
+      ent->blacklist.data[0] = '|';
+      ent->blacklist.data[1] = '\0';
+    }
+  else
+    ent->blacklist.current = 0;
 
   if (ent->stream == NULL)
     {
@@ -265,9 +270,14 @@ internal_endspent (ent_t *ent)
       ent->result = NULL;
     }
 
-  ent->blacklist.current = 0;
   if (ent->blacklist.data != NULL)
-    ent->blacklist.data[0] = '\0';
+    {
+      ent->blacklist.current = 1;
+      ent->blacklist.data[0] = '|';
+      ent->blacklist.data[1] = '\0';
+    }
+  else
+    ent->blacklist.current = 0;
 
   give_spwd_free (&ent->pwd);
 
@@ -704,18 +714,12 @@ getspnam_plususer (const char *name, struct spwd *result, char *buffer,
       int outvallen;
 
       if (yp_get_default_domain (&domain) != YPERR_SUCCESS)
-	{
-	  *errnop = errno;
-	  return NSS_STATUS_TRYAGAIN;
-	}
+	return NSS_STATUS_NOTFOUND;
 
       if (yp_match (domain, "shadow.byname", name, strlen (name),
-		    &outval, &outvallen)
-          != YPERR_SUCCESS)
-	{
-	  *errnop = errno;
-	  return NSS_STATUS_TRYAGAIN;
-	}
+		    &outval, &outvallen)  != YPERR_SUCCESS)
+	return NSS_STATUS_NOTFOUND;
+
       ptr = strncpy (buffer, outval, buflen < (size_t) outvallen ?
 		     buflen : (size_t) outvallen);
       buffer[buflen < (size_t) outvallen ? buflen : (size_t) outvallen] = '\0';
@@ -854,7 +858,8 @@ getspent_next_file (struct spwd *result, ent_t *ent,
           if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
             break;
           else
-            if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
+            if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */
+		|| status == NSS_STATUS_NOTFOUND) /* entry doesn't exist */
               continue;
             else
 	      {
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 5bef8d17d2..f07f0c6f82 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -74,11 +74,12 @@ __yp_bind (const char *domain, dom_binding **ypdb)
   if (ysd == NULL)
     {
       is_new = 1;
-      ysd = (dom_binding *) malloc (sizeof *ysd);
-      memset (ysd, '\0', sizeof *ysd);
+      ysd = (dom_binding *) calloc (1, sizeof *ysd);
       ysd->dom_socket = -1;
       ysd->dom_vers = -1;
     }
+  else
+    ysd->dom_client = NULL;
 
   try = 0;
 
@@ -257,11 +258,12 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
       use_ypbindlist = FALSE;
     }
   else
-    {
-      __yp_unbind (ydb);
-      free (ydb);
-      ydb = NULL;
-    }
+    if (ydb != NULL)
+      {
+	__yp_unbind (ydb);
+	free (ydb);
+	ydb = NULL;
+      }
 
   return result;
 }
@@ -728,7 +730,7 @@ yperr_string (const int error)
     case YPERR_NODOM:
       return _("Local domain name not set");
     case YPERR_BADDB:
-      return _("NIS map data base is bad");
+      return _("NIS map database is bad");
     case YPERR_VERS:
       return _("NIS client/server version mismatch - can't supply service");
     case YPERR_ACCESS:
diff --git a/posix/Makefile b/posix/Makefile
index 3fbacdc918..b8fbbd20bd 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -34,7 +34,7 @@ distribute := confstr.h TESTS TESTS2C.sed testcases.h \
 routines :=								      \
 	uname								      \
 	times								      \
-	wait waitpid wait3 wait4					      \
+	wait waitpid wait3 wait4 waitid					      \
 	alarm sleep pause nanosleep					      \
 	fork vfork _exit	      					      \
 	execve fexecve execv execle execl execvp execlp			      \
diff --git a/posix/sys/types.h b/posix/sys/types.h
index ab28d39aaf..d48e0d23eb 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -81,6 +81,10 @@ typedef __pid_t pid_t;
 # define pid_t pid_t
 #endif
 
+#if defined __USE_SVID || defined __USE_XOPEN
+typedef __id_t id_t;
+#endif
+
 #ifndef ssize_t
 typedef __ssize_t ssize_t;
 # define ssize_t ssize_t
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index e931405ecb..e663f41e05 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -89,6 +89,16 @@ typedef union
 # define W_STOPCODE(sig)	__W_STOPCODE(sig)
 #endif
 
+/* The following values are used by the `waitid' function.  */
+#if defined __USE_SVID || defined __USE_XOPEN
+typedef enum
+{
+  P_ALL,		/* Wait for any child.  */
+  P_PID,		/* Wait for specified process.  */
+  P_PGID		/* Wait for members of process group.  */
+} idtype_t;
+#endif
+
 
 /* Wait for a child to die.  When one does, put its status in *STAT_LOC
    and return its process ID.  For errors, return (pid_t) -1.  */
@@ -118,6 +128,21 @@ extern __pid_t __waitpid __P ((__pid_t __pid, int *__stat_loc,
 extern __pid_t waitpid __P ((__pid_t __pid, int *__stat_loc,
 			     int __options));
 
+#if defined __USE_SVID || defined __USE_XOPEN
+# define __need_siginfo_t
+# include <bits/siginfo.h>
+/* Wait for a childing matching IDTYPE and ID to change the status and
+   place appropriate information in *INFOP.
+   If IDTYPE is P_PID, match any process whose process ID is ID.
+   If IDTYPE is P_PGID, match any process whose process group is ID.
+   If IDTYPE is P_ALL, match any process.
+   If the WNOHANG bit is set in OPTIONS, and that child
+   is not already dead, clear *INFOP and return 0.  If successful, store
+   exit code and status in *INFOP.  */
+extern int waitid __P ((idtype_t __idtype, __id_t __id, siginfo_t *__infop,
+			int __options));
+#endif
+
 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 /* This being here makes the prototypes valid whether or not
    we have already included <sys/resource.h> to define `struct rusage'.  */
diff --git a/rt/aio.h b/rt/aio.h
index a49b8c7a67..c854e97dd3 100644
--- a/rt/aio.h
+++ b/rt/aio.h
@@ -179,7 +179,7 @@ extern int lio_listio64 __P ((int __mode, struct aiocb64 *__const __list[],
 extern int aio_error __P ((__const struct aiocb *__aiocbp));
 #else
 extern int aio_error __P ((__const struct aiocb *__aiocbp))
-     __asm__ ("aio_error64");;
+     __asm__ ("aio_error64");
 #endif
 #ifdef __USE_LARGEFILE64
 extern int aio_error64 __P ((__const struct aiocb64 *__aiocbp));
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index 6ea30c2158..cdfb63d28c 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -144,7 +144,7 @@ get_elem (void)
 
 
 void
-__aio_free_req (struct requestlist *elem)
+__aio_free_request (struct requestlist *elem)
 {
   elem->running = no;
   elem->next_prio = freelist;
@@ -375,7 +375,7 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
   else
     {
       /* Something went wrong.  */
-      __aio_free_req (newp);
+      __aio_free_request (newp);
       newp = NULL;
     }
 
@@ -486,7 +486,7 @@ handle_fildes_io (void *arg)
 	}
 
       /* Free the old element.  */
-      __aio_free_req (runp);
+      __aio_free_request (runp);
 
       runp = freelist;
       if (runp != NULL)
diff --git a/rt/librt.map b/rt/librt.map
index 375a02877e..13381ec800 100644
--- a/rt/librt.map
+++ b/rt/librt.map
@@ -3,8 +3,8 @@ GLIBC_2.1 {
 
     # AIO functions.
     aio_cancel; aio_cancel64; aio_error; aio_error64; aio_fsync; aio_fsync64;
-    aio_read; aio_read64; aio_return; aio_return64; aio_suspend; aio_suspend64;
-    aio_write; aio_write64; lio_listio; lio_listio64;
+    aio_init; aio_read; aio_read64; aio_return; aio_return64; aio_suspend;
+    aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
 
   local:
     *;
diff --git a/signal/signal.h b/signal/signal.h
index 8691b6880e..11b6565be6 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -56,7 +56,7 @@ extern __sighandler_t __sysv_signal __P ((int __sig,
 /* Set the handler for the signal SIG to HANDLER, returning the old
    handler, or SIG_ERR on error.
    By default `signal' has the BSD semantic.  */
-#if !defined __USE_XOPEN || defined __USE_GNU
+#ifdef __USE_BSD
 extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler));
 #else
 /* Make sure the used `signal' implementation is the SVID version.
@@ -176,15 +176,8 @@ typedef __sigset_t sigset_t;
 #  define __need_timespec
 #  include <time.h>
 
-/* Type for data associated with a signal.  */
-typedef union sigval
-  {
-    int sival_int;
-    void *sival_ptr;
-  } sigval_t;
-
 /* Get the `siginfo_t' type plus the needed symbols.  */
-# include <bits/siginfo.h>
+#  include <bits/siginfo.h>
 
 /* Clear all signals from SET.  */
 extern int sigemptyset __P ((sigset_t *__set));
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index de30c9a20c..4abee7ed91 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1637,6 +1637,9 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
   hp->_IO_write_ptr = buf;
   hp->_IO_write_end = buf + sizeof buf;
   hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS;
+#if _IO_JUMPS_OFFSET
+  hp->_vtable_offset = 0;
+#endif
 #ifdef _IO_MTSAFE_IO
   hp->_lock = &helper.lock;
   __libc_lock_init (*hp->_lock);
diff --git a/sunrpc/publickey.c b/sunrpc/publickey.c
index 9a314326b2..2519c3d743 100644
--- a/sunrpc/publickey.c
+++ b/sunrpc/publickey.c
@@ -1,5 +1,5 @@
 /* Get public or secret key from key server.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -18,16 +18,17 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <rpc/netdb.h>
 
 #include "nsswitch.h"
 
 
 /* Type of the lookup function for the public key.  */
-typedef int (*public_function) (const char *, char *);
+typedef int (*public_function) (const char *, char *, int *);
 
 /* Type of the lookup function for the secret key.  */
-typedef int (*secret_function) (const char *, char *, const char *);
+typedef int (*secret_function) (const char *, char *, const char *, int *);
 
 /* The lookup function for the first entry of this service.  */
 extern int __nss_publickey_lookup (service_user **nip, const char *name,
@@ -63,7 +64,7 @@ getpublickey (const char *name, char *key)
 
   while (! no_more)
     {
-      status = (*fct) (name, key);
+      status = (*fct) (name, key, __errno_location ());
 
       no_more = __nss_next (&nip, "getpublickey", (void **) &fct, status, 0);
     }
@@ -101,7 +102,7 @@ getsecretkey (const char *name, char *key, const char *passwd)
 
   while (! no_more)
     {
-      status = (*fct) (name, key, passwd);
+      status = (*fct) (name, key, passwd, __errno_location ());
 
       no_more = __nss_next (&nip, "getsecretkey", (void **) &fct, status, 0);
     }
diff --git a/sunrpc/rpcinfo.c b/sunrpc/rpcinfo.c
index 7adb89332e..07d7a6acb7 100644
--- a/sunrpc/rpcinfo.c
+++ b/sunrpc/rpcinfo.c
@@ -560,7 +560,8 @@ pmapdump (argc, argv)
 		 (xdrproc_t) xdr_pmaplist, (caddr_t) &head,
 		 minutetimeout) != RPC_SUCCESS)
     {
-      fputs (_("rpcinfo: can't contact portmapper: "), stderr);
+      fputs (_("rpcinfo: can't contact portmapper"), stderr);
+      fputs (": ", stderr);
       clnt_perror (client, "rpcinfo");
       exit (1);
     }
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index bc93087066..cd4f86a69c 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -204,8 +204,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup, #nop);
 #else
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);		\
-  strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
+  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb);	\
+  strong_alias (_dl_runtime_resolve, _dl_runtime_profile, #nop);
 #endif
 
 /* Initial entry point code for the dynamic linker.
diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h
index fc102c23a4..f670d4cf04 100644
--- a/sysdeps/generic/_G_config.h
+++ b/sysdeps/generic/_G_config.h
@@ -48,6 +48,9 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_HAVE_PRINTF_FP 1
 #define _G_HAVE_MMAP 1
 #define _G_HAVE_LONG_DOUBLE_IO 1
+#define _G_HAVE_IO_FILE_OPEN 1
+
+#define _G_IO_IO_FILE_VERSION 0x20001
 
 /* This is defined by <bits/stat.h> if `st_blksize' exists.  */
 #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
@@ -60,7 +63,7 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_VTABLE_LABEL_HAS_LENGTH 1
 
 
-#if defined (__cplusplus) || defined (__STDC__)
+#if defined __cplusplus || defined __STDC__
 # define _G_ARGS(ARGLIST) ARGLIST
 #else
 # define _G_ARGS(ARGLIST) ()
diff --git a/sysdeps/generic/bits/siginfo.h b/sysdeps/generic/bits/siginfo.h
index 35d9d69892..5a223e373b 100644
--- a/sysdeps/generic/bits/siginfo.h
+++ b/sysdeps/generic/bits/siginfo.h
@@ -17,10 +17,21 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SIGNAL_H
+#if !defined _SIGNAL_H && !defined __need_siginfo_t
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#if (!defined __have_siginfo_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t	1
+
+/* Type for data associated with a signal.  */
+typedef union sigval
+  {
+    int sival_int;
+    void *sival_ptr;
+  } sigval_t;
+
 typedef struct siginfo
   {
     int si_signo;		/* Signal number.  */
@@ -41,15 +52,15 @@ typedef struct siginfo
 enum
 {
   SI_ASYNCIO = -4,		/* Sent by AIO completion.  */
-#define SI_ASYNCIO	SI_ASYNCIO
+# define SI_ASYNCIO	SI_ASYNCIO
   SI_MESGQ,			/* Sent by real time mesq state change.  */
-#define SI_MESGQ	SI_MESGQ
+# define SI_MESGQ	SI_MESGQ
   SI_TIMER,			/* Sent by timer expiration.  */
-#define SI_TIMER	SI_TIMER
+# define SI_TIMER	SI_TIMER
   SI_QUEUE,			/* Sent by sigqueue.  */
-#define SI_QUEUE	SI_QUEUE
+# define SI_QUEUE	SI_QUEUE
   SI_USER			/* Sent by kill, sigsend, raise.  */
-#define SI_USER		SI_USER
+# define SI_USER	SI_USER
 };
 
 
@@ -57,111 +68,117 @@ enum
 enum
 {
   ILL_ILLOPC = 1,		/* Illegal opcode.  */
-#define ILL_ILLOPC	ILL_ILLOPC
+# define ILL_ILLOPC	ILL_ILLOPC
   ILL_ILL_OPN,			/* Illegal operand.  */
-#define ILL_ILLOPN	ILL_ILLOPN
+# define ILL_ILLOPN	ILL_ILLOPN
   ILL_ILLADR,			/* Illegal addressing mode.  */
-#define ILL_ILLADR	ILL_ILLADR
+# define ILL_ILLADR	ILL_ILLADR
   ILL_ILLTRP,			/* Illegal trap. */
-#define ILL_ILLTRP	ILL_ILLTRP
+# define ILL_ILLTRP	ILL_ILLTRP
   ILL_PRVOPC,			/* Privileged opcode.  */
-#define ILL_PRVOPC	ILL_PRVOPC
+# define ILL_PRVOPC	ILL_PRVOPC
   ILL_PRVREG,			/* Privileged register.  */
-#define ILL_PRVREG	ILL_PRVREG
+# define ILL_PRVREG	ILL_PRVREG
   ILL_COPROC,			/* Coprocessor error.  */
-#define ILL_COPROC	ILL_COPROC
+# define ILL_COPROC	ILL_COPROC
   ILL_BADSTK			/* Internal stack error.  */
-#define ILL_BADSTK	ILL_BADSTK
+# define ILL_BADSTK	ILL_BADSTK
 };
 
 /* `si_code' values for SIGFPE signal.  */
 enum
 {
   FPE_INTDIV = 1,		/* Integer divide by zero.  */
-#define FPE_INTDIV	FPE_INTDIV
+# define FPE_INTDIV	FPE_INTDIV
   FPE_INTOVF,			/* Integer overflow.  */
-#define FPE_INTOVF	FPE_INTOVF
+# define FPE_INTOVF	FPE_INTOVF
   FPE_FLTDIV,			/* Floating point divide by zero.  */
-#define FPE_FLTDIV	FPE_FLTDIV
+# define FPE_FLTDIV	FPE_FLTDIV
   FPE_FLTOVF,			/* Floating point overflow.  */
-#define FPE_FLTOVF	FPE_FLTOVF
+# define FPE_FLTOVF	FPE_FLTOVF
   FPE_FLTUND,			/* Floating point underflow.  */
-#define FPE_FLTUND	FPE_FLTUND
+# define FPE_FLTUND	FPE_FLTUND
   FPE_FLTRES,			/* Floating point inexact result.  */
-#define FPE_FLTRES	FPE_FLTRES
+# define FPE_FLTRES	FPE_FLTRES
   FPE_FLTINV,			/* Floating point invalid operation.  */
-#define FPE_FLTINV	FPE_FLTINV
+# define FPE_FLTINV	FPE_FLTINV
   FPE_FLTSUB			/* Subscript out of range.  */
-#define FPE_FLTSUB	FPE_FLTSUB
+# define FPE_FLTSUB	FPE_FLTSUB
 };
 
 /* `si_code' values for SIGSEGV signal.  */
 enum
 {
   SEGV_MAPERR = 1,		/* Address not mapped to object.  */
-#define SEGV_MAPERR	SEGV_MAPERR
+# define SEGV_MAPERR	SEGV_MAPERR
   SEGV_ACCERR			/* Invalid permissions for mapped object.  */
-#define SEGV_ACCERR	SEGV_ACCERR
+# define SEGV_ACCERR	SEGV_ACCERR
 };
 
 /* `si_code' values for SIGBUS signal.  */
 enum
 {
   BUS_ADRALN = 1,		/* Invalid address alignment.  */
-#define BUS_ADRALN	BUS_ADRALN
+# define BUS_ADRALN	BUS_ADRALN
   BUS_ADRERR,			/* Non-existant physical address.  */
-#define BUS_ADRERR	BUS_ADRERR
+# define BUS_ADRERR	BUS_ADRERR
   BUS_OBJERR			/* Object specific hardware error.  */
-#define BUS_OBJERR	BUS_OBJERR
+# define BUS_OBJERR	BUS_OBJERR
 };
 
 /* `si_code' values for SIGTRAP signal.  */
 enum
 {
   TRAP_BRKPT = 1,		/* Process breakpoint.  */
-#define TRAP_BRKPT	TRAP_BRKPT
+# define TRAP_BRKPT	TRAP_BRKPT
   TRAP_TRACE			/* Process trace trap.  */
-#define TRAP_TRACE	TRAP_TRACE
+# define TRAP_TRACE	TRAP_TRACE
 };
 
 /* `si_code' values for SIGCHLD signal.  */
 enum
 {
   CLD_EXITED = 1,		/* Child has exited.  */
-#define CLD_EXITED	CLD_EXITED
+# define CLD_EXITED	CLD_EXITED
   CLD_KILLED,			/* Child was killed.  */
-#define CLD_KILLED	CLD_KILLED
+# define CLD_KILLED	CLD_KILLED
   CLD_DUMPED,			/* Child terminated abnormally.  */
-#define CLD_DUMPED	CLD_DUMPED
+# define CLD_DUMPED	CLD_DUMPED
   CLD_TRAPPED,			/* Traced child has trapped.  */
-#define CLD_TRAPPED	CLD_TRAPPED
+# define CLD_TRAPPED	CLD_TRAPPED
   CLD_STOPPED,			/* Child has stopped.  */
-#define CLD_STOPPED	CLD_STOPPED
+# define CLD_STOPPED	CLD_STOPPED
   CLD_CONTINUED			/* Stopped child has continued.  */
-#define CLD_CONTINUED	CLD_CONTINUED
+# define CLD_CONTINUED	CLD_CONTINUED
 };
 
 /* `si_code' values for SIGPOLL signal.  */
 enum
 {
   POLL_IN = 1,			/* Data input available.  */
-#define POLL_IN		POLL_IN
+# define POLL_IN	POLL_IN
   POLL_OUT,			/* Output buffers available.  */
-#define POLL_OUT	POLL_OUT
+# define POLL_OUT	POLL_OUT
   POLL_MSG,			/* Input message available.   */
-#define POLL_MSG	POLL_MSG
+# define POLL_MSG	POLL_MSG
   POLL_ERR,			/* I/O error.  */
-#define POLL_ERR	POLL_ERR
+# define POLL_ERR	POLL_ERR
   POLL_PRI,			/* High priority input available.  */
-#define POLL_PRI	POLL_PRI
+# define POLL_PRI	POLL_PRI
   POLL_HUP			/* Device disconnected.  */
-#define POLL_HUP	POLL_HUP
+# define POLL_HUP	POLL_HUP
 };
 
+# undef __need_siginfo_t
+#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
+
+
+#if defined _SIGNAL_H && !defined __have_sigevent_t
+# define __have_sigevent_t	1
 
 /* Structure to transport application-defined values with signals.  */
-#define SIGEV_MAX_SIZE	64
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# define SIGEV_MAX_SIZE	64
+# define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
 
 typedef struct sigevent
   {
@@ -176,9 +193,11 @@ typedef struct sigevent
 enum
 {
   SIGEV_SIGNAL = 0,		/* Notify via signal.  */
-#define SIGEV_SIGNAL	SIGEV_SIGNAL
+# define SIGEV_SIGNAL	SIGEV_SIGNAL
   SIGEV_NONE,			/* Other notification: meaningless.  */
-#define SIGEV_NONE	SIGEV_NONE
+# define SIGEV_NONE	SIGEV_NONE
   SIGEV_THREAD			/* Deliver via thread creation.  */
-#define SIGEV_THREAD	SIGEV_THREAD
+# define SIGEV_THREAD	SIGEV_THREAD
 };
+
+#endif	/* have _SIGNAL_H.  */
diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
index 51fadd196e..5315a092ac 100644
--- a/sysdeps/generic/bits/types.h
+++ b/sysdeps/generic/bits/types.h
@@ -69,6 +69,7 @@ typedef long int __rlim_t;	/* Type for resource measurement.  */
 typedef __quad_t __rlim64_t;	/* Type for resource measurement (LFS).  */
 typedef __quad_t __ino64_t;	/* Type for file serial numbers.  */
 typedef __loff_t __off64_t;	/* Type of file izes and offsets.  */
+typedef unsigned int __id_t;	/* General type for IDs.  */
 
 /* Everythin' else.  */
 typedef long int __daddr_t;	/* The type of a disk address.  */
@@ -85,7 +86,7 @@ typedef long int __key_t;	/* Type of an IPC key */
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define	__NFDBITS	(sizeof (unsigned long int) * 8)
 #define	__FDELT(d)	((d) / __NFDBITS)
-#define	__FDMASK(d)	(1 << ((d) % __NFDBITS))
+#define	__FDMASK(d)	((unsigned long int) 1 << ((d) % __NFDBITS))
 
 typedef struct
   {
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index b71ad54e55..b2ae75cc9e 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -40,7 +40,6 @@ extern void _end;
 extern void ENTRY_POINT (void);
 
 ElfW(Addr) _dl_base_addr;
-uid_t __libc_uid;
 int __libc_enable_secure;
 int __libc_multiple_libcs;	/* Defining this here avoids the inclusion
 				   of init-first.  */
@@ -131,7 +130,6 @@ _dl_sysdep_start (void **start_argptr,
   SEE (EUID, euid);
   SEE (EGID, egid);
 
-  __libc_uid = uid;
   __libc_enable_secure = uid != euid || gid != egid;
 
   if (_dl_pagesize == 0)
diff --git a/sysdeps/generic/enbl-secure.c b/sysdeps/generic/enbl-secure.c
index 3520ad5fb0..3f3fe23c54 100644
--- a/sysdeps/generic/enbl-secure.c
+++ b/sysdeps/generic/enbl-secure.c
@@ -27,7 +27,7 @@
 int __libc_enable_secure = 1;
 
 /* We often need the UID.  */
-uid_t __libc_uid;
+extern uid_t __libc_uid;
 
 void
 __libc_init_secure (void)
diff --git a/sysdeps/generic/sigqueue.c b/sysdeps/generic/sigqueue.c
index c6af1d7021..684800eb2a 100644
--- a/sysdeps/generic/sigqueue.c
+++ b/sysdeps/generic/sigqueue.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <sys/types.h>
 
 int
 __sigqueue (pid_t pid, int sig, const union sigval val)
diff --git a/sysdeps/generic/sys/param.h b/sysdeps/generic/sys/param.h
index 1dafdda403..0e10a0ea94 100644
--- a/sysdeps/generic/sys/param.h
+++ b/sysdeps/generic/sys/param.h
@@ -8,6 +8,7 @@
 #include <limits.h>
 
 #define MAXSYMLINKS  1
+#define MAXPATHLEN   256
 
 /* Macros for min/max.  */
 #define MIN(a,b) (((a)<(b))?(a):(b))
diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c
new file mode 100644
index 0000000000..8843977a01
--- /dev/null
+++ b/sysdeps/generic/waitid.c
@@ -0,0 +1,33 @@
+/* Stub version of waitid.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/wait.h>
+
+int
+waitid (idtype, id, infop, options)
+     idtype_t idtype;
+     id_t id;
+     siginfo_t *infop;
+     int options;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index c347a515a4..2aaa5b7617 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -338,7 +338,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	    {
 	      const char *strtab;
 
-	      strtab = ((void *) map->l_addr
+	      strtab = ((const char *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
 	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
 				": Symbol `", strtab + refsym->st_name,
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 5823055c30..10e2b4ee33 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -110,8 +110,6 @@
 	__result; })
 # endif	/* __i686__ */
 
-/* XXX Argh!!!  More compiler errors.  */
-#if 0
 /* Test for negative number.  Used in the signbit() macro.  */
 __MATH_INLINE int
 __signbitf (float __x)
@@ -130,7 +128,6 @@ __signbitl (long double __x)
   return (__u.__i[2] & 0x8000) != 0;
 }
 #endif
-#endif
 
 
 /* The gcc, version 2.7 or below, has problems with all this inlining
@@ -534,8 +531,7 @@ __inline_mathcode (acosh, __x, \
 
 __inline_mathcode (atanh, __x, \
   register long double __y = __fabsl (__x);				      \
-  return (-0.5 * log1pl (-(__y + __y) / (1.0 + __y)) *			      \
-	  __sgn1l (__x)))
+  return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x))
 
 
 /* The argument range of the inline version of hypotl is slightly reduced.  */
@@ -581,7 +577,7 @@ __inline_mathcode2 (drem, __x, __y, \
 
 
 /* This function is used in the `isfinite' macro.  */
-__MATH_INLINE int __finite (double __x);
+__MATH_INLINE int __finite (double __x) __attribute__ ((__const__));
 __MATH_INLINE int
 __finite (double __x)
 {
@@ -615,12 +611,14 @@ __inline_mathcode (__acosh1p, __x, \
 
 
 /* This code is used internally in the GNU libc.  */
-#if 0
-/* XXX I hate compiler bugs.  The current version produces wrong code
-   if this optimization is used.  */
 #ifdef __LIBC_INTERNAL_MATH_INLINES
 __inline_mathop (__ieee754_sqrt, "fsqrt")
-#endif
+__inline_mathcode2 (__ieee754_atan2, __y, __x,
+		    register long double __value;
+		    __asm __volatile__ ("fpatan\n\t"
+					: "=t" (__value)
+					: "0" (__x), "u" (__y) : "st(1)");
+		    return __value;)
 #endif
 
 #endif /* __GNUC__  */
diff --git a/sysdeps/libm-ieee754/s_cacoshf.c b/sysdeps/libm-ieee754/s_cacoshf.c
index bcfebea123..6aa33e5a48 100644
--- a/sysdeps/libm-ieee754/s_cacoshf.c
+++ b/sysdeps/libm-ieee754/s_cacoshf.c
@@ -21,6 +21,7 @@
 #include <complex.h>
 #include <math.h>
 
+#include "math_private.h"
 
 __complex__ float
 __cacoshf (__complex__ float x)
@@ -66,6 +67,7 @@ __cacoshf (__complex__ float x)
     }
   else
     {
+#if 1
       __complex__ float y;
 
       __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
@@ -77,6 +79,19 @@ __cacoshf (__complex__ float x)
       __imag__ y += __imag__ x;
 
       res = __clogf (y);
+#else
+      float re2 = __real__ x * __real__ x;
+      float im2 = __imag__ x * __imag__ x;
+      float sq = re2 - im2 - 1.0;
+      float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
+      float a = __ieee754_sqrtf ((sq + ro) / 2.0);
+      float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
+
+      __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
+					   + im2 + __imag__ x * 2 * b
+					   + ro);
+      __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
+#endif
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_catan.c b/sysdeps/libm-ieee754/s_catan.c
index bab87e95a8..a3fc9ad3e8 100644
--- a/sysdeps/libm-ieee754/s_catan.c
+++ b/sysdeps/libm-ieee754/s_catan.c
@@ -69,7 +69,7 @@ __catan (__complex__ double x)
 
       den = 1 - r2 - __imag__ x * __imag__ x;
 
-      __real__ res = 0.5 * __atan ((2.0 * __real__ x) / den);
+      __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
 
       num = __imag__ x + 1.0;
       num = r2 + num * num;
diff --git a/sysdeps/libm-ieee754/s_catanf.c b/sysdeps/libm-ieee754/s_catanf.c
index 92bdac9ec8..18881cd6c9 100644
--- a/sysdeps/libm-ieee754/s_catanf.c
+++ b/sysdeps/libm-ieee754/s_catanf.c
@@ -69,7 +69,7 @@ __catanf (__complex__ float x)
 
       den = 1 - r2 - __imag__ x * __imag__ x;
 
-      __real__ res = 0.5 * __atanf ((2.0 * __real__ x) / den);
+      __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den);
 
       num = __imag__ x + 1.0;
       num = r2 + num * num;
diff --git a/sysdeps/libm-ieee754/s_catanh.c b/sysdeps/libm-ieee754/s_catanh.c
index 6c4b10e3db..0cb852a069 100644
--- a/sysdeps/libm-ieee754/s_catanh.c
+++ b/sysdeps/libm-ieee754/s_catanh.c
@@ -62,17 +62,17 @@ __catanh (__complex__ double x)
 
       i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 - __real__ x;
+      num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 + __real__ x;
+      den = 1.0 - __real__ x;
       den = i2 + den * den;
 
-      __real__ res = 0.25 * __ieee754_log (num / den);
+      __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
 
       den = 1 - __real__ x * __real__ x - i2;
 
-      __imag__ res = 0.5 * __atan ((2.0 * __imag__ x) / den);
+      __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_catanhf.c b/sysdeps/libm-ieee754/s_catanhf.c
index 5d195be905..ac0ed17edb 100644
--- a/sysdeps/libm-ieee754/s_catanhf.c
+++ b/sysdeps/libm-ieee754/s_catanhf.c
@@ -62,17 +62,17 @@ __catanhf (__complex__ float x)
 
       i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 - __real__ x;
+      num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 + __real__ x;
+      den = 1.0 - __real__ x;
       den = i2 + den * den;
 
-      __real__ res = 0.25 * __ieee754_logf (num / den);
+      __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
 
       den = 1 - __real__ x * __real__ x - i2;
 
-      __imag__ res = 0.5 * __atanf ((2.0 * __imag__ x) / den);
+      __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_catanhl.c b/sysdeps/libm-ieee754/s_catanhl.c
index d8396a7961..693799639a 100644
--- a/sysdeps/libm-ieee754/s_catanhl.c
+++ b/sysdeps/libm-ieee754/s_catanhl.c
@@ -62,17 +62,17 @@ __catanhl (__complex__ long double x)
 
       i2 = __imag__ x * __imag__ x;
 
-      num = 1.0 - __real__ x;
+      num = 1.0 + __real__ x;
       num = i2 + num * num;
 
-      den = 1.0 + __real__ x;
+      den = 1.0 - __real__ x;
       den = i2 + den * den;
 
-      __real__ res = 0.25 * __ieee754_logl (num / den);
+      __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
 
       den = 1 - __real__ x * __real__ x - i2;
 
-      __imag__ res = 0.5 * __atanl ((2.0 * __imag__ x) / den);
+      __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den);
     }
 
   return res;
diff --git a/sysdeps/libm-ieee754/s_catanl.c b/sysdeps/libm-ieee754/s_catanl.c
index 2fd8a4fa08..1da7c6c008 100644
--- a/sysdeps/libm-ieee754/s_catanl.c
+++ b/sysdeps/libm-ieee754/s_catanl.c
@@ -69,7 +69,7 @@ __catanl (__complex__ long double x)
 
       den = 1 - r2 - __imag__ x * __imag__ x;
 
-      __real__ res = 0.5 * __atanl ((2.0 * __real__ x) / den);
+      __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den);
 
       num = __imag__ x + 1.0;
       num = r2 + num * num;
diff --git a/sysdeps/libm-ieee754/s_clog10.c b/sysdeps/libm-ieee754/s_clog10.c
index 5a9de75733..7b2e474b8f 100644
--- a/sysdeps/libm-ieee754/s_clog10.c
+++ b/sysdeps/libm-ieee754/s_clog10.c
@@ -44,7 +44,7 @@ __clog10 (__complex__ double x)
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
 							  __imag__ x));
-      __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
+      __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
     }
   else
     {
diff --git a/sysdeps/libm-ieee754/s_clog10f.c b/sysdeps/libm-ieee754/s_clog10f.c
index 4e2fa83edf..bc4094b8ba 100644
--- a/sysdeps/libm-ieee754/s_clog10f.c
+++ b/sysdeps/libm-ieee754/s_clog10f.c
@@ -44,7 +44,7 @@ __clog10f (__complex__ float x)
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
 							    __imag__ x));
-      __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
+      __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
     }
   else
     {
diff --git a/sysdeps/libm-ieee754/s_clog10l.c b/sysdeps/libm-ieee754/s_clog10l.c
index bf7d394c42..70940f6863 100644
--- a/sysdeps/libm-ieee754/s_clog10l.c
+++ b/sysdeps/libm-ieee754/s_clog10l.c
@@ -1,4 +1,4 @@
-/* Compute complex natural logarithm.
+/* Compute complex base 10 logarithm.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -44,7 +44,7 @@ __clog10l (__complex__ long double x)
       /* Neither real nor imaginary part is NaN.  */
       __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
 							    __imag__ x));
-      __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
+      __imag__ result = M_LOG10E * __ieee754_atan2l (__imag__ x, __real__ x);
     }
   else
     {
diff --git a/sysdeps/m68k/fpu/bits/fenv.h b/sysdeps/m68k/fpu/bits/fenv.h
index a11e0724f1..b1608b9ddc 100644
--- a/sysdeps/m68k/fpu/bits/fenv.h
+++ b/sysdeps/m68k/fpu/bits/fenv.h
@@ -64,8 +64,9 @@ typedef unsigned int fexcept_t;
    corresponds to the layout of the block written by `fmovem'.  */
 typedef struct
   {
-    fexcept_t control_register;
-    fexcept_t status_register;
+    unsigned int control_register;
+    unsigned int status_register;
+    unsigned int instruction_address;
   }
 fenv_t;
 
diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h
index 827a8d603d..034b6f8294 100644
--- a/sysdeps/m68k/fpu/bits/mathinline.h
+++ b/sysdeps/m68k/fpu/bits/mathinline.h
@@ -138,13 +138,20 @@ __inline_mathop(__tan, tan)
 __inline_mathop(__tanh, tanh)
 __inline_mathop(__fabs, abs)
 
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
 __inline_mathop(__rint, int)
 __inline_mathop(__expm1, etoxm1)
 __inline_mathop(__log1p, lognp1)
+#endif
+
+#ifdef __USE_MISC
 __inline_mathop(__significand, getman)
+#endif
 
+#ifdef __USE_ISOC9X
 __inline_mathop(__log2, log2)
 __inline_mathop(__trunc, intrz)
+#endif
 
 #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
 
@@ -272,8 +279,18 @@ __m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x))		  \
   __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
 		      : "dmi" (__ctrl_reg));				  \
   return __result;							  \
-}									  \
-									  \
+}
+
+__inline_functions(double,)
+#if defined __USE_MISC || defined __USE_ISOC9X
+__inline_functions(float,f)
+__inline_functions(long double,l)
+#endif
+#undef __inline_functions
+
+#ifdef __USE_MISC
+
+# define __inline_functions(float_type, s)				  \
 __m81_defun (int, __CONCAT(__isinf,s), (float_type __value))		  \
 {									  \
   /* There is no branch-condition for infinity,				  \
@@ -284,14 +301,6 @@ __m81_defun (int, __CONCAT(__isinf,s), (float_type __value))		  \
   return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0;	  \
 }									  \
 									  \
-__m81_defun (int, __CONCAT(__isnan,s), (float_type __value))		  \
-{									  \
-  char __result;							  \
-  __asm("ftst%.x %1\n"							  \
-	"fsun %0" : "=dm" (__result) : "f" (__value));			  \
-  return __result;							  \
-}									  \
-									  \
 __m81_defun (int, __CONCAT(__finite,s), (float_type __value))		  \
 {									  \
   /* There is no branch-condition for infinity, so we must extract and	  \
@@ -302,6 +311,44 @@ __m81_defun (int, __CONCAT(__finite,s), (float_type __value))		  \
   return (__fpsr & (3 << 24)) == 0;					  \
 }									  \
 									  \
+__m81_defun (float_type, __CONCAT(__scalbn,s),				  \
+	     (float_type __x, int __n))					  \
+{									  \
+  float_type __result;							  \
+  __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x));  \
+  return __result;							  \
+}
+
+__inline_functions(double,)
+__inline_functions(float,f)
+__inline_functions(long double,l)
+# undef __inline_functions
+
+#endif /* Use misc.  */
+
+#if defined __USE_MISC || defined __USE_XOPEN
+
+# define __inline_functions(float_type, s)				  \
+__m81_defun (int, __CONCAT(__isnan,s), (float_type __value))		  \
+{									  \
+  char __result;							  \
+  __asm("ftst%.x %1\n"							  \
+	"fsun %0" : "=dm" (__result) : "f" (__value));			  \
+  return __result;							  \
+}
+
+__inline_functions(double,)
+# ifdef __USE_MISC
+__inline_functions(float,f)
+__inline_functions(long double,l)
+# endif
+# undef __inline_functions
+
+#endif
+
+#ifdef __USE_ISOC9X
+
+# define __inline_functions(float_type, s)				  \
 __m81_defun (int, __CONCAT(__signbit,s), (float_type __value))		  \
 {									  \
   /* There is no branch-condition for the sign bit, so we must extract	  \
@@ -312,14 +359,6 @@ __m81_defun (int, __CONCAT(__signbit,s), (float_type __value))		  \
   return (__fpsr >> 27) & 1;						  \
 }									  \
 									  \
-__m81_defun (float_type, __CONCAT(__scalbn,s),				  \
-	     (float_type __x, int __n))					  \
-{									  \
-  float_type __result;							  \
-  __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x));  \
-  return __result;							  \
-}									  \
-									  \
 __m81_defun (float_type, __CONCAT(__scalbln,s),				  \
 	     (float_type __x, long int __n))				  \
 {									  \
@@ -347,14 +386,6 @@ __m81_defun (long int, __CONCAT(__lrint,s), (float_type __x))		  \
   return __result;							  \
 }									  \
 									  \
-__m81_inline void							  \
-__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx,	  \
-			      float_type *__cosx)			  \
-{									  \
-  __asm ("fsincos%.x %2,%1:%0"						  \
-	 : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x));			  \
-}									  \
-									  \
 __m81_inline float_type							  \
 __m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y,		  \
 			   float_type __z)				  \
@@ -362,11 +393,30 @@ __m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y,		  \
   return (__x * __y) + __z;						  \
 }
 
-/* This defines the three variants of the inline functions.  */
 __inline_functions (double,)
 __inline_functions (float,f)
 __inline_functions (long double,l)
-#undef __inline_functions
+# undef __inline_functions
+
+#endif /* Use ISO C9x */
+
+#ifdef __USE_GNU
+
+# define __inline_functions(float_type, s)				\
+__m81_inline void							\
+__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx,	\
+			      float_type *__cosx)			\
+{									\
+  __asm ("fsincos%.x %2,%1:%0"						\
+	 : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x));			\
+}
+
+__inline_functions (double,)
+__inline_functions (float,f)
+__inline_functions (long double,l)
+# undef __inline_functions
+
+#endif
 
 #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
 
diff --git a/sysdeps/m68k/fpu/fegetenv.c b/sysdeps/m68k/fpu/fegetenv.c
index 59f743aecf..b437b7ef8a 100644
--- a/sysdeps/m68k/fpu/fegetenv.c
+++ b/sysdeps/m68k/fpu/fegetenv.c
@@ -23,5 +23,5 @@
 void
 fegetenv (fenv_t *envp)
 {
-  __asm__ ("fmovem%.l %/fpcr/%/fpsr,%0" : "=m" (*envp));
+  __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*envp));
 }
diff --git a/sysdeps/m68k/fpu/feholdexcpt.c b/sysdeps/m68k/fpu/feholdexcpt.c
index d8e2d8a8a1..e36617d962 100644
--- a/sysdeps/m68k/fpu/feholdexcpt.c
+++ b/sysdeps/m68k/fpu/feholdexcpt.c
@@ -26,7 +26,7 @@ feholdexcept (fenv_t *envp)
   fexcept_t fpcr, fpsr;
 
   /* Store the environment.  */
-  __asm__ ("fmovem%.l %/fpcr/%/fpsr,%0" : "=m" (*envp));
+  __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*envp));
 
   /* Now clear all exceptions.  */
   fpsr = envp->status_register & ~FE_ALL_EXCEPT;
diff --git a/sysdeps/m68k/fpu/fesetenv.c b/sysdeps/m68k/fpu/fesetenv.c
index 8b4d6b0f88..6dd131b888 100644
--- a/sysdeps/m68k/fpu/fesetenv.c
+++ b/sysdeps/m68k/fpu/fesetenv.c
@@ -29,7 +29,7 @@ fesetenv (const fenv_t *envp)
      values which we do not want to come from the saved environment.
      Therefore, we get the current environment and replace the values
      we want to use from the environment specified by the parameter.  */
-  __asm__ ("fmovem%.l %/fpcr/%/fpsr,%0" : "=m" (*&temp));
+  __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*&temp));
 
   temp.status_register &= ~FE_ALL_EXCEPT;
   temp.control_register &= ~((FE_ALL_EXCEPT << 6) | FE_UPWARD);
@@ -44,5 +44,5 @@ fesetenv (const fenv_t *envp)
       temp.status_register |= envp->status_register & FE_ALL_EXCEPT;
     }
 
-  __asm__ __volatile__ ("fmovem%.l %0,%/fpcr/%/fpsr" : : "m" (temp));
+  __asm__ __volatile__ ("fmovem%.l %0,%/fpcr/%/fpsr/%/fpiar" : : "m" (*&temp));
 }
diff --git a/sysdeps/posix/waitid.c b/sysdeps/posix/waitid.c
new file mode 100644
index 0000000000..a36883a8d2
--- /dev/null
+++ b/sysdeps/posix/waitid.c
@@ -0,0 +1,118 @@
+/* Pseudo implementation of waitid.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
+#include <assert.h>
+
+int
+waitid (idtype, id, infop, options)
+     idtype_t idtype;
+     id_t id;
+     siginfo_t *infop;
+     int options;
+{
+  pid_t pid, child;
+  int status;
+
+  switch (idtype)
+    {
+    case P_PID:
+      if(id <= 0)
+	goto invalid;
+      pid = (pid_t) id;
+      break;
+    case P_PGID:
+      if (id < 0 || id == 1)
+	goto invalid;
+      pid = (pid_t) -id;
+      break;
+    case P_ALL:
+      pid = -1;
+      break;
+    default:
+    invalid:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* Technically we're supposed to return EFAULT if infop is bogus,
+     but that would involve mucking with signals, which is
+     too much hassle.  User will have to deal with SIGSEGV/SIGBUS.
+     We just check for a null pointer. */
+
+  if (infop == NULL)
+    {
+      __set_errno (EFAULT);
+      return -1;
+    }
+
+  child = waitpid (pid, &status, options);
+
+  if (child == -1)
+    /* `waitpid' set `errno' for us.  */
+    return -1;
+
+  if (child == 0)
+    {
+      /* The WHOHANG bit in OPTIONS is set and there are children available
+	 but none has a status for us.  The XPG docs do not mention this
+	 case so we clear the `siginfo_t' struct and return succesfully.  */
+      infop->si_signo = 0;
+      infop->si_code = 0;
+      return 0;
+    }
+
+  /* Decode the status field and set infop members... */
+  infop->si_signo = SIGCHLD;
+  infop->si_pid = child;
+  infop->si_errno = 0;
+
+  if (WIFEXITED (status))
+    {
+      infop->si_code = CLD_EXITED;
+      infop->si_status = WEXITSTATUS (status);
+    }
+  else if (WIFSIGNALED (status))
+    {
+      infop->si_code = WCOREDUMP (status) ? CLD_DUMPED : CLD_KILLED;
+      infop->si_status = WTERMSIG (status);
+    }
+  else if (WIFSTOPPED (status))
+    {
+      infop->si_code = CLD_STOPPED;
+      infop->si_status = WSTOPSIG (status);
+    }
+#ifdef WIFCONTINUED
+  else if (WIFCONTINUED (status))
+    {
+      infop->si_code = CLD_CONTINUED;
+      infop->si_status = SIGCONT;
+    }
+#endif
+  else
+    /* Can't happen. */
+    assert (! "What?");
+
+  return 0;
+}
diff --git a/sysdeps/standalone/arm/bits/errno.h b/sysdeps/standalone/arm/bits/errno.h
index 97dbbd9ce3..391f92548f 100644
--- a/sysdeps/standalone/arm/bits/errno.h
+++ b/sysdeps/standalone/arm/bits/errno.h
@@ -52,6 +52,13 @@
 # define EISDIR		24
 # define EOPNOTSUPP	25	/* Operation not supported.  */
 # define ENOTTY		26
+# define EAGAIN		27
+# define EIO		28
+# define ENOSPC		29
+# define EEXIST		30
 #endif
 
 #define __set_errno(val) errno = (val)
+
+/* Function to get address of global `errno' variable.  */
+extern int *__errno_location __P ((void)) __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 6903e0b6cd..27684ef3fe 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -67,6 +67,12 @@ endif
 ifeq ($(subdir),stdio-common)
 # Just disable the auto generation in sysdeps/generic
 inhibit-siglist := yes
+
+ifeq ($(versioning),yes)
+aux += oldsiglist
+endif
+
+shared-only-routines += oldsiglist
 endif
 
 ifeq ($(subdir),inet)
@@ -111,8 +117,7 @@ endif
 
 ifeq ($(subdir),signal)
 sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait	\
-		   rt_sigqueueinfo rt_sigaction rt_sigpending	\
-		   rt_sigreturn
+		   rt_sigqueueinfo rt_sigaction rt_sigpending
 endif
 
 common-generated += bits/stdio_lim.h bits/stdio_lim.d
diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h
index 9ad897644e..5dda3d71db 100644
--- a/sysdeps/unix/sysv/linux/_G_config.h
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -48,6 +48,9 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_HAVE_PRINTF_FP 1
 #define _G_HAVE_MMAP 1
 #define _G_HAVE_LONG_DOUBLE_IO 1
+#define _G_HAVE_IO_FILE_OPEN 1
+
+#define _G_IO_IO_FILE_VERSION 0x20001
 
 #define _G_OPEN64	open64
 #define _G_LSEEK64	lseek64
@@ -66,7 +69,7 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_VTABLE_LABEL_PREFIX_ID __vt_
 
 
-#if defined (__cplusplus) || defined (__STDC__)
+#if defined __cplusplus || defined __STDC__
 # define _G_ARGS(ARGLIST) ARGLIST
 #else
 # define _G_ARGS(ARGLIST) ()
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index b9e6dd779a..9acdf0c490 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -62,6 +62,7 @@ typedef __uint32_t __fsblkcnt_t;	/* Type to count file system blocks.  */
 typedef __uint64_t __fsblkcnt64_t;	/*  "" (LFS) */
 typedef __uint64_t __fsfilcnt_t;	/* Type to count file system inodes.  */
 typedef __uint64_t __fsfilcnt64_t;	/*  "" (LFS) */
+typedef __uint32_t __id_t;		/* General type for IDs.  */
 
 typedef struct
   {
@@ -90,7 +91,7 @@ typedef unsigned long int __fd_mask;
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define __NFDBITS	(8 * sizeof (__fd_mask))
 #define	__FDELT(d)	((d) / __NFDBITS)
-#define	__FDMASK(d)	(1 << ((d) % __NFDBITS))
+#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
 
 /* fd_set for select and pselect.  */
 typedef struct
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h b/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
index 900bff4aab..6f8bc9bcd4 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
@@ -1,6 +1,6 @@
 /* This is the sigaction struction from the Linux 2.1.20 kernel.  */
 
-struct kernel_sigaction {
+struct old_kernel_sigaction {
 	__sighandler_t sa_handler;
 	unsigned long sa_mask;
 	unsigned int sa_flags;
diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
index 42030abc4f..503465b3bf 100644
--- a/sysdeps/unix/sysv/linux/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
@@ -17,12 +17,23 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SIGNAL_H
+#if !defined _SIGNAL_H && !defined __need_siginfo_t
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
-#define SI_MAX_SIZE     128
-#define SI_PAD_SIZE     ((SI_MAX_SIZE / sizeof (int)) - 3)
+#if (!defined __have_siginfo_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t	1
+
+/* Type for data associated with a signal.  */
+typedef union sigval
+  {
+    int sival_int;
+    void *sival_ptr;
+  } sigval_t;
+
+# define SI_MAX_SIZE     128
+# define SI_PAD_SIZE     ((SI_MAX_SIZE / sizeof (int)) - 3)
 
 typedef struct siginfo
   {
@@ -83,17 +94,17 @@ typedef struct siginfo
 
 
 /* X/Open requires some more fields with fixed names.  */
-#define si_pid		_sifields._kill.si_pid
-#define si_uid		_sifields._kill.si_uid
-#define si_status	_sifields._sigchld.si_status
-#define si_utime	_sifields._sigchld.si_utime
-#define si_stime	_sifields._sigchld.si_stime
-#define si_value	_sifields._rt.si_sigval
-#define si_int		_sifields._rt.si_sigval.sival_int
-#define si_ptr		_sifields._rt.si_sigval.sival_ptr
-#define si_addr		_sifields._sigfault.si_addr
-#define si_band		_sifields._sigpoll.si_band
-#define si_fd		_sifields._sigpoll.si_fd
+# define si_pid		_sifields._kill.si_pid
+# define si_uid		_sifields._kill.si_uid
+# define si_status	_sifields._sigchld.si_status
+# define si_utime	_sifields._sigchld.si_utime
+# define si_stime	_sifields._sigchld.si_stime
+# define si_value	_sifields._rt.si_sigval
+# define si_int		_sifields._rt.si_sigval.sival_int
+# define si_ptr		_sifields._rt.si_sigval.sival_ptr
+# define si_addr	_sifields._sigfault.si_addr
+# define si_band	_sifields._sigpoll.si_band
+# define si_fd		_sifields._sigpoll.si_fd
 
 
 /* Values for `si_code'.  Positive values are reserved for kernel-generated
@@ -101,15 +112,15 @@ typedef struct siginfo
 enum
 {
   SI_ASYNCIO = -4,		/* Sent by AIO completion.  */
-#define SI_ASYNCIO	SI_ASYNCIO
+# define SI_ASYNCIO	SI_ASYNCIO
   SI_MESGQ,			/* Sent by real time mesq state change.  */
-#define SI_MESGQ	SI_MESGQ
+# define SI_MESGQ	SI_MESGQ
   SI_TIMER,			/* Sent by timer expiration.  */
-#define SI_TIMER	SI_TIMER
+# define SI_TIMER	SI_TIMER
   SI_QUEUE,			/* Sent by sigqueue.  */
-#define SI_QUEUE	SI_QUEUE
+# define SI_QUEUE	SI_QUEUE
   SI_USER			/* Sent by kill, sigsend, raise.  */
-#define SI_USER		SI_USER
+# define SI_USER	SI_USER
 };
 
 
@@ -117,111 +128,117 @@ enum
 enum
 {
   ILL_ILLOPC = 1,		/* Illegal opcode.  */
-#define ILL_ILLOPC	ILL_ILLOPC
+# define ILL_ILLOPC	ILL_ILLOPC
   ILL_ILL_OPN,			/* Illegal operand.  */
-#define ILL_ILLOPN	ILL_ILLOPN
+# define ILL_ILLOPN	ILL_ILLOPN
   ILL_ILLADR,			/* Illegal addressing mode.  */
-#define ILL_ILLADR	ILL_ILLADR
+# define ILL_ILLADR	ILL_ILLADR
   ILL_ILLTRP,			/* Illegal trap. */
-#define ILL_ILLTRP	ILL_ILLTRP
+# define ILL_ILLTRP	ILL_ILLTRP
   ILL_PRVOPC,			/* Privileged opcode.  */
-#define ILL_PRVOPC	ILL_PRVOPC
+# define ILL_PRVOPC	ILL_PRVOPC
   ILL_PRVREG,			/* Privileged register.  */
-#define ILL_PRVREG	ILL_PRVREG
+# define ILL_PRVREG	ILL_PRVREG
   ILL_COPROC,			/* Coprocessor error.  */
-#define ILL_COPROC	ILL_COPROC
+# define ILL_COPROC	ILL_COPROC
   ILL_BADSTK			/* Internal stack error.  */
-#define ILL_BADSTK	ILL_BADSTK
+# define ILL_BADSTK	ILL_BADSTK
 };
 
 /* `si_code' values for SIGFPE signal.  */
 enum
 {
   FPE_INTDIV = 1,		/* Integer divide by zero.  */
-#define FPE_INTDIV	FPE_INTDIV
+# define FPE_INTDIV	FPE_INTDIV
   FPE_INTOVF,			/* Integer overflow.  */
-#define FPE_INTOVF	FPE_INTOVF
+# define FPE_INTOVF	FPE_INTOVF
   FPE_FLTDIV,			/* Floating point divide by zero.  */
-#define FPE_FLTDIV	FPE_FLTDIV
+# define FPE_FLTDIV	FPE_FLTDIV
   FPE_FLTOVF,			/* Floating point overflow.  */
-#define FPE_FLTOVF	FPE_FLTOVF
+# define FPE_FLTOVF	FPE_FLTOVF
   FPE_FLTUND,			/* Floating point underflow.  */
-#define FPE_FLTUND	FPE_FLTUND
+# define FPE_FLTUND	FPE_FLTUND
   FPE_FLTRES,			/* Floating point inexact result.  */
-#define FPE_FLTRES	FPE_FLTRES
+# define FPE_FLTRES	FPE_FLTRES
   FPE_FLTINV,			/* Floating point invalid operation.  */
-#define FPE_FLTINV	FPE_FLTINV
+# define FPE_FLTINV	FPE_FLTINV
   FPE_FLTSUB			/* Subscript out of range.  */
-#define FPE_FLTSUB	FPE_FLTSUB
+# define FPE_FLTSUB	FPE_FLTSUB
 };
 
 /* `si_code' values for SIGSEGV signal.  */
 enum
 {
   SEGV_MAPERR = 1,		/* Address not mapped to object.  */
-#define SEGV_MAPERR	SEGV_MAPERR
+# define SEGV_MAPERR	SEGV_MAPERR
   SEGV_ACCERR			/* Invalid permissions for mapped object.  */
-#define SEGV_ACCERR	SEGV_ACCERR
+# define SEGV_ACCERR	SEGV_ACCERR
 };
 
 /* `si_code' values for SIGBUS signal.  */
 enum
 {
   BUS_ADRALN = 1,		/* Invalid address alignment.  */
-#define BUS_ADRALN	BUS_ADRALN
+# define BUS_ADRALN	BUS_ADRALN
   BUS_ADRERR,			/* Non-existant physical address.  */
-#define BUS_ADRERR	BUS_ADRERR
+# define BUS_ADRERR	BUS_ADRERR
   BUS_OBJERR			/* Object specific hardware error.  */
-#define BUS_OBJERR	BUS_OBJERR
+# define BUS_OBJERR	BUS_OBJERR
 };
 
 /* `si_code' values for SIGTRAP signal.  */
 enum
 {
   TRAP_BRKPT = 1,		/* Process breakpoint.  */
-#define TRAP_BRKPT	TRAP_BRKPT
+# define TRAP_BRKPT	TRAP_BRKPT
   TRAP_TRACE			/* Process trace trap.  */
-#define TRAP_TRACE	TRAP_TRACE
+# define TRAP_TRACE	TRAP_TRACE
 };
 
 /* `si_code' values for SIGCHLD signal.  */
 enum
 {
   CLD_EXITED = 1,		/* Child has exited.  */
-#define CLD_EXITED	CLD_EXITED
+# define CLD_EXITED	CLD_EXITED
   CLD_KILLED,			/* Child was killed.  */
-#define CLD_KILLED	CLD_KILLED
+# define CLD_KILLED	CLD_KILLED
   CLD_DUMPED,			/* Child terminated abnormally.  */
-#define CLD_DUMPED	CLD_DUMPED
+# define CLD_DUMPED	CLD_DUMPED
   CLD_TRAPPED,			/* Traced child has trapped.  */
-#define CLD_TRAPPED	CLD_TRAPPED
+# define CLD_TRAPPED	CLD_TRAPPED
   CLD_STOPPED,			/* Child has stopped.  */
-#define CLD_STOPPED	CLD_STOPPED
+# define CLD_STOPPED	CLD_STOPPED
   CLD_CONTINUED			/* Stopped child has continued.  */
-#define CLD_CONTINUED	CLD_CONTINUED
+# define CLD_CONTINUED	CLD_CONTINUED
 };
 
 /* `si_code' values for SIGPOLL signal.  */
 enum
 {
   POLL_IN = 1,			/* Data input available.  */
-#define POLL_IN		POLL_IN
+# define POLL_IN	POLL_IN
   POLL_OUT,			/* Output buffers available.  */
-#define POLL_OUT	POLL_OUT
+# define POLL_OUT	POLL_OUT
   POLL_MSG,			/* Input message available.   */
-#define POLL_MSG	POLL_MSG
+# define POLL_MSG	POLL_MSG
   POLL_ERR,			/* I/O error.  */
-#define POLL_ERR	POLL_ERR
+# define POLL_ERR	POLL_ERR
   POLL_PRI,			/* High priority input available.  */
-#define POLL_PRI	POLL_PRI
+# define POLL_PRI	POLL_PRI
   POLL_HUP			/* Device disconnected.  */
-#define POLL_HUP	POLL_HUP
+# define POLL_HUP	POLL_HUP
 };
 
+# undef __need_siginfo_t
+#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
+
+
+#if defined _SIGNAL_H && !defined __have_sigevent_t
+# define __have_sigevent_t	1
 
 /* Structure to transport application-defined values with signals.  */
-#define SIGEV_MAX_SIZE	64
-#define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# define SIGEV_MAX_SIZE	64
+# define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
 
 typedef struct sigevent
   {
@@ -242,16 +259,18 @@ typedef struct sigevent
   } sigevent_t;
 
 /* POSIX names to access some of the members.  */
-#define sigev_notify_function   _sigev_un._sigev_thread._function
-#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
+# define sigev_notify_function   _sigev_un._sigev_thread._function
+# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
 
 /* `sigev_notify' values.  */
 enum
 {
   SIGEV_SIGNAL = 0,		/* Notify via signal.  */
-#define SIGEV_SIGNAL	SIGEV_SIGNAL
+# define SIGEV_SIGNAL	SIGEV_SIGNAL
   SIGEV_NONE,			/* Other notification: meaningless.  */
-#define SIGEV_NONE	SIGEV_NONE
+# define SIGEV_NONE	SIGEV_NONE
   SIGEV_THREAD			/* Deliver via thread creation.  */
-#define SIGEV_THREAD	SIGEV_THREAD
+# define SIGEV_THREAD	SIGEV_THREAD
 };
+
+#endif	/* have _SIGNAL_H.  */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index daa94336de..dec60e244b 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -67,6 +67,7 @@ typedef int __pid_t;			/* Type of process identifications.  */
 typedef int __ssize_t;			/* Type of a byte count, or error.  */
 typedef long int __rlim_t;		/* Type of resource counts.  */
 typedef __quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_int __id_t;			/* General type for ID.  */
 
 typedef struct
   {
@@ -90,7 +91,7 @@ typedef unsigned long int __fd_mask;
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define __NFDBITS	(8 * sizeof (__fd_mask))
 #define	__FDELT(d)	((d) / __NFDBITS)
-#define	__FDMASK(d)	(1 << ((d) % __NFDBITS))
+#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
 
 /* fd_set for select and pselect.  */
 typedef struct
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index 505b8ddcfe..3a172288b6 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -24,6 +24,7 @@
 #include <init-first.h>
 #include <sys/types.h>
 
+extern void __libc_init_secure (void);
 extern void __libc_init (int, char **, char **);
 extern void __libc_global_ctors (void);
 
@@ -42,8 +43,9 @@ int __libc_multiple_libcs = 1;
 int __libc_argc;
 char **__libc_argv;
 
-/* We often need the PID.  Cache this value.  */
+/* We often need the UID and PID.  Cache these values.  */
 pid_t __libc_pid = 0xf00baa;
+uid_t __libc_uid = 0xf00baa;
 
 
 static void
@@ -71,6 +73,10 @@ init (int argc, char **argv, char **envp)
   __libc_argv = argv;
   __environ = envp;
 
+#ifndef PIC
+  __libc_init_secure ();
+#endif
+
   __libc_init (argc, argv, envp);
 
   /* This is a hack to make the special getopt in GNU libc working.  */
diff --git a/sysdeps/unix/sysv/linux/net/if_slip.h b/sysdeps/unix/sysv/linux/net/if_slip.h
index 2670427dbe..4686bc5da1 100644
--- a/sysdeps/unix/sysv/linux/net/if_slip.h
+++ b/sysdeps/unix/sysv/linux/net/if_slip.h
@@ -1,6 +1,25 @@
-#ifndef __NET_SLIP_H
-#define __NET_SLIP_H 1
+/* Copyright (C) 1997 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.  */
+
+#ifndef _NET_IF_SLIP_H
+#define _NET_IF_SLIP_H 1
+
+/* We can use the kernel header.  */
 #include <linux/if_slip.h>
 
-#endif
+#endif	/* net/if_slip.h.  */
diff --git a/sysdeps/unix/sysv/linux/oldsiglist.c b/sysdeps/unix/sysv/linux/oldsiglist.c
new file mode 100644
index 0000000000..e9c933f9b3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/oldsiglist.c
@@ -0,0 +1,21 @@
+#include <stddef.h>
+#include <signal.h>
+
+const char * const __old_sys_siglist[32] =
+{
+#define init_sig(sig, abbrev, desc)   [sig] desc,
+#include "siglist.h"
+#undef init_sig
+};
+
+const char * const __old_sys_sigabbrev[32] =
+{
+#define init_sig(sig, abbrev, desc)   [sig] abbrev,
+#include "siglist.h"
+#undef init_sig
+};
+
+strong_alias (__old_sys_siglist, _old_sys_siglist)
+symbol_version (__old_sys_siglist, _sys_siglist, GLIBC_2.0);
+symbol_version (_old_sys_siglist, sys_siglist, GLIBC_2.0);
+symbol_version (__old_sys_sigabbrev, sys_sigabbrev, GLIBC_2.0);
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 1412c381d0..3eb721454e 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -16,6 +16,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <signal.h>
 
 /* The difference here is that the sigaction structure used in the
@@ -23,10 +24,10 @@
    translate it here.  */
 #include <kernel_sigaction.h>
 
-extern int __syscall_sigaction (int, const struct kernel_sigaction *,
-				struct kernel_sigaction *);
-extern int __syscall_rt_signal (int, const struct sigaction *,
-				struct sigaction *, size_t);
+extern int __syscall_sigaction (int, const struct old_kernel_sigaction *,
+				struct old_kernel_sigaction *);
+extern int __syscall_rt_sigaction (int, const struct sigaction *,
+				   struct sigaction *, size_t);
 
 /* The variable is shared between all wrappers around signal handling
    functions which have RT equivalents.  It is defined in sigsuspend.c.  */
diff --git a/sysdeps/unix/sysv/linux/siglist.c b/sysdeps/unix/sysv/linux/siglist.c
index c054e81999..9f42cc0a87 100644
--- a/sysdeps/unix/sysv/linux/siglist.c
+++ b/sysdeps/unix/sysv/linux/siglist.c
@@ -1,19 +1,26 @@
 #include <stddef.h>
 #include <signal.h>
 
-const char * const _sys_siglist[NSIG] =
+const char * const __new_sys_siglist[NSIG] =
 {
 #define init_sig(sig, abbrev, desc)   [sig] desc,
 #include "siglist.h"
 #undef init_sig
 };
 
-const char * const _sys_sigabbrev[NSIG] =
+const char * const __new_sys_sigabbrev[NSIG] =
 {
 #define init_sig(sig, abbrev, desc)   [sig] abbrev,
 #include "siglist.h"
 #undef init_sig
 };
 
+#ifdef DO_VERSIONING
+strong_alias (__new_sys_siglist, _new_sys_siglist)
+default_symbol_version (__new_sys_siglist, _sys_siglist, GLIBC_2.1);
+default_symbol_version (_new_sys_siglist, sys_siglist, GLIBC_2.1);
+default_symbol_version (__new_sys_sigabbrev, sys_sigabbrev, GLIBC_2.1);
+#else
 weak_alias(_sys_siglist, sys_siglist)
 weak_alias(_sys_sigabbrev, sys_sigabbrev)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c
index a88cd88f66..53e66af176 100644
--- a/sysdeps/unix/sysv/linux/sigqueue.c
+++ b/sysdeps/unix/sysv/linux/sigqueue.c
@@ -44,6 +44,8 @@ __sigqueue (pid, sig, val)
     __libc_pid = __getpid ();
   info.si_pid = __libc_pid;
 
+  if (__libc_uid ==0xf00baa)
+    __libc_pid = __getuid ();
   info.si_uid = __libc_uid;
 
   info.si_value = val;
diff --git a/sysdeps/unix/sysv/linux/sigreturn.c b/sysdeps/unix/sysv/linux/sigreturn.c
index 540dfdf388..6b3116fef2 100644
--- a/sysdeps/unix/sysv/linux/sigreturn.c
+++ b/sysdeps/unix/sysv/linux/sigreturn.c
@@ -1,51 +1,3 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-extern int __syscall_sigreturn (struct sigcontext *);
-extern int __syscall_rt_sigreturn (struct sigcontext *, size_t);
-
-/* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  It is defined in sigsuspend.c.  */
-extern int __libc_have_rt_sigs;
-
-
-/* Get and/or change the set of blocked signals.  */
-int
-__sigreturn (scp)
-     struct sigcontext *scp;
-{
-  /* First try the RT signals.  */
-  if (__libc_have_rt_sigs)
-    {
-      /* XXX The size argument hopefully will have to be changed to the
-	 real size of the user-level sigset_t.  */
-      int result = __syscall_rt_sigreturn (scp, _NSIG / 8);
-
-      if (result >= 0 || errno != ENOSYS)
-	return result;
-
-      __libc_have_rt_sigs = 0;
-    }
-
-  return __syscall_sigreturn (scp);
-}
-weak_alias (__sigprocmask, sigprocmask)
+/* The sigreturn syscall cannot be explicitly called on Linux, only
+   implicitly by returning from a signal handler.  */
+#include <sysdeps/generic/sigreturn.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index a417928863..0c421fb7a7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -54,6 +54,7 @@ typedef int __pid_t;			/* Type of process identifications.  */
 typedef long long int __ssize_t;	/* Type of a byte count, or error.  */
 typedef long int __rlim_t;		/* Type of resource counts.  */
 typedef long int __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_int __id_t;			/* General type for IDs.  */
 
 typedef struct
   {
@@ -82,7 +83,7 @@ typedef unsigned long int __fd_mask;
 /* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
 #define __NFDBITS	(8 * sizeof (__fd_mask))
 #define	__FDELT(d)	((d) / __NFDBITS)
-#define	__FDMASK(d)	(1 << ((d) % __NFDBITS))
+#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
 
 /* fd_set for select and pselect.  */
 typedef struct
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index ed760af2ab..16538cee73 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -39,7 +39,6 @@ rt_sigaction	-	rt_sigaction	4	__syscall_rt_sigaction
 rt_sigpending	-	rt_sigpending	2	__syscall_rt_sigpending
 rt_sigprocmask	-	rt_sigprocmask	4	__syscall_rt_sigprocmask
 rt_sigqueueinfo	-	rt_sigqueueinfo	3	__syscall_rt_sigqueueinfo
-rt_sigreturn	-	rt_sigreturn	1	__syscall_rt_sigreturn
 rt_sigsuspend	-	rt_sigsuspend	2	__syscall_rt_sigsuspend
 rt_sigtimedwait	-	rt_sigtimedwait	4	__syscall_rt_sigtimedwait
 s_getdents	EXTRA	getdents	3	__getdents
@@ -52,7 +51,6 @@ s_reboot	EXTRA	reboot		3	__syscall_reboot
 s_sigaction	sigaction sigaction	3	__syscall_sigaction
 s_sigpending	EXTRA	sigpending	1	__syscall_sigpending
 s_sigprocmask	EXTRA	sigprocmask	3	__syscall_sigprocmask
-s_sigreturn	sigreturn sigreturn	1	__syscall_sigreturn
 s_sigsuspend	sigsuspend sigsuspend	3	__syscall_sigsuspend
 s_sysctl	sysctl	_sysctl		1	__syscall__sysctl
 s_ustat		ustat	ustat		2	__syscall_ustat
diff --git a/version.h b/version.h
index 180f62be88..90acd092dd 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
 /* This file just defines the current version number of libc.  */
 
 #define RELEASE "experimental"
-#define VERSION "2.0.90"
+#define VERSION "2.0.91"
diff --git a/wctype/Makefile b/wctype/Makefile
index 731b43abe5..16a7f329fa 100644
--- a/wctype/Makefile
+++ b/wctype/Makefile
@@ -24,7 +24,7 @@ subdir	:= wctype
 headers		:= wctype.h
 distribute	:= cname-lookup.h
 routines	:= wcfuncs wctype iswctype wctrans towctrans wcextra \
-		   wcfuncs_l iswctype_l towctrans_l
+		   wcfuncs_l iswctype_l towctrans_l wctype_l
 
 tests	:= test_wctype
 
diff --git a/wctype/test_wctype.c b/wctype/test_wctype.c
index 300b86972d..1c9bf5aa3b 100644
--- a/wctype/test_wctype.c
+++ b/wctype/test_wctype.c
@@ -46,14 +46,22 @@ main (int argc, char *argv[])
 
   for (ch = 0; ch < 256; ++ch)
     {
-#define TEST(test)							      \
+#define TEST(test) \
       do								      \
-	if ((is##test (ch) == 0) != (iswctype (ch, bit_##test) == 0))	      \
-	  {								      \
-	    printf ("class `%s' test for character \\%o failed\n",	      \
-		    #test, ch);						      \
-	    result = 1;							      \
-	  }								      \
+	{								      \
+	  if ((is##test (ch) == 0) != (iswctype (ch, bit_##test) == 0))	      \
+	    {								      \
+	      printf ("`iswctype' class `%s' test "			      \
+		      "for character \\%o failed\n", #test, ch);	      \
+	      result = 1;						      \
+	    }								      \
+	  if ((is##test (ch) == 0) != (isw##test (ch) == 0))		      \
+	    {								      \
+	      printf ("`isw%s' test for character \\%o failed\n",	      \
+		      #test, ch);					      \
+	      result = 1;						      \
+	    }								      \
+	 }								      \
       while (0)
 
       TEST (alnum);
diff --git a/wctype/wctype.c b/wctype/wctype.c
index 01746be03b..07cb518ad3 100644
--- a/wctype/wctype.c
+++ b/wctype/wctype.c
@@ -20,21 +20,24 @@
 #include <endian.h>
 #include <string.h>
 #include <wctype.h>
-#include "../locale/localeinfo.h"
+#include <locale/localeinfo.h>
 
 wctype_t
 wctype (const char *property)
 {
   const char *names;
   wctype_t result;
+  size_t proplen = strlen (property);
 
   names = _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS_NAMES);
   for (result = 1; result != 0; result <<= 1)
     {
-      if (strcmp (property, names) == 0)
+      size_t nameslen = strlen (names);
+
+      if (proplen == nameslen && memcmp (property, names, proplen) == 0)
 	break;
 
-      names = strchr (names, '\0') + 1;
+      names += nameslen + 1;
       if (names[0] == '\0')
 	return 0;
     }
@@ -42,9 +45,9 @@ wctype (const char *property)
 #if __BYTE_ORDER == __BIG_ENDIAN
   return result;
 #else
-# define SWAPU32(w) \
-  (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
+#define XSWAPU32(w) \
+  ((((w) & 0xff00ff00) >> 8) | (((w) & 0xff00ff) << 8))
 
-  return SWAPU32 (result);
+  return XSWAPU32 (result);
 #endif
 }
diff --git a/wctype/wctype.h b/wctype/wctype.h
index 91a1678192..ffa4b25808 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -57,11 +57,7 @@ typedef unsigned long int wctype_t;
 #endif
 
 #ifndef _ISbit
-/* These are all the characteristics of characters.
-   If there get to be more than 16 distinct characteristics,
-   many things must be changed that use `unsigned short int's.
-
-   The characteristics are stored always in network byte order (big
+/* The characteristics are stored always in network byte order (big
    endian).  We define the bit value interpretations here dependent on the
    machine's byte order.  */
 
@@ -260,25 +256,30 @@ extern int __iswupper_l __P ((wint_t __wc, __locale_t __locale));
 extern int __iswxdigit_l __P ((wint_t __wc, __locale_t __locale));
 
 
+/* Construct value that describes a class of wide characters identified
+   by the string argument PROPERTY.  */
+extern wctype_t __wctype_l __P ((__const char *__property,
+				 __locale_t __locale));
+
 /* Determine whether the wide-character WC has the property described by
    DESC.  */
 extern int __iswctype_l __P ((wint_t __wc, wctype_t __desc,
-			      __locale_t locale));
+			      __locale_t __locale));
 
 
 /*
- * Wide-character case-mapping functions: 7.15.3.1.
+ * Wide-character case-mapping functions.
  */
 
 /* Converts an uppercase letter to the corresponding lowercase letter.  */
-extern wint_t __towlower_l __P ((wint_t __wc, __locale_t locale));
+extern wint_t __towlower_l __P ((wint_t __wc, __locale_t __locale));
 
 /* Converts an lowercase letter to the corresponding uppercase letter.  */
-extern wint_t __towupper_l __P ((wint_t __wc, __locale_t locale));
+extern wint_t __towupper_l __P ((wint_t __wc, __locale_t __locale));
 
 /* Map the wide character WC using the mapping described by DESC.  */
 extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc,
-				  __locale_t locale));
+				  __locale_t __locale));
 
 
 # ifndef __NO_WCTYPE
diff --git a/wctype/wctype_l.c b/wctype/wctype_l.c
new file mode 100644
index 0000000000..6a8d469fa8
--- /dev/null
+++ b/wctype/wctype_l.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <endian.h>
+#include <string.h>
+#include <wctype.h>
+#include <locale/localeinfo.h>
+
+wctype_t
+__wctype_l (const char *property, __locale_t locale)
+{
+  const char *names;
+  wctype_t result;
+  size_t proplen = strlen (property);
+
+  names = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_NAMES)].string;
+  for (result = 1; result != 0; result <<= 1)
+    {
+      size_t nameslen = strlen (names);
+
+      if (proplen == nameslen && memcmp (property, names, proplen) == 0)
+	break;
+
+      names += nameslen + 1;
+      if (names[0] == '\0')
+	return 0;
+    }
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+  return result;
+#else
+#define XSWAPU32(w) \
+  ((((w) & 0xff00ff00) >> 8) | (((w) & 0xff00ff) << 8))
+
+  return XSWAPU32 (result);
+#endif
+}