summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-08-07 23:50:59 +0000
committerUlrich Drepper <drepper@redhat.com>1996-08-07 23:50:59 +0000
commit233963756b2ef272f8876afec2a2bb629b425e0c (patch)
tree69b27a7182cd444f37d08d08a9f64f957cc64ef9
parent80776ab80da30197fe7eb34d46f12b397b8ce1d4 (diff)
downloadglibc-233963756b2ef272f8876afec2a2bb629b425e0c.tar.gz
glibc-233963756b2ef272f8876afec2a2bb629b425e0c.tar.xz
glibc-233963756b2ef272f8876afec2a2bb629b425e0c.zip
Thu Aug  8 01:41:43 1996  Ulrich Drepper  <drepper@cygnus.com>

	* elf/Makefile: Undo change of Tue Aug  6 14:27:11 1996.
	* elf/dl-support: Add definition of `_dl_sysdep_read_whole_file'.

Thu Aug  8 01:15:59 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/i386/fpu_control.h (_FPU_DEFAULT, _FPU_IEEE): Set
	to 0x137f to allow long double operations.

Sun Aug  4 13:12:05 1996  Richard Henderson  <rth@tamu.edu>

	Bug Fixes:

	* nss/nsswitch.c (_res): Remove redundant variable definition.
	The real one is in resolve/res_init.c, and having both prevents
	using -fno-common when building the shared library.
	* sunrpc/rpc_prot.c (_null_auth): Same.  Original is in rpc_common.c.

	* sysdeps/unix/sysv/linux/alpha/brk.S: When PIC, define __curbrk as
	a .bss object not a COMMON symbol.

	* sysdeps/alpha/bsd-_setjmp.S, sysdeps/alpha/bsd-setjmp.S: Must load
	$gp before referencing __sigsetjmp symbol.  Retain LITUSE for same.

	Optimizations:

	* sysdeps/alpha/strlen.S: Rearrange first-word setup and thense the
	main loop for better dual-issue on EV5.  Rearrange binary search to
	pipeline better and trim one instruction.

	Cosmetic Changes:

	* time/localtime.c (localtime_r): Move lock declaration back next to
	the comment where it was before the 960724 change.

	* INSTALL, manual/maint.texi: alpha-gnu-linux -> alpha-ANYTHING-linux.
	The second word is supposed to be the hardware manufacturer.

	* sysdeps/alpha/_mcount.S: Retain LITUSE for __mcount.
	* sysdeps/alpha/setjmp.S: Retain LITUSE for __sigsetjmp_aux.

	* sysdeps/alpha/divrem.h: More local labels, retain LITUSE for _mcount.

	* sysdeps/alpha/alphaev5/add_n.S, sysdeps/alpha/alphaev5/lshift.S,
	sysdeps/alpha/alphaev5/rshift.S, sysdeps/alpha/alphaev5/sub_n.S:
	Same cleanups as with EV4 GMP stuff.

Tue Jul 25 03:30:56 1996  Richard Henderson  <rth@tamu.edu>

	* sysdeps/unix/sysv/linux/Makefile [misc] (sysdep_routines): Add clone.
	* sysdeps/unix/sysv/linux/alpha/clone.S: New file.
	* sysdeps/unix/sysv/linux/i386/clone.S: New file.

Sun Aug  4 00:12:41 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/gnu/types.h: Declare __fd_mask as
	`unsigned long'.

	* misc/sys/select.h: Declare fd_mask as alias of __fd_mask.

Sat Aug  3 16:20:02 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/alpha/ioperm.c (platform): Add entry for
 	Mikasa.

	* socket/sys/socket.h (send, __send, sendto): Declare buffer
 	pointer as __const.

	* string/tester.c (main): Test stpncpy.

	* sysdeps/generic/stpncpy.c (__stpncpy): Fix so it works without
 	segfault when called with an N that is not a multiple of four and
 	src[N-1]=='\0'.

	* misc/syslog.c (LogType): New variable.
	(openlog): If connect() with SOCK_DGRAM fails with EPROTOTYPE,
 	try again with SOCK_STREAM (the Linux syslogd uses a socket of the
 	latter type).
	(vsyslog): When LogType==SOCK_STREAM, also send ASCII NUL
 	terminator as a record-delimiter.  If __send(LogFile) fails,
	call closelog() so logfile gets re-opened next time.

Wed Aug  7 15:15:14 1996  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-open (_dl_open): Add cast to avoid warning.

	* manual/memory.texi: Improve some examples to give readers better
	advice: Use `stpcpy' instead of `strcat' if possible.
	* manual/string.texi: Document `strtok_r' and `strtok'.

	* sunrpc/Makefile: Move `+gccwarn' definition before inclusion
	of Makeconfig.
	[$(cross-compiling)=no]: Change test before making librpcsvc
	to this from $(cross-compile).
	Reported by Andreas Schwab.

Tue Aug  6 14:27:11 1996  Ulrich Drepper  <drepper@cygnus.com>

	* elf/Makefile (routines): Move dl-sysdep to here...
	(rtld-routines): ...from here.  This should make static linking
	work again.

	* locale/setlocale.c: Add local variable `lock' and add code to
	`setlocale' to avoid simultaneous changing of global data.

	* catgets/catgets.c (catopen): Use `__strdup' instead of `strdup'.
	* catgets/open_catalog (__open_catalog): Use `__stpcpy', `__open',
	`__fstat', `__read', `__mmap', `__munmap' and `__close' instead
	of unprotected names.
-rw-r--r--ChangeLog111
-rw-r--r--csu/initfini.c18
-rw-r--r--dirent/dirent.h3
-rw-r--r--grp/grp.h27
-rw-r--r--io/fcntl.h4
-rw-r--r--libio/filedoalloc.c6
-rw-r--r--libio/fileops.c16
-rw-r--r--locale/setlocale.c16
-rw-r--r--login/endutent.c2
-rw-r--r--login/endutent_r.c3
-rw-r--r--login/getutent.c2
-rw-r--r--login/getutent_r.c3
-rw-r--r--login/getutid.c2
-rw-r--r--login/getutid_r.c5
-rw-r--r--login/getutline.c2
-rw-r--r--login/getutline_r.c7
-rw-r--r--login/pututline.c2
-rw-r--r--login/pututline_r.c3
-rw-r--r--login/setutent.c2
-rw-r--r--login/setutent_r.c8
-rw-r--r--login/utmp.h11
-rw-r--r--math/math.h1
-rw-r--r--misc/error.c2
-rw-r--r--misc/fstab.h17
-rw-r--r--misc/ttyent.h13
-rw-r--r--nss/getXXbyYY.c10
-rw-r--r--nss/getXXbyYY_r.c9
-rw-r--r--nss/getXXent.c8
-rw-r--r--nss/getXXent_r.c7
-rw-r--r--po/ko.po9
-rw-r--r--posix/getconf.c16
-rw-r--r--posix/posix1_lim.h6
-rw-r--r--posix/unistd.h1
-rw-r--r--pwd/pwd.h33
-rw-r--r--resolv/netdb.h447
-rw-r--r--resource/sys/resource.h20
-rw-r--r--stdio-common/reg-printf.c11
-rw-r--r--stdio-common/scanf.c16
-rw-r--r--stdio-common/vfprintf.c6
-rw-r--r--stdio/stdio.h1
-rw-r--r--stdio/vscanf.c6
-rw-r--r--stdlib/mbstowcs.c2
-rw-r--r--stdlib/mbtowc.c2
-rw-r--r--stdlib/wcstombs.c2
-rw-r--r--stdlib/wctomb.c2
-rw-r--r--string/argz.h78
-rw-r--r--string/envz.h26
-rw-r--r--sunrpc/rpc/xdr.h22
-rw-r--r--sysdeps/generic/confname.h194
-rw-r--r--sysdeps/generic/resourcebits.h12
-rw-r--r--sysdeps/libm-ieee754/k_standard.c84
-rw-r--r--sysdeps/mach/hurd/closedir.c5
-rw-r--r--sysdeps/mach/hurd/getrlimit.c7
-rw-r--r--sysdeps/mach/hurd/opendir.c4
-rw-r--r--sysdeps/mach/hurd/readdir.c4
-rw-r--r--sysdeps/posix/getcwd.c12
-rw-r--r--sysdeps/posix/getdtsz.c16
-rw-r--r--sysdeps/posix/sigsetmask.c17
-rw-r--r--sysdeps/posix/sysconf.c117
-rw-r--r--sysdeps/posix/ttyname_r.c3
-rw-r--r--sysdeps/stub/closedir.c9
-rw-r--r--sysdeps/stub/getrlimit.c8
-rw-r--r--sysdeps/stub/opendir.c9
-rw-r--r--sysdeps/stub/readdir.c9
-rw-r--r--sysdeps/stub/sysconf.c17
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/resourcebits.h10
-rw-r--r--sysdeps/unix/closedir.c9
-rw-r--r--sysdeps/unix/getlogin.c11
-rw-r--r--sysdeps/unix/opendir.c5
-rw-r--r--sysdeps/unix/readdir.c3
-rw-r--r--sysdeps/unix/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/resourcebits.h63
-rw-r--r--sysdeps/unix/sysv/linux/i386/resourcebits.h63
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c45
-rw-r--r--sysdeps/unix/sysv/linux/m68k/resourcebits.h (renamed from sysdeps/unix/sysv/linux/resourcebits.h)14
-rw-r--r--sysdeps/unix/sysv/linux/mips/resourcebits.h65
-rw-r--r--sysdeps/unix/sysv/sysv4/getdtsz.c2
-rw-r--r--time/Makefile6
-rw-r--r--time/asctime.c23
-rw-r--r--time/ctime_r.c (renamed from sysdeps/unix/sysv/linux/sysconf.c)29
-rw-r--r--time/time.h14
-rw-r--r--wcsmbs/mbrtowc.c3
-rw-r--r--wcsmbs/mbsrtowcs.c3
-rw-r--r--wcsmbs/wchar.h9
-rw-r--r--wcsmbs/wcrtomb.c3
-rw-r--r--wcsmbs/wcsrtombs.c3
86 files changed, 1394 insertions, 546 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c1813425b..fc8b65f97a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,114 @@
+Thu Aug  8 01:41:43 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/Makefile: Undo change of Tue Aug  6 14:27:11 1996.
+	* elf/dl-support: Add definition of `_dl_sysdep_read_whole_file'.
+
+Thu Aug  8 01:15:59 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/i386/fpu_control.h (_FPU_DEFAULT, _FPU_IEEE): Set
+	to 0x137f to allow long double operations.
+
+Sun Aug  4 13:12:05 1996  Richard Henderson  <rth@tamu.edu>
+
+	Bug Fixes:
+
+	* nss/nsswitch.c (_res): Remove redundant variable definition.
+	The real one is in resolve/res_init.c, and having both prevents
+	using -fno-common when building the shared library.
+	* sunrpc/rpc_prot.c (_null_auth): Same.  Original is in rpc_common.c.
+
+	* sysdeps/unix/sysv/linux/alpha/brk.S: When PIC, define __curbrk as
+	a .bss object not a COMMON symbol.
+
+	* sysdeps/alpha/bsd-_setjmp.S, sysdeps/alpha/bsd-setjmp.S: Must load
+	$gp before referencing __sigsetjmp symbol.  Retain LITUSE for same.
+
+	Optimizations:
+
+	* sysdeps/alpha/strlen.S: Rearrange first-word setup and thense the
+	main loop for better dual-issue on EV5.  Rearrange binary search to
+	pipeline better and trim one instruction.
+
+	Cosmetic Changes:
+
+	* time/localtime.c (localtime_r): Move lock declaration back next to
+	the comment where it was before the 960724 change.
+
+	* INSTALL, manual/maint.texi: alpha-gnu-linux -> alpha-ANYTHING-linux.
+	The second word is supposed to be the hardware manufacturer.
+
+	* sysdeps/alpha/_mcount.S: Retain LITUSE for __mcount.
+	* sysdeps/alpha/setjmp.S: Retain LITUSE for __sigsetjmp_aux.
+
+	* sysdeps/alpha/divrem.h: More local labels, retain LITUSE for _mcount.
+
+	* sysdeps/alpha/alphaev5/add_n.S, sysdeps/alpha/alphaev5/lshift.S,
+	sysdeps/alpha/alphaev5/rshift.S, sysdeps/alpha/alphaev5/sub_n.S:
+	Same cleanups as with EV4 GMP stuff.
+
+Tue Jul 25 03:30:56 1996  Richard Henderson  <rth@tamu.edu>
+
+	* sysdeps/unix/sysv/linux/Makefile [misc] (sysdep_routines): Add clone.
+	* sysdeps/unix/sysv/linux/alpha/clone.S: New file.
+	* sysdeps/unix/sysv/linux/i386/clone.S: New file.
+
+Sun Aug  4 00:12:41 1996  David Mosberger-Tang  <davidm@azstarnet.com>
+
+	* sysdeps/unix/sysv/linux/gnu/types.h: Declare __fd_mask as
+	`unsigned long'.
+
+	* misc/sys/select.h: Declare fd_mask as alias of __fd_mask.
+
+Sat Aug  3 16:20:02 1996  David Mosberger-Tang  <davidm@azstarnet.com>
+
+	* sysdeps/unix/sysv/linux/alpha/ioperm.c (platform): Add entry for
+ 	Mikasa.
+
+	* socket/sys/socket.h (send, __send, sendto): Declare buffer
+ 	pointer as __const.
+
+	* string/tester.c (main): Test stpncpy.
+
+	* sysdeps/generic/stpncpy.c (__stpncpy): Fix so it works without
+ 	segfault when called with an N that is not a multiple of four and
+ 	src[N-1]=='\0'.
+
+	* misc/syslog.c (LogType): New variable.
+	(openlog): If connect() with SOCK_DGRAM fails with EPROTOTYPE,
+ 	try again with SOCK_STREAM (the Linux syslogd uses a socket of the
+ 	latter type).
+	(vsyslog): When LogType==SOCK_STREAM, also send ASCII NUL
+ 	terminator as a record-delimiter.  If __send(LogFile) fails,
+	call closelog() so logfile gets re-opened next time.
+
+Wed Aug  7 15:15:14 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/dl-open (_dl_open): Add cast to avoid warning.
+
+	* manual/memory.texi: Improve some examples to give readers better
+	advice: Use `stpcpy' instead of `strcat' if possible.
+	* manual/string.texi: Document `strtok_r' and `strtok'.
+
+	* sunrpc/Makefile: Move `+gccwarn' definition before inclusion
+	of Makeconfig.
+	[$(cross-compiling)=no]: Change test before making librpcsvc
+	to this from $(cross-compile).
+	Reported by Andreas Schwab.
+
+Tue Aug  6 14:27:11 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/Makefile (routines): Move dl-sysdep to here...
+	(rtld-routines): ...from here.  This should make static linking
+	work again.
+
+	* locale/setlocale.c: Add local variable `lock' and add code to
+	`setlocale' to avoid simultaneous changing of global data.
+
+	* catgets/catgets.c (catopen): Use `__strdup' instead of `strdup'.
+	* catgets/open_catalog (__open_catalog): Use `__stpcpy', `__open',
+	`__fstat', `__read', `__mmap', `__munmap' and `__close' instead
+	of unprotected names.
+
 Tue Aug  6 01:13:56 1996  Ulrich Drepper  <drepper@cygnus.com>
 
 	Clean name space according to ISO C, ISO C/Amd 1, and POSIX.1.
diff --git a/csu/initfini.c b/csu/initfini.c
index 6b12850a24..bc412622bc 100644
--- a/csu/initfini.c
+++ b/csu/initfini.c
@@ -66,6 +66,17 @@ useless_function (void)
 }
 asm ("\nEOF.end\n");
 
+/* Find out how much alignment is produced by the compiler.  */
+asm ("align=`awk '$1==\".align\" { if ($2>max) max=$2; } END { print max; }' \
+<<\\EOF.align");
+void
+useless_function2 (void (*foo) (void))
+{
+  if (foo)
+    (*foo) ();
+}
+asm ("\nEOF.align\n`\n");
+
 /* Append the .init prologue to crti.s-new.  */
 asm ("cat >> crti.s-new <<\\EOF.crti.init");
 
@@ -88,6 +99,7 @@ _init (void)
      to crtn.s-new, followed by the function epilogue.  */
   asm ("\n\
 EOF.crti.init\n\
+	test -n \"$align\" && echo .align $align >> crti.s-new\n\
 	test -n \"$need_end\" && echo .end _init >> crti.s-new\n\
 	fgrep .init crti.s-new >>crtn.s-new\n\
 	fgrep -v .end >> crtn.s-new <<\\EOF.crtn.init");
@@ -99,6 +111,11 @@ asm ("\nEOF.crtn.init\
 \n\
 cat >> crti.s-new <<\\EOF.crti.fini");
 
+/* Global variable which says whether we have a statically or dynamically
+   linked program.  If > 0, static, for < 0 dynamic, == 0 means yet to
+   be determined (see init-first.c).  */
+int __libc_is_static = 0;
+
 SECTION (".fini")
 void
 _fini (void)
@@ -107,6 +124,7 @@ _fini (void)
      Then fetch the .section directive just written and append that
      to crtn.s-new, followed by the function epilogue.  */
   asm ("\nEOF.crti.fini\n\
+test -n \"$align\" && echo .align $align >> crti.s-new\n\
 test -n \"$need_end\" && echo .end _fini >> crti.s-new\n\
 cat > /dev/null <<\\EOF.fini.skip");
 
diff --git a/dirent/dirent.h b/dirent/dirent.h
index 3b708ebc78..02a5e6a18a 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -101,16 +101,19 @@ typedef struct __dirstream DIR;
 
 /* Open a directory stream on NAME.
    Return a DIR stream on the directory, or NULL if it could not be opened.  */
+extern DIR *__opendir __P ((__const char *__name));
 extern DIR *opendir __P ((__const char *__name));
 
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
+extern int __closedir __P ((DIR * __dirp));
 extern int closedir __P ((DIR * __dirp));
 
 /* Read a directory entry from DIRP.
    Return a pointer to a `struct dirent' describing the entry,
    or NULL for EOF or error.  The storage returned may be overwritten
    by a later readdir call on the same DIR stream.  */
+extern struct dirent *__readdir __P ((DIR * __dirp));
 extern struct dirent *readdir __P ((DIR * __dirp));
 
 /* Rewind DIRP to the beginning of the directory.  */
diff --git a/grp/grp.h b/grp/grp.h
index 1b3d615793..1abe22e4e2 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -85,6 +85,33 @@ extern struct group *getgrgid __P ((__gid_t __gid));
 /* Search for an entry with a matching group name.  */
 extern struct group *getgrnam __P ((__const char *__name));
 
+#ifdef	__USE_REENTRANT
+/* Reasonable value for the buffer sized used in the reentrant
+   functions below.  But better use `sysconf'.  */
+#define	NSS_BUFLEN_GROUP	1024
+
+/* Reentrant versions of some of the functions above.
+
+   PLEASE NOTE: these functions are not yet standardized.  The interface
+   may change in later versions of this library.  */
+
+#if defined(__USE_SVID) || defined(__USE_MISC) || defined (__USE_BSD)
+extern struct group *getgrent_r __P ((struct group *__resultbuf,
+				      char *buffer, int __buflen));
+#endif
+
+/* Search for an entry with a matching group ID.  */
+extern struct group *getgrgid_r __P ((__gid_t __gid,
+				      struct group *__resultbuf,
+				      char *buffer, int __buflen));
+
+/* Search for an entry with a matching group name.  */
+extern struct group *getgrnam_r __P ((__const char *__name,
+				      struct group *__resultbuf,
+				      char *buffer, int __buflen));
+
+#endif	/* reentrant */
+
 
 #ifdef	__USE_BSD
 
diff --git a/io/fcntl.h b/io/fcntl.h
index c808639ca7..792bd938ec 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -52,8 +52,8 @@ extern int fcntl __P ((int __fd, int __cmd, ...));
 /* Open FILE and return a new file descriptor for it, or -1 on error.
    OFLAG determines the type of access used.  If O_CREAT is on OFLAG,
    the third argument is taken as a `mode_t', the mode of the created file.  */
-extern int __open __P ((__const char *__file, int __oflag,...));
-extern int open __P ((__const char *__file, int __oflag,...));
+extern int __open __P ((__const char *__file, int __oflag, ...));
+extern int open __P ((__const char *__file, int __oflag, ...));
 
 /* Create and open FILE, with mode MODE.
    This takes an `int' MODE argument because that is
diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c
index f71656478c..045bff697d 100644
--- a/libio/filedoalloc.c
+++ b/libio/filedoalloc.c
@@ -1,4 +1,4 @@
-/* 
+/*
 Copyright (C) 1993 Free Software Foundation
 
 This file is part of the GNU IO Library.  This library is free
@@ -77,7 +77,7 @@ DEFUN(_IO_file_doallocate, (fp),
      to get called by any program that does buffered I/O. */
   if (_IO_cleanup_registration_needed)
     (*_IO_cleanup_registration_needed)();
-  
+
   if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
     {
       couldbetty = 0;
@@ -100,7 +100,7 @@ DEFUN(_IO_file_doallocate, (fp),
   if (p == NULL)
     return EOF;
   _IO_setb(fp, p, p+size, 1);
-  if (couldbetty && isatty(fp->_fileno))
+  if (couldbetty && __isatty (fp->_fileno))
     fp->_flags |= _IO_LINE_BUF;
   return 1;
 }
diff --git a/libio/fileops.c b/libio/fileops.c
index 828f99db96..a3138afd16 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1,4 +1,4 @@
-/* 
+/*
 Copyright (C) 1993, 1995 Free Software Foundation
 
 This file is part of the GNU IO Library.  This library is free
@@ -70,14 +70,14 @@ extern int errno;
    (The pointers save_gptr() and save_egptr() are the values
    of gptr() and egptr() at the time putback mode was entered.)
    The OS position corresponds to that of save_egptr().
-   
+
    LINE BUFFERED OUTPUT:
    During line buffered output, pbase()==base() && epptr()==base().
    However, ptr() may be anywhere between base() and ebuf().
    This forces a call to filebuf::overflow(int C) on every put.
    If there is more space in the buffer, and C is not a '\n',
    then C is inserted, and pptr() incremented.
-   
+
    UNBUFFERED STREAMS:
    If a filebuf is unbuffered(), the _shortbuf[1] is used as the buffer.
 */
@@ -172,7 +172,7 @@ DEFUN(_IO_file_fopen, (fp, filename, mode),
     omode = O_RDWR;
     read_write &= _IO_IS_APPENDING;
   }
-  fdesc = open(filename, omode|oflags, oprot);
+  fdesc = __open (filename, omode|oflags, oprot);
   if (fdesc < 0)
     return NULL;
   fp->_fileno = fdesc;
@@ -230,7 +230,7 @@ DEFUN(_IO_do_write, (fp, data, to_do),
        unpredictable. */
     fp->_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
-    { 
+    {
       _IO_pos_t new_pos
 	= _IO_SYSSEEK(fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
@@ -339,7 +339,7 @@ DEFUN(_IO_file_sync, (fp),
   /*    char* ptr = cur_ptr(); */
   if (fp->_IO_write_ptr > fp->_IO_write_base)
     if (_IO_do_flush(fp)) return EOF;
-  delta = fp->_IO_read_ptr - fp->_IO_read_end; 
+  delta = fp->_IO_read_ptr - fp->_IO_read_end;
   if (delta != 0)
     {
 #ifdef TODO
@@ -641,7 +641,7 @@ DEFUN(_IO_file_xsputn, (f, data, n),
       if (_IO_do_write(f, s, count) == EOF)
 	return n - to_do;
       to_do = dont_write;
-      
+
       /* Now write out the remainder.  Normally, this will fit in the
 	 buffer, but it's somewhat messier for line-buffered files,
 	 so we let _IO_default_xsputn handle the general case. */
@@ -706,7 +706,7 @@ DEFUN(_IO_file_xsgetn, (fp, data, n),
 	       else
 		 fp->_flags |= _IO_ERR_SEEN, count = 0;
 	     }
-	  
+
 	  s += count;
 	  more -= count;
 	}
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 2c8ec3d401..8bf58da608 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -221,7 +221,6 @@ setdata (int category, const struct locale_data *data)
 char *
 setlocale (int category, const char *locale)
 {
-  char *locpath_var;
   char *locale_path;
   size_t locale_path_len;
   char *composite;
@@ -245,12 +244,15 @@ setlocale (int category, const char *locale)
   locale_path = NULL;
   locale_path_len = 0;
 
-  locpath_var = getenv ("LOCPATH");
-  if (locpath_var != NULL && locpath_var[0] != '\0'
-      && __getuid () == __geteuid () && __getgid () == __getegid ())
-    if (__argz_create_sep (locpath_var, ':',
-			   &locale_path, &locale_path_len) != 0)
-      return NULL;
+  if (!__libc_enable_secure)
+    {
+      char *locpath_var = getenv ("LOCPATH");
+
+      if (locpath_var != NULL && locpath_var[0] != '\0')
+	if (__argz_create_sep (locpath_var, ':',
+			       &locale_path, &locale_path_len) != 0)
+	  return NULL;
+    }
 
   if (__argz_append (&locale_path, &locale_path_len,
 		     LOCALE_PATH, sizeof (LOCALE_PATH)) != 0)
diff --git a/login/endutent.c b/login/endutent.c
index 9aed00d7a7..3df95bef93 100644
--- a/login/endutent.c
+++ b/login/endutent.c
@@ -27,5 +27,5 @@ extern struct utmp_data __utmp_data;
 void
 endutent (void)
 {
-  endutent_r (&__utmp_data);
+  __endutent_r (&__utmp_data);
 }
diff --git a/login/endutent_r.c b/login/endutent_r.c
index b15f57a964..a531054a2a 100644
--- a/login/endutent_r.c
+++ b/login/endutent_r.c
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.  */
 
 
 void
-endutent_r (struct utmp_data *utmp_data)
+__endutent_r (struct utmp_data *utmp_data)
 {
   if (utmp_data->ut_fd != -1)
     {
@@ -30,3 +30,4 @@ endutent_r (struct utmp_data *utmp_data)
       utmp_data->ut_fd = -1;
     }
 }
+weak_alias (__endutent_r, endutent_r)
diff --git a/login/getutent.c b/login/getutent.c
index 36411469a0..03b49dbf7e 100644
--- a/login/getutent.c
+++ b/login/getutent.c
@@ -29,7 +29,7 @@ getutent (void)
 {
   struct utmp *result;
 
-  if (getutent_r (&result, &__utmp_data) < 0)
+  if (__getutent_r (&result, &__utmp_data) < 0)
     return NULL;
 
   return result;
diff --git a/login/getutent_r.c b/login/getutent_r.c
index ad8e9eb7c2..e3550017f9 100644
--- a/login/getutent_r.c
+++ b/login/getutent_r.c
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.  */
 
 
 int
-getutent_r (struct utmp **utmp, struct utmp_data *utmp_data)
+__getutent_r (struct utmp **utmp, struct utmp_data *utmp_data)
 {
   /* Open utmp file if not already done.  */
   if (utmp_data->ut_fd == -1)
@@ -48,3 +48,4 @@ getutent_r (struct utmp **utmp, struct utmp_data *utmp_data)
 
   return 0;
 }
+weak_alias (__getutent_r, getutent_r)
diff --git a/login/getutid.c b/login/getutid.c
index 6b29d38fd0..64ced6aeea 100644
--- a/login/getutid.c
+++ b/login/getutid.c
@@ -29,7 +29,7 @@ getutid (const struct utmp *id)
 {
   struct utmp *result;
 
-  if (getutid_r (id, &result, &__utmp_data) < 0)
+  if (__getutid_r (id, &result, &__utmp_data) < 0)
     return NULL;
 
   return (struct utmp *) result;
diff --git a/login/getutid_r.c b/login/getutid_r.c
index 73bcb3d9c0..00dbec40c8 100644
--- a/login/getutid_r.c
+++ b/login/getutid_r.c
@@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA.  */
 /* For implementing this function we don't use the getutent_r function
    because we can avoid the reposition on every new entry this way.  */
 int
-getutid_r (const struct utmp *id, struct utmp **utmp,
-	   struct utmp_data *utmp_data)
+__getutid_r (const struct utmp *id, struct utmp **utmp,
+	     struct utmp_data *utmp_data)
 {
 #if (_HAVE_UT_ID - 0) && (_HAVE_UT_TYPE - 0)
   /* Test whether ID has any of the legal types.  */
@@ -114,3 +114,4 @@ getutid_r (const struct utmp *id, struct utmp **utmp,
   return -1;
 #endif
 }
+weak_alias (__getutid_r, getutid_r)
diff --git a/login/getutline.c b/login/getutline.c
index 23ca6a8107..c21f81745b 100644
--- a/login/getutline.c
+++ b/login/getutline.c
@@ -29,7 +29,7 @@ getutline (const struct utmp *line)
 {
   struct utmp *result;
 
-  if (getutline_r (line, &result, &__utmp_data) < 0)
+  if (__getutline_r (line, &result, &__utmp_data) < 0)
     return NULL;
 
   return (struct utmp *) result;
diff --git a/login/getutline_r.c b/login/getutline_r.c
index 4d3547181f..e5c41966c6 100644
--- a/login/getutline_r.c
+++ b/login/getutline_r.c
@@ -26,13 +26,13 @@ Boston, MA 02111-1307, USA.  */
 /* For implementing this function we don't use the getutent_r function
    because we can avoid the reposition on every new entry this way.  */
 int
-getutline_r (const struct utmp *line, struct utmp **utmp,
-	     struct utmp_data *utmp_data)
+__getutline_r (const struct utmp *line, struct utmp **utmp,
+	       struct utmp_data *utmp_data)
 {
   /* Open utmp file if not already done.  */
   if (utmp_data->ut_fd == -1)
     {
-      setutent_r (utmp_data);
+      __setutent_r (utmp_data);
       if (utmp_data->ut_fd == -1)
 	return -1;
     }
@@ -71,3 +71,4 @@ getutline_r (const struct utmp *line, struct utmp **utmp,
 
   return 0;
 }
+weak_alias (__getutline_r, getutline_r)
diff --git a/login/pututline.c b/login/pututline.c
index a704e380fa..7af3efbb46 100644
--- a/login/pututline.c
+++ b/login/pututline.c
@@ -27,7 +27,7 @@ extern struct utmp_data __utmp_data;
 struct utmp *
 pututline (const struct utmp *utmp)
 {
-  if (pututline_r (utmp, &__utmp_data) < 0)
+  if (__pututline_r (utmp, &__utmp_data) < 0)
     return NULL;
 
   return (struct utmp *) utmp;
diff --git a/login/pututline_r.c b/login/pututline_r.c
index ada6059aae..0b819000d1 100644
--- a/login/pututline_r.c
+++ b/login/pututline_r.c
@@ -31,7 +31,7 @@ Boston, MA 02111-1307, USA.  */
    which write the new value.  */
 
 int
-pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
+__pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
 {
   struct stat st;
   int result = 0;
@@ -136,3 +136,4 @@ pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
 
   return result;
 }
+weak_alias (__pututline_r, pututline_r)
diff --git a/login/setutent.c b/login/setutent.c
index aab28c0015..32d2f8c1f7 100644
--- a/login/setutent.c
+++ b/login/setutent.c
@@ -27,5 +27,5 @@ struct utmp_data __utmp_data = { ut_fd: -1 };
 void
 setutent (void)
 {
-  setutent_r (&__utmp_data);
+  __setutent_r (&__utmp_data);
 }
diff --git a/login/setutent_r.c b/login/setutent_r.c
index 4b980cf1a7..46700e700f 100644
--- a/login/setutent_r.c
+++ b/login/setutent_r.c
@@ -31,7 +31,7 @@ static const char *utmp_file_name = (const char *) default_utmp_name;
 
 
 void
-setutent_r (struct utmp_data *utmp_data)
+__setutent_r (struct utmp_data *utmp_data)
 {
   /* Before the UTMP_DATA is used before the first time the UT_FD
      field must be set to -1.  */
@@ -56,12 +56,13 @@ setutent_r (struct utmp_data *utmp_data)
   utmp_data->ubuf.ut_type = UT_UNKNOWN;
 #endif
 }
+weak_alias (__setutent_r, setutent_r)
 
 
 int
-utmpname (const char *file)
+__utmpname (const char *file)
 {
-  char *fname = strdup (file);
+  char *fname = __strdup (file);
   if (fname == NULL)
     return 0;
 
@@ -72,3 +73,4 @@ utmpname (const char *file)
 
   return 1;
 }
+weak_alias (__utmpname, utmpname)
diff --git a/login/utmp.h b/login/utmp.h
index 0109d50994..76870f68ef 100644
--- a/login/utmp.h
+++ b/login/utmp.h
@@ -86,19 +86,30 @@ struct utmp_data
 
 
 /* Reentrant versions of the file for handling utmp files.  */
+extern int __getutent_r __P ((struct utmp **__utmp,
+			      struct utmp_data *__utmp_data));
 extern int getutent_r __P ((struct utmp **__utmp,
 			    struct utmp_data *__utmp_data));
 
+extern void __setutent_r __P ((struct utmp_data *__utmp_data));
 extern void setutent_r __P ((struct utmp_data *__utmp_data));
 
+extern void __endutent_r __P ((struct utmp_data *__utmp_data));
 extern void endutent_r __P ((struct utmp_data *__utmp_data));
 
+extern int __getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
+			     struct utmp_data *__utmp_data));
 extern int getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
 			   struct utmp_data *__utmp_data));
 
+extern int __getutline_r __P ((__const struct utmp *__line,
+			       struct utmp **__utmp,
+			       struct utmp_data *__utmp_data));
 extern int getutline_r __P ((__const struct utmp *__line, struct utmp **__utmp,
 			     struct utmp_data *__utmp_data));
 
+extern int __pututline_r __P ((__const struct utmp *__utmp_ptr,
+			       struct utmp_data *__utmp_data));
 extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
 			     struct utmp_data *__utmp_data));
 
diff --git a/math/math.h b/math/math.h
index 4d08cd94b5..74b893a49d 100644
--- a/math/math.h
+++ b/math/math.h
@@ -114,6 +114,7 @@ struct exception
     double retval;
   };
 
+extern int __matherr __P ((struct exception *));
 extern int matherr __P ((struct exception *));
 
 #define X_TLOSS		1.41484755040568800000e+16
diff --git a/misc/error.c b/misc/error.c
index 49c772dbb5..82de13777e 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -88,7 +88,7 @@ private_strerror (errnum)
   extern int sys_nerr;
 
   if (errnum > 0 && errnum <= sys_nerr)
-    return sys_errlist[errnum];
+    return _(sys_errlist[errnum]);
   return _("Unknown system error");
 }
 #define strerror private_strerror
diff --git a/misc/fstab.h b/misc/fstab.h
index 2a176bdb83..d45ce62d2b 100644
--- a/misc/fstab.h
+++ b/misc/fstab.h
@@ -34,7 +34,9 @@
  */
 
 #ifndef _FSTAB_H_
-#define _FSTAB_H_
+
+#define _FSTAB_H_	1
+#include <features.h>
 
 /*
  * File system table, see fstab(5).
@@ -66,14 +68,15 @@ struct fstab {
 	int	fs_passno;		/* pass number on parallel dump */
 };
 
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
-struct fstab *getfsent __P((void));
-struct fstab *getfsspec __P((const char *));
-struct fstab *getfsfile __P((const char *));
-int setfsent __P((void));
-void endfsent __P((void));
+
+extern struct fstab *getfsent __P ((void));
+extern struct fstab *getfsspec __P ((__const char *__name));
+extern struct fstab *getfsfile __P ((__const char *__name));
+extern int setfsent __P ((void));
+extern void endfsent __P ((void));
+
 __END_DECLS
 
 #endif /* !_FSTAB_H_ */
diff --git a/misc/ttyent.h b/misc/ttyent.h
index fb3f952e04..a3b4550776 100644
--- a/misc/ttyent.h
+++ b/misc/ttyent.h
@@ -34,7 +34,9 @@
  */
 
 #ifndef	_TTYENT_H_
-#define	_TTYENT_H_
+
+#define	_TTYENT_H_	1
+#include <features.h>
 
 #define	_PATH_TTYS	"/etc/ttys"
 
@@ -54,14 +56,13 @@ struct ttyent {
 	char	*ty_comment;	/* comment field */
 };
 
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 
-struct ttyent *getttyent __P ((void));
-struct ttyent *getttynam __P ((__const char *));
-int setttyent __P ((void));
-int endttyent __P ((void));
+extern struct ttyent *getttyent __P ((void));
+extern struct ttyent *getttynam __P ((__const char *__tty));
+extern int setttyent __P ((void));
+extern int endttyent __P ((void));
 
 __END_DECLS
 
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index 5eb9ee9c87..a99b68f0e2 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -46,6 +46,8 @@ Boston, MA 02111-1307, USA.  */
 #define REENTRANT_NAME APPEND_R (FUNCTION_NAME)
 #define APPEND_R(name) APPEND_R1 (name)
 #define APPEND_R1(name) name##_r
+#define INTERNAL(name) INTERNAL1 (name)
+#define INTERNAL1(name) __##name
 
 /* Sometimes we need to store error codes in the `h_errno' variable.  */
 #ifdef NEED_H_ERRNO
@@ -58,8 +60,9 @@ Boston, MA 02111-1307, USA.  */
 
 
 /* Prototype for reentrant version we use here.  */
-extern LOOKUP_TYPE *REENTRANT_NAME (ADD_PARAMS, LOOKUP_TYPE *result,
-				    char *buffer, int buflen H_ERRNO_PARM);
+extern LOOKUP_TYPE *INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *result,
+					       char *buffer, int buflen
+					       H_ERRNO_PARM);
 
 LOOKUP_TYPE *
 FUNCTION_NAME (ADD_PARAMS)
@@ -67,5 +70,6 @@ FUNCTION_NAME (ADD_PARAMS)
   static LOOKUP_TYPE result;
   static char buffer[BUFLEN];
 
-  return REENTRANT_NAME (ADD_VARIABLES, &result, buffer, BUFLEN H_ERRNO_VAR);
+  return INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &result, buffer,
+				    BUFLEN H_ERRNO_VAR);
 }
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 37ad22d045..631fd1e33e 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -47,6 +47,8 @@ Boston, MA 02111-1307, USA.  */
 #define REENTRANT_NAME APPEND_R (FUNCTION_NAME)
 #define APPEND_R(name) APPEND_R1 (name)
 #define APPEND_R1(name) name##_r
+#define INTERNAL(name) INTERNAL1 (name)
+#define INTERNAL1(name) __##name
 
 #define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME)
 #define REENTRANT_NAME_STRING STRINGIZE (REENTRANT_NAME)
@@ -81,8 +83,8 @@ extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp);
 
 
 LOOKUP_TYPE *
-REENTRANT_NAME (ADD_PARAMS, LOOKUP_TYPE *result, char *buffer, int buflen
-		H_ERRNO_PARM)
+INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *result, char *buffer,
+			   int buflen H_ERRNO_PARM)
 {
   static service_user *startp = NULL;
   static lookup_function start_fct;
@@ -128,3 +130,6 @@ REENTRANT_NAME (ADD_PARAMS, LOOKUP_TYPE *result, char *buffer, int buflen
 
   return status == NSS_STATUS_SUCCESS ? result : NULL;
 }
+
+#define do_weak_alias(n1, n2) weak_alias ((n1), (n2))
+do_weak_alias (INTERNAL (REENTRANT_NAME), REENTRANT_NAME)
diff --git a/nss/getXXent.c b/nss/getXXent.c
index fd75979c9d..ecf7eadc4c 100644
--- a/nss/getXXent.c
+++ b/nss/getXXent.c
@@ -38,6 +38,8 @@ Boston, MA 02111-1307, USA.  */
 #define REENTRANT_GETNAME APPEND_R (GETFUNC_NAME)
 #define APPEND_R(name) APPEND_R1 (name)
 #define APPEND_R1(name) name##_r
+#define INTERNAL(name) INTERNAL1 (name)
+#define INTERNAL1(name) __##name
 
 /* Sometimes we need to store error codes in the `h_errno' variable.  */
 #ifdef NEED_H_ERRNO
@@ -49,8 +51,8 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 /* Prototype of the reentrant version.  */
-LOOKUP_TYPE *REENTRANT_GETNAME (LOOKUP_TYPE *result, char *buffer,
-				int buflen H_ERRNO_PARM);
+LOOKUP_TYPE *INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *result, char *buffer,
+					   int buflen H_ERRNO_PARM);
 
 
 LOOKUP_TYPE *
@@ -59,5 +61,5 @@ GETFUNC_NAME (void)
   static char buffer[BUFLEN];
   static LOOKUP_TYPE result;
 
-  return REENTRANT_GETNAME (&result, buffer, BUFLEN H_ERRNO_VAR);
+  return INTERNAL (REENTRANT_GETNAME) (&result, buffer, BUFLEN H_ERRNO_VAR);
 }
diff --git a/nss/getXXent_r.c b/nss/getXXent_r.c
index 620eebd1f7..ea391fe094 100644
--- a/nss/getXXent_r.c
+++ b/nss/getXXent_r.c
@@ -50,6 +50,8 @@ Boston, MA 02111-1307, USA.  */
 #define REENTRANT_GETNAME APPEND_R (GETFUNC_NAME)
 #define APPEND_R(name) APPEND_R1 (name)
 #define APPEND_R1(name) name##_r
+#define INTERNAL(name) INTERNAL1 (name)
+#define INTERNAL1(name) __##name
 
 #define SETFUNC_NAME_STRING STRINGIZE (SETFUNC_NAME)
 #define GETFUNC_NAME_STRING STRINGIZE (REENTRANT_GETNAME)
@@ -186,7 +188,8 @@ ENDFUNC_NAME (void)
 
 
 LOOKUP_TYPE *
-REENTRANT_GETNAME (LOOKUP_TYPE *result, char *buffer, int buflen H_ERRNO_PARM)
+INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *result, char *buffer, int buflen
+			      H_ERRNO_PARM)
 {
   get_function fct;
   int no_more;
@@ -221,3 +224,5 @@ REENTRANT_GETNAME (LOOKUP_TYPE *result, char *buffer, int buflen H_ERRNO_PARM)
 
   return status == NSS_STATUS_SUCCESS ? result : NULL;
 }
+#define do_weak_alias(n1, n2) weak_alias (n1, n2)
+do_weak_alias (INTERNAL (REENTRANT_GETNAME), REENTRANT_GETNAME)
diff --git a/po/ko.po b/po/ko.po
index 662358bd5c..a70f7d9d68 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: GNU C Library 1.10.1\n"
-"PO-Revision-Date: 1996-05-26 22:59 KST\n"
+"PO-Revision-Date: 1996-08-02 18:58 MET DST\n"
 "Last-Translator: Bang Jun Young <bangjy@nownuri.nowcom.co.kr>\n"
 "Language-Team: Korean <ko@li.org>\n"
 "MIME-Version: 1.0\n"
@@ -1049,11 +1049,11 @@ msgstr "rcmd: ¾²±â (Ç¥ÁØ¿À·ù ¼³Á¤): %s\n"
 
 #: sunrpc/svc_simple.c:83
 msgid "registerrpc: out of memory\n"
-msgstr "registerrpc: ¸Þ¸ð¸® ºÎÁ·"
+msgstr "registerrpc: ¸Þ¸ð¸® ºÎÁ·\n"
 
 #: inet/rcmd.c:158
 msgid "select: protocol failure in circuit setup\n"
-msgstr "select: ȸ·Î ¼³Á¤Áß ±Ô¾àÀÌ ºÒÀÌÇàµÊ"
+msgstr "select: ȸ·Î ¼³Á¤Áß ±Ô¾àÀÌ ºÒÀÌÇàµÊ\n"
 
 #: inet/rcmd.c:176
 msgid "socket: protocol failure in circuit setup.\n"
@@ -1061,7 +1061,7 @@ msgstr "socket: ȸ·Î ¼³Á¤Áß ±Ô¾àÀÌ ºÒÀÌÇàµÊ.\n"
 
 #: sunrpc/svc_tcp.c:199 svc_tcp.c:204
 msgid "svc_tcp: makefd_xprt: out of memory\n"
-msgstr "svc_tcp: makefc_xprt: ¸Þ¸ð¸® ºÎÁ·"
+msgstr "svc_tcp: makefc_xprt: ¸Þ¸ð¸® ºÎÁ·\n"
 
 #: sunrpc/svc_tcp.c:147
 msgid "svctcp_.c - cannot getsockname or listen"
@@ -1110,4 +1110,3 @@ msgstr "°¡º¯ ±æÀÌ ¹è¿­ ¼±¾ðÀÌ ÀÖ¾î¾ß ÇÔ"
 #: sunrpc/rpc_parse.c:370
 msgid "voids allowed only inside union and program definitions"
 msgstr "void´Â ¿ÀÁ÷ °ø¿ëü¿Í ÇÁ·Î±×·¥ Á¤ÀÇ ³»¿¡¼­¸¸ Çã¿ëµË´Ï´Ù"
-
diff --git a/posix/getconf.c b/posix/getconf.c
index 6d78205a88..4ee1446341 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -83,6 +83,22 @@ static struct conf vars[] =
     { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
     { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
     { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
+    { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
+    { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
+    { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
+    { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
+    { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
+    { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
+    { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
+    { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
+    { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
+    { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
+    { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
+    { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
+    { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
+    { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
+    { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
+    { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
     /* POSIX.2  */
     { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
     { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
diff --git a/posix/posix1_lim.h b/posix/posix1_lim.h
index 287e9a2d19..445907ccec 100644
--- a/posix/posix1_lim.h
+++ b/posix/posix1_lim.h
@@ -81,6 +81,12 @@ Cambridge, MA 02139, USA.  */
 /* Maximum number of elements in an `iovec' array.  */
 #define	_POSIX_UIO_MAXIOV	16
 
+/* Maximum number of characters in a tty name.  */
+#define	_POSIX_TTY_NAME_MAX	9
+
+/* Maximum length of login name.  */
+#define	_POSIX_LOGIN_NAME_MAX	9
+
 
 /* Get the implementation-specific values for the above.  */
 #include <local_lim.h>
diff --git a/posix/unistd.h b/posix/unistd.h
index 424cedd2ec..ab40f24f83 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -503,6 +503,7 @@ extern char *ttyname __P ((int __fd));
 #ifdef __USE_REENTRANT
 /* Store at most BUFLEN characters of the pathname of the terminal FD is
    open on in BUF.  Return 0 on success, -1 otherwise.  */
+extern int __ttyname_r __P ((int __fd, char *__buf, int __buflen));
 extern int ttyname_r __P ((int __fd, char *__buf, int __buflen));
 #endif
 
diff --git a/pwd/pwd.h b/pwd/pwd.h
index 58eb2e5851..00235093aa 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -92,6 +92,39 @@ extern struct passwd *getpwuid __P ((__uid_t __uid));
 /* Search for an entry with a matching username.  */
 extern struct passwd *getpwnam __P ((__const char *__name));
 
+#ifdef	__USE_REENTRANT
+/* Reasonable value for the buffer sized used in the reentrant
+   functions below.  But better use `sysconf'.  */
+#define	NSS_BUFLEN_PASSWD	1024
+
+/* Reentrant versions of some of the functions above.
+
+   PLEASE NOTE: these functions are not yet standardized.  The interface
+   may change in later versions of this library.  */
+
+#if defined(__USE_SVID) || defined(__USE_MISC)
+extern struct passwd *__getpwent_r __P ((struct passwd *__resultbuf,
+					 char *__buffer, int __buflen));
+extern struct passwd *getpwent_r __P ((struct passwd *__resultbuf,
+				       char *__buffer, int __buflen));
+#endif
+
+extern struct passwd *__getpwuid_r __P ((__uid_t __uid,
+					 struct passwd *__resultbuf,
+					 char *__buffer, int __buflen));
+extern struct passwd *getpwuid_r __P ((__uid_t __uid,
+				       struct passwd *__resultbuf,
+				       char *__buffer, int __buflen));
+
+extern struct passwd *__getpwnam_r __P ((__const char *__name,
+					 struct passwd *__resultbuf,
+					 char *__buffer, int __buflen));
+extern struct passwd *getpwnam_r __P ((__const char *__name,
+				       struct passwd *__resultbuf,
+				       char *__buffer, int __buflen));
+
+#endif	/* reentrant */
+
 
 __END_DECLS
 
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 38367e324f..cca3060826 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -1,72 +1,35 @@
-/*
- * ++Copyright++ 1980, 1983, 1988, 1993
- * -
- * Copyright (c) 1980, 1983, 1988, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-/*
- *      @(#)netdb.h	8.1 (Berkeley) 6/2/93
- *	$Id$
- */
-
-#ifndef _NETDB_H_
-#define _NETDB_H_
-
-#include <sys/param.h>
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#endif
-#include <sys/cdefs.h>
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
+   The GNU C Library is free software; you can redistribute it
+   and/or modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be
+   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, write to the Free Software Foundation, Inc., 59 Temple Place -
+   Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* All data returned by the network data base library are supplied in
+   host order and returned in network order (suitable for use in
+   system calls).  */
+
+#ifndef	_NETDB_H
+
+#define	_NETDB_H	1
+#include <features.h>
+
+/* This is necessary to make this include file properly replace the
+   Sun version.  */
+#include <rpc/netdb.h>
+
+/* Absolute file name for network data base files.  */
 #define	_PATH_HEQUIV		"/etc/hosts.equiv"
 #define	_PATH_HOSTS		"/etc/hosts"
 #define	_PATH_NETWORKS		"/etc/networks"
@@ -74,98 +37,284 @@
 #define	_PATH_PROTOCOLS		"/etc/protocols"
 #define	_PATH_SERVICES		"/etc/services"
 
+
+__BEGIN_DECLS
+
+/* Error status for non-reentrant lookup functions.  */
 extern int h_errno;
 
-/*
- * Structures returned by network data base library.  All addresses are
- * supplied in host order, and returned in network order (suitable for
- * use in system calls).
- */
-struct	hostent {
-	char	*h_name;	/* official name of host */
-	char	**h_aliases;	/* alias list */
-	int	h_addrtype;	/* host address type */
-	int	h_length;	/* length of address */
-	char	**h_addr_list;	/* list of addresses from name server */
-#define	h_addr	h_addr_list[0]	/* address, for backward compatiblity */
-};
+/* Possible values left in `h_errno'.  */
+#define	NETDB_INTERNAL	-1	/* See errno.  */
+#define	NETDB_SUCCESS	0	/* No problem.  */
+#define	HOST_NOT_FOUND	1	/* Authoritative Answer Host not found.  */
+#define	TRY_AGAIN	2	/* Non-Authoritive Host not found,
+				   or SERVERFAIL.  */
+#define	NO_RECOVERY	3	/* Non recoverable errors, FORMERR, REFUSED,
+				   NOTIMP.  */
+#define	NO_DATA		4	/* Valid name, no data record of requested
+				   type.  */
+#define	NO_ADDRESS	NO_DATA	/* No address, look for MX record.  */
+
+/* Print error indicated by `h_errno' variable on standard error.  STR
+   if non-null is printed before the error string.  */
+extern void herror __P ((__const char *__str));
+
+/* Return string associated with error ERR_NUM.  */
+extern __const char *hstrerror __P ((int __err_num));
+
 
-/*
- * Assumption here is that a network number
- * fits in an unsigned long -- probably a poor one.
- */
-struct	netent {
-	char		*n_name;	/* official name of net */
-	char		**n_aliases;	/* alias list */
-	int		n_addrtype;	/* net address type */
-	unsigned long	n_net;		/* network # */
+
+/* Description of data base entry for a single host.  */
+struct hostent
+{
+  char *h_name;			/* Official name of host.  */
+  char **h_aliases;		/* Alias list.  */
+  int h_addrtype;		/* Host address type.  */
+  int h_length;			/* Length of address.  */
+  char **h_addr_list;		/* List of addresses from name server.  */
+#define	h_addr	h_addr_list[0]	/* Address, for backward compatiblity.  */
 };
 
-struct	servent {
-	char	*s_name;	/* official service name */
-	char	**s_aliases;	/* alias list */
-	int	s_port;		/* port # */
-	char	*s_proto;	/* protocol to use */
+/* Open host data base files and mark them as staying open even after
+   a later search if STAY_OPEN is non-zero.  */
+extern void sethostent __P ((int __stay_open));
+
+/* Close host data base files and clear `stay open' flag.  */
+extern void endhostent __P ((void));
+
+/* Get next entry from host data base file.  Open data base if
+   necessary.  */
+extern struct hostent *gethostent __P ((void));
+
+/* Return entry from host data base which address match ADDR with
+   length LEN and type TYPE.  */
+extern struct hostent *gethostbyaddr __P ((__const char *__addr, int __len,
+					   int __type));
+
+/* Return entry from host data base for host with NAME.  */
+extern struct hostent *gethostbyname __P ((__const char *__name));
+
+/* Return entry from host data base for host with NAME.  AF must be
+   set to the address type which as `AF_INET' for IPv4 or `AF_INET6'
+   for IPv6.  */
+extern struct hostent *gethostbyname2 __P ((__const char *__name, int __af));
+
+#ifdef	__USE_REENTRANT
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  The last
+   argument is a pointer to a variable which gets the value which
+   would be stored in the global variable `herrno' by the
+   non-reentrant functions.  */
+extern struct hostent *__gethostent_r __P ((struct hostent *__result_buf,
+					    char *__buf, int __buf_len,
+					    int *__h_errnop));
+extern struct hostent *gethostent_r __P ((struct hostent *__result_buf,
+					  char *__buf, int __buf_len,
+					  int *__h_errnop));
+
+extern struct hostent *__gethostbyaddr_r __P ((__const char *__addr, int __len,
+					       int __type,
+					       struct hostent *__result_buf,
+					       char *__buf, int __buflen,
+					       int *__h_errnop));
+extern struct hostent *gethostbyaddr_r __P ((__const char *__addr, int __len,
+					     int __type,
+					     struct hostent *__result_buf,
+					     char *__buf, int __buflen,
+					     int *__h_errnop));
+
+extern struct hostent *__gethostbyname_r __P ((__const char *__name,
+					       struct hostent *__result_buf,
+					       char *__buf, int __buflen,
+					       int *__h_errnop));
+extern struct hostent *gethostbyname_r __P ((__const char *__name,
+					     struct hostent *__result_buf,
+					     char *__buf, int __buflen,
+					     int *__h_errnop));
+
+extern struct hostent *__gethostbyname2_r __P ((__const char *__name, int __af,
+						struct hostent *__result_buf,
+						char *__buf, int __buflen,
+						int *__h_errnop));
+extern struct hostent *gethostbyname2_r __P ((__const char *__name, int __af,
+					      struct hostent *__result_buf,
+					      char *__buf, int __buflen,
+					      int *__h_errnop));
+#endif	/* reentrant */
+
+
+/* Description of data base entry for a single network.  NOTE: here a
+   poor assumption is made.  The network number is expected to fit
+   into an unsigned long int variable.  */
+struct netent
+{
+  char *n_name;			/* Official name of network.  */
+  char **n_aliases;		/* Alias list.  */
+  int n_addrtype;		/* Net address type.  */
+  unsigned long	int n_net;	/* Network number.  */
 };
 
-struct	protoent {
-	char	*p_name;	/* official protocol name */
-	char	**p_aliases;	/* alias list */
-	int	p_proto;	/* protocol # */
+/* Open network data base files and mark them as staying open even
+   after a later search if STAY_OPEN is non-zero.  */
+extern void setnetent __P ((int __stay_open));
+
+/* Close network data base files and clear `stay open' flag.  */
+extern void endnetent __P ((void));
+
+/* Get next entry from network data base file.  Open data base if
+   necessary.  */
+extern struct netent *getnetent __P ((void));
+
+/* Return entry from network data base which address match NET and
+   type TYPE.  */
+extern struct netent *getnetbyaddr __P ((unsigned long int __net,
+					 int __type));
+
+/* Return entry from network data base for network with NAME.  */
+extern struct netent *getnetbyname __P ((__const char *__name));
+
+#ifdef	__USE_REENTRANT
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  The last
+   argument is a pointer to a variable which gets the value which
+   would be stored in the global variable `herrno' by the
+   non-reentrant functions.  */
+extern struct netent *__getnetent_r __P ((struct netent *__result_buf,
+					  char *__buf, int __buf_len,
+					  int *__h_errnop));
+extern struct netent *getnetent_r __P ((struct netent *__result_buf,
+					char *__buf, int __buf_len,
+					int *__h_errnop));
+
+extern struct netent *__getnetbyaddr_r __P ((unsigned long int __net,
+					     int __type,
+					     struct netent *__result_buf,
+					     char *__buf, int __buflen,
+					     int *__h_errnop));
+extern struct netent *getnetbyaddr_r __P ((unsigned long int __net,
+					   int __type,
+					   struct netent *__result_buf,
+					   char *__buf, int __buflen,
+					   int *__h_errnop));
+
+extern struct netent *__getnetbyname_r __P ((__const char *__name,
+					     struct netent *__result_buf,
+					     char *__buf, int __buflen,
+					     int *__h_errnop));
+extern struct netent *getnetbyname_r __P ((__const char *__name,
+					   struct netent *__result_buf,
+					   char *__buf, int __buflen,
+					   int *__h_errnop));
+#endif	/* reentrant */
+
+
+/* Description of data base entry for a single service.  */
+struct servent
+{
+  char *s_name;			/* Official service name.  */
+  char **s_aliases;		/* Alias list.  */
+  int s_port;			/* Port number.  */
+  char *s_proto;		/* Protocol to use.  */
 };
 
-/*
- * Error return codes from gethostbyname() and gethostbyaddr()
- * (left in extern int h_errno).
- */
+/* Open service data base files and mark them as staying open even
+   after a later search if STAY_OPEN is non-zero.  */
+extern void setservent __P ((int __stay_open));
 
-#define	NETDB_INTERNAL	-1	/* see errno */
-#define	NETDB_SUCCESS	0	/* no problem */
-#define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
-#define	TRY_AGAIN	2 /* Non-Authoritive Host not found, or SERVERFAIL */
-#define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
-#define	NO_DATA		4 /* Valid name, no data record of requested type */
-#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
+/* Close service data base files and clear `stay open' flag.  */
+extern void endservent __P ((void));
 
-__BEGIN_DECLS
-void		endhostent __P((void));
-void		endnetent __P((void));
-void		endprotoent __P((void));
-void		endservent __P((void));
-struct hostent	*gethostbyaddr __P((const char *, int, int));
-struct hostent	*gethostbyname __P((const char *));
-struct hostent	*gethostbyname2 __P((const char *, int));
-struct hostent	*gethostent __P((void));
-struct netent	*getnetbyaddr __P((unsigned long, int));
-struct netent	*getnetbyname __P((const char *));
-struct netent	*getnetent __P((void));
-struct protoent	*getprotobyname __P((const char *));
-struct protoent	*getprotobynumber __P((int));
-struct protoent	*getprotoent __P((void));
-struct servent	*getservbyname __P((const char *, const char *));
-struct servent	*getservbyport __P((int, const char *));
-struct servent	*getservent __P((void));
-void		herror __P((const char *));
-const char	*hstrerror __P((int));
-void		sethostent __P((int));
-/* void		sethostfile __P((const char *)); */
-void		setnetent __P((int));
-void		setprotoent __P((int));
-void		setservent __P((int));
-__END_DECLS
+/* Get next entry from service data base file.  Open data base if
+   necessary.  */
+extern struct servent *getservent __P ((void));
 
-/* This is nec'y to make this include file properly replace the sun version. */
-#ifdef __GNU_LIBRARY__
-#include <rpc/netdb.h>
-#else
-#ifdef sun
-struct rpcent {
-	char	*r_name;	/* name of server for this rpc program */
-	char	**r_aliases;	/* alias list */
-	int	r_number;	/* rpc program number */
+/* Return entry from network data base for network with NAME and
+   protocol PROTO.  */
+extern struct servent *getservbyname __P ((__const char *__name,
+					   __const char *__proto));
+
+/* Return entry from service data base which matches port PORT and
+   protocol PROTO.  */
+extern struct servent *getservbyport __P ((int __port, __const char *__proto));
+
+
+#ifdef	__USE_REENTRANT
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  */
+extern struct servent *__getservent_r __P ((struct servent *__result_buf,
+					    char *__buf, int __buf_len));
+extern struct servent *getservent_r __P ((struct servent *__result_buf,
+					  char *__buf, int __buf_len));
+
+extern struct servent *__getservbyname_r __P ((__const char *__name,
+					       __const char *__proto,
+					       struct servent *__result_buf,
+					       char *__buf, int __buflen));
+extern struct servent *getservbyname_r __P ((__const char *__name,
+					     __const char *__proto,
+					     struct servent *__result_buf,
+					     char *__buf, int __buflen));
+
+extern struct servent *__getservbyport_r __P ((int __port,
+					       __const char *__proto,
+					       struct servent *__result_buf,
+					       char *__buf, int __buflen));
+extern struct servent *getservbyport_r __P ((int __port, __const char *__proto,
+					     struct servent *__result_buf,
+					     char *__buf, int __buflen));
+#endif	/* reentrant */
+
+
+/* Description of data base entry for a single service.  */
+struct protoent
+{
+  char *p_name;			/* Official protocol name.  */
+  char **p_aliases;		/* Alias list.  */
+  int p_proto;			/* Protocol number.  */
 };
-struct rpcent	*getrpcbyname(), *getrpcbynumber(), *getrpcent();
-#endif /* sun */
-#endif /* __GNU_LIBRARY__ */
 
-#endif /* !_NETDB_H_ */
+/* Open protocol data base files and mark them as staying open even
+   after a later search if STAY_OPEN is non-zero.  */
+extern void setprotoent __P ((int __stay_open));
+
+/* Close protocol data base files and clear `stay open' flag.  */
+extern void endprotoent __P ((void));
+
+/* Get next entry from protocol data base file.  Open data base if
+   necessary.  */
+extern struct protoent *getprotoent __P ((void));
+
+/* Return entry from protocol data base for network with NAME.  */
+extern struct protoent *getprotobyname __P ((__const char *__name));
+
+/* Return entry from protocol data base which number is PROTO.  */
+extern struct protoent *getprotobynumber __P ((int __proto));
+
+
+#ifdef	__USE_REENTRANT
+/* Reentrant versions of the functions above.  The additional
+   arguments specify a buffer of BUFLEN starting at BUF.  */
+extern struct protoent *__getprotoent_r __P ((struct protoent *__result_buf,
+					      char *__buf, int __buf_len));
+extern struct protoent *getprotoent_r __P ((struct protoent *__result_buf,
+					    char *__buf, int __buf_len));
+
+extern struct protoent *__getprotobyname_r __P ((__const char *__name,
+						 struct protoent *__result_buf,
+						 char *__buf, int __buflen));
+extern struct protoent *getprotobyname_r __P ((__const char *__name,
+					       struct protoent *__result_buf,
+					       char *__buf, int __buflen));
+
+extern struct protoent *__getprotobynumber_r __P ((int __proto,
+						   struct protoent *__res_buf,
+						   char *__buf, int __buflen));
+extern struct protoent *getprotobynumber_r __P ((int __proto,
+						 struct protoent *__result_buf,
+						 char *__buf, int __buflen));
+#endif	/* reentrant */
+
+
+__END_DECLS
+
+#endif	/* netdb.h */
diff --git a/resource/sys/resource.h b/resource/sys/resource.h
index 14bec34d74..3d0e5a921b 100644
--- a/resource/sys/resource.h
+++ b/resource/sys/resource.h
@@ -39,14 +39,16 @@ struct rlimit
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
-int getrlimit __P ((enum __rlimit_resource __resource,
-		    struct rlimit * __rlimits));
+extern int __getrlimit __P ((enum __rlimit_resource __resource,
+			     struct rlimit *__rlimits));
+extern int getrlimit __P ((enum __rlimit_resource __resource,
+			   struct rlimit *__rlimits));
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
    Return 0 if successful, -1 if not (and sets errno).  */
-int setrlimit __P ((enum __rlimit_resource __resource,
-		    struct rlimit * __rlimits));
+extern int setrlimit __P ((enum __rlimit_resource __resource,
+			   struct rlimit *__rlimits));
 
 
 /* Whose usage statistics do you want?  */
@@ -110,8 +112,8 @@ struct rusage
 
 /* Return resource usage information on process indicated by WHO
    and put it in *USAGE.  Returns 0 for success, -1 for failure.  */
-int __getrusage __P ((enum __rusage_who __who, struct rusage * __usage));
-int getrusage __P ((enum __rusage_who __who, struct rusage * __usage));
+extern int __getrusage __P ((enum __rusage_who __who, struct rusage *__usage));
+extern int getrusage __P ((enum __rusage_who __who, struct rusage *__usage));
 
 /* Function depends on CMD:
    1 = Return the limit on the size of a file, in units of 512 bytes.
@@ -120,8 +122,8 @@ int getrusage __P ((enum __rusage_who __who, struct rusage * __usage));
    3 = Return the maximum possible address of the data segment.
    4 = Return the maximum number of files that the calling process can open.
    Returns -1 on errors.  */
-long int __ulimit __P ((int __cmd, long int __newlimit));
-long int ulimit __P ((int __cmd, long int __newlimit));
+extern long int __ulimit __P ((int __cmd, long int __newlimit));
+extern long int ulimit __P ((int __cmd, long int __newlimit));
 
 
 /* Priority limits.  */
@@ -151,4 +153,4 @@ extern int setpriority __P ((enum __priority_which __which, int __who,
 
 __END_DECLS
 
-#endif /* resource.h  */
+#endif	/* resource.h  */
diff --git a/stdio-common/reg-printf.c b/stdio-common/reg-printf.c
index 95d7a1f3c9..db33a3d618 100644
--- a/stdio-common/reg-printf.c
+++ b/stdio-common/reg-printf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <limits.h>
 #include <printf.h>
@@ -29,9 +28,10 @@ printf_function **__printf_function_table;
 
 /* Register FUNC to be called to format SPEC specifiers.  */
 int
-DEFUN(register_printf_function, (spec, converter, arginfo),
-      int spec AND printf_function converter AND
-      printf_arginfo_function arginfo)
+__register_printf_function (spec, converter, arginfo)
+     int spec;
+     printf_function converter;
+     printf_arginfo_function arginfo;
 {
   if (spec < 0 || spec > (int) UCHAR_MAX)
     {
@@ -45,3 +45,4 @@ DEFUN(register_printf_function, (spec, converter, arginfo),
 
   return 0;
 }
+weak_alias (__register_printf_function, register_printf_function)
diff --git a/stdio-common/scanf.c b/stdio-common/scanf.c
index 3c35fa3691..8e9b90f3e7 100644
--- a/stdio-common/scanf.c
+++ b/stdio-common/scanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -19,17 +19,25 @@ Cambridge, MA 02139, USA.  */
 #include <stdarg.h>
 #include <stdio.h>
 
+/* The function `vscanf' is not defined in ISO C.  Therefore we must
+   use the protected form here.  In stdio it is called `__vscanf' and
+   in libio `_IO_vscanf'.  */
+#ifdef USE_IN_LIBIO
+# define VSCANF _IO_vscanf
+#else
+# define VSCANF __vscanf
+#endif
+
 /* Read formatted input from stdin according to the format string FORMAT.  */
 /* VARARGS1 */
 int
-scanf (format)
-     const char *format;
+scanf (const char *format, ...)
 {
   va_list arg;
   int done;
 
   va_start (arg, format);
-  done = vscanf (format, arg);
+  done = VSCANF (format, arg);
   va_end (arg);
 
   return done;
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index ebe6220b24..9a9e583faa 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -737,15 +737,15 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	    const wchar_t *s2 = (const wchar_t *) string;		      \
 	    mbstate_t mbstate;						      \
 									      \
-	    len = wcsrtombs (NULL, &s2, 0, &mbstate);			      \
+	    len = __wcsrtombs (NULL, &s2, 0, &mbstate);			      \
 	    if (len == (size_t) -1)					      \
 	      /* Illegal wide-character string.  */			      \
 	      return -1;						      \
 									      \
 	    s2 = (const wchar_t *) string;				      \
 	    string = alloca (len + 1);					      \
-	    (void) wcsrtombs (string, &s2, prec != -1 ? prec : UINT_MAX,      \
-			      &mbstate);				      \
+	    (void) __wcsrtombs (string, &s2, prec != -1 ? prec : UINT_MAX,    \
+				&mbstate);				      \
 	  }								      \
 									      \
 	if ((width -= len) < 0)						      \
diff --git a/stdio/stdio.h b/stdio/stdio.h
index 38bfc148d7..47348a6576 100644
--- a/stdio/stdio.h
+++ b/stdio/stdio.h
@@ -439,6 +439,7 @@ extern int vfscanf __P ((FILE *__s, __const char *__format,
 			 __gnuc_va_list __arg));
 
 /* Read formatted input from stdin into argument list ARG.  */
+extern int __vscanf __P ((__const char *__format, __gnuc_va_list __arg));
 extern int vscanf __P ((__const char *__format, __gnuc_va_list __arg));
 
 /* Read formatted input from S into argument list ARG.  */
diff --git a/stdio/vscanf.c b/stdio/vscanf.c
index 0d829440e9..52cf690ec2 100644
--- a/stdio/vscanf.c
+++ b/stdio/vscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <stdarg.h>
 #include <stdio.h>
 
@@ -26,7 +25,8 @@ Cambridge, MA 02139, USA.  */
 /* Read formatted input from stdin according to the format
    string in FORMAT, using the argument list in ARG.  */
 int
-DEFUN(vscanf, (format, arg), CONST char *format AND va_list arg)
+__vscanf (const char *format, va_list arg)
 {
   return vfscanf (stdin, format, arg);
 }
+weak_alias (__vscanf, vscanf)
diff --git a/stdlib/mbstowcs.c b/stdlib/mbstowcs.c
index da3ae6b19d..1b380308d6 100644
--- a/stdlib/mbstowcs.c
+++ b/stdlib/mbstowcs.c
@@ -36,7 +36,7 @@ mbstowcs (wchar_t *pwcs, const char *s, size_t n)
   mbstate_t save_shift = __no_r_state;
   size_t written;
 
-  written = mbsrtowcs (pwcs, &s, n, &__no_r_state);
+  written = __mbsrtowcs (pwcs, &s, n, &__no_r_state);
 
   /* Restore the old shift state.  */
   __no_r_state = save_shift;
diff --git a/stdlib/mbtowc.c b/stdlib/mbtowc.c
index c340dd72a6..1f5d45dc62 100644
--- a/stdlib/mbtowc.c
+++ b/stdlib/mbtowc.c
@@ -45,7 +45,7 @@ mbtowc (wchar_t *pwc, const char *s, size_t n)
   if (s == NULL)
     return 1;
 
-  result = mbrtowc (pwc, s, n, &__no_r_state);
+  result = __mbrtowc (pwc, s, n, &__no_r_state);
 
   /* The `mbrtowc' functions tell us more than we need.  Fold the -1
      and -2 result into -1.  */
diff --git a/stdlib/wcstombs.c b/stdlib/wcstombs.c
index 73f015bf7e..65011f77c3 100644
--- a/stdlib/wcstombs.c
+++ b/stdlib/wcstombs.c
@@ -36,7 +36,7 @@ wcstombs (char *s, const wchar_t *pwcs, size_t n)
   mbstate_t save_shift = __no_r_state;
   size_t written;
 
-  written = wcsrtombs (s, &pwcs, n, &__no_r_state);
+  written = __wcsrtombs (s, &pwcs, n, &__no_r_state);
 
   /* Restore the old shift state.  */
   __no_r_state = save_shift;
diff --git a/stdlib/wctomb.c b/stdlib/wctomb.c
index f7143add82..75b6069af4 100644
--- a/stdlib/wctomb.c
+++ b/stdlib/wctomb.c
@@ -41,5 +41,5 @@ wctomb (char *s, wchar_t wchar)
   if (s == NULL)
     return 1;
 
-  return wcrtomb (s, wchar, &__no_r_state);
+  return __wcrtomb (s, wchar, &__no_r_state);
 }
diff --git a/string/argz.h b/string/argz.h
index 924dd46019..d9314e6bef 100644
--- a/string/argz.h
+++ b/string/argz.h
@@ -1,7 +1,5 @@
 /* Routines for dealing with '\0' separated arg vectors.
-
    Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
    Written by Miles Bader <miles@gnu.ai.mit.edu>
 
    This program is free software; you can redistribute it and/or
@@ -19,8 +17,8 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #ifndef __ARGZ_H__
-#define __ARGZ_H__	1
 
+#define __ARGZ_H__	1
 #include <features.h>
 
 #include <errno.h>		/* Define error_t.  */
@@ -32,47 +30,51 @@ __BEGIN_DECLS
 /* Make a '\0' separated arg vector from a unix argv vector, returning it in
    ARGZ, and the total length in LEN.  If a memory allocation error occurs,
    ENOMEM is returned, otherwise 0.  The result can be destroyed using free. */
-error_t __argz_create __P ((char *const argv[], char **argz, size_t *len));
-error_t argz_create __P ((char *const argv[], char **argz, size_t *len));
+extern error_t __argz_create __P ((char *const __argv[], char **__argz,
+				   size_t *__len));
+extern error_t argz_create __P ((char *const __argv[], char **__argz,
+				 size_t *__len));
 
 /* Make a '\0' separated arg vector from a SEP separated list in
    STRING, returning it in ARGZ, and the total length in LEN.  If a
    memory allocation error occurs, ENOMEM is returned, otherwise 0.
    The result can be destroyed using free.  */
-error_t __argz_create_sep __P ((__const char *string, int sep,
-				char **argz, size_t *len));
-error_t argz_create_sep __P ((__const char *string, int sep,
-			      char **argz, size_t *len));
+extern error_t __argz_create_sep __P ((__const char *__string, int __sep,
+				       char **__argz, size_t *__len));
+extern error_t argz_create_sep __P ((__const char *__string, int __sep,
+				     char **__argz, size_t *__len));
 
 /* Returns the number of strings in ARGZ.  */
-size_t __argz_count __P ((__const char *argz, size_t len));
-size_t argz_count __P ((__const char *argz, size_t len));
+extern size_t __argz_count __P ((__const char *__argz, size_t __len));
+extern size_t argz_count __P ((__const char *__argz, size_t __len));
 
 /* Puts pointers to each string in ARGZ into ARGV, which must be large enough
    to hold them all.  */
-void __argz_extract __P ((char *argz, size_t len, char **argv));
-void argz_extract __P ((char *argz, size_t len, char **argv));
+extern void __argz_extract __P ((char *__argz, size_t __len, char **__argv));
+extern void argz_extract __P ((char *__argz, size_t __len, char **__argv));
 
 /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
    except the last into the character SEP.  */
-void __argz_stringify __P ((char *argz, size_t len, int sep));
-void argz_stringify __P ((char *argz, size_t len, int sep));
+extern void __argz_stringify __P ((char *__argz, size_t __len, int __sep));
+extern void argz_stringify __P ((char *__argz, size_t __len, int __sep));
 
 /* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN.  */
-error_t __argz_append __P ((char **argz, size_t *argz_len,
-			    __const char *buf, size_t buf_len));
-error_t argz_append __P ((char **argz, size_t *argz_len,
-			  __const char *buf, size_t buf_len));
+extern error_t __argz_append __P ((char **__argz, size_t *__argz_len,
+				   __const char *__buf, size_t _buf_len));
+extern error_t argz_append __P ((char **__argz, size_t *__argz_len,
+				 __const char *__buf, size_t __buf_len));
 
 /* Append STR to the argz vector in ARGZ & ARGZ_LEN.  */
-error_t __argz_add __P ((char **argz, size_t *argz_len,
-			 __const char *str));
-error_t argz_add __P ((char **argz, size_t *argz_len,
-		       __const char *str));
+extern error_t __argz_add __P ((char **__argz, size_t *__argz_len,
+				__const char *__str));
+extern error_t argz_add __P ((char **__argz, size_t *__argz_len,
+			      __const char *__str));
 
 /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there.  */
-void __argz_delete __P ((char **argz, size_t *argz_len, char *entry));
-void argz_delete __P ((char **argz, size_t *argz_len, char *entry));
+extern void __argz_delete __P ((char **__argz, size_t *__argz_len,
+				char *__entry));
+extern void argz_delete __P ((char **__argz, size_t *__argz_len,
+			      char *__entry));
 
 /* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an
    existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end.
@@ -80,10 +82,10 @@ void argz_delete __P ((char **argz, size_t *argz_len, char *entry));
    ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ.  If BEFORE is not
    in ARGZ, EINVAL is returned, else if memory can't be allocated for the new
    ARGZ, ENOMEM is returned, else 0.  */
-error_t __argz_insert __P ((char **argz, size_t *argz_len,
-			    char *before, __const char *entry));
-error_t argz_insert __P ((char **argz, size_t *argz_len,
-			  char *before, __const char *entry));
+extern error_t __argz_insert __P ((char **__argz, size_t *__argz_len,
+				   char *__before, __const char *__entry));
+extern error_t argz_insert __P ((char **__argz, size_t *__argz_len,
+				 char *__before, __const char *__entry));
 
 /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there
    are no more.  If entry is NULL, then the first entry is returned.  This
@@ -106,25 +108,25 @@ extern char *argz_next __P ((char *argz, size_t __argz_len,
 
 #if defined (__OPTIMIZE__) && __GNUC__ >= 2
 extern inline char *
-__argz_next (char *argz, size_t argz_len, const char *entry)
+__argz_next (char *__argz, size_t __argz_len, const char *__entry)
 {
-  if (entry)
+  if (__entry)
     {
-      if (entry < argz + argz_len)
-	entry = strchr (entry, '\0') + 1;
+      if (__entry < __argz + __argz_len)
+	__entry = strchr (__entry, '\0') + 1;
 
-      return entry >= argz + argz_len ? NULL : (char *) entry;
+      return __entry >= __argz + __argz_len ? NULL : (char *) __entry;
     }
   else
-    if (argz_len > 0)
-      return argz;
+    if (__argz_len > 0)
+      return __argz;
     else
       return 0;
 }
 extern inline char *
-argz_next (char *argz, size_t argz_len, const char *entry)
+argz_next (char *__argz, size_t __argz_len, const char *__entry)
 {
-  return __argz_next (argz, argz_len, entry);
+  return __argz_next (__argz, __argz_len, __entry);
 }
 #endif /* optimizing GCC2 */
 
diff --git a/string/envz.h b/string/envz.h
index fd8865711d..dfd5e8aeb6 100644
--- a/string/envz.h
+++ b/string/envz.h
@@ -1,7 +1,5 @@
 /* Routines for dealing with '\0' separated environment vectors
-
    Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
    Written by Miles Bader <miles@gnu.ai.mit.edu>
 
    This program is free software; you can redistribute it and/or
@@ -19,7 +17,9 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #ifndef __ENVZ_H__
-#define __ENVZ_H__
+
+#define __ENVZ_H__	1
+#include <features.h>
 
 #include <errno.h>
 
@@ -28,13 +28,13 @@
 #include <argz.h>
 
 /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none.  */
-char *envz_entry __P ((__const char *__envz, size_t __envz_len,
-		       __const char *__name));
+extern char *envz_entry __P ((__const char *__envz, size_t __envz_len,
+			      __const char *__name));
 
 /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
    if there is none.  */
-char *envz_get __P ((__const char *__envz, size_t __envz_len,
-		     __const char *__name));
+extern char *envz_get __P ((__const char *__envz, size_t __envz_len,
+			    __const char *__name));
 
 /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN.  If an entry
    with the same name already exists in ENVZ, it is removed.  If VALUE is
@@ -42,17 +42,17 @@ char *envz_get __P ((__const char *__envz, size_t __envz_len,
    return NULL, although envz_entry will still return an entry; this is handy
    because when merging with another envz, the null entry can override an
    entry in the other one.  Null entries can be removed with envz_strip ().  */
-error_t envz_add __P ((char **__envz, size_t *__envz_len,
-		       __const char *__name, __const char *__value));
+extern error_t envz_add __P ((char **__envz, size_t *__envz_len,
+			      __const char *__name, __const char *__value));
 
 /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add().  If
    OVERRIDE is true, then values in ENVZ2 will supercede those with the same
    name in ENV, otherwise not.  */
-error_t envz_merge __P ((char **__envz, size_t *__envz_len,
-			 __const char *__envz2, size_t __envz2_len,
-			 int __override));
+extern error_t envz_merge __P ((char **__envz, size_t *__envz_len,
+				__const char *__envz2, size_t __envz2_len,
+				int __override));
 
 /* Remove null entries.  */
-void envz_strip __P ((char **__envz, size_t *__envz_len));
+extern void envz_strip __P ((char **__envz, size_t *__envz_len));
 
 #endif /* __ENVZ_H__ */
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index 9336279e46..ad5b83e798 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -94,17 +94,6 @@ enum xdr_op {
 		    * BYTES_PER_XDR_UNIT)
 
 /*
- * A xdrproc_t exists for each data type which is to be encoded or decoded.
- *
- * The second argument to the xdrproc_t is a pointer to an opaque pointer.
- * The opaque pointer generally points to a structure of the data type
- * to be decoded.  If this pointer is 0, then the type routines should
- * allocate dynamic storage of the appropriate size and return it.
- * bool_t	(*xdrproc_t)(XDR *, caddr_t *);
- */
-typedef	bool_t (*xdrproc_t)();
-
-/*
  * The XDR handle.
  * Contains operation which is being applied to the stream,
  * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
@@ -129,6 +118,17 @@ typedef struct {
 } XDR;
 
 /*
+ * A xdrproc_t exists for each data type which is to be encoded or decoded.
+ *
+ * The second argument to the xdrproc_t is a pointer to an opaque pointer.
+ * The opaque pointer generally points to a structure of the data type
+ * to be decoded.  If this pointer is 0, then the type routines should
+ * allocate dynamic storage of the appropriate size and return it.
+ * bool_t	(*xdrproc_t)(XDR *, caddr_t *);
+ */
+typedef	bool_t (*xdrproc_t) __P ((XDR *, void *, ...));
+
+/*
  * Operations defined on a XDR handle
  *
  * XDR		*xdrs;
diff --git a/sysdeps/generic/confname.h b/sysdeps/generic/confname.h
index fb2679fb45..d0968a1ba5 100644
--- a/sysdeps/generic/confname.h
+++ b/sysdeps/generic/confname.h
@@ -21,175 +21,209 @@ Cambridge, MA 02139, USA.  */
 enum
   {
     _PC_LINK_MAX,
-#define	_PC_LINK_MAX		_PC_LINK_MAX
+#define	_PC_LINK_MAX			_PC_LINK_MAX
     _PC_MAX_CANON,
-#define	_PC_MAX_CANON		_PC_MAX_CANON
+#define	_PC_MAX_CANON			_PC_MAX_CANON
     _PC_MAX_INPUT,
-#define	_PC_MAX_INPUT		_PC_MAX_INPUT
+#define	_PC_MAX_INPUT			_PC_MAX_INPUT
     _PC_NAME_MAX,
-#define	_PC_NAME_MAX		_PC_NAME_MAX
+#define	_PC_NAME_MAX			_PC_NAME_MAX
     _PC_PATH_MAX,
-#define	_PC_PATH_MAX		_PC_PATH_MAX
+#define	_PC_PATH_MAX			_PC_PATH_MAX
     _PC_PIPE_BUF,
-#define	_PC_PIPE_BUF		_PC_PIPE_BUF
+#define	_PC_PIPE_BUF			_PC_PIPE_BUF
     _PC_CHOWN_RESTRICTED,
-#define	_PC_CHOWN_RESTRICTED	_PC_CHOWN_RESTRICTED
+#define	_PC_CHOWN_RESTRICTED		_PC_CHOWN_RESTRICTED
     _PC_NO_TRUNC,
-#define	_PC_NO_TRUNC		_PC_NO_TRUNC
+#define	_PC_NO_TRUNC			_PC_NO_TRUNC
     _PC_VDISABLE,
     _PC_SYNC_IO,
-#define	_PC_SYNC_IO		_PC_SYNC_IO
+#define	_PC_SYNC_IO			_PC_SYNC_IO
     _PC_ASYNC_IO,
-#define	_PC_ASYNC_IO		_PC_ASYNC_IO
+#define	_PC_ASYNC_IO			_PC_ASYNC_IO
     _PC_PRIO_IO,
-#define	_PC_PRIO_IO		_PC_PRIO_IO
+#define	_PC_PRIO_IO			_PC_PRIO_IO
     _PC_SOCK_MAXBUF
-#define	_PC_SOCK_MAXBUF		_PC_SOCK_MAXBUF
+#define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
   };
 
 /* Values for the argument to `sysconf'.  */
 enum
   {
     _SC_ARG_MAX,
-#define	_SC_ARG_MAX		_SC_ARG_MAX
+#define	_SC_ARG_MAX			_SC_ARG_MAX
     _SC_CHILD_MAX,
-#define	_SC_CHILD_MAX		_SC_CHILD_MAX
+#define	_SC_CHILD_MAX			_SC_CHILD_MAX
     _SC_CLK_TCK,
-#define	_SC_CLK_TCK		_SC_CLK_TCK
+#define	_SC_CLK_TCK			_SC_CLK_TCK
     _SC_NGROUPS_MAX,
-#define	_SC_NGROUPS_MAX		_SC_NGROUPS_MAX
+#define	_SC_NGROUPS_MAX			_SC_NGROUPS_MAX
     _SC_OPEN_MAX,
-#define	_SC_OPEN_MAX		_SC_OPEN_MAX
+#define	_SC_OPEN_MAX			_SC_OPEN_MAX
     _SC_STREAM_MAX,
-#define	_SC_STREAM_MAX		_SC_STREAM_MAX
+#define	_SC_STREAM_MAX			_SC_STREAM_MAX
     _SC_TZNAME_MAX,
-#define	_SC_TZNAME_MAX		_SC_TZNAME_MAX
+#define	_SC_TZNAME_MAX			_SC_TZNAME_MAX
     _SC_JOB_CONTROL,
-#define	_SC_JOB_CONTROL		_SC_JOB_CONTROL
+#define	_SC_JOB_CONTROL			_SC_JOB_CONTROL
     _SC_SAVED_IDS,
-#define	_SC_SAVED_IDS		_SC_SAVED_IDS
+#define	_SC_SAVED_IDS			_SC_SAVED_IDS
     _SC_REALTIME_SIGNALS,
-#define	_SC_REALTIME_SIGNALS	_SC_REALTIME_SIGNALS
+#define	_SC_REALTIME_SIGNALS		_SC_REALTIME_SIGNALS
     _SC_PRIORITY_SCHEDULING,
-#define	_SC_PRIORITY_SCHEDULING	_SC_PRIORITY_SCHEDULING
+#define	_SC_PRIORITY_SCHEDULING		_SC_PRIORITY_SCHEDULING
     _SC_TIMERS,
-#define	_SC_TIMERS		_SC_TIMERS
+#define	_SC_TIMERS			_SC_TIMERS
     _SC_ASYNCHRONOUS_IO,
-#define	_SC_ASYNCHRONOUS_IO	_SC_ASYNCHRONOUS_IO
+#define	_SC_ASYNCHRONOUS_IO		_SC_ASYNCHRONOUS_IO
     _SC_PRIORITIZED_IO,
-#define	_SC_PRIORITIZED_IO	_SC_PRIORITIZED_IO
+#define	_SC_PRIORITIZED_IO		_SC_PRIORITIZED_IO
     _SC_SYNCHRONIZED_IO,
-#define	_SC_SYNCHRONIZED_IO	_SC_SYNCHRONIZED_IO
+#define	_SC_SYNCHRONIZED_IO		_SC_SYNCHRONIZED_IO
     _SC_FSYNC,
-#define	_SC_FSYNC		_SC_FSYNC
+#define	_SC_FSYNC			_SC_FSYNC
     _SC_MAPPED_FILES,
-#define	_SC_MAPPED_FILES	_SC_MAPPED_FILES
+#define	_SC_MAPPED_FILES		_SC_MAPPED_FILES
     _SC_MEMLOCK,
-#define	_SC_MEMLOCK		_SC_MEMLOCK
+#define	_SC_MEMLOCK			_SC_MEMLOCK
     _SC_MEMLOCK_RANGE,
-#define	_SC_MEMLOCK_RANGE	_SC_MEMLOCK_RANGE
+#define	_SC_MEMLOCK_RANGE		_SC_MEMLOCK_RANGE
     _SC_MEMORY_PROTECTION,
-#define	_SC_MEMORY_PROTECTION	_SC_MEMORY_PROTECTION
+#define	_SC_MEMORY_PROTECTION		_SC_MEMORY_PROTECTION
     _SC_MESSAGE_PASSING,
-#define	_SC_MESSAGE_PASSING	_SC_MESSAGE_PASSING
+#define	_SC_MESSAGE_PASSING		_SC_MESSAGE_PASSING
     _SC_SEMAPHORES,
-#define	_SC_SEMAPHORES		_SC_SEMAPHORES
+#define	_SC_SEMAPHORES			_SC_SEMAPHORES
     _SC_SHARED_MEMORY_OBJECTS,
 #define	_SC_SHARED_MEMORY_OBJECTS	_SC_SHARED_MEMORY_OBJECTS
     _SC_AIO_LISTIO_MAX,
-#define	_SC_AIO_LIST_MAX	_SC_AIO_LIST_MAX
+#define	_SC_AIO_LIST_MAX		_SC_AIO_LIST_MAX
     _SC_AIO_MAX,
-#define	_SC_AIO_MAX		_SC_AIO_MAX
+#define	_SC_AIO_MAX			_SC_AIO_MAX
     _SC_AIO_PRIO_DELTA_MAX,
-#define	_SC_AIO_PRIO_DELTA_MAX	_SC_AIO_PRIO_DELTA_MAX
+#define	_SC_AIO_PRIO_DELTA_MAX		_SC_AIO_PRIO_DELTA_MAX
     _SC_DELAYTIMER_MAX,
-#define	_SC_DELAYTIMER_MAX	_SC_DELAYTIMER_MAX
+#define	_SC_DELAYTIMER_MAX		_SC_DELAYTIMER_MAX
     _SC_MQ_OPEN_MAX,
-#define	_SC_MQ_OPEN_MAX		_SC_MQ_OPEN_MAX
+#define	_SC_MQ_OPEN_MAX			_SC_MQ_OPEN_MAX
     _SC_MQ_PRIO_MAX,
-#define	_SC_MQ_PRIO_MAX		_SC_MQ_PRIO_MAX
+#define	_SC_MQ_PRIO_MAX			_SC_MQ_PRIO_MAX
     _SC_VERSION,
-#define	_SC_VERSION		_SC_VERSION
+#define	_SC_VERSION			_SC_VERSION
     _SC_PAGESIZE,
-#define	_SC_PAGESIZE		_SC_PAGESIZE
-#define	_SC_PAGE_SIZE		_SC_PAGESIZE
+#define	_SC_PAGESIZE			_SC_PAGESIZE
+#define	_SC_PAGE_SIZE			_SC_PAGESIZE
     _SC_RTSIG_MAX,
-#define	_SC_RTSIG_MAX		_SC_RTSIG_MAX
+#define	_SC_RTSIG_MAX			_SC_RTSIG_MAX
     _SC_SEM_NSEMS_MAX,
-#define	_SC_SEM_NSEMS_MAX	_SC_SEM_NSEMS_MAX
+#define	_SC_SEM_NSEMS_MAX		_SC_SEM_NSEMS_MAX
     _SC_SEM_VALUE_MAX,
-#define	_SC_SEM_VALUE_MAX	_SC_SEM_VALUE_MAX
+#define	_SC_SEM_VALUE_MAX		_SC_SEM_VALUE_MAX
     _SC_SIGQUEUE_MAX,
-#define	_SC_SIGQUEUE_MAX	_SC_SIGQUEUE_MAX
+#define	_SC_SIGQUEUE_MAX		_SC_SIGQUEUE_MAX
     _SC_TIMER_MAX,
-#define	_SC_TIMER_MAX		_SC_TIMER_MAX
+#define	_SC_TIMER_MAX			_SC_TIMER_MAX
 
     /* Values for the argument to `sysconf'
        corresponding to _POSIX2_* symbols.  */
     _SC_BC_BASE_MAX,
-#define	_SC_BC_BASE_MAX		_SC_BC_BASE_MAX
+#define	_SC_BC_BASE_MAX			_SC_BC_BASE_MAX
     _SC_BC_DIM_MAX,
-#define	_SC_BC_DIM_MAX		_SC_BC_DIM_MAX
+#define	_SC_BC_DIM_MAX			_SC_BC_DIM_MAX
     _SC_BC_SCALE_MAX,
-#define	_SC_BC_SCALE_MAX	_SC_BC_SCALE_MAX
+#define	_SC_BC_SCALE_MAX		_SC_BC_SCALE_MAX
     _SC_BC_STRING_MAX,
-#define	_SC_BC_STRING_MAX	_SC_BC_STRING_MAX
+#define	_SC_BC_STRING_MAX		_SC_BC_STRING_MAX
     _SC_COLL_WEIGHTS_MAX,
-#define	_SC_COLL_WEIGHTS_MAX	_SC_COLL_WEIGHTS_MAX
+#define	_SC_COLL_WEIGHTS_MAX		_SC_COLL_WEIGHTS_MAX
     _SC_EQUIV_CLASS_MAX,
-#define	_SC_EQUIV_CLASS_MAX	_SC_EQUIV_CLASS_MAX
+#define	_SC_EQUIV_CLASS_MAX		_SC_EQUIV_CLASS_MAX
     _SC_EXPR_NEST_MAX,
-#define	_SC_EXPR_NEST_MAX	_SC_EXPR_NEST_MAX
+#define	_SC_EXPR_NEST_MAX		_SC_EXPR_NEST_MAX
     _SC_LINE_MAX,
-#define	_SC_LINE_MAX		_SC_LINE_MAX
+#define	_SC_LINE_MAX			_SC_LINE_MAX
     _SC_RE_DUP_MAX,
-#define	_SC_RE_DUP_MAX		_SC_RE_DUP_MAX
+#define	_SC_RE_DUP_MAX			_SC_RE_DUP_MAX
     _SC_CHARCLASS_NAME_MAX,
-#define	_SC_CHARCLASS_NAME_MAX	_SC_CHARCLASS_NAME_MAX
+#define	_SC_CHARCLASS_NAME_MAX		_SC_CHARCLASS_NAME_MAX
 
     _SC_2_VERSION,
-#define	_SC_2_VERSION		_SC_2_VERSION
+#define	_SC_2_VERSION			_SC_2_VERSION
     _SC_2_C_BIND,
-#define	_SC_2_C_BIND		_SC_2_C_BIND
+#define	_SC_2_C_BIND			_SC_2_C_BIND
     _SC_2_C_DEV,
-#define	_SC_2_C_DEV		_SC_2_C_DEV
+#define	_SC_2_C_DEV			_SC_2_C_DEV
     _SC_2_FORT_DEV,
-#define	_SC_2_FORT_DEV		_SC_2_FORT_DEV
+#define	_SC_2_FORT_DEV			_SC_2_FORT_DEV
     _SC_2_FORT_RUN,
-#define	_SC_2_FORT_RUN		_SC_2_FORT_RUN
+#define	_SC_2_FORT_RUN			_SC_2_FORT_RUN
     _SC_2_SW_DEV,
-#define	_SC_2_SW_DEV		_SC_2_SW_DEV
+#define	_SC_2_SW_DEV			_SC_2_SW_DEV
     _SC_2_LOCALEDEF,
-#define	_SC_2_LOCALEDEF		_SC_2_LOCALEDEF
+#define	_SC_2_LOCALEDEF			_SC_2_LOCALEDEF
 
     _SC_PII,
-#define	_SC_PII			_SC_PII
+#define	_SC_PII				_SC_PII
     _SC_PII_XTI,
-#define	_SC_PII_XTI		_SC_PII_XTI
+#define	_SC_PII_XTI			_SC_PII_XTI
     _SC_PII_SOCKET,
-#define	_SC_PII_SOCKET		_SC_PII_SOCKET
+#define	_SC_PII_SOCKET			_SC_PII_SOCKET
     _SC_PII_INTERNET,
-#define	_SC_PII_INTERNET	_SC_PII_INTERNET
+#define	_SC_PII_INTERNET		_SC_PII_INTERNET
     _SC_PII_OSI,
-#define	_SC_PII_OSI		_SC_PII_OSI
+#define	_SC_PII_OSI			_SC_PII_OSI
     _SC_POLL,
-#define	_SC_POLL		_SC_POLL
+#define	_SC_POLL			_SC_POLL
     _SC_SELECT,
-#define	_SC_SELECT		_SC_SELECT
+#define	_SC_SELECT			_SC_SELECT
     _SC_UIO_MAXIOV,
-#define	_SC_UIO_MAXIOV		_SC_UIO_MAXIOV
+#define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
     _SC_PII_INTERNET_STREAM,
-#define	_SC_PII_INTERNET_STREAM	_SC_PII_INTERNET_STREAM
+#define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
     _SC_PII_INTERNET_DGRAM,
-#define	_SC_PII_INTERNET_DGRAM	_SC_PII_INTERNET_DGRAM
+#define	_SC_PII_INTERNET_DGRAM		_SC_PII_INTERNET_DGRAM
     _SC_PII_OSI_COTS,
-#define	_SC_PII_OSI_COTS	_SC_PII_OSI_COTS
+#define	_SC_PII_OSI_COTS		_SC_PII_OSI_COTS
     _SC_PII_OSI_CLTS,
-#define	_SC_PII_OSI_CLTS	_SC_PII_OSI_CLTS
+#define	_SC_PII_OSI_CLTS		_SC_PII_OSI_CLTS
     _SC_PII_OSI_M,
-#define	_SC_PII_OSI_M		_SC_PII_OSI_M
-    _SC_T_IOV_MAX
-#define	_SC_T_IOV_MAX		_SC_T_IOV_MAX
+#define	_SC_PII_OSI_M			_SC_PII_OSI_M
+    _SC_T_IOV_MAX,
+#define	_SC_T_IOV_MAX			_SC_T_IOV_MAX
+
+    /* Values according to POSIX 1003.1c (POSIX threads).  */
+    _SC_THREADS,
+#define	_SC_THREADS			_SC_THREADS
+    _SC_THREAD_SAFE_FUNCTIONS,
+#define _SC_THREAD_SAFE_FUNCTIONS	_SC_THREAD_SAFE_FUNCTIONS
+    _SC_GETGR_R_SIZE_MAX,
+#define	_SC_GETGR_R_SIZE_MAX		_SC_GETGR_R_SIZE_MAX
+    _SC_GETPW_R_SIZE_MAX,
+#define	_SC_GETPW_R_SIZE_MAX		_SC_GETPW_R_SIZE_MAX
+    _SC_LOGIN_NAME_MAX,
+#define	_SC_LOGIN_NAME_MAX		_SC_LOGIN_NAME_MAX
+    _SC_TTY_NAME_MAX,
+#define	_SC_TTY_NAME_MAX		_SC_TTY_NAME_MAX
+    _SC_THREAD_DESTRUCTOR_ITERATIONS,
+#define	_SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS
+    _SC_THREAD_KEYS_MAX,
+#define	_SC_THREAD_KEYS_MAX		_SC_THREAD_KEYS_MAX
+    _SC_THREAD_STACK_MIN,
+#define	_SC_THREAD_STACK_MIN		_SC_THREAD_STACK_MIN
+    _SC_THREAD_THREADS_MAX,
+#define	_SC_THREAD_THREADS_MAX		_SC_THREAD_THREADS_MAX
+    _SC_THREAD_ATTR_STACKADDR,
+#define	_SC_THREAD_ATTR_STACKADDR	_SC_THREAD_ATTR_STACKADDR
+    _SC_THREAD_ATTR_STACKSIZE,
+#define	_SC_THREAD_ATTR_STACKSIZE	_SC_THREAD_ATTR_STACKSIZE
+    _SC_THREAD_PRIORITY_SCHEDULING,
+#define	_SC_THREAD_PRIORITY_SCHEDULING	_SC_THREAD_PRIORITY_SCHEDULING
+    _SC_THREAD_PRIO_INHERIT,
+#define	_SC_THREAD_PRIO_INHERIT		_SC_THREAD_PRIO_INHERIT
+    _SC_THREAD_PRIO_PROTECT,
+#define	_SC_THREAD_PRIO_PROTECT		_SC_THREAD_PRIO_PROTECT
+    _SC_THREAD_PROCESS_SHARED,
+#define	_SC_THREAD_PROCESS_SHARED	_SC_THREAD_PROCESS_SHARED
   };
 
 #ifdef __USE_POSIX2
diff --git a/sysdeps/generic/resourcebits.h b/sysdeps/generic/resourcebits.h
index e343b300cc..74cbcb0e97 100644
--- a/sysdeps/generic/resourcebits.h
+++ b/sysdeps/generic/resourcebits.h
@@ -1,5 +1,5 @@
 /* Bit values for resource limits.  4.4 BSD/generic GNU version.
-Copyright (C) 1994 Free Software Foundation, Inc.
+Copyright (C) 1994, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -27,26 +27,36 @@ enum __rlimit_resource
   {
     /* Per-process CPU limit, in seconds.  */
     RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
     /* Largest file that can be created, in bytes.  */
     RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
     /* Maximum size of data segment, in bytes.  */
     RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
     /* Maximum size of stack segment, in bytes.  */
     RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
     /* Largest core file that can be created, in bytes.  */
     RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
     /* Largest resident set size, in bytes.
        This affects swapping; processes that are exceeding their
        resident set size will be more likely to have physical memory
        taken from them.  */
     RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
     /* Locked-in-memory address space.  */
     RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
     /* Number of processes.  */
     RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
     /* Number of open files.  */
     RLIMIT_OFILE,
     RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
 
     RLIMIT_NLIMITS,		/* Number of limit flavors.  */
     RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c
index ea070bc9b2..644108e7a0 100644
--- a/sysdeps/libm-ieee754/k_standard.c
+++ b/sysdeps/libm-ieee754/k_standard.c
@@ -112,7 +112,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 		    (void) WRITE2("acos: DOMAIN error\n", 19);
 		  }
@@ -129,7 +129,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if(_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 		    	(void) WRITE2("asin: DOMAIN error\n", 19);
 		  }
@@ -148,7 +148,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if(_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 			(void) WRITE2("atan2: DOMAIN error\n", 20);
 		      }
@@ -168,7 +168,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -185,7 +185,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -202,7 +202,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -216,7 +216,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -232,7 +232,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
 		      }
@@ -251,7 +251,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
 		      }
@@ -270,7 +270,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
 		      }
@@ -289,7 +289,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
 		      }
@@ -308,7 +308,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
 		      }
@@ -327,7 +327,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
 		      }
@@ -347,7 +347,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
                 if (_LIB_VERSION == _POSIX_)
 			errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         errno = ERANGE;
 		}
 		break;
@@ -364,7 +364,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("lgamma: SING error\n", 19);
 		      }
@@ -383,7 +383,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log: SING error\n", 16);
 		      }
@@ -402,7 +402,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log: DOMAIN error\n", 18);
 		      }
@@ -422,7 +422,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log10: SING error\n", 18);
 		      }
@@ -442,7 +442,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log10: DOMAIN error\n", 20);
 		      }
@@ -458,7 +458,7 @@ static double zero = 0.0;	/* used as const */
 		exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
 		exc.retval = zero;
 		if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			(void) WRITE2("pow(0,0): DOMAIN error\n", 23);
 			errno = EDOM;
 		}
@@ -480,7 +480,7 @@ static double zero = 0.0;	/* used as const */
 		}
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -493,7 +493,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval =  zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -509,7 +509,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
 		      }
@@ -528,7 +528,7 @@ static double zero = 0.0;	/* used as const */
 		    exc.retval = zero/zero;	/* X/Open allow NaN */
 		if (_LIB_VERSION == _POSIX_)
 		   errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
 		      }
@@ -548,7 +548,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL);
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -565,7 +565,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = zero/zero;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("sqrt: DOMAIN error\n", 19);
 		      }
@@ -585,7 +585,7 @@ static double zero = 0.0;	/* used as const */
 		    exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("fmod:  DOMAIN error\n", 20);
                   }
@@ -603,7 +603,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("remainder: DOMAIN error\n", 24);
                   }
@@ -620,7 +620,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("acosh: DOMAIN error\n", 20);
                   }
@@ -637,7 +637,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: DOMAIN error\n", 20);
                   }
@@ -654,7 +654,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x/zero;	/* sign(x)*inf */
                 if (_LIB_VERSION == _POSIX_)
                   errno = EDOM;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: SING error\n", 18);
                   }
@@ -671,7 +671,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -685,7 +685,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = __copysign(zero,x);
 		if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = ERANGE;
 		}
 		break;
@@ -698,7 +698,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -715,7 +715,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -732,7 +732,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -749,7 +749,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -766,7 +766,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -783,7 +783,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -804,7 +804,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
                 if (_LIB_VERSION == _POSIX_)
 		  errno = ERANGE;
-                else if (!matherr(&exc)) {
+                else if (!__matherr(&exc)) {
                   errno = ERANGE;
                 }
 		break;
@@ -821,7 +821,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("gamma: SING error\n", 18);
 		      }
@@ -838,7 +838,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x;
 		if (_LIB_VERSION == _IEEE_ ||
 		    _LIB_VERSION == _POSIX_) exc.retval = 1.0;
-		else if (!matherr(&exc)) {
+		else if (!__matherr(&exc)) {
 			errno = EDOM;
 		}
 		break;
diff --git a/sysdeps/mach/hurd/closedir.c b/sysdeps/mach/hurd/closedir.c
index 4c62783584..482e19aa20 100644
--- a/sysdeps/mach/hurd/closedir.c
+++ b/sysdeps/mach/hurd/closedir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -29,7 +28,7 @@ Cambridge, MA 02139, USA.  */
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
 int
-DEFUN(closedir, (dirp), DIR *dirp)
+__closedir (DIR *dirp)
 {
   error_t err;
 
@@ -59,4 +58,4 @@ DEFUN(closedir, (dirp), DIR *dirp)
 
   return 0;
 }
-
+weak_alias (__closedir, closedir)
diff --git a/sysdeps/mach/hurd/getrlimit.c b/sysdeps/mach/hurd/getrlimit.c
index a05d32277d..5645181978 100644
--- a/sysdeps/mach/hurd/getrlimit.c
+++ b/sysdeps/mach/hurd/getrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <sys/resource.h>
 #include <errno.h>
 #include <hurd.h>
@@ -25,8 +24,7 @@ Cambridge, MA 02139, USA.  */
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 int
-DEFUN(getrlimit, (resource, rlimits),
-      enum __rlimit_resource resource AND struct rlimit *rlimits)
+__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
 {
   struct rlimit lim;
 
@@ -44,3 +42,4 @@ DEFUN(getrlimit, (resource, rlimits),
 
   return 0;
 }
+weak_alias (__getrlimit, getrlimit)
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index bab84d52f0..9c3ae8af89 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <limits.h>
 #include <stddef.h>
@@ -34,7 +33,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Open a directory stream on NAME.  */
 DIR *
-DEFUN(opendir, (name), CONST char *name)
+__opendir (const char *name)
 {
   DIR *dirp;
   int fd;
@@ -70,3 +69,4 @@ DEFUN(opendir, (name), CONST char *name)
 
   return dirp;
 }
+weak_alias (__opendir, opendir)
diff --git a/sysdeps/mach/hurd/readdir.c b/sysdeps/mach/hurd/readdir.c
index 715f9278a2..2ff43e30ca 100644
--- a/sysdeps/mach/hurd/readdir.c
+++ b/sysdeps/mach/hurd/readdir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <limits.h>
 #include <stddef.h>
@@ -31,7 +30,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Read a directory entry from DIRP.  */
 struct dirent *
-DEFUN(readdir, (dirp), DIR *dirp)
+__readdir (DIR *dirp)
 {
   struct dirent *dp;
 
@@ -104,3 +103,4 @@ DEFUN(readdir, (dirp), DIR *dirp)
 
   return dp;
 }
+weak_alias (__readdir, readdir)
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index af858a2643..2d8011e276 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -286,10 +286,10 @@ __getcwd (buf, size)
       mount_point = dotdev != thisdev;
 
       /* Search for the last directory.  */
-      dirstream = opendir (dotp);
+      dirstream = __opendir (dotp);
       if (dirstream == NULL)
 	goto lose;
-      while ((d = readdir (dirstream)) != NULL)
+      while ((d = __readdir (dirstream)) != NULL)
 	{
 	  if (d->d_name[0] == '.' &&
 	      (d->d_name[1] == '\0' ||
@@ -304,7 +304,7 @@ __getcwd (buf, size)
 	      if (__lstat (name, &st) < 0)
 		{
 		  int save = errno;
-		  (void) closedir (dirstream);
+		  (void) __closedir (dirstream);
 		  errno = save;
 		  goto lose;
 		}
@@ -315,7 +315,7 @@ __getcwd (buf, size)
       if (d == NULL)
 	{
 	  int save = errno;
-	  (void) closedir (dirstream);
+	  (void) __closedir (dirstream);
 	  errno = save;
 	  goto lose;
 	}
@@ -336,7 +336,7 @@ __getcwd (buf, size)
 		  buf = realloc (path, size);
 		  if (buf == NULL)
 		    {
-		      (void) closedir (dirstream);
+		      (void) __closedir (dirstream);
 		      free (path);
 		      errno = ENOMEM; /* closedir might have changed it.  */
 		      return NULL;
@@ -348,7 +348,7 @@ __getcwd (buf, size)
 	  pathp -= namlen;
 	  (void) memcpy (pathp, d->d_name, namlen);
 	  *--pathp = '/';
-	  (void) closedir (dirstream);
+	  (void) __closedir (dirstream);
 	}
 
       thisdev = dotdev;
diff --git a/sysdeps/posix/getdtsz.c b/sysdeps/posix/getdtsz.c
index 2080dc7c51..22ecb4f890 100644
--- a/sysdeps/posix/getdtsz.c
+++ b/sysdeps/posix/getdtsz.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,17 +16,21 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
+#include <limits.h>
 #include <unistd.h>
-
-extern long int EXFUN(__sysconf, (int));
+#include <sys/resource.h>
 
 /* Return the maximum number of file descriptors
    the current process could possibly have.  */
 int
-DEFUN_VOID(__getdtablesize)
+__getdtablesize (void)
 {
-  return __sysconf (_SC_OPEN_MAX);
+  struct rlimit ru;
+
+  /* This should even work if `getrlimit' is not implemented.  POSIX.1
+     does not define this function but we will generate a stub which
+     returns -1.  */
+  return __getrlimit (RLIMIT_NOFILE, &ru) < 0 ? OPEN_MAX : ru.rlim_cur;
 }
 
 weak_alias (__getdtablesize, getdtablesize)
diff --git a/sysdeps/posix/sigsetmask.c b/sysdeps/posix/sigsetmask.c
index 12e77a619d..87756278ad 100644
--- a/sysdeps/posix/sigsetmask.c
+++ b/sysdeps/posix/sigsetmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,29 +16,28 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <signal.h>
 
 /* Set the mask of blocked signals to MASK, returning the old mask.  */
 int
-DEFUN(__sigsetmask, (mask), int mask)
+__sigsetmask (int mask)
 {
   register int sig;
   sigset_t set, oset;
 
-  if (__sigemptyset(&set) < 0)
+  if (__sigemptyset (&set) < 0)
     return -1;
-  
+
   if (sizeof (mask) == sizeof (set))
     *(int *) &set = mask;
   else
     for (sig = 1; sig < NSIG; ++sig)
       if ((mask & sigmask(sig)) &&
-	  __sigaddset(&set, sig) < 0)
+	  __sigaddset (&set, sig) < 0)
 	return -1;
 
-  if (sigprocmask(SIG_SETMASK, &set, &oset) < 0)
+  if (__sigprocmask (SIG_SETMASK, &set, &oset) < 0)
     return -1;
 
   mask = 0;
@@ -46,8 +45,8 @@ DEFUN(__sigsetmask, (mask), int mask)
     mask = *(int *) &oset;
   else
     for (sig = 1; sig < NSIG; ++sig)
-      if (__sigismember(&oset, sig))
-	mask |= sigmask(sig);
+      if (__sigismember (&oset, sig))
+	mask |= sigmask (sig);
 
   return mask;
 }
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index dda72a3591..5b2caf66f6 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -18,10 +18,12 @@ Cambridge, MA 02139, USA.  */
 
 #include <errno.h>
 #include <limits.h>
-#include <unistd.h>
+#include <grp.h>
+#include <pwd.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <time.h>
+#include <unistd.h>
 
 extern int __getdtablesize __P ((void));
 extern size_t __getpagesize __P ((void));
@@ -480,6 +482,119 @@ __sysconf (name)
 #else
       return -1;
 #endif
+
+      /* POSIX 1003.1c (POSIX Threads).  */
+    case _SC_THREADS:
+#ifdef	_POSIX_THREADS
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_SAFE_FUNCTIONS:
+#ifdef	_POSIX_THREAD_SAFE_FUNCTIONS
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_GETGR_R_SIZE_MAX:
+#ifdef	NSS_BUFLEN_GROUP
+      return NSS_BUFLEN_GROUP;
+#else
+      return -1;
+#endif
+
+    case _SC_GETPW_R_SIZE_MAX:
+#ifdef	NSS_BUFLEN_PASSWD
+      return NSS_BUFLEN_PASSWD;
+#else
+      return -1;
+#endif
+
+    case _SC_LOGIN_NAME_MAX:
+#ifdef	_POSIX_LOGIN_NAME_MAX
+      return _POSIX_LOGIN_NAME_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_TTY_NAME_MAX:
+#ifdef	_POSIX_TTY_NAME_MAX
+      return _POSIX_TTY_NAME_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_DESTRUCTOR_ITERATIONS:
+#ifdef	PTHREAD_DESTRUCTOR_ITERATIONS
+      return PTHREAD_DESTRUCTOR_ITERATIONS;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_KEYS_MAX:
+#ifdef	PTHREAD_KEYS_MAX
+      return PTHREAD_KEYS_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_STACK_MIN:
+#ifdef	PTHREAD_STACK_MIN
+      return PTHREAD_STACK_MIN;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_THREADS_MAX:
+#ifdef	PTHREAD_THREADS_MAX
+      return PTHREAD_THREADS_MAX;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_ATTR_STACKADDR:
+#ifdef	_POSIX_THREAD_ATTR_STACKADDR
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_ATTR_STACKSIZE:
+#ifdef	_POSIX_THREAD_ATTR_STACKSIZE
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PRIORITY_SCHEDULING:
+#ifdef	_POSIX_THREAD_PRIORITY_SCHEDULING
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PRIO_INHERIT:
+#ifdef	_POSIX_THREAD_PRIO_INHERIT
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PRIO_PROTECT:
+#ifdef	_POSIX_THREAD_PRIO_PROTECT
+      return 1;
+#else
+      return -1;
+#endif
+
+    case _SC_THREAD_PROCESS_SHARED:
+#ifdef	_POSIX_THREAD_PROCESS_SHARED
+      return 1;
+#else
+      return -1;
+#endif
     }
 }
 
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index 4450a83326..a05dbd5be3 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -33,7 +33,7 @@ Cambridge, MA 02139, USA.  */
 /* Store at most BUFLEN character of the pathname of the terminal FD is
    open on in BUF.  Return 0 on success, -1 otherwise.  */
 int
-ttyname_r (fd, buf, buflen)
+__ttyname_r (fd, buf, buflen)
      int fd;
      char *buf;
      int buflen;
@@ -89,3 +89,4 @@ ttyname_r (fd, buf, buflen)
   errno = save;
   return -1;
 }
+weak_alias (__ttyname_r, ttyname_r)
diff --git a/sysdeps/stub/closedir.c b/sysdeps/stub/closedir.c
index fbc1ebe3d4..5fb2ed3e7d 100644
--- a/sysdeps/stub/closedir.c
+++ b/sysdeps/stub/closedir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <dirent.h>
@@ -25,11 +24,11 @@ Cambridge, MA 02139, USA.  */
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
 int
-DEFUN(closedir, (dirp), DIR *dirp)
+__closedir (DIR *dirp)
 {
   errno = ENOSYS;
-  return(-1);
+  return -1;
 }
-
+weak_alias (__closedir, closedir)
 
 stub_warning (closedir)
diff --git a/sysdeps/stub/getrlimit.c b/sysdeps/stub/getrlimit.c
index 8553c5f262..a3f31448bc 100644
--- a/sysdeps/stub/getrlimit.c
+++ b/sysdeps/stub/getrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,19 +16,17 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <sys/resource.h>
 #include <errno.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 int
-DEFUN(getrlimit, (resource, rlimits),
-      enum __rlimit_resource resource AND struct rlimit *rlimits)
+__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
 {
   errno = ENOSYS;
   return -1;
 }
-
+weak_alias (__getrlimit, getrlimit)
 
 stub_warning (getrlimit)
diff --git a/sysdeps/stub/opendir.c b/sysdeps/stub/opendir.c
index e2124c79ad..f0d7784d1e 100644
--- a/sysdeps/stub/opendir.c
+++ b/sysdeps/stub/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <dirent.h>
@@ -24,11 +23,11 @@ Cambridge, MA 02139, USA.  */
 
 /* Open a directory stream on NAME.  */
 DIR *
-DEFUN(opendir, (name), CONST char *name)
+__opendir (const char *name)
 {
   errno = ENOSYS;
-  return(NULL);
+  return NULL;
 }
-
+weak_alias (__opendir, opendir)
 
 stub_warning (opendir)
diff --git a/sysdeps/stub/readdir.c b/sysdeps/stub/readdir.c
index ad23ac1afc..d210906dbd 100644
--- a/sysdeps/stub/readdir.c
+++ b/sysdeps/stub/readdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,18 +16,17 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <dirent.h>
 
 /* Read a directory entry from DIRP.  */
 struct dirent *
-DEFUN(readdir, (dirp), DIR *dirp)
+__readdir (DIR *dirp)
 {
   errno = ENOSYS;
-  return(NULL);
+  return NULL;
 }
-
+weak_alias (__readdir, readdir)
 
 stub_warning (readdir)
diff --git a/sysdeps/stub/sysconf.c b/sysdeps/stub/sysconf.c
index f3b0c352ca..613ef674b8 100644
--- a/sysdeps/stub/sysconf.c
+++ b/sysdeps/stub/sysconf.c
@@ -128,6 +128,23 @@ __sysconf (name)
     case _SC_2_FORT_DEV:
     case _SC_2_SW_DEV:
 
+    case _SC_THREADS:
+    case _SC_THREAD_SAFE_FUNCTIONS:
+    case _SC_GETGR_R_SIZE_MAX:
+    case _SC_GETPW_R_SIZE_MAX:
+    case _SC_LOGIN_NAME_MAX:
+    case _SC_TTY_NAME_MAX:
+    case _SC_THREAD_DESTRUCTOR_ITERATIONS:
+    case _SC_THREAD_KEYS_MAX:
+    case _SC_THREAD_STACK_MIN:
+    case _SC_THREAD_THREADS_MAX:
+    case _SC_THREAD_ATTR_STACKADDR:
+    case _SC_THREAD_ATTR_STACKSIZE:
+    case _SC_THREAD_PRIORITY_SCHEDULING:
+    case _SC_THREAD_PRIO_INHERIT:
+    case _SC_THREAD_PRIO_PROTECT:
+    case _SC_THREAD_PROCESS_SHARED:
+
       break;
     }
 
diff --git a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h b/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
index b5d3704e6c..485dec9b81 100644
--- a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
+++ b/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
@@ -1,5 +1,5 @@
 /* Bit values for resource limits.  SunOS 4 version.
-Copyright (C) 1994 Free Software Foundation, Inc.
+Copyright (C) 1994, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -27,22 +27,30 @@ enum __rlimit_resource
   {
     /* Per-process CPU limit, in seconds.  */
     RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
     /* Largest file that can be created, in bytes.  */
     RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
     /* Maximum size of data segment, in bytes.  */
     RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
     /* Maximum size of stack segment, in bytes.  */
     RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
     /* Largest core file that can be created, in bytes.  */
     RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
     /* Largest resident set size, in bytes.
        This affects swapping; processes that are exceeding their
        resident set size will be more likely to have physical memory
        taken from them.  */
     RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
     /* Number of open files.  */
     RLIMIT_NOFILE,
     RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
+#defin	RLIMIT_NOFILE	RLIMIT_NOFILE
+#defin	RLIMIT_OFILE	RLIMIT_OFILE
 
     RLIM_NLIMITS
   };
diff --git a/sysdeps/unix/closedir.c b/sysdeps/unix/closedir.c
index 1d4fd8eef0..5b938a8272 100644
--- a/sysdeps/unix/closedir.c
+++ b/sysdeps/unix/closedir.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -27,7 +26,7 @@ Cambridge, MA 02139, USA.  */
 /* Close the directory stream DIRP.
    Return 0 if successful, -1 if not.  */
 int
-DEFUN(closedir, (dirp), DIR *dirp)
+__closedir (DIR *dirp)
 {
   int fd;
 
@@ -40,12 +39,12 @@ DEFUN(closedir, (dirp), DIR *dirp)
   __libc_lock_lock (dirp->lock);
 
   fd = dirp->fd;
-  free ((PTR) dirp->data);
+  free ((void *) dirp->data);
 
   __libc_lock_fini (dirp->lock);
 
-  free ((PTR) dirp);
+  free ((void *) dirp);
 
   return __close (fd);
 }
-
+weak_alias (__closedir, closedir)
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c
index 246b488f51..5a8ad96df2 100644
--- a/sysdeps/unix/getlogin.c
+++ b/sysdeps/unix/getlogin.c
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
@@ -30,7 +29,7 @@ Cambridge, MA 02139, USA.  */
    The returned pointer, if not NULL, is good only until the next call.  */
 
 char *
-DEFUN_VOID(getlogin)
+getlogin (void)
 {
   char tty_pathname[2 + 2 * NAME_MAX];
   char *real_tty_path = tty_pathname;
@@ -44,7 +43,7 @@ DEFUN_VOID(getlogin)
     if (d < 0)
       return NULL;
 
-    if (ttyname_r (d, real_tty_path, sizeof (tty_pathname)) < 0)
+    if (__ttyname_r (d, real_tty_path, sizeof (tty_pathname)) < 0)
       err = errno;
     (void) close (d);
 
@@ -57,9 +56,9 @@ DEFUN_VOID(getlogin)
 
   real_tty_path += 5;		/* Remove "/dev/".  */
 
-  setutent_r (&utmp_data);
+  __setutent_r (&utmp_data);
   strncpy (line.ut_line, real_tty_path, sizeof line.ut_line);
-  if (getutline_r (&line, &ut, &utmp_data) < 0)
+  if (__getutline_r (&line, &ut, &utmp_data) < 0)
     {
       if (errno == ESRCH)
 	/* The caller expects ENOENT if nothing is found.  */
@@ -69,7 +68,7 @@ DEFUN_VOID(getlogin)
   else
     result = ut->ut_line;
 
-  endutent_r (&utmp_data);
+  __endutent_r (&utmp_data);
 
   return result;
 }
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 8dca80b3ae..890d428086 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -31,7 +31,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Open a directory stream on NAME.  */
 DIR *
-opendir (const char *name)
+__opendir (const char *name)
 {
   DIR *dirp;
   struct stat statbuf;
@@ -49,7 +49,7 @@ opendir (const char *name)
   if (fd < 0)
     return NULL;
 
-  if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
+  if (__fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
     goto lose;
 
   if (fstat (fd, &statbuf) < 0)
@@ -95,3 +95,4 @@ opendir (const char *name)
 
   return dirp;
 }
+weak_alias (__opendir, opendir)
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index 5d0c40fdc1..46f2caff87 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -30,7 +30,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Read a directory entry from DIRP.  */
 struct dirent *
-readdir (DIR *dirp)
+__readdir (DIR *dirp)
 {
   struct dirent *dp;
 
@@ -105,3 +105,4 @@ readdir (DIR *dirp)
 
   return dp;
 }
+weak_alias (__readdir, readdir)
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 5b3e30de89..0da9d17b07 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -18,7 +18,7 @@ getgroups	-	getgroups	2	__getgroups	getgroups
 getitimer	-	getitimer	2	__getitimer	getitimer
 getpid		-	getpid		0	__getpid	getpid
 getpriority	-	getpriority	2	getpriority
-getrlimit	-	getrlimit	2	getrlimit
+getrlimit	-	getrlimit	2	__getrlimit	getrlimit
 getuid		-	getuid		0	__getuid	getuid
 ioctl		-	ioctl		3	__ioctl		ioctl
 kill		-	kill		2	__kill		kill
@@ -33,7 +33,7 @@ readlink	-	readlink	3	__readlink	readlink
 readv		-	readv		3	readv
 reboot		-	reboot		1	reboot
 rename		-	rename		2	rename
-rmdir		-	rmdir		1	__rmdir	rmdir
+rmdir		-	rmdir		1	__rmdir		rmdir
 select		-	select		5	__select	select
 setdomain	-	setdomainname	2	setdomainname
 setegid		-	setegid		1	__setegid	setegid
diff --git a/sysdeps/unix/sysv/linux/alpha/resourcebits.h b/sysdeps/unix/sysv/linux/alpha/resourcebits.h
new file mode 100644
index 0000000000..a53d523a1e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/resourcebits.h
@@ -0,0 +1,63 @@
+/* Bit values for resource limits.  Linux/Alpha version.
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These are the values for Linux/Alpha.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Address space limit.  */
+    RLIMIT_AS,
+#define	RLIMIT_AS	RLIMIT_AS
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
+  };
diff --git a/sysdeps/unix/sysv/linux/i386/resourcebits.h b/sysdeps/unix/sysv/linux/i386/resourcebits.h
new file mode 100644
index 0000000000..b4713bf3d6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/resourcebits.h
@@ -0,0 +1,63 @@
+/* Bit values for resource limits.  Linux/i386 version.
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These are the values for Linux/i386.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+    /* Address space limit.  */
+    RLIMIT_AS,
+#define	RLIMIT_AS	RLIMIT_AS
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
+  };
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index a63200c1ae..aa7d9c4ac0 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -20,6 +20,7 @@ Cambridge, MA 02139, USA.  */
 #include <unistd.h>
 #include <sysdep.h>
 #include <fpu_control.h>
+#include <linux/personality.h>
 #include "init-first.h"
 
 extern void __libc_init (int, char **, char **);
@@ -28,6 +29,11 @@ extern void __libc_global_ctors (void);
 /* The function is called from assembly stubs the compiler can't see.  */
 static void init (void *) __attribute__ ((unused));
 
+extern int __libc_is_static;
+#ifdef PIC
+weak_extern (__libc_is_static)
+#endif
+
 static void
 init (void *data)
 {
@@ -37,15 +43,36 @@ init (void *data)
   char **argv = (char **)data + 1;
   char **envp = &argv[argc + 1];
 
-  /* The `personality' system call takes one argument that chooses the
-     "personality", i.e. the set of system calls and such.  Zero is the
-     native Linux value; we must make this call first thing to disable
-     emulation of some other system that might have been enabled by default
-     based on the executable format.  */
-  __personality (0);
-
-  /* Set the FPU control word to the proper default value.  */
-  __setfpucw (__fpu_control);
+#ifdef PIC
+  if (&__libc_is_static != NULL)
+#endif
+    {
+#ifdef PIC
+      /* We must not call `personality' twice.  */
+      if (__libc_is_static == 0)
+#endif
+	{
+	  /* The `personality' system call takes one argument that
+	     chooses the "personality", i.e. the set of system calls
+	     and such.  We must make this call first thing to disable
+	     emulation of some other system that might have been
+	     enabled by default based on the executable format.  */
+	  __personality (PER_LINUX);
+
+	  /* Set the FPU control word to the proper default value.  */
+	  __setfpucw (__fpu_control);
+	}
+
+      /* We set LIBC_IS_STATIC to a value > 0 for the static library
+	 and < 0 for the shared library.  This information might be
+	 useful for the running program but it is mainly necessary for
+	 the above `if' statement.  */
+#ifdef PIC
+      __libc_is_static = -1;
+#else
+      __libc_is_static = 1;
+#endif
+    }
 
   __environ = envp;
   __libc_init (argc, argv, envp);
diff --git a/sysdeps/unix/sysv/linux/resourcebits.h b/sysdeps/unix/sysv/linux/m68k/resourcebits.h
index 9cd6ab46d8..65cc6e550a 100644
--- a/sysdeps/unix/sysv/linux/resourcebits.h
+++ b/sysdeps/unix/sysv/linux/m68k/resourcebits.h
@@ -1,4 +1,4 @@
-/* Bit values for resource limits.  Linux version.
+/* Bit values for resource limits.  Linux/m68k version.
 Copyright (C) 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
@@ -17,33 +17,43 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-/* These are the values for Linux.  */
+/* These are the values for Linux/m68k.  */
 
 /* Kinds of resource limit.  */
 enum __rlimit_resource
   {
     /* Per-process CPU limit, in seconds.  */
     RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
     /* Largest file that can be created, in bytes.  */
     RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
     /* Maximum size of data segment, in bytes.  */
     RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
     /* Maximum size of stack segment, in bytes.  */
     RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
     /* Largest core file that can be created, in bytes.  */
     RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
     /* Largest resident set size, in bytes.
        This affects swapping; processes that are exceeding their
        resident set size will be more likely to have physical memory
        taken from them.  */
     RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
     /* Number of processes.  */
     RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
     /* Number of open files.  */
     RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
     RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
     /* Locked-in-memory address space.  */
     RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
 
     RLIMIT_NLIMITS,		/* Number of limit flavors.  */
     RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
diff --git a/sysdeps/unix/sysv/linux/mips/resourcebits.h b/sysdeps/unix/sysv/linux/mips/resourcebits.h
new file mode 100644
index 0000000000..095f40b09c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/resourcebits.h
@@ -0,0 +1,65 @@
+/* Bit values for resource limits.  Linux/MIPS version.
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These are the values for Linux/MIPS.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Address space limit.  */
+    RLIMIT_AS,
+#define	RLIMIT_AS	RLIMIT_AS
+    RLIMIT_VMEM = RLIMIT_AS,
+#define	RLIMIT_VMEM	RLIMIT_VMEM
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
+  };
diff --git a/sysdeps/unix/sysv/sysv4/getdtsz.c b/sysdeps/unix/sysv/sysv4/getdtsz.c
deleted file mode 100644
index c1ae6108fb..0000000000
--- a/sysdeps/unix/sysv/sysv4/getdtsz.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Solaris uses sysconf ala POSIX.1.  */
-#include <sysdeps/posix/getdtsz.c>
diff --git a/time/Makefile b/time/Makefile
index d77c6c5f2d..84e52306d7 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -25,9 +25,9 @@ headers	:= time.h sys/time.h sys/timeb.h timebits.h
 distribute := tzfile.h private.h scheck.c ialloc.c yearistype
 extra-objs = scheck.o ialloc.o $(tzfiles:%=z.%)
 
-routines	:= offtime asctime clock ctime difftime gmtime	\
-		   localtime mktime strftime time tzset tzfile	\
-		   gettimeofday settimeofday adjtime		\
+routines	:= offtime asctime clock ctime ctime_r difftime	\
+		   gmtime localtime mktime strftime time tzset	\
+		   tzfile gettimeofday settimeofday adjtime	\
 		   getitimer setitimer				\
 		   stime dysize timegm ftime			\
 		   strptime
diff --git a/time/asctime.c b/time/asctime.c
index 644df3277f..bb20a3aedc 100644
--- a/time/asctime.c
+++ b/time/asctime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,28 +16,34 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include "../locale/localeinfo.h"
 #include <errno.h>
 #include <stdio.h>
 #include <time.h>
 
 
+static const char format[] = "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n";
+static char result[	         3+1+ 3+1+20+1+20+1+20+1+20+1+20+1 + 1];
+
 /* Returns a string of the form "Day Mon dd hh:mm:ss yyyy\n"
    which is the representation of TP in that form.  */
 char *
-DEFUN(asctime, (tp), CONST struct tm *tp)
+asctime (const struct tm *tp)
 {
-  static const char format[] = "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n";
-  static char result[	         3+1+ 3+1+20+1+20+1+20+1+20+1+20+1 + 1];
+  return __asctime_r (tp, result);
+}
+
 
+char *
+__asctime_r (const struct tm *tp, char *buf)
+{
   if (tp == NULL)
     {
       errno = EINVAL;
       return NULL;
     }
-  
-  if (sprintf (result, format,
+
+  if (sprintf (buf, format,
 	       (tp->tm_wday < 0 || tp->tm_wday >= 7 ?
 		"???" : _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)),
 	       (tp->tm_mon < 0 || tp->tm_mon >= 12 ?
@@ -46,5 +52,6 @@ DEFUN(asctime, (tp), CONST struct tm *tp)
 	       tp->tm_sec, 1900 + tp->tm_year) < 0)
     return NULL;
 
-  return result;
+  return buf;
 }
+weak_alias (__asctime_r, asctime_r)
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/time/ctime_r.c
index 2ae584f164..e1981892dd 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/time/ctime_r.c
@@ -1,4 +1,7 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* ctime_r - return in BUF representation of time T in form of asctime
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
 The GNU C Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public License as
@@ -15,23 +18,13 @@ 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.  */
 
-/* On Linux we must not ask __getdtablesize for te value for _SC_OPEN_MAX
-   because this would mean an endless loop.  */
+#include <time.h>
 
-#include <limits.h>
-#include <unistd.h>
-
-extern long int __default_sysconf (int name);
-
-long int
-__sysconf (int name)
+/* Return a string as returned by asctime which is the representation
+   of *T in that form.  Reentrant version.  */
+char *
+ctime_r (const time_t *t, char *buf)
 {
-  if (name == _SC_OPEN_MAX)
-    return OPEN_MAX;
-
-  return __default_sysconf (name);
+  struct tm tm;
+  return asctime_r (localtime_r (t, &tm), buf);
 }
-
-#define __sysconf __default_sysconf
-
-#include <sysdeps/posix/sysconf.c>
diff --git a/time/time.h b/time/time.h
index 62e098ee46..6b955f1986 100644
--- a/time/time.h
+++ b/time/time.h
@@ -177,7 +177,7 @@ extern struct tm *__localtime_r __P ((__const time_t *__timer,
 				      struct tm *__tp));
 extern struct tm *localtime_r __P ((__const time_t *__timer,
 				    struct tm *__tp));
-#endif
+#endif	/* reentrant */
 
 /* Compute the `struct tm' representation of *T,
    offset OFFSET seconds east of UTC,
@@ -193,6 +193,18 @@ extern char *asctime __P ((__const struct tm *__tp));
 /* Equivalent to `asctime(localtime(timer))'.  */
 extern char *ctime __P ((__const time_t *__timer));
 
+#ifdef	__USE_REENTRANT
+/* Reentrant versions of the above functions.  */
+
+/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
+   that is the representation of TP in this format.  */
+extern char *__asctime_r __P ((__const struct tm *__tp, char *__buf));
+extern char *asctime_r __P ((__const struct tm *__tp, char *__buf));
+
+/* Equivalent to `asctime_r(localtime_r(timer, *TMP*), buf)'.  */
+extern char *ctime_r __P ((__const time_t *__timer, char *__buf));
+#endif	/* reentrant */
+
 
 /* Defined in localtime.c.  */
 extern char *__tzname[2];	/* Current timezone names.  */
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 07fb0c4bff..056f7be517 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA.  */
 static mbstate_t internal;
 
 size_t
-mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
+__mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
 {
   size_t used = 0;
 
@@ -128,3 +128,4 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
 
   return (size_t) -2;
 }
+weak_alias (__mbrtowc, mbrtowc)
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index 712b199271..d7305d6904 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA.  */
 static mbstate_t internal;
 
 size_t
-mbsrtowcs (dst, src, len, ps)
+__mbsrtowcs (dst, src, len, ps)
      wchar_t *dst;
      const char **src;
      size_t len;
@@ -135,3 +135,4 @@ mbsrtowcs (dst, src, len, ps)
 
   return written;
 }
+weak_alias (__mbsrtowcs, mbsrtowcs)
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 0346364b44..db3c08d833 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -151,10 +151,13 @@ extern int mbsinit __P ((__const mbstate_t *__ps));
 
 /* Write wide character representation of multibyte character pointed
    to by S to PWC.  */
+extern size_t __mbrtowc __P ((wchar_t *__pwc, __const char *__s, size_t __n,
+			      mbstate_t *__p));
 extern size_t mbrtowc __P ((wchar_t *__pwc, __const char *__s, size_t __n,
 			    mbstate_t *__p));
 
 /* Write multibyte representation of wide character WC to S.  */
+extern size_t __wcrtomb __P ((char *__s, wchar_t __wc, mbstate_t *__ps));
 extern size_t wcrtomb __P ((char *__s, wchar_t __wc, mbstate_t *__ps));
 
 /* Return number of bytes in multibyte character pointed to by S.  */
@@ -165,16 +168,20 @@ extern size_t mbrlen __P ((__const char *__s, size_t __n, mbstate_t *__ps));
     && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
 /* Define inline function as optimization.  */
 extern __inline size_t mbrlen (__const char *s, size_t n, mbstate_t *ps)
-{ return ps != NULL ? mbrtowc (NULL, s, n, ps) : __mbrlen (s, n, NULL); }
+{ return ps != NULL ? __mbrtowc (NULL, s, n, ps) : __mbrlen (s, n, NULL); }
 #endif
 
 /* Write wide character representation of multibyte character string
    SRC to DST.  */
+extern size_t __mbsrtowcs __P ((wchar_t *__dst, __const char **__src,
+				size_t __len, mbstate_t *__ps));
 extern size_t mbsrtowcs __P ((wchar_t *__dst, __const char **__src,
 			      size_t __len, mbstate_t *__ps));
 
 /* Write multibyte character representation of wide character string
    SRC to DST.  */
+extern size_t __wcsrtombs __P ((char *__dst, __const wchar_t **__src,
+				size_t __len, mbstate_t *__ps));
 extern size_t wcsrtombs __P ((char *__dst, __const wchar_t **__src,
 			      size_t __len, mbstate_t *__ps));
 
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index eb007a69b9..052a5b951b 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -38,7 +38,7 @@ static const unsigned char encoding_byte[] =
 static mbstate_t internal;
 
 size_t
-wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
+__wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
 {
   char fake[1];
   size_t written = 0;
@@ -89,3 +89,4 @@ wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
 
   return written;
 }
+weak_alias (__wcrtomb, wcrtomb)
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index 99ca6acc5b..999e291eb2 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -40,7 +40,7 @@ static const unsigned char encoding_byte[] =
 static mbstate_t internal;
 
 size_t
-wcsrtombs (dst, src, len, ps)
+__wcsrtombs (dst, src, len, ps)
      char *dst;
      const wchar_t **src;
      size_t len;
@@ -122,3 +122,4 @@ wcsrtombs (dst, src, len, ps)
 
   return written;
 }
+weak_alias (__wcsrtombs, wcsrtombs)