[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r20037 - in /fsf/trunk/libc: ./ bits/ nptl/ nptl/sysdeps/pthread/ ports/ ports/sysdeps/unix/sysv/linux/alpha/ ports/sysdeps/...



Author: eglibc
Date: Wed Aug  8 00:01:44 2012
New Revision: 20037

Log:
Import glibc-mainline for 2012-08-08

Added:
    fsf/trunk/libc/sysdeps/posix/closedir.c
    fsf/trunk/libc/sysdeps/posix/dirfd.c
    fsf/trunk/libc/sysdeps/posix/dirstream.h
    fsf/trunk/libc/sysdeps/posix/fdopendir.c
    fsf/trunk/libc/sysdeps/posix/opendir.c
    fsf/trunk/libc/sysdeps/posix/readdir.c
    fsf/trunk/libc/sysdeps/posix/readdir_r.c
    fsf/trunk/libc/sysdeps/posix/rewinddir.c
    fsf/trunk/libc/sysdeps/posix/seekdir.c
    fsf/trunk/libc/sysdeps/posix/telldir.c
Removed:
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure.in
    fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
    fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/fcntl.h
    fsf/trunk/libc/sysdeps/unix/closedir.c
    fsf/trunk/libc/sysdeps/unix/dirfd.c
    fsf/trunk/libc/sysdeps/unix/dirstream.h
    fsf/trunk/libc/sysdeps/unix/fdopendir.c
    fsf/trunk/libc/sysdeps/unix/opendir.c
    fsf/trunk/libc/sysdeps/unix/readdir.c
    fsf/trunk/libc/sysdeps/unix/readdir_r.c
    fsf/trunk/libc/sysdeps/unix/rewinddir.c
    fsf/trunk/libc/sysdeps/unix/seekdir.c
    fsf/trunk/libc/sysdeps/unix/telldir.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/README
    fsf/trunk/libc/bits/dirent.h
    fsf/trunk/libc/bits/fcntl.h
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c
    fsf/trunk/libc/ports/ChangeLog.alpha
    fsf/trunk/libc/ports/ChangeLog.am33
    fsf/trunk/libc/ports/ChangeLog.arm
    fsf/trunk/libc/ports/ChangeLog.hppa
    fsf/trunk/libc/ports/ChangeLog.m68k
    fsf/trunk/libc/ports/ChangeLog.mips
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure.in
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/kernel-features.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure.in
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
    fsf/trunk/libc/sunrpc/rpc_main.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/configure
    fsf/trunk/libc/sysdeps/unix/sysv/linux/configure.in
    fsf/trunk/libc/sysdeps/unix/sysv/linux/dl-execstack.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/readdir64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/opendir.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/readdir64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/waitid.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/readdir.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Aug  8 00:01:44 2012
@@ -1,3 +1,106 @@
+2012-08-07	Allan McRae	<allan@xxxxxxxxxxxxx>
+
+	[BZ #14303]
+	* sunrpc/rpc_main.c (SVR4_CPP): Remove.
+	(SUNOS_CPP): Likewise.
+	(find_cpp): Fall back to selecting system cpp when /lib/cpp is
+	not found.
+	(open_input): Call CPP using execvp.
+
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/kernel-features.h
+	(__ASSUME_PROT_GROWSUPDOWN): Remove.
+	(__ASSUME_NO_CLONE_DETACHED): Likewise.
+	(__ASSUME_GETDENTS32_D_TYPE): Likewise.
+	(__ASSUME_WAITID_SYSCALL): Likewise.
+	* sysdeps/unix/sysv/linux/dl-execstack.c
+	(_dl_make_stack_executable) [PROT_GROWSDOWN || PROT_GROWSUP]: Make
+	code unconditional.
+	(_dl_make_stack_executable) [!__ASSUME_PROT_GROWSUPDOWN]: Remove
+	conditional code.
+	* sysdeps/unix/sysv/linux/getdents.c (__GETDENTS)
+	[__ASSUME_GETDENTS32_D_TYPE]: Make code unconditional.
+	(__GETDENTS) [!__ASSUME_GETDENTS32_D_TYPE]: Remove conditional
+	code.
+	* sysdeps/unix/sysv/linux/waitid.c [__NR_waitid]: Make code
+	unconditional.
+	[__ASSUME_WAITID_SYSCALL]: Likewise.
+	[!__ASSUME_WAITID_SYSCALL]: Remove conditional code.
+
+2012-08-07  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* sysdeps/unix/closedir.c: Renamed to ...
+	* sysdeps/posix/closedir.c: ... here.
+	* sysdeps/unix/dirfd.c: Renamed to ...
+	* sysdeps/posix/dirfd.c: ... here.
+	* sysdeps/unix/dirstream.h: Renamed to ...
+	* sysdeps/posix/dirstream.h: ... here.
+	* sysdeps/unix/fdopendir.c: Renamed to ...
+	* sysdeps/posix/fdopendir.c: ... here.
+	* sysdeps/unix/opendir.c: Renamed to ...
+	* sysdeps/posix/opendir.c: ... here.
+	* sysdeps/unix/readdir.c: Renamed to ...
+	* sysdeps/posix/readdir.c: ... here.
+	* sysdeps/unix/readdir_r.c: Renamed to ...
+	* sysdeps/posix/readdir_r.c: ... here.
+	* sysdeps/unix/rewinddir.c: Renamed to ...
+	* sysdeps/posix/rewinddir.c: ... here.
+	* sysdeps/unix/seekdir.c: Renamed to ...
+	* sysdeps/posix/seekdir.c: ... here.
+	* sysdeps/unix/telldir.c: Renamed to ...
+	* sysdeps/posix/telldir.c: ... here.
+	* sysdeps/unix/sysv/linux/opendir.c: Update #include.
+	* sysdeps/unix/sysv/linux/readdir64.c: Likewise.
+	* sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise.
+	* sysdeps/unix/sysv/linux/wordsize-64/readdir.c: Likewise.
+
+	* sysdeps/unix/bsd/bsd4.4/bits/fcntl.h: Renamed to ...
+	* bits/fcntl.h: ... here.
+
+	* sysdeps/unix/bsd/bsd4.4/bits/fcntl.h (O_NOCTTY): Define to 0x8000,
+	not 0.
+	(O_ASYNC, O_FSYNC, O_SYNC): Move outside [__USE_MISC].
+	[__USE_XOPEN2K8] (O_DIRECTORY, O_NOFOLLOW, O_CLOEXEC): New macros.
+	(FCREAT, FEXCL, FTRUNC, FNOCTTY, FNONBLOCK): Macros removed.
+	(struct flock): Move l_start, l_len to the beginning.
+	Use __pid_t for l_pid.
+	[__USE_XOPEN2K] (POSIX_FADV_NORMAL, POSIX_FADV_RANDOM): New macros.
+	[__USE_XOPEN2K] (POSIX_FADV_SEQUENTIAL, POSIX_FADV_WILLNEED): Likewise.
+	[__USE_XOPEN2K] (POSIX_FADV_DONTNEED, POSIX_FADV_NOREUSE): Likewise.
+	(F_GETLK64, F_SETLK64, F_SETLKW64): New macros.
+	[__USE_XOPEN2K8] (F_DUPFD_CLOEXEC): New macro.
+	[__USE_LARGEFILE64] (struct flock64): New type.
+	(F_GETOWN, F_SETOWN): Also define for [__USE_XOPEN2K8].
+
+	* sysdeps/unix/bsd/bsd4.4/bits/dirent.h: Renamed to ...
+	* bits/dirent.h: ... here.
+
+	* sysdeps/unix/bsd/bsd4.4/bits/dirent.h
+	[__INO_T_MATCHES_INO64_T] (_DIRENT_MATCHES_DIRENT64): New macro.
+
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/configure.in (arch_minimum_kernel):
+	Change from 2.6.0 to 2.6.16.
+	* sysdeps/unix/sysv/linux/configure: Regenerated.
+	* sysdeps/unix/sysv/linux/kernel-features.h
+	(__ASSUME_POSIX_CPU_TIMERS): Define unconditionally.
+	(__ASSUME_TGKILL): Define conditional on architectures, not kernel
+	version.
+	(__ASSUME_UTIMES): Likewise.
+	(__ASSUME_CLONE_STOPPED): Remove.
+	(__ASSUME_FADVISE64_64_SYSCALL): Define conditional on
+	architectures, not kernel version.
+	(__ASSUME_PROT_GROWSUPDOWN): Define unconditionally.
+	(__ASSUME_NO_CLONE_DETACHED): Likewise.
+	(__ASSUME_GETDENTS32_D_TYPE): Likewise.
+	(__ASSUME_WAITID_SYSCALL): Likewise.
+	[__sparc__ && __arch64__] (__ASSUME_STAT64_SYSCALL): Do not
+	condition definition on __LINUX_KERNEL_VERSION >= 0x02060c.
+	* README: State 2.6.16 as minimum Linux kernel version.  Do not
+	refer to older versions.
+
 2012-08-06  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	* dirent/alphasort.c [_DIRENT_MATCHES_DIRENT64]:

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed Aug  8 00:01:44 2012
@@ -25,7 +25,7 @@
   Implemented by Gary Benson.
 
 * The minimum Linux kernel version that this version of the GNU C Library
-  can be used with is 2.6.0.
+  can be used with is 2.6.16.
 
 
 Version 2.16

Modified: fsf/trunk/libc/README
==============================================================================
--- fsf/trunk/libc/README (original)
+++ fsf/trunk/libc/README Wed Aug  8 00:01:44 2012
@@ -17,12 +17,7 @@
 incorporated into an official GNU C Library release.
 
 When working with Linux kernels, this version of the GNU C Library
-requires Linux kernel version 2.6.0 or later.
-
-All Linux kernel versions prior to 2.6.16 are known to have some bugs that
-may cause some of the tests related to pthreads in "make check" to fail.
-If you see such problems, please try the test suite on the most recent
-Linux kernel version that you can use, before pursuing those bugs further.
+requires Linux kernel version 2.6.16 or later.
 
 Also note that the shared version of the libgcc_s library must be
 installed for the pthread library to work correctly.
@@ -35,7 +30,7 @@
 	powerpc64-*-linux-gnu
 	s390-*-linux-gnu
 	s390x-*-linux-gnu
-	sh[34]-*-linux-gnu	Requires Linux 2.6.11 or newer
+	sh[34]-*-linux-gnu
 	sparc*-*-linux-gnu
 	sparc64*-*-linux-gnu
 
@@ -45,14 +40,14 @@
 same place where you got the main glibc distribution files.
 Currently these configurations have code in the `ports' add-on:
 
-	alpha*-*-linux-gnu	Requires Linux 2.6.9 or newer for NPTL
+	alpha*-*-linux-gnu
 	am33*-*-linux-gnu	Not currently functional
-	arm-*-linux-gnueabi	Requires Linux 2.6.16-rc1 or newer for NPTL
+	arm-*-linux-gnueabi
 	hppa-*-linux-gnu	Not currently functional without patches.
 	ia64-*-linux-gnu
 	m68k-*-linux-gnu
-	mips-*-linux-gnu	Requires Linux 2.6.12 or newer for NPTL
-	mips64-*-linux-gnu	Requires Linux 2.6.12 or newer for NPTL
+	mips-*-linux-gnu
+	mips64-*-linux-gnu
 	powerpc-*-linux-gnu	Software floating point (--without-fp)
 	tilegx-*-linux-gnu
 	tilepro-*-linux-gnu

Modified: fsf/trunk/libc/bits/dirent.h
==============================================================================
--- fsf/trunk/libc/bits/dirent.h (original)
+++ fsf/trunk/libc/bits/dirent.h Wed Aug  8 00:01:44 2012
@@ -1,4 +1,4 @@
-/* Directory entry structure `struct dirent'.  Stub version.
+/* Directory entry structure `struct dirent'.  4.4BSD/Generic version.
    Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,17 +22,38 @@
 
 struct dirent
   {
-    char d_name[1];		/* Variable length.  */
-    int d_fileno;
+#ifndef __USE_FILE_OFFSET64
+    __ino_t d_ino;		/* File serial number.  */
+#else
+    __ino64_t d_ino;
+#endif
+    unsigned short int d_reclen; /* Length of the whole `struct dirent'.  */
+    unsigned char d_type;	/* File type, possibly unknown.  */
+    unsigned char d_namlen;	/* Length of the file name.  */
+
+    /* Only this member is in the POSIX standard.  */
+    char d_name[1];		/* File name (actually longer).  */
   };
 
 #ifdef __USE_LARGEFILE64
 struct dirent64
   {
-    char d_name[1];		/* Variable length.  */
-    int d_fileno;
+    __ino64_t d_ino;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    unsigned char d_namlen;
+
+    char d_name[1];
   };
 #endif
 
-/* Inform libc code that these two types are identical.  */
-#define _DIRENT_MATCHES_DIRENT64	1
+#define d_fileno	d_ino	/* Backwards compatibility.  */
+
+#define _DIRENT_HAVE_D_RECLEN 1
+#define _DIRENT_HAVE_D_NAMLEN 1
+#define _DIRENT_HAVE_D_TYPE 1
+
+#ifdef __INO_T_MATCHES_INO64_T
+/* Inform libc code that these two types are effectively identical.  */
+# define _DIRENT_MATCHES_DIRENT64	1
+#endif

Modified: fsf/trunk/libc/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/bits/fcntl.h (original)
+++ fsf/trunk/libc/bits/fcntl.h Wed Aug  8 00:01:44 2012
@@ -1,5 +1,5 @@
-/* O_*, F_*, FD_* bit values for stub configuration.
-   Copyright (C) 1991, 1992, 1997, 2000, 2004 Free Software Foundation, Inc.
+/* O_*, F_*, FD_* bit values. 4.4BSD/Generic version.
+   Copyright (C) 1991-2012 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,10 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* These values should be changed as appropriate for your system.  */
-
 #ifndef	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -33,7 +31,24 @@
 #define	O_CREAT		0x0200	/* Create file if it doesn't exist.  */
 #define	O_EXCL		0x0800	/* Fail if file already exists.  */
 #define	O_TRUNC		0x0400	/* Truncate file to zero length.  */
-#define	O_NOCTTY	0x0100	/* Don't assign a controlling terminal.  */
+#define	O_NOCTTY	0x8000	/* Don't assign a controlling terminal.  */
+#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
+#define	O_FSYNC		0x0080	/* Synchronous writes.  */
+#define	O_SYNC		O_FSYNC
+#ifdef	__USE_MISC
+#define	O_SHLOCK	0x0010	/* Open with shared file lock.  */
+#define	O_EXLOCK	0x0020	/* Open with shared exclusive lock.  */
+#endif
+#ifdef __USE_XOPEN2K8
+# define O_DIRECTORY	0x00200000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0x00000100	/* Do not follow links.	 */
+# define O_CLOEXEC	0x00400000      /* Set close_on_exec.  */
+#endif
+
+/* All opens support large file sizes, so there is no flag bit for this.  */
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE	0
+#endif
 
 /* File status flags for `open' and `fcntl'.  */
 #define	O_APPEND	0x0008	/* Writes append to the file.  */
@@ -41,6 +56,22 @@
 
 #ifdef __USE_BSD
 # define O_NDELAY	O_NONBLOCK
+#endif
+
+#ifdef __USE_BSD
+/* Bits in the file status flags returned by F_GETFL.
+   These are all the O_* flags, plus FREAD and FWRITE, which are
+   independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
+   given to `open'.  */
+# define FREAD		1
+# define FWRITE		2
+
+/* Traditional BSD names the O_* bits.  */
+# define FASYNC		O_ASYNC
+# define FFSYNC		O_FSYNC
+# define FSYNC		O_SYNC
+# define FAPPEND	O_APPEND
+# define FNDELAY	O_NDELAY
 #endif
 
 /* Mask for file access modes.  This is system-dependent in case
@@ -53,13 +84,21 @@
 #define	F_SETFD		2	/* Set file descriptor flags.  */
 #define	F_GETFL		3	/* Get file status flags.  */
 #define	F_SETFL		4	/* Set file status flags.  */
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-# define F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
+#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
+#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
 #endif
 #define	F_GETLK		7	/* Get record locking info.  */
-#define	F_SETLK		8	/* Set record locking info.  */
-#define	F_SETLKW	9	/* Set record locking info, wait.  */
+#define	F_SETLK		8	/* Set record locking info (non-blocking).  */
+#define	F_SETLKW	9	/* Set record locking info (blocking).  */
+/* Not necessary, we always have 64-bit offsets.  */
+#define F_GETLK64	F_GETLK	/* Get record locking info.  */
+#define F_SETLK64	F_SETLK	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	F_SETLKW/* Set record locking info (blocking).	*/
+#ifdef __USE_XOPEN2K8
+# define F_DUPFD_CLOEXEC 12	/* Duplicate file descriptor with
+				   close-on-exit set.  */
+#endif
 
 /* File descriptor flags used with F_GETFD and F_SETFD.  */
 #define	FD_CLOEXEC	1	/* Close on exec.  */
@@ -71,12 +110,24 @@
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
 struct flock
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
     __pid_t l_pid;	/* Process holding the lock.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
   };
+
+#ifdef __USE_LARGEFILE64
+/* Note this matches struct flock exactly.  */
+struct flock64
+  {
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+  };
+#endif
 
 /* Values for the `l_type' field of a `struct flock'.  */
 #define	F_RDLCK	1	/* Read lock.  */

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Wed Aug  8 00:01:44 2012
@@ -1,3 +1,8 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/pthread/createthread.c (create_thread)
+	[!__ASSUME_NO_CLONE_DETACHED]: Remove conditional code.
+
 2012-08-03  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* nptl-init.c (sigcancel_handler) [__ASSUME_CORRECT_SI_PID]: Make

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/createthread.c Wed Aug  8 00:01:44 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -179,18 +179,11 @@
 	sys_exit() in the location pointed to by the seventh parameter
 	to CLONE.
 
-     CLONE_DETACHED
-	No signal is generated if the thread exists and it is
-	automatically reaped.
-
      The termination signal is chosen to be zero which means no signal
      is sent.  */
   int clone_flags = (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGNAL
 		     | CLONE_SETTLS | CLONE_PARENT_SETTID
 		     | CLONE_CHILD_CLEARTID | CLONE_SYSVSEM
-#if __ASSUME_NO_CLONE_DETACHED == 0
-		     | CLONE_DETACHED
-#endif
 		     | 0);
 
   if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))

Modified: fsf/trunk/libc/ports/ChangeLog.alpha
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.alpha (original)
+++ fsf/trunk/libc/ports/ChangeLog.alpha Wed Aug  8 00:01:44 2012
@@ -1,3 +1,10 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
+	(__ASSUME_TGKILL): Define unconditionally.
+	(__ASSUME_STAT64_SYSCALL): Likewise.
+	(__ASSUME_IEEE_RAISE_EXCEPTION): Likewise.
+
 2012-08-02  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/alpha/bits/dirent.h

Modified: fsf/trunk/libc/ports/ChangeLog.am33
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.am33 (original)
+++ fsf/trunk/libc/ports/ChangeLog.am33 Wed Aug  8 00:01:44 2012
@@ -1,3 +1,9 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/am33/configure.in (arch_minimum_kernel):
+	Change to 2.6.25.
+	* sysdeps/unix/sysv/linux/am33/configure: Regenerated.
+
 2012-08-01  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	[BZ #14138]

Modified: fsf/trunk/libc/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.arm (original)
+++ fsf/trunk/libc/ports/ChangeLog.arm Wed Aug  8 00:01:44 2012
@@ -1,3 +1,11 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/arm/configure.in (arch_minimum_kernel):
+	Remove.
+	* sysdeps/unix/sysv/linux/arm/configure: Regenerated.
+	* sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_UTIMES):
+	Define unconditionally.
+
 2012-08-02  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/arm/sysdep.h (ASM_TYPE_DIRECTIVE): Remove.

Modified: fsf/trunk/libc/ports/ChangeLog.hppa
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.hppa (original)
+++ fsf/trunk/libc/ports/ChangeLog.hppa Wed Aug  8 00:01:44 2012
@@ -1,3 +1,10 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/hppa/nptl/configure.in: Remove.
+	* sysdeps/unix/sysv/linux/hppa/nptl/configure: Likewise.
+	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
+	(__ASSUME_LWS_CAS): Define unconditionally.
+
 2012-08-01  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/hppa/kernel-features.h

Modified: fsf/trunk/libc/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.m68k (original)
+++ fsf/trunk/libc/ports/ChangeLog.m68k Wed Aug  8 00:01:44 2012
@@ -1,3 +1,13 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/m68k/configure.in (arch_minimum_kernel):
+	Remove.
+	* sysdeps/unix/sysv/linux/m68k/configure: Regenerated.
+	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
+	(__ASSUME_TGKILL): Define unconditionally.
+	(__ASSUME_UTIMES): Likewise.
+	(__ASSUME_FADVISE64_64_SYSCALL): Likewise.
+
 2012-08-03  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
 
 	* sysdeps/m68k/sysdep.h (ALIGNARG, ASM_TYPE_DIRECTIVE)

Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Wed Aug  8 00:01:44 2012
@@ -1,3 +1,9 @@
+2012-08-07  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/mips/configure.in (arch_minimum_kernel):
+	Remove.
+	* sysdeps/unix/sysv/linux/mips/configure: Regenerated.
+
 2012-08-01  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/mips/kernel-features.h

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h Wed Aug  8 00:01:44 2012
@@ -20,23 +20,16 @@
 #ifndef _KERNEL_FEATURES_H
 #define _KERNEL_FEATURES_H 1
 
-/* The tgkill syscall was introduced for alpha 2.6.0-test1 which unfortunately
-   cannot be distinguished from 2.6.0.  */
-#if __LINUX_KERNEL_VERSION >= 132609
-# define __ASSUME_TGKILL	1
-#endif
+/* The tgkill syscall was introduced for alpha 2.6.0-test1.  */
+#define __ASSUME_TGKILL	1
 
 /* Starting with version 2.6.4, the stat64 syscalls are available.  */
-#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
-# define __ASSUME_STAT64_SYSCALL   1
-#endif
+#define __ASSUME_STAT64_SYSCALL   1
 
 #define __ASSUME_UTIMES	1
 
 /* Starting with version 2.6.9, SSI_IEEE_RAISE_EXCEPTION exists.  */
-#if __LINUX_KERNEL_VERSION >= 0x020609
-# define __ASSUME_IEEE_RAISE_EXCEPTION	1
-#endif
+#define __ASSUME_IEEE_RAISE_EXCEPTION	1
 
 /* Support for the O_CLOEXEC flag was added for alpha in 2.6.23.  */
 #if __LINUX_KERNEL_VERSION >= 0x020617

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure Wed Aug  8 00:01:44 2012
@@ -1,4 +1,4 @@
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for am33/sysdeps/unix/sysv/linux/am33
 
-arch_minimum_kernel=2.4.0
+arch_minimum_kernel=2.6.25

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/am33/configure.in Wed Aug  8 00:01:44 2012
@@ -1,4 +1,4 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for am33/sysdeps/unix/sysv/linux/am33
 
-arch_minimum_kernel=2.4.0
+arch_minimum_kernel=2.6.25

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure Wed Aug  8 00:01:44 2012
@@ -1,6 +1,5 @@
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/unix/sysv/linux/arm.
 
-arch_minimum_kernel=2.6.16
 libc_cv_gcc_unwind_find_fde=no
 CFLAGS=${CFLAGS% -fno-unwind-tables}

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/configure.in Wed Aug  8 00:01:44 2012
@@ -1,6 +1,5 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/unix/sysv/linux/arm.
 
-arch_minimum_kernel=2.6.16
 libc_cv_gcc_unwind_find_fde=no
 CFLAGS=${CFLAGS% -fno-unwind-tables}

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h Wed Aug  8 00:01:44 2012
@@ -18,9 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 /* The utimes syscall was added before 2.6.1.  */
-#if __LINUX_KERNEL_VERSION >= 132609
-# define __ASSUME_UTIMES	1
-#endif
+#define __ASSUME_UTIMES	1
 
 /* On ARM the mmap2/stat64/lstat64/fstat64 syscalls were introduced in
    2.3.35.  */

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/kernel-features.h Wed Aug  8 00:01:44 2012
@@ -1,6 +1,6 @@
 /* Set flags signalling availability of kernel features based on given
    kernel version number.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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,8 +30,6 @@
 #define __ASSUME_GETDENTS64_SYSCALL	1
 
 /* PA-RISC 2.6.9 kernels had the first LWS CAS support */
-#if __LINUX_KERNEL_VERSION >= 0x020609
-# define __ASSUME_LWS_CAS		1
-#endif
+#define __ASSUME_LWS_CAS		1
 
 #include_next <kernel-features.h>

Removed: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure (removed)
@@ -1,5 +1,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
- # Local configure fragment for sysdeps/unix/sysv/linux/hppa/nptl.
-
-# Needed for LWS CAS
-arch_minimum_kernel=2.6.9

Removed: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/hppa/nptl/configure.in (removed)
@@ -1,5 +1,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-# Local configure fragment for sysdeps/unix/sysv/linux/hppa/nptl.
-
-# Needed for LWS CAS
-arch_minimum_kernel=2.6.9

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure Wed Aug  8 00:01:44 2012
@@ -1,7 +1,6 @@
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  case $machine in
 m68k/coldfire)
-  arch_minimum_kernel=2.6.10
   ;;
 *)
   libc_cv_gcc_unwind_find_fde=yes

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/configure.in Wed Aug  8 00:01:44 2012
@@ -2,7 +2,6 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 case $machine in
 m68k/coldfire)
-  arch_minimum_kernel=2.6.10
   ;;
 *)
   libc_cv_gcc_unwind_find_fde=yes

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h Wed Aug  8 00:01:44 2012
@@ -22,11 +22,9 @@
 #define __ASSUME_STAT64_SYSCALL	1
 
 /* Many syscalls were added in 2.6.10 for m68k.  */
-#if __LINUX_KERNEL_VERSION >= 132618
-# define __ASSUME_TGKILL	1
-# define __ASSUME_UTIMES	1
-# define __ASSUME_FADVISE64_64_SYSCALL	1
-#endif
+#define __ASSUME_TGKILL	1
+#define __ASSUME_UTIMES	1
+#define __ASSUME_FADVISE64_64_SYSCALL	1
 
 #include_next <kernel-features.h>
 

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure Wed Aug  8 00:01:44 2012
@@ -30,7 +30,4 @@
   esac
 esac
 
-if test -z "$arch_minimum_kernel"; then
-  arch_minimum_kernel=2.6.12
-  libc_cv_gcc_unwind_find_fde=yes
-fi
+libc_cv_gcc_unwind_find_fde=yes

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in Wed Aug  8 00:01:44 2012
@@ -31,7 +31,4 @@
   esac
 esac
 
-if test -z "$arch_minimum_kernel"; then
-  arch_minimum_kernel=2.6.12
-  libc_cv_gcc_unwind_find_fde=yes
-fi
+libc_cv_gcc_unwind_find_fde=yes

Modified: fsf/trunk/libc/sunrpc/rpc_main.c
==============================================================================
--- fsf/trunk/libc/sunrpc/rpc_main.c (original)
+++ fsf/trunk/libc/sunrpc/rpc_main.c Wed Aug  8 00:01:44 2012
@@ -75,12 +75,9 @@
 
 static const char *cmdname;
 
-#define SVR4_CPP "/usr/ccs/lib/cpp"
-#define SUNOS_CPP "/lib/cpp"
-
 static const char *svcclosetime = "120";
 static int cppDefined;	/* explicit path for C preprocessor */
-static const char *CPP = SUNOS_CPP;
+static const char *CPP = "/lib/cpp";
 static const char CPPFLAGS[] = "-C";
 static char *pathbuf;
 static int cpp_pid;
@@ -327,23 +324,17 @@
 {
   struct stat buf;
 
-  if (stat (CPP, &buf) < 0)
-    {				/* /lib/cpp or explicit cpp does not exist */
-      if (cppDefined)
-	{
-	  fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
-	  crash ();
-	}
-      else
-	{			/* try the other one */
-	  CPP = SVR4_CPP;
-	  if (stat (CPP, &buf) < 0)
-	    {			/* can't find any cpp */
-	      fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
-	      crash ();
-	    }
-	}
-    }
+  if (stat (CPP, &buf) == 0)
+    return;
+
+  if (cppDefined) /* user specified cpp but it does not exist */
+    {
+      fprintf (stderr, _ ("cannot find C preprocessor: %s\n"), CPP);
+      crash ();
+    }
+
+  /* fall back to system CPP */
+  CPP = "cpp";
 }
 
 /*
@@ -374,8 +365,13 @@
       close (1);
       dup2 (pd[1], 1);
       close (pd[0]);
-      execv (arglist[0], (char **) arglist);
-      perror ("execv");
+      execvp (arglist[0], (char **) arglist);
+      if (errno == ENOENT)
+        {
+          fprintf (stderr, _ ("cannot find C preprocessor: %s\n"), CPP);
+          exit (1);
+        }
+      perror ("execvp");
       exit (1);
     case -1:
       perror ("fork");

Added: fsf/trunk/libc/sysdeps/posix/closedir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/closedir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/closedir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,55 @@
+/* Copyright (C) 1991,1993,1995,1996,1998,2002,2003, 2007
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <dirstream.h>
+#include <not-cancel.h>
+
+
+/* Close the directory stream DIRP.
+   Return 0 if successful, -1 if not.  */
+int
+__closedir (DIR *dirp)
+{
+  int fd;
+
+  if (dirp == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* We do not try to synchronize access here.  If some other thread
+     still uses this handle it is a big mistake and that thread
+     deserves all the bad data it gets.  */
+
+  fd = dirp->fd;
+
+#ifndef NOT_IN_libc
+  __libc_lock_fini (dirp->lock);
+#endif
+
+  free ((void *) dirp);
+
+  return close_not_cancel (fd);
+}
+weak_alias (__closedir, closedir)

Added: fsf/trunk/libc/sysdeps/posix/dirfd.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/dirfd.c (added)
+++ fsf/trunk/libc/sysdeps/posix/dirfd.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,29 @@
+/* Return the file descriptor used by a DIR stream.  Unix version.
+   Copyright (C) 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <dirent.h>
+#include <dirstream.h>
+
+#undef dirfd
+
+int
+dirfd (dirp)
+     DIR *dirp;
+{
+  return dirp->fd;
+}

Added: fsf/trunk/libc/sysdeps/posix/dirstream.h
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/dirstream.h (added)
+++ fsf/trunk/libc/sysdeps/posix/dirstream.h Wed Aug  8 00:01:44 2012
@@ -1,0 +1,48 @@
+/* Copyright (C) 1993, 1995, 1996, 2007 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_DIRSTREAM_H
+#define	_DIRSTREAM_H	1
+
+#include <sys/types.h>
+
+#include <bits/libc-lock.h>
+
+/* Directory stream type.
+
+   The miscellaneous Unix `readdir' implementations read directory data
+   into a buffer and return `struct dirent *' pointers into it.  */
+
+struct __dirstream
+  {
+    int fd;			/* File descriptor.  */
+
+    __libc_lock_define (, lock) /* Mutex lock for this structure.  */
+
+    size_t allocation;		/* Space allocated for the block.  */
+    size_t size;		/* Total valid data in the block.  */
+    size_t offset;		/* Current offset into the block.  */
+
+    off_t filepos;		/* Position of next entry to read.  */
+
+    /* Directory block.  */
+    char data[0] __attribute__ ((aligned (__alignof__ (void*))));
+  };
+
+#define _DIR_dirfd(dirp)	((dirp)->fd)
+
+#endif	/* dirstream.h */

Added: fsf/trunk/libc/sysdeps/posix/fdopendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/fdopendir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/fdopendir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,51 @@
+/* Copyright (C) 2005, 2006, 2011 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <not-cancel.h>
+
+
+DIR *
+__fdopendir (int fd)
+{
+  struct stat64 statbuf;
+
+  if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
+    return NULL;
+  if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+    {
+      __set_errno (ENOTDIR);
+      return NULL;
+    }
+
+  /* Make sure the descriptor allows for reading.  */
+  int flags = __fcntl (fd, F_GETFL);
+  if (__builtin_expect (flags == -1, 0))
+    return NULL;
+  if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
+    {
+      __set_errno (EINVAL);
+      return NULL;
+    }
+
+  return __alloc_dir (fd, false, flags, &statbuf);
+}
+weak_alias (__fdopendir, fdopendir)

Added: fsf/trunk/libc/sysdeps/posix/opendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/opendir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/opendir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,228 @@
+/* Copyright (C) 1991-1996,98,2000-2003,2005,2007,2009,2011
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <dirstream.h>
+#include <not-cancel.h>
+#include <kernel-features.h>
+
+
+/* opendir() must not accidentally open something other than a directory.
+   Some OS's have kernel support for that, some don't.  In the worst
+   case we have to stat() before the open() AND fstat() after.
+
+   We have to test at runtime for kernel support since libc may have
+   been compiled with different headers to the kernel it's running on.
+   This test can't be done reliably in the general case.  We'll use
+   /dev/null, which if it's not a device lots of stuff will break, as
+   a guinea pig.  It may be missing in chroot environments, so we
+   make sure to fail safe. */
+#ifdef O_DIRECTORY
+# ifdef O_DIRECTORY_WORKS
+#  define o_directory_works 1
+#  define tryopen_o_directory() while (1) /* This must not be called.  */
+# else
+static int o_directory_works;
+
+static void
+tryopen_o_directory (void)
+{
+  int serrno = errno;
+  int x = open_not_cancel_2 ("/dev/null", O_RDONLY|O_NDELAY|O_DIRECTORY);
+
+  if (x >= 0)
+    {
+      close_not_cancel_no_status (x);
+      o_directory_works = -1;
+    }
+  else if (errno != ENOTDIR)
+    o_directory_works = -1;
+  else
+    o_directory_works = 1;
+
+  __set_errno (serrno);
+}
+# endif
+# define EXTRA_FLAGS O_DIRECTORY
+#else
+# define EXTRA_FLAGS 0
+#endif
+
+
+DIR *
+internal_function
+__opendirat (int dfd, const char *name)
+{
+  struct stat64 statbuf;
+  struct stat64 *statp = NULL;
+
+  if (__builtin_expect (name[0], '\1') == '\0')
+    {
+      /* POSIX.1-1990 says an empty name gets ENOENT;
+	 but `open' might like it fine.  */
+      __set_errno (ENOENT);
+      return NULL;
+    }
+
+#ifdef O_DIRECTORY
+  /* Test whether O_DIRECTORY works.  */
+  if (o_directory_works == 0)
+    tryopen_o_directory ();
+
+  /* We can skip the expensive `stat' call if O_DIRECTORY works.  */
+  if (o_directory_works < 0)
+#endif
+    {
+      /* We first have to check whether the name is for a directory.  We
+	 cannot do this after the open() call since the open/close operation
+	 performed on, say, a tape device might have undesirable effects.  */
+      if (__builtin_expect (__xstat64 (_STAT_VER, name, &statbuf), 0) < 0)
+	return NULL;
+      if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+	{
+	  __set_errno (ENOTDIR);
+	  return NULL;
+	 }
+    }
+
+  int flags = O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE;
+#ifdef O_CLOEXEC
+  flags |= O_CLOEXEC;
+#endif
+  int fd;
+#ifdef IS_IN_rtld
+  assert (dfd == AT_FDCWD);
+  fd = open_not_cancel_2 (name, flags);
+#else
+  fd = openat_not_cancel_3 (dfd, name, flags);
+#endif
+  if (__builtin_expect (fd, 0) < 0)
+    return NULL;
+
+#ifdef O_DIRECTORY
+  if (o_directory_works <= 0)
+#endif
+    {
+      /* Now make sure this really is a directory and nothing changed since
+	 the `stat' call.  */
+      if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
+	goto lose;
+      if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+	{
+	  __set_errno (ENOTDIR);
+	lose:
+	  close_not_cancel_no_status (fd);
+	  return NULL;
+	}
+      statp = &statbuf;
+    }
+
+  return __alloc_dir (fd, true, 0, statp);
+}
+
+
+/* Open a directory stream on NAME.  */
+DIR *
+__opendir (const char *name)
+{
+  return __opendirat (AT_FDCWD, name);
+}
+weak_alias (__opendir, opendir)
+
+
+#ifdef __ASSUME_O_CLOEXEC
+# define check_have_o_cloexec(fd) 1
+#else
+static int
+check_have_o_cloexec (int fd)
+{
+  if (__have_o_cloexec == 0)
+    __have_o_cloexec = (__fcntl (fd, F_GETFD, 0) & FD_CLOEXEC) == 0 ? -1 : 1;
+  return __have_o_cloexec > 0;
+}
+#endif
+
+
+DIR *
+internal_function
+__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp)
+{
+  /* We always have to set the close-on-exit flag if the user provided
+     the file descriptor.  Otherwise only if we have no working
+     O_CLOEXEC support.  */
+#ifdef O_CLOEXEC
+  if ((! close_fd && (flags & O_CLOEXEC) == 0)
+      || ! check_have_o_cloexec (fd))
+#endif
+    {
+      if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
+	goto lose;
+    }
+
+  const size_t default_allocation = (4 * BUFSIZ < sizeof (struct dirent64)
+				     ? sizeof (struct dirent64) : 4 * BUFSIZ);
+  const size_t small_allocation = (BUFSIZ < sizeof (struct dirent64)
+				   ? sizeof (struct dirent64) : BUFSIZ);
+  size_t allocation = default_allocation;
+#ifdef _STATBUF_ST_BLKSIZE
+  if (statp != NULL && default_allocation < statp->st_blksize)
+    allocation = statp->st_blksize;
+#endif
+
+  DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation);
+  if (dirp == NULL)
+    {
+      allocation = small_allocation;
+      dirp = (DIR *) malloc (sizeof (DIR) + allocation);
+
+      if (dirp == NULL)
+      lose:
+	{
+	  if (close_fd)
+	    {
+	      int save_errno = errno;
+	      close_not_cancel_no_status (fd);
+	      __set_errno (save_errno);
+	    }
+	  return NULL;
+	}
+    }
+
+  dirp->fd = fd;
+#ifndef NOT_IN_libc
+  __libc_lock_init (dirp->lock);
+#endif
+  dirp->allocation = allocation;
+  dirp->size = 0;
+  dirp->offset = 0;
+  dirp->filepos = 0;
+
+  return dirp;
+}

Added: fsf/trunk/libc/sysdeps/posix/readdir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/readdir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/readdir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,122 @@
+/* Copyright (C) 1991-1997,1999,2000,2002,2007 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+#ifndef __READDIR
+# define __READDIR __readdir
+# define __GETDENTS __getdents
+# define DIRENT_TYPE struct dirent
+# define __READDIR_ALIAS
+#endif
+
+/* Read a directory entry from DIRP.  */
+DIRENT_TYPE *
+__READDIR (DIR *dirp)
+{
+  DIRENT_TYPE *dp;
+  int saved_errno = errno;
+
+#ifndef NOT_IN_libc
+  __libc_lock_lock (dirp->lock);
+#endif
+
+  do
+    {
+      size_t reclen;
+
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
+	  if (bytes <= 0)
+	    {
+	      /* On some systems getdents fails with ENOENT when the
+		 open directory has been rmdir'd already.  POSIX.1
+		 requires that we treat this condition like normal EOF.  */
+	      if (bytes < 0 && errno == ENOENT)
+		bytes = 0;
+
+	      /* Don't modifiy errno when reaching EOF.  */
+	      if (bytes == 0)
+		__set_errno (saved_errno);
+	      dp = NULL;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent*' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read jst one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    } while (dp->d_ino == 0);
+
+#ifndef NOT_IN_libc
+  __libc_lock_unlock (dirp->lock);
+#endif
+
+  return dp;
+}
+
+#ifdef __READDIR_ALIAS
+weak_alias (__readdir, readdir)
+#endif

Added: fsf/trunk/libc/sysdeps/posix/readdir_r.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/readdir_r.c (added)
+++ fsf/trunk/libc/sysdeps/posix/readdir_r.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,137 @@
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,02,10
+	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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+#ifndef __READDIR_R
+# define __READDIR_R __readdir_r
+# define __GETDENTS __getdents
+# define DIRENT_TYPE struct dirent
+# define __READDIR_R_ALIAS
+#endif
+
+/* Read a directory entry from DIRP.  */
+int
+__READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
+{
+  DIRENT_TYPE *dp;
+  size_t reclen;
+  const int saved_errno = errno;
+
+  __libc_lock_lock (dirp->lock);
+
+  do
+    {
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
+	  if (bytes <= 0)
+	    {
+	      /* On some systems getdents fails with ENOENT when the
+		 open directory has been rmdir'd already.  POSIX.1
+		 requires that we treat this condition like normal EOF.  */
+	      if (bytes < 0 && errno == ENOENT)
+		{
+		  bytes = 0;
+		  __set_errno (saved_errno);
+		}
+
+	      dp = NULL;
+	      /* Reclen != 0 signals that an error occurred.  */
+	      reclen = bytes != 0;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent*' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read just one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    }
+  while (dp->d_ino == 0);
+
+  if (dp != NULL)
+    {
+#ifdef GETDENTS_64BIT_ALIGNED
+      /* The d_reclen value might include padding which is not part of
+	 the DIRENT_TYPE data structure.  */
+      reclen = MIN (reclen,
+		    offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
+#endif
+      *result = memcpy (entry, dp, reclen);
+#ifdef GETDENTS_64BIT_ALIGNED
+      entry->d_reclen = reclen;
+#endif
+    }
+  else
+    *result = NULL;
+
+  __libc_lock_unlock (dirp->lock);
+
+  return dp != NULL ? 0 : reclen ? errno : 0;
+}
+
+#ifdef __READDIR_R_ALIAS
+weak_alias (__readdir_r, readdir_r)
+#endif

Added: fsf/trunk/libc/sysdeps/posix/rewinddir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/rewinddir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/rewinddir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,40 @@
+/* Copyright (C) 1991, 1995-1998, 2005, 2011 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <dirstream.h>
+
+/* Rewind DIRP to the beginning of the directory.  */
+void
+rewinddir (dirp)
+     DIR *dirp;
+{
+#ifndef NOT_IN_libc
+  __libc_lock_lock (dirp->lock);
+#endif
+  (void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
+  dirp->filepos = 0;
+  dirp->offset = 0;
+  dirp->size = 0;
+#ifndef NOT_IN_libc
+  __libc_lock_unlock (dirp->lock);
+#endif
+}
+libc_hidden_def (rewinddir)

Added: fsf/trunk/libc/sysdeps/posix/seekdir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/seekdir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/seekdir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,1999,2001 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <dirstream.h>
+
+/* Seek to position POS in DIRP.  */
+/* XXX should be __seekdir ? */
+void
+seekdir (dirp, pos)
+     DIR *dirp;
+     long int pos;
+{
+  __libc_lock_lock (dirp->lock);
+  (void) __lseek (dirp->fd, pos, SEEK_SET);
+  dirp->size = 0;
+  dirp->offset = 0;
+  dirp->filepos = pos;
+  __libc_lock_unlock (dirp->lock);
+}

Added: fsf/trunk/libc/sysdeps/posix/telldir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/telldir.c (added)
+++ fsf/trunk/libc/sysdeps/posix/telldir.c Wed Aug  8 00:01:44 2012
@@ -1,0 +1,27 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <dirent.h>
+
+#include <dirstream.h>
+
+/* Return the current position of DIRP.  */
+long int
+telldir (DIR *dirp)
+{
+  return dirp->filepos;
+}

Removed: fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/dirent.h (original)
+++ fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/dirent.h (removed)
@@ -1,54 +1,0 @@
-/* Directory entry structure `struct dirent'.  4.4BSD version.
-   Copyright (C) 1996,97,98,2001 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _DIRENT_H
-# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
-#endif
-
-struct dirent
-  {
-#ifndef __USE_FILE_OFFSET64
-    __ino_t d_ino;		/* File serial number.  */
-#else
-    __ino64_t d_ino;
-#endif
-    unsigned short int d_reclen; /* Length of the whole `struct dirent'.  */
-    unsigned char d_type;	/* File type, possibly unknown.  */
-    unsigned char d_namlen;	/* Length of the file name.  */
-
-    /* Only this member is in the POSIX standard.  */
-    char d_name[1];		/* File name (actually longer).  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct dirent64
-  {
-    __ino64_t d_ino;
-    unsigned short int d_reclen;
-    unsigned char d_type;
-    unsigned char d_namlen;
-
-    char d_name[1];
-  };
-#endif
-
-#define d_fileno	d_ino	/* Backwards compatibility.  */
-
-#define _DIRENT_HAVE_D_RECLEN 1
-#define _DIRENT_HAVE_D_NAMLEN 1
-#define _DIRENT_HAVE_D_TYPE 1

Removed: fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/fcntl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/fcntl.h (original)
+++ fsf/trunk/libc/sysdeps/unix/bsd/bsd4.4/bits/fcntl.h (removed)
@@ -1,112 +1,0 @@
-/* O_*, F_*, FD_* bit values for 4.4 BSD.
-   Copyright (C) 1991, 1992, 1997, 2004 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'.  */
-#define	O_RDONLY	0	/* Open read-only.  */
-#define	O_WRONLY	1	/* Open write-only.  */
-#define	O_RDWR		2	/* Open read/write.  */
-
-
-/* Bits OR'd into the second argument to open.  */
-#define	O_CREAT		0x0200	/* Create file if it doesn't exist.  */
-#define	O_EXCL		0x0800	/* Fail if file already exists.  */
-#define	O_TRUNC		0x0400	/* Truncate file to zero length.  */
-/* Apparently not assigning a controlling terminal is the default
-   behavior in BSD, so no bit is required to request that behavior.  */
-#define	O_NOCTTY	0	/* Don't assign a controlling terminal.  */
-#ifdef	__USE_MISC
-#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x0080	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
-#define	O_SHLOCK	0x0010	/* Open with shared file lock.  */
-#define	O_EXLOCK	0x0020	/* Open with shared exclusive lock.  */
-#endif
-
-/* File status flags for `open' and `fcntl'.  */
-#define	O_APPEND	0x0008	/* Writes append to the file.  */
-#define	O_NONBLOCK	0x0004	/* Non-blocking I/O.  */
-
-#ifdef __USE_BSD
-#define	O_NDELAY	O_NONBLOCK
-#endif
-
-#ifdef __USE_BSD
-/* Bits in the file status flags returned by F_GETFL.
-   These are all the O_* flags, plus FREAD and FWRITE, which are
-   independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
-   given to `open'.  */
-#define FREAD		1
-#define	FWRITE		2
-
-/* Traditional BSD names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNDELAY		O_NDELAY
-#endif
-
-/* Mask for file access modes.  This is system-dependent in case
-   some system ever wants to define some other flavor of access.  */
-#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
-
-/* Values for the second argument to `fcntl'.  */
-#define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
-#define	F_GETFD		1	/* Get file descriptor flags.  */
-#define	F_SETFD		2	/* Set file descriptor flags.  */
-#define	F_GETFL		3	/* Get file status flags.  */
-#define	F_SETFL		4	/* Set file status flags.  */
-#if defined __USE_BSD || defined __USE_UNIX98
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
-#endif
-#define	F_GETLK		7	/* Get record locking info.  */
-#define	F_SETLK		8	/* Set record locking info (non-blocking).  */
-#define	F_SETLKW	9	/* Set record locking info (blocking).  */
-
-/* File descriptor flags used with F_GETFD and F_SETFD.  */
-#define	FD_CLOEXEC	1	/* Close on exec.  */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock.  This is the type of the third
-   argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    short int l_pid;	/* Process holding the lock.  */
-  };
-
-/* Values for the `l_type' field of a `struct flock'.  */
-#define	F_RDLCK	1	/* Read lock.  */
-#define	F_WRLCK	2	/* Write lock.  */
-#define	F_UNLCK	3	/* Remove lock.  */

Removed: fsf/trunk/libc/sysdeps/unix/closedir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/closedir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/closedir.c (removed)
@@ -1,55 +1,0 @@
-/* Copyright (C) 1991,1993,1995,1996,1998,2002,2003, 2007
-   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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <dirstream.h>
-#include <not-cancel.h>
-
-
-/* Close the directory stream DIRP.
-   Return 0 if successful, -1 if not.  */
-int
-__closedir (DIR *dirp)
-{
-  int fd;
-
-  if (dirp == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* We do not try to synchronize access here.  If some other thread
-     still uses this handle it is a big mistake and that thread
-     deserves all the bad data it gets.  */
-
-  fd = dirp->fd;
-
-#ifndef NOT_IN_libc
-  __libc_lock_fini (dirp->lock);
-#endif
-
-  free ((void *) dirp);
-
-  return close_not_cancel (fd);
-}
-weak_alias (__closedir, closedir)

Removed: fsf/trunk/libc/sysdeps/unix/dirfd.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/dirfd.c (original)
+++ fsf/trunk/libc/sysdeps/unix/dirfd.c (removed)
@@ -1,29 +1,0 @@
-/* Return the file descriptor used by a DIR stream.  Unix version.
-   Copyright (C) 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <dirent.h>
-#include <dirstream.h>
-
-#undef dirfd
-
-int
-dirfd (dirp)
-     DIR *dirp;
-{
-  return dirp->fd;
-}

Removed: fsf/trunk/libc/sysdeps/unix/dirstream.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/dirstream.h (original)
+++ fsf/trunk/libc/sysdeps/unix/dirstream.h (removed)
@@ -1,48 +1,0 @@
-/* Copyright (C) 1993, 1995, 1996, 2007 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef	_DIRSTREAM_H
-#define	_DIRSTREAM_H	1
-
-#include <sys/types.h>
-
-#include <bits/libc-lock.h>
-
-/* Directory stream type.
-
-   The miscellaneous Unix `readdir' implementations read directory data
-   into a buffer and return `struct dirent *' pointers into it.  */
-
-struct __dirstream
-  {
-    int fd;			/* File descriptor.  */
-
-    __libc_lock_define (, lock) /* Mutex lock for this structure.  */
-
-    size_t allocation;		/* Space allocated for the block.  */
-    size_t size;		/* Total valid data in the block.  */
-    size_t offset;		/* Current offset into the block.  */
-
-    off_t filepos;		/* Position of next entry to read.  */
-
-    /* Directory block.  */
-    char data[0] __attribute__ ((aligned (__alignof__ (void*))));
-  };
-
-#define _DIR_dirfd(dirp)	((dirp)->fd)
-
-#endif	/* dirstream.h */

Removed: fsf/trunk/libc/sysdeps/unix/fdopendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/fdopendir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/fdopendir.c (removed)
@@ -1,51 +1,0 @@
-/* Copyright (C) 2005, 2006, 2011 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include <not-cancel.h>
-
-
-DIR *
-__fdopendir (int fd)
-{
-  struct stat64 statbuf;
-
-  if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
-    return NULL;
-  if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
-    {
-      __set_errno (ENOTDIR);
-      return NULL;
-    }
-
-  /* Make sure the descriptor allows for reading.  */
-  int flags = __fcntl (fd, F_GETFL);
-  if (__builtin_expect (flags == -1, 0))
-    return NULL;
-  if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
-    {
-      __set_errno (EINVAL);
-      return NULL;
-    }
-
-  return __alloc_dir (fd, false, flags, &statbuf);
-}
-weak_alias (__fdopendir, fdopendir)

Removed: fsf/trunk/libc/sysdeps/unix/opendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/opendir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/opendir.c (removed)
@@ -1,228 +1,0 @@
-/* Copyright (C) 1991-1996,98,2000-2003,2005,2007,2009,2011
-   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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dirstream.h>
-#include <not-cancel.h>
-#include <kernel-features.h>
-
-
-/* opendir() must not accidentally open something other than a directory.
-   Some OS's have kernel support for that, some don't.  In the worst
-   case we have to stat() before the open() AND fstat() after.
-
-   We have to test at runtime for kernel support since libc may have
-   been compiled with different headers to the kernel it's running on.
-   This test can't be done reliably in the general case.  We'll use
-   /dev/null, which if it's not a device lots of stuff will break, as
-   a guinea pig.  It may be missing in chroot environments, so we
-   make sure to fail safe. */
-#ifdef O_DIRECTORY
-# ifdef O_DIRECTORY_WORKS
-#  define o_directory_works 1
-#  define tryopen_o_directory() while (1) /* This must not be called.  */
-# else
-static int o_directory_works;
-
-static void
-tryopen_o_directory (void)
-{
-  int serrno = errno;
-  int x = open_not_cancel_2 ("/dev/null", O_RDONLY|O_NDELAY|O_DIRECTORY);
-
-  if (x >= 0)
-    {
-      close_not_cancel_no_status (x);
-      o_directory_works = -1;
-    }
-  else if (errno != ENOTDIR)
-    o_directory_works = -1;
-  else
-    o_directory_works = 1;
-
-  __set_errno (serrno);
-}
-# endif
-# define EXTRA_FLAGS O_DIRECTORY
-#else
-# define EXTRA_FLAGS 0
-#endif
-
-
-DIR *
-internal_function
-__opendirat (int dfd, const char *name)
-{
-  struct stat64 statbuf;
-  struct stat64 *statp = NULL;
-
-  if (__builtin_expect (name[0], '\1') == '\0')
-    {
-      /* POSIX.1-1990 says an empty name gets ENOENT;
-	 but `open' might like it fine.  */
-      __set_errno (ENOENT);
-      return NULL;
-    }
-
-#ifdef O_DIRECTORY
-  /* Test whether O_DIRECTORY works.  */
-  if (o_directory_works == 0)
-    tryopen_o_directory ();
-
-  /* We can skip the expensive `stat' call if O_DIRECTORY works.  */
-  if (o_directory_works < 0)
-#endif
-    {
-      /* We first have to check whether the name is for a directory.  We
-	 cannot do this after the open() call since the open/close operation
-	 performed on, say, a tape device might have undesirable effects.  */
-      if (__builtin_expect (__xstat64 (_STAT_VER, name, &statbuf), 0) < 0)
-	return NULL;
-      if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
-	{
-	  __set_errno (ENOTDIR);
-	  return NULL;
-	 }
-    }
-
-  int flags = O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE;
-#ifdef O_CLOEXEC
-  flags |= O_CLOEXEC;
-#endif
-  int fd;
-#ifdef IS_IN_rtld
-  assert (dfd == AT_FDCWD);
-  fd = open_not_cancel_2 (name, flags);
-#else
-  fd = openat_not_cancel_3 (dfd, name, flags);
-#endif
-  if (__builtin_expect (fd, 0) < 0)
-    return NULL;
-
-#ifdef O_DIRECTORY
-  if (o_directory_works <= 0)
-#endif
-    {
-      /* Now make sure this really is a directory and nothing changed since
-	 the `stat' call.  */
-      if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
-	goto lose;
-      if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
-	{
-	  __set_errno (ENOTDIR);
-	lose:
-	  close_not_cancel_no_status (fd);
-	  return NULL;
-	}
-      statp = &statbuf;
-    }
-
-  return __alloc_dir (fd, true, 0, statp);
-}
-
-
-/* Open a directory stream on NAME.  */
-DIR *
-__opendir (const char *name)
-{
-  return __opendirat (AT_FDCWD, name);
-}
-weak_alias (__opendir, opendir)
-
-
-#ifdef __ASSUME_O_CLOEXEC
-# define check_have_o_cloexec(fd) 1
-#else
-static int
-check_have_o_cloexec (int fd)
-{
-  if (__have_o_cloexec == 0)
-    __have_o_cloexec = (__fcntl (fd, F_GETFD, 0) & FD_CLOEXEC) == 0 ? -1 : 1;
-  return __have_o_cloexec > 0;
-}
-#endif
-
-
-DIR *
-internal_function
-__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp)
-{
-  /* We always have to set the close-on-exit flag if the user provided
-     the file descriptor.  Otherwise only if we have no working
-     O_CLOEXEC support.  */
-#ifdef O_CLOEXEC
-  if ((! close_fd && (flags & O_CLOEXEC) == 0)
-      || ! check_have_o_cloexec (fd))
-#endif
-    {
-      if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
-	goto lose;
-    }
-
-  const size_t default_allocation = (4 * BUFSIZ < sizeof (struct dirent64)
-				     ? sizeof (struct dirent64) : 4 * BUFSIZ);
-  const size_t small_allocation = (BUFSIZ < sizeof (struct dirent64)
-				   ? sizeof (struct dirent64) : BUFSIZ);
-  size_t allocation = default_allocation;
-#ifdef _STATBUF_ST_BLKSIZE
-  if (statp != NULL && default_allocation < statp->st_blksize)
-    allocation = statp->st_blksize;
-#endif
-
-  DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation);
-  if (dirp == NULL)
-    {
-      allocation = small_allocation;
-      dirp = (DIR *) malloc (sizeof (DIR) + allocation);
-
-      if (dirp == NULL)
-      lose:
-	{
-	  if (close_fd)
-	    {
-	      int save_errno = errno;
-	      close_not_cancel_no_status (fd);
-	      __set_errno (save_errno);
-	    }
-	  return NULL;
-	}
-    }
-
-  dirp->fd = fd;
-#ifndef NOT_IN_libc
-  __libc_lock_init (dirp->lock);
-#endif
-  dirp->allocation = allocation;
-  dirp->size = 0;
-  dirp->offset = 0;
-  dirp->filepos = 0;
-
-  return dirp;
-}

Removed: fsf/trunk/libc/sysdeps/unix/readdir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/readdir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/readdir.c (removed)
@@ -1,122 +1,0 @@
-/* Copyright (C) 1991-1997,1999,2000,2002,2007 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <limits.h>
-#include <stddef.h>
-#include <string.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <assert.h>
-
-#include <dirstream.h>
-
-#ifndef __READDIR
-# define __READDIR __readdir
-# define __GETDENTS __getdents
-# define DIRENT_TYPE struct dirent
-# define __READDIR_ALIAS
-#endif
-
-/* Read a directory entry from DIRP.  */
-DIRENT_TYPE *
-__READDIR (DIR *dirp)
-{
-  DIRENT_TYPE *dp;
-  int saved_errno = errno;
-
-#ifndef NOT_IN_libc
-  __libc_lock_lock (dirp->lock);
-#endif
-
-  do
-    {
-      size_t reclen;
-
-      if (dirp->offset >= dirp->size)
-	{
-	  /* We've emptied out our buffer.  Refill it.  */
-
-	  size_t maxread;
-	  ssize_t bytes;
-
-#ifndef _DIRENT_HAVE_D_RECLEN
-	  /* Fixed-size struct; must read one at a time (see below).  */
-	  maxread = sizeof *dp;
-#else
-	  maxread = dirp->allocation;
-#endif
-
-	  bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
-	  if (bytes <= 0)
-	    {
-	      /* On some systems getdents fails with ENOENT when the
-		 open directory has been rmdir'd already.  POSIX.1
-		 requires that we treat this condition like normal EOF.  */
-	      if (bytes < 0 && errno == ENOENT)
-		bytes = 0;
-
-	      /* Don't modifiy errno when reaching EOF.  */
-	      if (bytes == 0)
-		__set_errno (saved_errno);
-	      dp = NULL;
-	      break;
-	    }
-	  dirp->size = (size_t) bytes;
-
-	  /* Reset the offset into the buffer.  */
-	  dirp->offset = 0;
-	}
-
-      dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
-
-#ifdef _DIRENT_HAVE_D_RECLEN
-      reclen = dp->d_reclen;
-#else
-      /* The only version of `struct dirent*' that lacks `d_reclen'
-	 is fixed-size.  */
-      assert (sizeof dp->d_name > 1);
-      reclen = sizeof *dp;
-      /* The name is not terminated if it is the largest possible size.
-	 Clobber the following byte to ensure proper null termination.  We
-	 read jst one entry at a time above so we know that byte will not
-	 be used later.  */
-      dp->d_name[sizeof dp->d_name] = '\0';
-#endif
-
-      dirp->offset += reclen;
-
-#ifdef _DIRENT_HAVE_D_OFF
-      dirp->filepos = dp->d_off;
-#else
-      dirp->filepos += reclen;
-#endif
-
-      /* Skip deleted files.  */
-    } while (dp->d_ino == 0);
-
-#ifndef NOT_IN_libc
-  __libc_lock_unlock (dirp->lock);
-#endif
-
-  return dp;
-}
-
-#ifdef __READDIR_ALIAS
-weak_alias (__readdir, readdir)
-#endif

Removed: fsf/trunk/libc/sysdeps/unix/readdir_r.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/readdir_r.c (original)
+++ fsf/trunk/libc/sysdeps/unix/readdir_r.c (removed)
@@ -1,137 +1,0 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,02,10
-	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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <limits.h>
-#include <stddef.h>
-#include <string.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <assert.h>
-
-#include <dirstream.h>
-
-#ifndef __READDIR_R
-# define __READDIR_R __readdir_r
-# define __GETDENTS __getdents
-# define DIRENT_TYPE struct dirent
-# define __READDIR_R_ALIAS
-#endif
-
-/* Read a directory entry from DIRP.  */
-int
-__READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
-{
-  DIRENT_TYPE *dp;
-  size_t reclen;
-  const int saved_errno = errno;
-
-  __libc_lock_lock (dirp->lock);
-
-  do
-    {
-      if (dirp->offset >= dirp->size)
-	{
-	  /* We've emptied out our buffer.  Refill it.  */
-
-	  size_t maxread;
-	  ssize_t bytes;
-
-#ifndef _DIRENT_HAVE_D_RECLEN
-	  /* Fixed-size struct; must read one at a time (see below).  */
-	  maxread = sizeof *dp;
-#else
-	  maxread = dirp->allocation;
-#endif
-
-	  bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
-	  if (bytes <= 0)
-	    {
-	      /* On some systems getdents fails with ENOENT when the
-		 open directory has been rmdir'd already.  POSIX.1
-		 requires that we treat this condition like normal EOF.  */
-	      if (bytes < 0 && errno == ENOENT)
-		{
-		  bytes = 0;
-		  __set_errno (saved_errno);
-		}
-
-	      dp = NULL;
-	      /* Reclen != 0 signals that an error occurred.  */
-	      reclen = bytes != 0;
-	      break;
-	    }
-	  dirp->size = (size_t) bytes;
-
-	  /* Reset the offset into the buffer.  */
-	  dirp->offset = 0;
-	}
-
-      dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
-
-#ifdef _DIRENT_HAVE_D_RECLEN
-      reclen = dp->d_reclen;
-#else
-      /* The only version of `struct dirent*' that lacks `d_reclen'
-	 is fixed-size.  */
-      assert (sizeof dp->d_name > 1);
-      reclen = sizeof *dp;
-      /* The name is not terminated if it is the largest possible size.
-	 Clobber the following byte to ensure proper null termination.  We
-	 read just one entry at a time above so we know that byte will not
-	 be used later.  */
-      dp->d_name[sizeof dp->d_name] = '\0';
-#endif
-
-      dirp->offset += reclen;
-
-#ifdef _DIRENT_HAVE_D_OFF
-      dirp->filepos = dp->d_off;
-#else
-      dirp->filepos += reclen;
-#endif
-
-      /* Skip deleted files.  */
-    }
-  while (dp->d_ino == 0);
-
-  if (dp != NULL)
-    {
-#ifdef GETDENTS_64BIT_ALIGNED
-      /* The d_reclen value might include padding which is not part of
-	 the DIRENT_TYPE data structure.  */
-      reclen = MIN (reclen,
-		    offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
-#endif
-      *result = memcpy (entry, dp, reclen);
-#ifdef GETDENTS_64BIT_ALIGNED
-      entry->d_reclen = reclen;
-#endif
-    }
-  else
-    *result = NULL;
-
-  __libc_lock_unlock (dirp->lock);
-
-  return dp != NULL ? 0 : reclen ? errno : 0;
-}
-
-#ifdef __READDIR_R_ALIAS
-weak_alias (__readdir_r, readdir_r)
-#endif

Removed: fsf/trunk/libc/sysdeps/unix/rewinddir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/rewinddir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/rewinddir.c (removed)
@@ -1,40 +1,0 @@
-/* Copyright (C) 1991, 1995-1998, 2005, 2011 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <stddef.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <dirstream.h>
-
-/* Rewind DIRP to the beginning of the directory.  */
-void
-rewinddir (dirp)
-     DIR *dirp;
-{
-#ifndef NOT_IN_libc
-  __libc_lock_lock (dirp->lock);
-#endif
-  (void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
-  dirp->filepos = 0;
-  dirp->offset = 0;
-  dirp->size = 0;
-#ifndef NOT_IN_libc
-  __libc_lock_unlock (dirp->lock);
-#endif
-}
-libc_hidden_def (rewinddir)

Removed: fsf/trunk/libc/sysdeps/unix/seekdir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/seekdir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/seekdir.c (removed)
@@ -1,37 +1,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1999,2001 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <dirstream.h>
-
-/* Seek to position POS in DIRP.  */
-/* XXX should be __seekdir ? */
-void
-seekdir (dirp, pos)
-     DIR *dirp;
-     long int pos;
-{
-  __libc_lock_lock (dirp->lock);
-  (void) __lseek (dirp->fd, pos, SEEK_SET);
-  dirp->size = 0;
-  dirp->offset = 0;
-  dirp->filepos = pos;
-  __libc_lock_unlock (dirp->lock);
-}

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/configure
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/configure (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/configure Wed Aug  8 00:01:44 2012
@@ -284,34 +284,34 @@
 case "$machine" in
   i386*)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   s390/s390-32)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   s390/s390-64)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   sh*)
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     libc_cv_gcc_unwind_find_fde=yes
     ;;
   sparc/sparc64*)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   sparc*)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   *)
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
 esac
 if test -n "$minimum_kernel"; then

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/configure.in
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/configure.in (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/configure.in Wed Aug  8 00:01:44 2012
@@ -41,34 +41,34 @@
 case "$machine" in
   i386*)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   s390/s390-32)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   s390/s390-64)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   sh*)
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     libc_cv_gcc_unwind_find_fde=yes
     ;;
   sparc/sparc64*)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   sparc*)
     libc_cv_gcc_unwind_find_fde=yes
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
   *)
-    arch_minimum_kernel=2.6.0
+    arch_minimum_kernel=2.6.16
     ;;
 esac
 if test -n "$minimum_kernel"; then

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/dl-execstack.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/dl-execstack.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/dl-execstack.c Wed Aug  8 00:01:44 2012
@@ -1,5 +1,5 @@
 /* Stack executability handling for GNU dynamic linker.  Linux version.
-   Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 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
@@ -46,95 +46,11 @@
       || __builtin_expect (*stack_endp != __libc_stack_end, 0))
     return EPERM;
 
-  /* Newer Linux kernels support a flag to make our job easy.  */
-#if defined  PROT_GROWSDOWN || defined PROT_GROWSUP
-# if __ASSUME_PROT_GROWSUPDOWN == 0
-  static bool no_growsupdown;
-  if (! no_growsupdown)
-# endif
-    {
-      if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize),
-					__stack_prot) == 0, 1))
-	goto return_success;
-# if __ASSUME_PROT_GROWSUPDOWN == 0
-      if (errno == EINVAL)
-	no_growsupdown = true;
-      else
-# endif
-	{
-	  result = errno;
-	  goto out;
-	}
-    }
-#endif
-
-  /* There is always a hole in the address space below the bottom of the
-     stack.  So when we make an mprotect call that starts below the bottom
-     of the stack, it will include the hole and fail with ENOMEM.
-
-     We start with a random guess at how deep the stack might have gotten
-     so as to have extended the GROWSDOWN mapping to lower pages.  */
-
-#if __ASSUME_PROT_GROWSUPDOWN == 0
-  size_t size = GLRO(dl_pagesize) * 8;
-
-# if _STACK_GROWS_DOWN
-  page = page + GLRO(dl_pagesize) - size;
-  while (1)
-    {
-      if (__mprotect ((void *) page, size,
-		      __stack_prot & ~PROT_GROWSDOWN) == 0)
-	/* We got this chunk changed; loop to do another chunk below.  */
-	page -= size;
-      else
-	{
-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    {
-	      result = errno;
-	      goto out;
-	    }
-
-	  if (size == GLRO(dl_pagesize))
-	    /* We just tried to mprotect the top hole page and failed.
-	       We are done.  */
-	    break;
-
-	  /* Our mprotect call failed because it started below the lowest
-	     stack page.  Try again on just the top half of that region.  */
-	  size /= 2;
-	  page += size;
-	}
-    }
-
-# elif _STACK_GROWS_UP
-  while (1)
-    {
-      if (__mprotect ((void *) page, size, __stack_prot & ~PROT_GROWSUP) == 0)
-	/* We got this chunk changed; loop to do another chunk below.  */
-	page += size;
-      else
-	{
-	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    {
-	      result = errno;
-	      goto out;
-	    }
-
-	  if (size == GLRO(dl_pagesize))
-	    /* We just tried to mprotect the lowest hole page and failed.
-	       We are done.  */
-	    break;
-
-	  /* Our mprotect call failed because it extended past the highest
-	     stack page.  Try again on just the bottom half of that region.  */
-	  size /= 2;
-	}
-    }
-
-# else
-#  error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
-# endif
-#endif
+  if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize),
+				    __stack_prot) == 0, 1))
+    goto return_success;
+  result = errno;
+  goto out;
 
  return_success:
   /* Clear the address.  */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c Wed Aug  8 00:01:44 2012
@@ -97,7 +97,6 @@
 {
   ssize_t retval;
 
-#ifdef __ASSUME_GETDENTS32_D_TYPE
   /* The d_ino and d_off fields in kernel_dirent and dirent must have
      the same sizes and alignments.  */
   if (sizeof (DIRENT_TYPE) == sizeof (struct dirent)
@@ -135,7 +134,6 @@
 
       return retval;
     }
-#endif
 
   off64_t last_offset = -1;
 
@@ -293,11 +291,7 @@
 	DIRENT_SET_DP_INO(dp, kdp->d_ino);
 	dp->d_off = kdp->d_off;
 	dp->d_reclen = new_reclen;
-#ifdef __ASSUME_GETDENTS32_D_TYPE
 	dp->d_type = *((char *) kdp + kdp->d_reclen - 1);
-#else
-	dp->d_type = DT_UNKNOWN;
-#endif
 	memcpy (dp->d_name, kdp->d_name,
 		kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/readdir64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/readdir64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/readdir64.c Wed Aug  8 00:01:44 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2012 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,7 +19,7 @@
 #define __GETDENTS __getdents64
 #define DIRENT_TYPE struct dirent64
 
-#include <sysdeps/unix/readdir.c>
+#include <sysdeps/posix/readdir.c>
 
 #include <shlib-compat.h>
 
@@ -37,7 +37,7 @@
 #define __GETDENTS __old_getdents64
 #define DIRENT_TYPE struct __old_dirent64
 
-#include <sysdeps/unix/readdir.c>
+#include <sysdeps/posix/readdir.c>
 
 compat_symbol (libc, __old_readdir64, readdir64, GLIBC_2_1);
 #endif

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Wed Aug  8 00:01:44 2012
@@ -108,19 +108,15 @@
 #define __ASSUME_POSIX_TIMERS		1
 
 /* Beginning with 2.6.12 the clock and timer supports CPU clocks.  */
-#if __LINUX_KERNEL_VERSION >= 0x2060c
-# define __ASSUME_POSIX_CPU_TIMERS	1
-#endif
+#define __ASSUME_POSIX_CPU_TIMERS	1
 
 /* The statfs64 syscalls are available in 2.5.74 (but not for alpha).  */
 #define __ASSUME_STATFS64	1
 
 /* The tgkill syscall was instroduced for i386 in 2.5.75.  On x86-64,
    sparc, SH, ppc, and ppc64 it was introduced in 2.6.0-test3. */
-#if defined __i386__ \
-    || (__LINUX_KERNEL_VERSION >= 132609 \
-        && (defined __x86_64__ || defined __powerpc__ \
-            || defined __sh__ || defined __sparc__))
+#if (defined __i386__ || defined __x86_64__ || defined __powerpc__	\
+     || defined __sh__ || defined __sparc__)
 # define __ASSUME_TGKILL	1
 #endif
 
@@ -129,34 +125,18 @@
    ppc, and ppc64 it was introduced in 2.6.0-test3.  */
 #if defined __sparc__ \
     || defined __i386__ \
-    || (__LINUX_KERNEL_VERSION > 132609 && defined __x86_64__) \
-    || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
-    || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
+    || defined __x86_64__ \
+    || defined __powerpc__ \
+    || defined __sh__
 # define __ASSUME_UTIMES	1
-#endif
-
-// XXX Disabled for now since the semantics we want is not achieved.
-#if 0
-/* The CLONE_STOPPED flag was introduced in the 2.6.0-test1 series.  */
-#if __LINUX_KERNEL_VERSION >= 132609
-# define __ASSUME_CLONE_STOPPED	1
-#endif
 #endif
 
 /* The fixed version of the posix_fadvise64 syscall appeared in
    2.6.0-test3.  At least for x86 and sparc.  Powerpc support appeared
    in 2.6.2, but for 32-bit userspace only.  */
-#if (__LINUX_KERNEL_VERSION >= 132609				\
-     && (defined __i386__ || defined __sparc__))		\
-    || (__LINUX_KERNEL_VERSION >= 132610 && defined __powerpc__ \
-       && !defined __powerpc64__)
+#if (defined __i386__ || defined __sparc__			\
+     || (defined __powerpc__ && !defined __powerpc64__))
 # define __ASSUME_FADVISE64_64_SYSCALL	1
-#endif
-
-/* The PROT_GROWSDOWN/PROT_GROWSUP flags were introduced in the 2.6.0-test
-   series.  */
-#if __LINUX_KERNEL_VERSION >= 132609
-# define __ASSUME_PROT_GROWSUPDOWN	1
 #endif
 
 /* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector
@@ -166,32 +146,8 @@
 # define __ASSUME_SWAPCONTEXT_SYSCALL	1
 #endif
 
-/* The CLONE_DETACHED flag is not necessary in 2.6.2 kernels, it is
-   implied.  */
-#if __LINUX_KERNEL_VERSION >= 132610
-# define __ASSUME_NO_CLONE_DETACHED	1
-#endif
-
-/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
-   information as well and in between 2.6.5 and 2.6.8 most compat wrappers
-   were fixed too.  Except s390{,x} which was fixed in 2.6.11.  */
-#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
-    || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
-# define __ASSUME_GETDENTS32_D_TYPE	1
-#endif
-
-/* Starting with version 2.6.9, the waitid system call is available.
-   Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12.  */
-#if (__LINUX_KERNEL_VERSION >= 0x020609 \
-     && !defined __powerpc__ && !defined __s390__) \
-    || (__LINUX_KERNEL_VERSION >= 0x02060c \

[... 159 lines stripped ...]
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits