summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog85
-rw-r--r--Makefile4
-rw-r--r--Makerules9
-rw-r--r--bits/confname.h6
-rw-r--r--bits/dlfcn.h7
-rw-r--r--bits/sigthread.h24
-rw-r--r--bits/types.h3
-rw-r--r--elf/Versions2
-rw-r--r--elf/dl-reloc.c1
-rw-r--r--elf/dlfcn.h8
-rw-r--r--elf/ldsodefs.h3
-rw-r--r--elf/rtld.c23
-rw-r--r--iconv/skeleton.c9
-rw-r--r--io/fcntl.h9
-rw-r--r--libio/fileops.c4
-rw-r--r--libio/libio.h17
-rw-r--r--libio/stdio.h6
-rw-r--r--linuxthreads/ChangeLog9
-rw-r--r--linuxthreads/Versions2
-rw-r--r--linuxthreads/mutex.c2
-rw-r--r--linuxthreads/sysdeps/pthread/pthread.h29
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h32
-rw-r--r--misc/getttyent.c4
-rw-r--r--misc/mntent_r.c5
-rw-r--r--posix/bits/posix1_lim.h7
-rw-r--r--posix/regex.h2
-rw-r--r--posix/unistd.h25
-rw-r--r--scripts/versions.awk (renamed from versions.awk)31
-rw-r--r--signal/Makefile3
-rw-r--r--signal/signal.h3
-rw-r--r--stdlib/stdlib.h2
-rw-r--r--sysdeps/generic/bits/confname.h6
-rw-r--r--sysdeps/generic/bits/dlfcn.h7
-rw-r--r--sysdeps/generic/bits/sigthread.h24
-rw-r--r--sysdeps/generic/bits/types.h3
-rw-r--r--sysdeps/generic/dl-sysdep.c20
-rw-r--r--sysdeps/posix/pathconf.c11
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fpathconf.c64
-rw-r--r--sysdeps/unix/sysv/linux/alpha/pathconf.c57
-rw-r--r--sysdeps/unix/sysv/linux/bits/errno.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h14
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/fstatvfs.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/dl-librecon.h3
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/types.h3
-rw-r--r--sysdeps/wordsize-32/stdint.h3
-rw-r--r--sysdeps/wordsize-64/stdint.h3
51 files changed, 544 insertions, 74 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e79745d05..6d23e62944 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,88 @@
+1998-07-08 22:18  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/Versions: Add _dl_mcount_wrapper_check.
+	* elf/dlfcn.h (DL_CALL_FCT): Don't test _dl_profile_map, simply use
+	_dl_mcount_wrapper_check.
+	* iconv/skeleton.c: Use DL_CALL_FCT, not _CALL_DL_FCT.
+
+	* elf/dl-reloc.c (_dl_relocate_object): Don't declare using
+	internal_function.
+	* elf/ldsodefs.h: Likewise.
+
+	* io/fcntl.h: Define SEEK_SET, SEEK_CUR, and SEEK_END.
+
+	* libio/stdio.h: Make sure va_list is defined for X/Open.
+	Define P_tmpdir for X/Open.
+
+	* posix/regex.h: Fix typo.
+
+	* posix/unistd.h: Define intptr_t if not already happened.
+	Add pthread_atfork prototype.
+	* sysdeps/generic/bits/types.h: Define __intptr_t.
+	* sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/mips/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sparc/sparc64/types.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/solaris2/bits/types.h: Likewise.
+	* sysdeps/wordsize-32/stdint.h: Don't define intptr_t if already done.
+	* sysdeps/wordsize-64/stdint.h: Likewise.
+
+	* posix/bits/posix1_lim.h: Define _POSIX_CLOCKRES_MIN.
+
+	* signal/Makefile (headers): Add bits/sigthread.h.
+	* signal/signal.h: Include bits/sigthread.h.
+	* sysdeps/generic/bits/sigthread.h: New file.
+
+	* stdlib/stdlib.h: Declare rand_r use __USE_POSIX.
+
+	* sysdeps/generic/bits/confname.h: Define _PC_FILESIZEBITS.
+	* sysdeps/posix/pathconf.c: Handle _PC_FILESIZEBITS.
+	* sysdeps/unix/sysv/linux/alpha/fpathconf.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/pathconf.c: New file.
+
+	* sysdeps/generic/bits/dlfcn.h: Define RTLD_LOCAL.
+
+	* elf/rtld.c: Remove preloading and loadpath variables in SUID
+	programs.
+	* sysdeps/generic/dl-sysdep.c: Define unsetenv.
+	* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Define other envvar
+	names.
+
+	* sysdeps/unix/sysv/linux/bits/errno.h: Define ECANCELED.
+
+	* sysdeps/unix/sysv/linux/bits/fcntl.h: Define O_RSYNC and O_DSYNC.
+	Remove O_READ and O_WRITE definition.
+
+	* sysdeps/unix/sysv/linux/bits/resource.h: Define RLIM_SAVED_MAX
+	and RLIM_SAVED_CUR.
+
+	* sysdeps/unix/sysv/linux/fstatvfs.h: Handle UFS filesystem.
+
+1998-07-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makerules ($(common-objpfx)sysd-versions): Expect awk script in
+	scripts directory.  Pass move-if-change to awk.
+	(common-generated): Add $(version-maps) and sysd-versions.
+	* versions.awk: Moved to...
+	* scripts/versions.awk: ... here.  Use move-if-change to void
+	touching unchanged files.  Print "version-maps = ..." instead of
+	"all-version-maps = ..." and without $(common-objpfx).  Explain
+	expected variable names.
+	* Makefile (distribute): Updated.
+
+1998-07-06  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* misc/getttyent.c (getttyent): Don't return with locked stream.
+	* misc/mntent_r.c (__getmntent_r): Likewise.
+
+1998-07-07 18:24  Ulrich Drepper  <drepper@cygnus.com>
+
+	* libio/fileops.c (_IO_do_write): Don't shrink wwrite buffer to zero
+	if stream is line buffered.
+	(_io_file_overflow): Likewise.
+	* libio/libio.h (_IO_putc_unlocked): Make sure that for line-buffered
+	streams writing '\n' flushes the string.
+
 1998-07-07 17:28  Ulrich Drepper  <drepper@cygnus.com>
 
 	* elf/dl-profstub.c (_dl_profile_map): Only declare variable here.
diff --git a/Makefile b/Makefile
index 6e2a603bce..431652c038 100644
--- a/Makefile
+++ b/Makefile
@@ -246,11 +246,11 @@ distribute  :=	README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS	\
 		Makefile.in sysdep.h set-hooks.h libc-symbols.h		\
 		version.h shlib-versions rpm/Makefile rpm/template	\
 		rpm/rpmrc glibcbug.in abi-tags stub-tag.h		\
-		test-skeleton.c include/des.h Versions.def versions.awk \
+		test-skeleton.c include/des.h Versions.def		\
 		$(addprefix scripts/,					\
 			    rellns-sh config.sub config.guess		\
 			    mkinstalldirs move-if-change install-sh	\
-			    test-installation.pl gen-FAQ.pl)
+			    test-installation.pl gen-FAQ.pl versions.awk)
 
 distribute := $(strip $(distribute))
 generated := $(generated) stubs.h
diff --git a/Makerules b/Makerules
index 01be04b57d..230b800e0b 100644
--- a/Makerules
+++ b/Makerules
@@ -279,13 +279,18 @@ endif
 # Generate version maps.
 ifeq ($(versioning),yes)
 -include $(common-objpfx)sysd-versions
-$(common-objpfx)sysd-versions: $(..)Versions.def $(..)versions.awk \
+$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
+generated += $(versin-maps)
+
+ifndef avoid-generated
+$(common-objpfx)sysd-versions: $(..)Versions.def $(..)scripts/versions.awk \
 			       $(wildcard $(all-subdirs:%=$(..)%/Versions)) \
 			       $(wildcard $(+sysdep_dirs:%=%/Versions))
 	$(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
+	       -v move_if_change='$(move-if-change)' \
 	       -f $(filter-out $<,$^) > $@T
 	mv -f $@T $@
-$(all-version-maps): $(common-objpfx)sysd-versions
+endif
 endif
 
 ifndef compile-command.S
diff --git a/bits/confname.h b/bits/confname.h
index 8aac5cb67d..229088d67d 100644
--- a/bits/confname.h
+++ b/bits/confname.h
@@ -1,5 +1,5 @@
 /* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -48,8 +48,10 @@ enum
 #define	_PC_ASYNC_IO			_PC_ASYNC_IO
     _PC_PRIO_IO,
 #define	_PC_PRIO_IO			_PC_PRIO_IO
-    _PC_SOCK_MAXBUF
+    _PC_SOCK_MAXBUF,
 #define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
+    _PC_FILESIZEBITS
+#define _PC_FILESIZEBITS		_PC_FILESIZEBITS
   };
 
 /* Values for the argument to `sysconf'.  */
diff --git a/bits/dlfcn.h b/bits/dlfcn.h
index 7c33694018..c2b1c9a7a1 100644
--- a/bits/dlfcn.h
+++ b/bits/dlfcn.h
@@ -1,5 +1,5 @@
 /* System dependand definitions for run-time dynamic loading.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,3 +30,8 @@
    the symbols of the loaded object and its dependencies are made
    visible as if the object were linked directly into the program.  */
 #define RTLD_GLOBAL	0x100
+
+/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
+   The implementation does this by default and so we can define the
+   value to zero.  */
+#define RTLD_LOCAL	0
diff --git a/bits/sigthread.h b/bits/sigthread.h
new file mode 100644
index 0000000000..de6f2dc73e
--- /dev/null
+++ b/bits/sigthread.h
@@ -0,0 +1,24 @@
+/* Signal handling function for threaded programs.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly.  Use <signal.h> instead"
+#endif
+
+/* There are none available in this configuration.  */
diff --git a/bits/types.h b/bits/types.h
index b985a3a49f..c6b7b8884e 100644
--- a/bits/types.h
+++ b/bits/types.h
@@ -115,4 +115,7 @@ typedef __u_quad_t __fsfilcnt64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* This definition makes this file kind of architecture dependent.  */
+typedef long int __intptr_t;
+
 #endif /* bits/types.h */
diff --git a/elf/Versions b/elf/Versions
index d908c59fd4..1b02cd328c 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -21,7 +21,7 @@ libc {
     _dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile;
 
     # functions used in other libraries
-    _dl_mcount; _dl_mcount_wrapper;
+    _dl_mcount; _dl_mcount_wrapper; _dl_mcount_wrapper_check;
   }
 }
 
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index e0eae3c2ae..1c0cbb67c4 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -27,7 +27,6 @@
 
 
 void
-internal_function
 _dl_relocate_object (struct link_map *l, struct link_map *scope[], int lazy,
 		     int consider_profiling)
 {
diff --git a/elf/dlfcn.h b/elf/dlfcn.h
index e0b17d392a..2f890bfe24 100644
--- a/elf/dlfcn.h
+++ b/elf/dlfcn.h
@@ -82,13 +82,9 @@ extern int dladdr __P ((const void *__address, Dl_info *__info));
         foo = DL_CALL_FCT (fctp, (arg1, arg2));
 */
 # if __GNUC__ >= 2
-/* Do not ever use this variable directly, it is internal!  */
-extern struct link_map *_dl_profile_map;
-
 #  define DL_CALL_FCT(fctp, args) \
-  (__extension__ ({ if (_dl_profile_map != NULL)			      \
-		      _dl_mcount_wrapper_check (fctp);			      \
-		    (*fctp) args; })
+  (__extension__ ({ _dl_mcount_wrapper_check (fctp);			      \
+		    (*fctp) args; }))
 # else
 /* This feature is not available without GCC.  */
 #  define DL_CALL_FCT(fctp, args) (*fctp) args
diff --git a/elf/ldsodefs.h b/elf/ldsodefs.h
index 6814f25556..847d5cec12 100644
--- a/elf/ldsodefs.h
+++ b/elf/ldsodefs.h
@@ -365,8 +365,7 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname,
    If LAZY is nonzero, don't relocate its PLT.  */
 extern void _dl_relocate_object (struct link_map *map,
 				 struct link_map *scope[],
-				 int lazy, int consider_profiling)
-     internal_function;
+				 int lazy, int consider_profiling);
 
 /* Check the version dependencies of all objects available through
    MAP.  If VERBOSE print some more diagnostics.  */
diff --git a/elf/rtld.c b/elf/rtld.c
index df5db230f4..f1b612166d 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1193,6 +1193,29 @@ process_envvars (enum mode *modep, int *lazyp)
 	}
     }
 
+  /* Extra security for SUID binaries.  Remove all dangerous environment
+     variables.  */
+  if (__libc_enable_secure)
+    {
+      static const char *unsecure_envvars[] =
+      {
+#ifdef EXTRA_UNSECURE_ENVVARS
+	EXTRA_UNSECURE_ENVVARS
+#endif
+      };
+      size_t cnt;
+
+      if (preloadlist != NULL)
+	unsetenv ("LD_PRELOAD");
+      if (library_path != NULL)
+	unsetenv ("LD_LIBRARY_PATH");
+
+      for (cnt = 0;
+	   cnt < sizeof (unsecure_envvars) / sizeof (unsecure_envvars[0]);
+	   ++cnt)
+	unsetenv (unsecure_envvars[cnt]);
+    }
+
   /* If we have to run the dynamic linker in debugging mode and the
      LD_DEBUG_OUTPUT environment variable is given, we write the debug
      messages to this file.  */
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 19e737ac3e..90203213ef 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -77,6 +77,7 @@
  */
 
 #include <assert.h>
+#include <dlfcn.h>
 #include <gconv.h>
 #include <string.h>
 #define __need_size_t
@@ -219,8 +220,8 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
 	  if (status == GCONV_OK)
 #endif
 	    /* Give the modules below the same chance.  */
-	    status = _CALL_DL_FCT (fct, (next_step, next_data, NULL, NULL,
-					 written, 1));
+	    status = DL_CALL_FCT (fct, (next_step, next_data, NULL, NULL,
+					written, 1));
 	}
     }
   else
@@ -286,8 +287,8 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
 	      const char *outerr = data->outbuf;
 	      int result;
 
-	      result = _CALL_DL_FCT (fct, (next_step, next_data, &outerr,
-					   outbuf, written, 0));
+	      result = DL_CALL_FCT (fct, (next_step, next_data, &outerr,
+					  outbuf, written, 0));
 
 	      if (result != GCONV_EMPTY_INPUT)
 		{
diff --git a/io/fcntl.h b/io/fcntl.h
index b75dc8934b..7c654c0503 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -48,6 +48,13 @@ __BEGIN_DECLS
 # endif
 #endif /* Use misc.  */
 
+/* XPG wants the following symbols.  */
+#ifdef __USE_XOPEN		/* <stdio.h> has the same definitions.  */
+# define SEEK_SET	0	/* Seek from beginning of file.  */
+# define SEEK_CUR	1	/* Seek from current position.  */
+# define SEEK_END	2	/* Seek from end of file.  */
+#endif	/* XPG */
+
 /* Do the file control operation described by CMD on FD.
    The remaining arguments are interpreted depending on CMD.  */
 extern int __fcntl __P ((int __fd, int __cmd, ...));
diff --git a/libio/fileops.c b/libio/fileops.c
index 1219abea5d..66c2fc514b 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -316,7 +316,7 @@ _IO_do_write (fp, data, to_do)
     fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, to_do) + 1;
   _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
   fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
-  fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+  fp->_IO_write_end = ((fp->_flags & (_IO_UNBUFFERED))
 		       ? fp->_IO_buf_base : fp->_IO_buf_end);
   return count != to_do ? EOF : 0;
 }
@@ -410,7 +410,7 @@ _IO_file_overflow (f, ch)
       f->_IO_write_end = f->_IO_buf_end;
       f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
 
-      if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
+      if (f->_flags & (_IO_UNBUFFERED))
 	f->_IO_write_end = f->_IO_write_ptr;
       f->_flags |= _IO_CURRENTLY_PUTTING;
     }
diff --git a/libio/libio.h b/libio/libio.h
index c3dd640b2f..410794f77c 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -287,10 +287,23 @@ extern int __overflow __P ((_IO_FILE *, int));
 	  && __underflow (_fp) == EOF ? EOF \
 	: *(unsigned char *) (_fp)->_IO_read_ptr)
 
-#define _IO_putc_unlocked(_ch, _fp) \
+#ifdef __GNUC__
+# define _IO_putc_unlocked(_ch, _fp) \
+  (__extension__ \
+   ({ unsigned char _chl = (_ch); \
+      (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end \
+	|| (_chl == '\n' && ((_fp)->_flags & _IO_LINE_BUF))) \
+       ? __overflow (_fp, (unsigned char) _chl) \
+       : (unsigned char) (*(_fp)->_IO_write_ptr++ = _chl)); }))
+#else
+# define _IO_putc_unlocked(_ch, _fp) \
    (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \
     ? __overflow (_fp, (unsigned char) (_ch)) \
-    : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
+    : ((unsigned char) (*(_fp)->_IO_write_ptr = (_ch)) == '\n' \
+       && ((_fp)->_flags & _IO_LINE_BUF) \
+       ? __overflow (_fp, (unsigned char) *(_fp)->_IO_write_ptr) \
+       : (unsigned char) (*(_fp)->_IO_write_ptr++)))
+#endif
 
 #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
 #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
diff --git a/libio/stdio.h b/libio/stdio.h
index b220e41081..1167d3cf39 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -32,7 +32,9 @@ __BEGIN_DECLS
 # define __need_NULL
 # include <stddef.h>
 
-# define __need___va_list
+# ifndef __USE_XOPEN
+#  define __need___va_list
+# endif
 # include <stdarg.h>
 
 # include <bits/types.h>
@@ -111,7 +113,7 @@ extern void __libc_fatal __P ((__const char *__message))
 #define SEEK_END	2	/* Seek from end of file.  */
 
 
-#ifdef	__USE_SVID
+#if defined __USE_SVID || defined __USE_XOPEN
 /* Default path prefix for `tempnam' and `tmpnam'.  */
 # define P_tmpdir	"/tmp"
 #endif
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index c149bdde9c..e5fff7590d 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,12 @@
+1998-07-08 22:26  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Versions: Add pthread_mutexattr_gettype, pthread_mutexattr_settype.
+	* mutex.c: Define weak alias pthread_mutexattr_gettype and
+	pthread_mutexattr_settype.
+	* sysdeps/pthread/pthread.h: Declare these functions.
+	Move pthread_sigmask and pthread_kill declaration in separate header.
+	* sysdeps/unix/sysv/linux/bits/sigthread.h: New file.
+
 1998-07-07 15:20  Ulrich Drepper  <drepper@cygnus.com>
 
 	* Makefile: Add rules to compile and run tests.
diff --git a/linuxthreads/Versions b/linuxthreads/Versions
index 2df1490804..abb237962a 100644
--- a/linuxthreads/Versions
+++ b/linuxthreads/Versions
@@ -91,5 +91,7 @@ libpthread {
     pthread_attr_getstacksize; pthread_attr_setstacksize;
 
     pthread_getconcurrency; pthread_setconcurrency;
+
+    pthread_mutexattr_gettype; pthread_mutexattr_settype;
   }
 }
diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c
index 54504bfbc3..44a17d5b5a 100644
--- a/linuxthreads/mutex.c
+++ b/linuxthreads/mutex.c
@@ -154,6 +154,7 @@ int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
   return 0;
 }
 weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np)
+weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_settype)
 
 int __pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind)
 {
@@ -161,6 +162,7 @@ int __pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind)
   return 0;
 }
 weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np)
+weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_gettype)
 
 /* Once-only execution */
 
diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h
index 1d402e6329..5ae6211c85 100644
--- a/linuxthreads/sysdeps/pthread/pthread.h
+++ b/linuxthreads/sysdeps/pthread/pthread.h
@@ -314,15 +314,17 @@ extern int pthread_mutexattr_init __P ((pthread_mutexattr_t *__attr));
 extern int __pthread_mutexattr_destroy __P ((pthread_mutexattr_t *__attr));
 extern int pthread_mutexattr_destroy __P ((pthread_mutexattr_t *__attr));
 
-/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_FAST_NP
-   or PTHREAD_MUTEX_RECURSIVE_NP). */
-extern int __pthread_mutexattr_setkind_np __P ((pthread_mutexattr_t *__attr,
-						int __kind));
-extern int pthread_mutexattr_setkind_np __P ((pthread_mutexattr_t *__attr,
-					      int __kind));
+#ifdef __USE_UNIX98
+/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL,
+   PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or
+   PTHREAD_MUTEX_DEFAULT).  */
+extern int pthread_mutexattr_settype __P ((pthread_mutexattr_t *__attr,
+					   int __kind));
+
 /* Return in *KIND the mutex kind attribute in *ATTR. */
-extern int pthread_mutexattr_getkind_np __P ((__const pthread_mutexattr_t *__attr,
-                                              int *__kind));
+extern int pthread_mutexattr_gettype __P ((__const pthread_mutexattr_t *__attr,
+					   int *__kind));
+#endif
 
 
 /* Functions for handling conditional variables.  */
@@ -525,16 +527,7 @@ extern void _pthread_cleanup_pop_restore __P ((struct _pthread_cleanup_buffer *_
 #endif
 
 /* Functions for handling signals. */
-
-/* Modify the signal mask for the calling thread.  The arguments have
-   the same meaning as for sigprocmask(2). */
-
-extern int pthread_sigmask __P ((int __how, __const sigset_t *__newmask,
-				 sigset_t *__oldmask));
-
-/* Send signal SIGNO to the given thread. */
-
-extern int pthread_kill __P ((pthread_t __thread, int __signo));
+#include <bits/sigthread.h>
 
 
 /* Functions for handling process creation and process execution. */
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h b/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
new file mode 100644
index 0000000000..e3aa7178bf
--- /dev/null
+++ b/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
@@ -0,0 +1,32 @@
+/* Signal handling function for threaded programs.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#if !defined _SIGNAL_H && !defined _PTHREAD_H
+# error "Never include this file directly.  Use <pthread.h> instead"
+#endif
+
+/* Functions for handling signals. */
+
+/* Modify the signal mask for the calling thread.  The arguments have
+   the same meaning as for sigprocmask(2). */
+extern int pthread_sigmask __P ((int __how, __const sigset_t *__newmask,
+				 sigset_t *__oldmask));
+
+/* Send signal SIGNO to the given thread. */
+extern int pthread_kill __P ((pthread_t __thread, int __signo));
diff --git a/misc/getttyent.c b/misc/getttyent.c
index 07018f7051..e886e58b8e 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -73,8 +73,10 @@ getttyent()
 		return (NULL);
 	flockfile (tf);
 	for (;;) {
-		if (!fgets_unlocked(p = line, sizeof(line), tf))
+		if (!fgets_unlocked(p = line, sizeof(line), tf)) {
+			funlockfile (tf);
 			return (NULL);
+		}
 		/* skip lines that are too big */
 		if (!index(p, '\n')) {
 			while ((c = getc_unlocked(tf)) != '\n' && c != EOF)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 9567a6f077..94b1d15c71 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -57,7 +57,10 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
       char *end_ptr;
 
       if (fgets_unlocked (buffer, bufsiz, stream) == NULL)
-	return NULL;
+	{
+	  funlockfile (stream);
+	  return NULL;
+	}
 
       end_ptr = strchr (buffer, '\n');
       if (end_ptr != NULL)	/* chop newline */
diff --git a/posix/bits/posix1_lim.h b/posix/bits/posix1_lim.h
index 71a7cc45a3..ee84b94a70 100644
--- a/posix/bits/posix1_lim.h
+++ b/posix/bits/posix1_lim.h
@@ -118,13 +118,16 @@
 /* Maximum length of login name.  */
 #define	_POSIX_LOGIN_NAME_MAX	9
 
+/* Maximum clock resolution in nanoseconds.  */
+#define _POSIX_CLOCKRES_MIN	20000000
+
 
 /* Get the implementation-specific values for the above.  */
 #include <bits/local_lim.h>
 
 
 #ifndef	SSIZE_MAX
-#define	SSIZE_MAX	INT_MAX
+# define SSIZE_MAX	INT_MAX
 #endif
 
 
@@ -132,7 +135,7 @@
    The current maximum can be got from `sysconf'.  */
 
 #ifndef	NGROUPS_MAX
-#define	NGROUPS_MAX	_POSIX_NGROUPS_MAX
+# define NGROUPS_MAX	_POSIX_NGROUPS_MAX
 #endif
 
 #endif	/* bits/posix1_lim.h  */
diff --git a/posix/regex.h b/posix/regex.h
index cb26d54072..0efef36e66 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -283,7 +283,7 @@ extern reg_syntax_t re_syntax_options;
 typedef enum
 {
 #if (_XOPEN_SOURCE - 0) == 500
-  REG_NOSYS = -1,	/* This will never happen for this implementation.  */
+  REG_ENOSYS = -1,	/* This will never happen for this implementation.  */
 #endif
 
   REG_NOERROR = 0,	/* Success.  */
diff --git a/posix/unistd.h b/posix/unistd.h
index c824311d2a..fa28d94d1e 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -228,6 +228,11 @@ typedef __off64_t off64_t;
 typedef __pid_t pid_t;
 #  define pid_t pid_t
 # endif
+
+# ifndef intptr_t
+typedef __intptr_t intptr_t;
+#  define intptr_t intptr_t
+# endif
 #endif	/* Unix98 */
 
 /* Values for the second argument to access.
@@ -1054,8 +1059,26 @@ extern void swab __P ((__const __ptr_t __from, __ptr_t __to, ssize_t __n));
 /* Return the name of the controlling terminal.  */
 extern char *ctermid __P ((char *__s));
 
-/* Return the name of the current user.  */
+/* Return the name of the current user.  This function should not be
+   used and might go away some time.  */
 extern char *cuserid __P ((char *__s));
+
+
+/* This function is only available if the system has POSIX threads.  */
+
+/* Install handlers to be called when a new process is created with FORK.
+   The PREPARE handler is called in the parent process just before performing
+   FORK. The PARENT handler is called in the parent process just after FORK.
+   The CHILD handler is called in the child process.  Each of the three
+   handlers can be NULL, meaning that no handler needs to be called at that
+   point.
+   PTHREAD_ATFORK can be called several times, in which case the PREPARE
+   handlers are called in LIFO order (last added with PTHREAD_ATFORK,
+   first called before FORK), and the PARENT and CHILD handlers are called
+   in FIFO (first added, first called). */
+extern int pthread_atfork __P ((void (*__prepare) (void),
+				void (*__parent) (void),
+				void (*__child) (void)));
 #endif
 
 __END_DECLS
diff --git a/versions.awk b/scripts/versions.awk
index 7565ee10ca..d6571fd039 100644
--- a/versions.awk
+++ b/scripts/versions.awk
@@ -3,6 +3,11 @@
 # (C) Copyright 1998 Free Software Foundation, Inc.
 # Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
+# This script expects the following variables to be defined:
+# defsfile		name of Versions.def file
+# buildroot		name of build directory with trailing slash
+# move_if_change	move-if-change command
+
 # Read definitions for the versions.
 BEGIN {
   nlibs=0;
@@ -23,8 +28,8 @@ BEGIN {
   }
   close(defsfile);
 
-  tmpfile = (buildroot "Versions.tmp");
-  sort = ("sort -n >" tmpfile);
+  tmpfile = buildroot "Versions.tmp";
+  sort = "sort -n > " tmpfile;
 }
 
 # Remove comment lines.
@@ -68,23 +73,29 @@ function closeversion(name) {
   printf("}%s;\n", derived[oldlib, name]) > outfile;
 }
 
+function close_and_move(name, real_name) {
+  close(name);
+  system(move_if_change " " name " " real_name " >&2");
+}
+
 # Now print the accumulated information.
 END {
   close(sort);
-  oldlib="";
-  oldver="";
-  printf("all-version-maps =");
+  oldlib = "";
+  oldver = "";
+  printf("version-maps =");
   while(getline < tmpfile) {
     if ($1 != oldlib) {
       if (oldlib != "") {
 	closeversion(oldver);
 	oldver = "";
-	close(outfile);
+	close_and_move(outfile, real_outfile);
       }
       oldlib = $1;
-      outfile = (buildroot oldlib ".map");
+      real_outfile = buildroot oldlib ".map";
+      outfile = real_outfile "T";
       firstinfile = 1;
-      printf(" $(common-objpfx)%s.map", oldlib);
+      printf(" %s.map", oldlib);
     }
     if ($2 != oldver) {
       if (oldver != "") {
@@ -101,6 +112,6 @@ END {
   }
   printf("\n");
   closeversion(oldver);
-  close(outfile);
-  system("rm " tmpfile);
+  close_and_move(outfile, real_outfile);
+  system("rm -f " tmpfile);
 }
diff --git a/signal/Makefile b/signal/Makefile
index ee15a2c5f9..9d19a963a5 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -22,7 +22,8 @@
 subdir	:= signal
 
 headers	:= signal.h sys/signal.h bits/signum.h bits/sigcontext.h \
-	   bits/sigaction.h bits/sigset.h bits/siginfo.h bits/sigstack.h
+	   bits/sigaction.h bits/sigset.h bits/siginfo.h bits/sigstack.h \
+	   bits/sigthread.h
 
 routines	:= signal raise killpg \
 		   sigaction sigprocmask kill \
diff --git a/signal/signal.h b/signal/signal.h
index 5e983e468e..c803a5bec4 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -352,6 +352,9 @@ extern int sigignore __P ((int __sig));
 extern __sighandler_t sigset __P ((int __sig, __sighandler_t __disp));
 #endif
 
+/* Some of the functions for handling signals in threaded programs must
+   be defined here.  */
+#include <bits/sigthread.h>
 
 /* The following functions are used internally in the C library and in
    other code which need deep insights.  */
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index bd5b1e69f0..c1f1c225b7 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -386,7 +386,7 @@ extern int rand __P ((void));
 /* Seed the random number generator with the given number.  */
 extern void srand __P ((unsigned int __seed));
 
-#ifdef __USE_MISC
+#ifdef __USE_POSIX
 /* Reentrant interface according to POSIX.1.  */
 extern int __rand_r __P ((unsigned int *__seed));
 extern int rand_r __P ((unsigned int *__seed));
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 8aac5cb67d..229088d67d 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/bits/confname.h
@@ -1,5 +1,5 @@
 /* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -48,8 +48,10 @@ enum
 #define	_PC_ASYNC_IO			_PC_ASYNC_IO
     _PC_PRIO_IO,
 #define	_PC_PRIO_IO			_PC_PRIO_IO
-    _PC_SOCK_MAXBUF
+    _PC_SOCK_MAXBUF,
 #define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
+    _PC_FILESIZEBITS
+#define _PC_FILESIZEBITS		_PC_FILESIZEBITS
   };
 
 /* Values for the argument to `sysconf'.  */
diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h
index 7c33694018..c2b1c9a7a1 100644
--- a/sysdeps/generic/bits/dlfcn.h
+++ b/sysdeps/generic/bits/dlfcn.h
@@ -1,5 +1,5 @@
 /* System dependand definitions for run-time dynamic loading.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,3 +30,8 @@
    the symbols of the loaded object and its dependencies are made
    visible as if the object were linked directly into the program.  */
 #define RTLD_GLOBAL	0x100
+
+/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
+   The implementation does this by default and so we can define the
+   value to zero.  */
+#define RTLD_LOCAL	0
diff --git a/sysdeps/generic/bits/sigthread.h b/sysdeps/generic/bits/sigthread.h
new file mode 100644
index 0000000000..de6f2dc73e
--- /dev/null
+++ b/sysdeps/generic/bits/sigthread.h
@@ -0,0 +1,24 @@
+/* Signal handling function for threaded programs.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly.  Use <signal.h> instead"
+#endif
+
+/* There are none available in this configuration.  */
diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
index b985a3a49f..c6b7b8884e 100644
--- a/sysdeps/generic/bits/types.h
+++ b/sysdeps/generic/bits/types.h
@@ -115,4 +115,7 @@ typedef __u_quad_t __fsfilcnt64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* This definition makes this file kind of architecture dependent.  */
+typedef long int __intptr_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 758fb754e7..6516ba9b1a 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -279,6 +279,26 @@ _dl_next_ld_env_entry (char ***position)
   return result;
 }
 
+void
+unsetenv (const char *name)
+{
+  const size_t len = strlen (name);
+  char **ep;
+
+  for (ep = __environ; *ep != NULL; ++ep)
+    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+      {
+	/* Found it.  Remove this pointer by moving later ones back.  */
+	char **dp = ep;
+
+	do
+	  dp[0] = dp[1];
+	while (*dp++);
+	/* Continue the loop in case NAME appears again.  */
+      }
+}
+
+
 /* Return an array of useful/necessary hardware capability names.  */
 const struct r_strlenpair *
 internal_function
diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
index fe2ac8d905..2032afe208 100644
--- a/sysdeps/posix/pathconf.c
+++ b/sysdeps/posix/pathconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -144,7 +144,16 @@ __pathconf (const char *path, int name)
 #else
       return -1;
 #endif
+
+    case _PC_FILESIZEBITS:
+#ifdef FILESIZEBITS
+      return FILESIZEBITS;
+#else
+      /* We let platforms with larger file sizes overwrite this value.  */
+      return 32;
+#endif
     }
 }
 
+#undef __pathconf
 weak_alias (__pathconf, pathconf)
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 276236d4f5..d4f2217f05 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -110,6 +110,9 @@ typedef struct
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef long int __intptr_t;
+
 
 /* Now add the thread types.  */
 #include <bits/pthreadtypes.h>
diff --git a/sysdeps/unix/sysv/linux/alpha/fpathconf.c b/sysdeps/unix/sysv/linux/alpha/fpathconf.c
new file mode 100644
index 0000000000..d8c428dcda
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/fpathconf.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 1991, 1995, 1996, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <limits.h>
+#include <sys/statfs.h>
+
+#define EXT2_SUPER_MAGIC	0xef53
+#define UFS_MAGIC		0x00011954
+#define UFS_CIGAM		0x54190100 /* byteswapped MAGIC */
+
+static long int default_fpathconf (int fd, int name);
+
+/* Get file-specific information about descriptor FD.  */
+long int
+__fpathconf (fd, name)
+     int fd;
+     int name;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  if (name == _PC_FILESIZEBITS)
+    {
+      /* Test whether this is on a ext2 filesystem which supports large
+	 files.  */
+      struct statfs fs;
+
+      if (__fstatfs (fd, &fs) < 0
+	  || (fs.f_type != EXT2_SUPER_MAGIC
+	      && fs.f_type != UFS_MAGIC
+	      && fs.f_type != UFS_CIGAM))
+	return 32;
+
+      /* This filesystem supported files >2GB.  */
+      return 64;
+    }
+
+  /* Fallback to the generic version.  */
+  return default_fpathconf (fd, name);
+}
+
+#define __fpathconf static default_fpathconf
+#include <sysdeps/posix/fpathconf.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/pathconf.c b/sysdeps/unix/sysv/linux/alpha/pathconf.c
new file mode 100644
index 0000000000..91ca0942fb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/pathconf.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 1991, 1995, 1996, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <sys/statfs.h>
+
+#define EXT2_SUPER_MAGIC	0xef53
+#define UFS_MAGIC		0x00011954
+#define UFS_CIGAM		0x54190100 /* byteswapped MAGIC */
+
+static long int default_pathconf (const char *path, int name);
+
+/* Get file-specific information about PATH.  */
+long int
+__pathconf (const char *path, int name)
+{
+  if (name == _PC_FILESIZEBITS)
+    {
+      /* Test whether this is on a ext2 or UFS filesystem which
+	 support large files.  */
+      struct statfs fs;
+
+      if (__statfs (path, &fs) < 0
+	  || (fs.f_type != EXT2_SUPER_MAGIC
+	      && fs.f_type != UFS_MAGIC
+	      && fs.f_type != UFS_CIGAM))
+	return 32;
+
+      /* This filesystem supported files >2GB.  */
+      return 64;
+    }
+
+  /* Fallback to the generic version.  */
+  return default_pathconf (path, name);
+}
+
+#define __pathconf static default_pathconf
+#include <sysdeps/posix/pathconf.c>
diff --git a/sysdeps/unix/sysv/linux/bits/errno.h b/sysdeps/unix/sysv/linux/bits/errno.h
index 5976c25f02..e3e8b3213d 100644
--- a/sysdeps/unix/sysv/linux/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/bits/errno.h
@@ -27,6 +27,10 @@
 /* Linux has no ENOTSUP error code.  */
 # define ENOTSUP EOPNOTSUPP
 
+/* Linux also has no ECANCELED error code.  Since it is not used here
+   we define it to an invalid value.  */
+# define ECANCELED	(-1)
+
 # ifndef __ASSEMBLER__
 /* We now need a declaration of the `errno' variable.  */
 extern int errno;
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index 4222631129..f63e8ce4eb 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -24,12 +24,6 @@
 
 #include <sys/types.h>
 
-
-/* In GNU, read and write are bits (unlike BSD).  */
-#ifdef __USE_GNU
-# define O_READ		O_RDONLY /* Open for reading.  */
-# define O_WRITE	O_WRONLY /* Open for writing.  */
-#endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
 #define O_ACCMODE	  0003
@@ -47,6 +41,14 @@
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000
 
+/* For now Linux has synchronisity options for data and read operations.
+   We define the symbols here but let them do the same as O_SYNS since
+   this is a superset.  */
+#ifdef __USE_UNIX98
+# define O_DSYNC	O_SYNC	/* Synchronize data.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.  */
+#endif
+
 /* XXX missing */
 #ifdef __USE_LARGEFILE64
 # define O_LARGEFILE	0
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index faa493e7e3..7b188b9f9f 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -115,6 +115,10 @@ enum __rlimit_resource
 # define RLIM64_INFINITY 0x7fffffffffffffffLL
 #endif
 
+/* We can represent all limits.  */
+#define RLIM_SAVED_MAX	RLIM_INFINITY
+#define RLIM_SAVED_CUR	RLIM_INFINITY
+
 
 /* Type for resource quantity measurement.  */
 #ifndef __USE_FILE_OFFSET64
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 916910908f..30dc5e20e0 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -134,6 +134,9 @@ typedef __loff_t __off64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef int __intptr_t;
+
 
 /* Now add the thread types.  */
 #include <bits/pthreadtypes.h>
diff --git a/sysdeps/unix/sysv/linux/fstatvfs.c b/sysdeps/unix/sysv/linux/fstatvfs.c
index de926f49c4..43bab44543 100644
--- a/sysdeps/unix/sysv/linux/fstatvfs.c
+++ b/sysdeps/unix/sysv/linux/fstatvfs.c
@@ -49,6 +49,8 @@
 #define SYSV4_SUPER_MAGIC	0x012ff7b5
 #define SYSV2_SUPER_MAGIC	0x012ff7b6
 #define COH_SUPER_MAGIC		0x012ff7b7
+#define UFS_MAGIC		0x00011954
+#define UFS_CIGAM		0x54190100 /* byteswapped MAGIC */
 
 
 int
@@ -99,6 +101,8 @@ fstatvfs (int fd, struct statvfs *buf)
     case SYSV4_SUPER_MAGIC:
     case SYSV2_SUPER_MAGIC:
     case COH_SUPER_MAGIC:
+    case UFS_MAGIC:
+    case UFS_CIGAM:
     default:
       /* I hope it's safe to assume no fragmentation.  */
       buf->f_frsize = buf->f_bsize;
diff --git a/sysdeps/unix/sysv/linux/i386/dl-librecon.h b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
index ef2c4bb632..b9ef9af8b6 100644
--- a/sysdeps/unix/sysv/linux/i386/dl-librecon.h
+++ b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
@@ -54,4 +54,7 @@
 	break;								      \
       }
 
+/* Extra unsecure variables.  */
+#define EXTRA_UNSECURE_ENVVARS "LD_AOUT_LIBRARY_PATH", "LD_AOUT_PRELOAD"
+
 #endif /* dl-librecon.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h
index 313e96b480..2bb8a2a9c6 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/types.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/types.h
@@ -134,6 +134,9 @@ typedef __loff_t __off64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef int __intptr_t;
+
 
 /* Now add the thread types.  */
 #include <bits/pthreadtypes.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 88638143d6..c147dbe6e5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -122,6 +122,9 @@ typedef __u_quad_t __fsfilcnt64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef long int __intptr_t;
+
 
 /* Now add the thread types.  */
 #include <bits/pthreadtypes.h>
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h
index 44e343ab1c..e25dec98fb 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/types.h
@@ -115,4 +115,7 @@ typedef __u_quad_t __fsfilcnt64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef long int __intptr_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/wordsize-32/stdint.h b/sysdeps/wordsize-32/stdint.h
index c3a9e3027d..2f693e81ff 100644
--- a/sysdeps/wordsize-32/stdint.h
+++ b/sysdeps/wordsize-32/stdint.h
@@ -78,7 +78,10 @@ typedef unsigned long long int uint_fast64_t;
 
 
 /* Types for `void *' pointers.  */
+#ifndef intptr_t
 typedef int           intptr_t;
+# define intptr_t intptr_t
+#endif
 typedef unsigned int uintptr_t;
 
 
diff --git a/sysdeps/wordsize-64/stdint.h b/sysdeps/wordsize-64/stdint.h
index c0e521ac70..743fb434bf 100644
--- a/sysdeps/wordsize-64/stdint.h
+++ b/sysdeps/wordsize-64/stdint.h
@@ -78,7 +78,10 @@ typedef unsigned long int uint_fast64_t;
 
 
 /* Types for `void *' pointers.  */
+#ifndef intptr_t
 typedef long int           intptr_t;
+# define intptr_t intptr_t
+#endif
 typedef unsigned long int uintptr_t;