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

[commits] r3020 - in /fsf/trunk/libc: ./ include/ io/ login/ posix/ rt/ stdlib/ sysdeps/generic/ sysdeps/unix/ wcsmbs/



Author: eglibc
Date: Fri Aug  3 00:03:22 2007
New Revision: 3020

Log:
Import glibc-mainline for 2007-08-03

Added:
    fsf/trunk/libc/io/have_o_cloexec.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/include/fcntl.h
    fsf/trunk/libc/include/stdlib.h
    fsf/trunk/libc/include/wchar.h
    fsf/trunk/libc/io/Makefile
    fsf/trunk/libc/login/utmp_file.c
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/rt/mqueue.h
    fsf/trunk/libc/stdlib/stdlib.h
    fsf/trunk/libc/sysdeps/generic/inttypes.h
    fsf/trunk/libc/sysdeps/unix/dirstream.h
    fsf/trunk/libc/sysdeps/unix/opendir.c
    fsf/trunk/libc/wcsmbs/wchar.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Aug  3 00:03:22 2007
@@ -1,3 +1,40 @@
+2007-08-02  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* io/Makefile (aux): Add have_o_cloexec.
+	* include/fcntl.h: Declare __have_o_cloexec.
+	* io/have_o_cloexec.c: New file.
+	* sysdeps/unix/opendir.c (__opendir): Use O_CLOEXEC is available.
+	(__alloc_dir): If O_CLOEXEC has been used, don't duplicate the
+	fcntl call if not necessary.
+	* login/utmp_file.c (setutent_file): Use __have_o_cloexec instead
+	of local variable.
+
+	* sysdeps/unix/opendir.c (__alloc_dir): Don't initialize ->data.
+	Avoid memset, add explicit initialization.
+	* sysdeps/unix/dirstream.h (struct __dirstream): Move data elemtn
+	to the end and change into zero-sized array.
+	Move lock member to fill a hole on 64-bit platforms.
+
+	* stdlib/stdlib.h: Remove __strto*_internal prototypes and strto*
+	inline functions.
+	* include/stdlib.h: Add __strto*_internal prototypes here.
+	* wcsmbs/wchar.h: Remove __wcsto*_internal prototypes and wcsto*
+	inline functions.
+	* include/wchar.h: Add __wcsto*_internal prototypes.
+	* sysdeps/generic/inttypes.h: No need to protect the declaration
+	of the __strto*_internal and __wcsto*_internal members here.
+
+	* rt/mqueue.h: Change const to __const and add nonnull attributes.
+
+2007-08-02  Roland McGrath  <roland@xxxxxxxxxx>
+
+	* posix/Makefile ($(inst_libexecdir)/getconf): Make hard links to
+	$(inst_bindir)/getconf if possible.
+
+	* posix/Makefile ($(objpfx)getconf.speclist): New target.
+	(generated): Add it.
+	($(inst_libexecdir)/getconf): Use it.
+
 2007-08-01  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Using

Modified: fsf/trunk/libc/include/fcntl.h
==============================================================================
--- fsf/trunk/libc/include/fcntl.h (original)
+++ fsf/trunk/libc/include/fcntl.h Fri Aug  3 00:03:22 2007
@@ -41,4 +41,8 @@
 /* Flag determining whether the *at system calls are available.  */
 extern int __have_atfcts attribute_hidden;
 
+#ifdef O_CLOEXEC
+extern int __have_o_cloexec attribute_hidden;
 #endif
+
+#endif

Modified: fsf/trunk/libc/include/stdlib.h
==============================================================================
--- fsf/trunk/libc/include/stdlib.h (original)
+++ fsf/trunk/libc/include/stdlib.h Fri Aug  3 00:03:22 2007
@@ -28,13 +28,6 @@
 libc_hidden_proto (lrand48_r)
 libc_hidden_proto (wctomb)
 libc_hidden_proto (__secure_getenv)
-libc_hidden_proto (__strtof_internal)
-libc_hidden_proto (__strtod_internal)
-libc_hidden_proto (__strtold_internal)
-libc_hidden_proto (__strtol_internal)
-libc_hidden_proto (__strtoll_internal)
-libc_hidden_proto (__strtoul_internal)
-libc_hidden_proto (__strtoull_internal)
 
 extern long int __random (void);
 extern void __srandom (unsigned int __seed);
@@ -100,6 +93,44 @@
 
 extern int __libc_system (const char *line);
 
+
+extern double __strtod_internal (__const char *__restrict __nptr,
+				 char **__restrict __endptr, int __group)
+     __THROW __nonnull ((1)) __wur;
+extern float __strtof_internal (__const char *__restrict __nptr,
+				char **__restrict __endptr, int __group)
+     __THROW __nonnull ((1)) __wur;
+extern long double __strtold_internal (__const char *__restrict __nptr,
+				       char **__restrict __endptr,
+				       int __group)
+     __THROW __nonnull ((1)) __wur;
+extern long int __strtol_internal (__const char *__restrict __nptr,
+				   char **__restrict __endptr,
+				   int __base, int __group)
+     __THROW __nonnull ((1)) __wur;
+extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
+					     char **__restrict __endptr,
+					     int __base, int __group)
+     __THROW __nonnull ((1)) __wur;
+__extension__
+extern long long int __strtoll_internal (__const char *__restrict __nptr,
+					 char **__restrict __endptr,
+					 int __base, int __group)
+     __THROW __nonnull ((1)) __wur;
+__extension__
+extern unsigned long long int __strtoull_internal (__const char *
+						   __restrict __nptr,
+						   char **__restrict __endptr,
+						   int __base, int __group)
+     __THROW __nonnull ((1)) __wur;
+libc_hidden_proto (__strtof_internal)
+libc_hidden_proto (__strtod_internal)
+libc_hidden_proto (__strtold_internal)
+libc_hidden_proto (__strtol_internal)
+libc_hidden_proto (__strtoll_internal)
+libc_hidden_proto (__strtoul_internal)
+libc_hidden_proto (__strtoull_internal)
+
 extern double ____strtod_l_internal (__const char *__restrict __nptr,
 				     char **__restrict __endptr, int __group,
 				     __locale_t __loc);

Modified: fsf/trunk/libc/include/wchar.h
==============================================================================
--- fsf/trunk/libc/include/wchar.h (original)
+++ fsf/trunk/libc/include/wchar.h Fri Aug  3 00:03:22 2007
@@ -18,6 +18,32 @@
 libc_hidden_proto (__wcsftime_l)
 
 
+extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
+				 wchar_t **__restrict __endptr, int __group)
+     __THROW;
+extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
+				wchar_t **__restrict __endptr, int __group)
+     __THROW;
+extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
+				       wchar_t **__restrict __endptr,
+				       int __group) __THROW;
+extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
+				   wchar_t **__restrict __endptr,
+				   int __base, int __group) __THROW;
+extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
+					     wchar_t **__restrict __endptr,
+					     int __base, int __group) __THROW;
+__extension__
+extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
+					 wchar_t **__restrict __endptr,
+					 int __base, int __group) __THROW;
+__extension__
+extern unsigned long long int __wcstoull_internal (__const wchar_t *
+						   __restrict __nptr,
+						   wchar_t **
+						   __restrict __endptr,
+						   int __base,
+						   int __group) __THROW;
 libc_hidden_proto (__wcstof_internal)
 libc_hidden_proto (__wcstod_internal)
 libc_hidden_proto (__wcstold_internal)

Modified: fsf/trunk/libc/io/Makefile
==============================================================================
--- fsf/trunk/libc/io/Makefile (original)
+++ fsf/trunk/libc/io/Makefile Fri Aug  3 00:03:22 2007
@@ -54,6 +54,8 @@
 	sendfile sendfile64 \
 	utimensat futimens
 
+aux := have_o_cloexec
+
 # These routines will be omitted from the libc shared object.
 # Instead the static object files will be included in a special archive
 # linked against when the shared library will be used.

Added: fsf/trunk/libc/io/have_o_cloexec.c
==============================================================================
--- fsf/trunk/libc/io/have_o_cloexec.c (added)
+++ fsf/trunk/libc/io/have_o_cloexec.c Fri Aug  3 00:03:22 2007
@@ -1,0 +1,24 @@
+/* Copyright (C) 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fcntl.h>
+#include <kernel-features.h>
+
+#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
+int __have_o_cloexec;
+#endif

Modified: fsf/trunk/libc/login/utmp_file.c
==============================================================================
--- fsf/trunk/libc/login/utmp_file.c (original)
+++ fsf/trunk/libc/login/utmp_file.c Fri Aug  3 00:03:22 2007
@@ -157,9 +157,7 @@
 
 #ifndef __ASSUME_O_CLOEXEC
 # ifdef O_CLOEXEC
-      static int have_o_cloexec;
-
-      if (have_o_cloexec <= 0)
+      if (__have_o_cloexec <= 0)
 # endif
 	{
 	  /* We have to make sure the file is `closed on exec'.  */
@@ -167,8 +165,8 @@
 	  if (result >= 0)
 	    {
 # ifdef O_CLOEXEC
-	      if (have_o_cloexec == 0)
-		have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
+	      if (__have_o_cloexec == 0)
+		__have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
 # endif
 
 	      result = fcntl_not_cancel (file_fd, F_SETFD,

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Fri Aug  3 00:03:22 2007
@@ -110,7 +110,7 @@
 	     tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
 	     tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
 	     bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
-	     tst-vfork3-mem tst-vfork3.mtrace
+	     tst-vfork3-mem tst-vfork3.mtrace getconf.speclist
 
 include ../Rules
 
@@ -291,12 +291,16 @@
 $(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@
 
-$(inst_libexecdir)/getconf: $(objpfx)getconf FORCE
+$(inst_libexecdir)/getconf: $(inst_bindir)/getconf \
+			    $(objpfx)getconf.speclist FORCE
 	$(addprefix $(..)./scripts/mkinstalldirs ,\
 		    $(filter-out $(wildcard $@),$@))
-	for spec in `LC_ALL=C GETCONF_DIR=/dev/null \
-		     $(run-program-prefix) $< \
-		     _POSIX_V6_WIDTH_RESTRICTED_ENVS`; do \
-		$(INSTALL_PROGRAM) $< $@/$$spec.new; \
-		mv -f $@/$$spec.new $@/$$spec; \
-	done
+	while read spec; do \
+	  ln -f $< $@/$$spec.new || $(INSTALL_PROGRAM) $< $@/$$spec.new; \
+	  mv -f $@/$$spec.new $@/$$spec; \
+	done < $(objpfx)getconf.speclist
+
+$(objpfx)getconf.speclist: $(objpfx)getconf
+	LC_ALL=C GETCONF_DIR=/dev/null \
+	$(run-program-prefix) $< _POSIX_V6_WIDTH_RESTRICTED_ENVS > $@.new
+	mv -f $@.new

Modified: fsf/trunk/libc/rt/mqueue.h
==============================================================================
--- fsf/trunk/libc/rt/mqueue.h (original)
+++ fsf/trunk/libc/rt/mqueue.h Fri Aug  3 00:03:22 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 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
@@ -38,37 +38,40 @@
    argument is taken as `struct mq_attr *', pointer to message queue
    attributes.  If the fourth argument is NULL, default attributes are
    used.  */
-extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW;
+extern mqd_t mq_open (__const char *__name, int __oflag, ...)
+  __THROW __nonnull ((1));
 
 /* Removes the association between message queue descriptor MQDES and its
    message queue.  */
 extern int mq_close (mqd_t __mqdes) __THROW;
 
 /* Query status and attributes of message queue MQDES.  */
-extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat) __THROW;
+extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat)
+  __THROW __nonnull ((2));
 
 /* Set attributes associated with message queue MQDES and if OMQSTAT is
    not NULL also query its old attributes.  */
 extern int mq_setattr (mqd_t __mqdes,
-		       const struct mq_attr *__restrict __mqstat,
-		       struct mq_attr *__restrict __omqstat) __THROW;
+		       __const struct mq_attr *__restrict __mqstat,
+		       struct mq_attr *__restrict __omqstat)
+  __THROW __nonnull ((2));
 
 /* Remove message queue named NAME.  */
-extern int mq_unlink (const char *__name) __THROW;
+extern int mq_unlink (__const char *__name) __THROW __nonnull ((1));
 
 /* Register notification issued upon message arrival to an empty
    message queue MQDES.  */
-extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
+extern int mq_notify (mqd_t __mqdes, __const struct sigevent *__notification)
      __THROW;
 
 /* Receive the oldest from highest priority messages in message queue
    MQDES.  */
 extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len,
-			   unsigned int *__msg_prio);
+			   unsigned int *__msg_prio) __nonnull ((2));
 
 /* Add message pointed by MSG_PTR to message queue MQDES.  */
-extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len,
-		    unsigned int __msg_prio);
+extern int mq_send (mqd_t __mqdes, __const char *__msg_ptr, size_t __msg_len,
+		    unsigned int __msg_prio) __nonnull ((2));
 
 #ifdef __USE_XOPEN2K
 /* Receive the oldest from highest priority messages in message queue
@@ -76,13 +79,15 @@
 extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
 				size_t __msg_len,
 				unsigned int *__restrict __msg_prio,
-				const struct timespec *__restrict __abs_timeout);
+				__const struct timespec *__restrict __abs_timeout)
+  __nonnull ((1, 4));
 
 /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
    on full message queue if ABS_TIMEOUT expires.  */
-extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
+extern int mq_timedsend (mqd_t __mqdes, __const char *__msg_ptr,
 			 size_t __msg_len, unsigned int __msg_prio,
-			 const struct timespec *__abs_timeout);
+			 __const struct timespec *__abs_timeout)
+  __nonnull ((1, 4));
 #endif
 
 __END_DECLS

Modified: fsf/trunk/libc/stdlib/stdlib.h
==============================================================================
--- fsf/trunk/libc/stdlib/stdlib.h (original)
+++ fsf/trunk/libc/stdlib/stdlib.h Fri Aug  3 00:03:22 2007
@@ -273,125 +273,7 @@
 #endif /* GNU */
 
 
-/* The internal entry points for `strtoX' take an extra flag argument
-   saying whether or not to parse locale-dependent number grouping.  */
-
-extern double __strtod_internal (__const char *__restrict __nptr,
-				 char **__restrict __endptr, int __group)
-     __THROW __nonnull ((1)) __wur;
-extern float __strtof_internal (__const char *__restrict __nptr,
-				char **__restrict __endptr, int __group)
-     __THROW __nonnull ((1)) __wur;
-extern long double __strtold_internal (__const char *__restrict __nptr,
-				       char **__restrict __endptr,
-				       int __group)
-     __THROW __nonnull ((1)) __wur;
-#ifndef __strtol_internal_defined
-extern long int __strtol_internal (__const char *__restrict __nptr,
-				   char **__restrict __endptr,
-				   int __base, int __group)
-     __THROW __nonnull ((1)) __wur;
-# define __strtol_internal_defined	1
-#endif
-#ifndef __strtoul_internal_defined
-extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
-					     char **__restrict __endptr,
-					     int __base, int __group)
-     __THROW __nonnull ((1)) __wur;
-# define __strtoul_internal_defined	1
-#endif
-#if defined __GNUC__ || defined __USE_ISOC99
-# ifndef __strtoll_internal_defined
-__extension__
-extern long long int __strtoll_internal (__const char *__restrict __nptr,
-					 char **__restrict __endptr,
-					 int __base, int __group)
-     __THROW __nonnull ((1)) __wur;
-#  define __strtoll_internal_defined	1
-# endif
-# ifndef __strtoull_internal_defined
-__extension__
-extern unsigned long long int __strtoull_internal (__const char *
-						   __restrict __nptr,
-						   char **__restrict __endptr,
-						   int __base, int __group)
-     __THROW __nonnull ((1)) __wur;
-#  define __strtoull_internal_defined	1
-# endif
-#endif /* GCC */
-
 #ifdef __USE_EXTERN_INLINES
-/* Define inline functions which call the internal entry points.  */
-
-__BEGIN_NAMESPACE_STD
-__extern_inline double
-__NTH (strtod (__const char *__restrict __nptr, char **__restrict __endptr))
-{
-  return __strtod_internal (__nptr, __endptr, 0);
-}
-__extern_inline long int
-__NTH (strtol (__const char *__restrict __nptr, char **__restrict __endptr,
-	       int __base))
-{
-  return __strtol_internal (__nptr, __endptr, __base, 0);
-}
-__extern_inline unsigned long int
-__NTH (strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
-		int __base))
-{
-  return __strtoul_internal (__nptr, __endptr, __base, 0);
-}
-__END_NAMESPACE_STD
-
-# ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
-__extern_inline float
-__NTH (strtof (__const char *__restrict __nptr, char **__restrict __endptr))
-{
-  return __strtof_internal (__nptr, __endptr, 0);
-}
-#  ifndef __LDBL_COMPAT
-__extern_inline long double
-__NTH (strtold (__const char *__restrict __nptr, char **__restrict __endptr))
-{
-  return __strtold_internal (__nptr, __endptr, 0);
-}
-#  endif
-__END_NAMESPACE_C99
-# endif
-
-# ifdef __USE_BSD
-__extension__ __extern_inline long long int
-__NTH (strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
-	       int __base))
-{
-  return __strtoll_internal (__nptr, __endptr, __base, 0);
-}
-__extension__ __extern_inline unsigned long long int
-__NTH (strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
-		int __base))
-{
-  return __strtoull_internal (__nptr, __endptr, __base, 0);
-}
-# endif
-
-# if defined __USE_MISC || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
-__extension__ __extern_inline long long int
-__NTH (strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
-		int __base))
-{
-  return __strtoll_internal (__nptr, __endptr, __base, 0);
-}
-__extension__ __extern_inline unsigned long long int
-__NTH (strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
-		 int __base))
-{
-  return __strtoull_internal (__nptr, __endptr, __base, 0);
-}
-__END_NAMESPACE_C99
-# endif
-
 __BEGIN_NAMESPACE_STD
 __extern_inline double
 __NTH (atof (__const char *__nptr))

Modified: fsf/trunk/libc/sysdeps/generic/inttypes.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/inttypes.h (original)
+++ fsf/trunk/libc/sysdeps/generic/inttypes.h Fri Aug  3 00:03:22 2007
@@ -323,13 +323,11 @@
 
 # if __WORDSIZE == 64
 
-/* Like `strtol' but convert to `intmax_t'.  */
-#  ifndef __strtol_internal_defined
 extern long int __strtol_internal (__const char *__restrict __nptr,
 				   char **__restrict __endptr,
-				   int __base, int __group) __THROW;
-#   define __strtol_internal_defined	1
-#  endif
+				   int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtol' but convert to `intmax_t'.  */
 __extern_inline intmax_t
 __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
@@ -337,14 +335,12 @@
   return __strtol_internal (nptr, endptr, base, 0);
 }
 
-/* Like `strtoul' but convert to `uintmax_t'.  */
-#  ifndef __strtoul_internal_defined
 extern unsigned long int __strtoul_internal (__const char *
 					     __restrict __nptr,
 					     char ** __restrict __endptr,
-					     int __base, int __group) __THROW;
-#   define __strtoul_internal_defined	1
-#  endif
+					     int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtoul' but convert to `uintmax_t'.  */
 __extern_inline uintmax_t
 __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
@@ -352,13 +348,11 @@
   return __strtoul_internal (nptr, endptr, base, 0);
 }
 
-/* Like `wcstol' but convert to `intmax_t'.  */
-#  ifndef __wcstol_internal_defined
 extern long int __wcstol_internal (__const __gwchar_t * __restrict __nptr,
 				   __gwchar_t **__restrict __endptr,
-				   int __base, int __group) __THROW;
-#   define __wcstol_internal_defined	1
-#  endif
+				   int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstol' but convert to `intmax_t'.  */
 __extern_inline intmax_t
 __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
@@ -366,16 +360,13 @@
   return __wcstol_internal (nptr, endptr, base, 0);
 }
 
-
-/* Like `wcstoul' but convert to `uintmax_t'.  */
-#  ifndef __wcstoul_internal_defined
 extern unsigned long int __wcstoul_internal (__const __gwchar_t *
 					     __restrict __nptr,
 					     __gwchar_t **
 					     __restrict __endptr,
-					     int __base, int __group) __THROW;
-#   define __wcstoul_internal_defined	1
-#  endif
+					     int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstoul' but convert to `uintmax_t'.  */
 __extern_inline uintmax_t
 __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
@@ -385,14 +376,12 @@
 
 # else /* __WORDSIZE == 32 */
 
-/* Like `strtol' but convert to `intmax_t'.  */
-#  ifndef __strtoll_internal_defined
 __extension__
 extern long long int __strtoll_internal (__const char *__restrict __nptr,
 					 char **__restrict __endptr,
-					 int __base, int __group) __THROW;
-#   define __strtoll_internal_defined	1
-#  endif
+					 int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtol' but convert to `intmax_t'.  */
 __extern_inline intmax_t
 __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
@@ -400,17 +389,15 @@
   return __strtoll_internal (nptr, endptr, base, 0);
 }
 
-/* Like `strtoul' but convert to `uintmax_t'.  */
-#  ifndef __strtoull_internal_defined
 __extension__
 extern unsigned long long int __strtoull_internal (__const char *
 						   __restrict __nptr,
 						   char **
 						   __restrict __endptr,
 						   int __base,
-						   int __group) __THROW;
-#   define __strtoull_internal_defined	1
-#  endif
+						   int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `strtoul' but convert to `uintmax_t'.  */
 __extern_inline uintmax_t
 __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
 		  int base))
@@ -418,15 +405,13 @@
   return __strtoull_internal (nptr, endptr, base, 0);
 }
 
-/* Like `wcstol' but convert to `intmax_t'.  */
-#  ifndef __wcstoll_internal_defined
 __extension__
 extern long long int __wcstoll_internal (__const __gwchar_t *
 					 __restrict __nptr,
 					 __gwchar_t **__restrict __endptr,
-					 int __base, int __group) __THROW;
-#   define __wcstoll_internal_defined	1
-#  endif
+					 int __base, int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstol' but convert to `intmax_t'.  */
 __extern_inline intmax_t
 __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))
@@ -435,17 +420,15 @@
 }
 
 
-/* Like `wcstoul' but convert to `uintmax_t'.  */
-#  ifndef __wcstoull_internal_defined
 __extension__
 extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
 						   __restrict __nptr,
 						   __gwchar_t **
 						   __restrict __endptr,
 						   int __base,
-						   int __group) __THROW;
-#   define __wcstoull_internal_defined	1
-#  endif
+						   int __group)
+  __THROW __nonnull ((1)) __wur;
+/* Like `wcstoul' but convert to `uintmax_t'.  */
 __extern_inline uintmax_t
 __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
 		  __gwchar_t **__restrict endptr, int base))

Modified: fsf/trunk/libc/sysdeps/unix/dirstream.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/dirstream.h (original)
+++ fsf/trunk/libc/sysdeps/unix/dirstream.h Fri Aug  3 00:03:22 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+/* 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
@@ -17,7 +17,6 @@
    02111-1307 USA.  */
 
 #ifndef	_DIRSTREAM_H
-
 #define	_DIRSTREAM_H	1
 
 #include <sys/types.h>
@@ -33,14 +32,16 @@
   {
     int fd;			/* File descriptor.  */
 
-    char *data;			/* Directory block.  */
+    __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.  */
 
-    __libc_lock_define (, lock) /* Mutex lock for this structure.  */
+    /* Directory block.  */
+    char data[0] __attribute__ ((aligned (__alignof__ (void*))));
   };
 
 #define _DIR_dirfd(dirp)	((dirp)->fd)

Modified: fsf/trunk/libc/sysdeps/unix/opendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/opendir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/opendir.c Fri Aug  3 00:03:22 2007
@@ -31,6 +31,7 @@
 
 #include <dirstream.h>
 #include <not-cancel.h>
+#include <kernel-features.h>
 
 
 /* opendir() must not accidentally open something other than a directory.
@@ -110,7 +111,11 @@
 	 }
     }
 
-  int fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
+  int flags = O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE;
+#ifdef O_CLOEXEC
+  flags |= O_CLOEXEC;
+#endif
+  int fd = open_not_cancel_2 (name, flags);
   if (__builtin_expect (fd, 0) < 0)
     return NULL;
 
@@ -138,12 +143,33 @@
 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, const struct stat64 *statp)
 {
-  if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
-    goto lose;
+  /* 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 || ! check_have_o_cloexec (fd))
+#endif
+    {
+      if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
+	goto lose;
+    }
 
   size_t allocation;
 #ifdef _STATBUF_ST_BLKSIZE
@@ -155,9 +181,7 @@
     allocation = (BUFSIZ < sizeof (struct dirent64)
 		  ? sizeof (struct dirent64) : BUFSIZ);
 
-  const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
-
-  DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
+  DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation);
   if (dirp == NULL)
   lose:
     {
@@ -169,14 +193,15 @@
 	}
       return NULL;
     }
-  memset (dirp, '\0', sizeof (DIR));
-  dirp->data = (char *) (dirp + 1) + pad;
+
   dirp->allocation = allocation;
-  dirp->fd = fd;
-
 #ifndef NOT_IN_libc
   __libc_lock_init (dirp->lock);
 #endif
+  dirp->fd = fd;
+  dirp->size = 0;
+  dirp->offset = 0;
+  dirp->filepos = 0;
 
   return dirp;
 }

Modified: fsf/trunk/libc/wcsmbs/wchar.h
==============================================================================
--- fsf/trunk/libc/wcsmbs/wchar.h (original)
+++ fsf/trunk/libc/wcsmbs/wchar.h Fri Aug  3 00:03:22 2007
@@ -503,96 +503,6 @@
 #endif /* GNU */
 
 
-/* The internal entry points for `wcstoX' take an extra flag argument
-   saying whether or not to parse locale-dependent number grouping.  */
-extern double __wcstod_internal (__const wchar_t *__restrict __nptr,
-				 wchar_t **__restrict __endptr, int __group)
-     __THROW;
-extern float __wcstof_internal (__const wchar_t *__restrict __nptr,
-				wchar_t **__restrict __endptr, int __group)
-     __THROW;
-extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
-				       wchar_t **__restrict __endptr,
-				       int __group) __THROW;
-
-#if !defined __wcstol_internal_defined \
-    && defined __OPTIMIZE__ && __GNUC__ >= 2
-extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
-				   wchar_t **__restrict __endptr,
-				   int __base, int __group) __THROW;
-# define __wcstol_internal_defined	1
-#endif
-#if !defined __wcstoul_internal_defined \
-    && defined __OPTIMIZE__ && __GNUC__ >= 2
-extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
-					     wchar_t **__restrict __endptr,
-					     int __base, int __group) __THROW;
-# define __wcstoul_internal_defined	1
-#endif
-#if !defined __wcstoll_internal_defined \
-    && defined __OPTIMIZE__ && __GNUC__ >= 2
-__extension__
-extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
-					 wchar_t **__restrict __endptr,
-					 int __base, int __group) __THROW;
-# define __wcstoll_internal_defined	1
-#endif
-#if !defined __wcstoull_internal_defined \
-    && defined __OPTIMIZE__ && __GNUC__ >= 2
-__extension__
-extern unsigned long long int __wcstoull_internal (__const wchar_t *
-						   __restrict __nptr,
-						   wchar_t **
-						   __restrict __endptr,
-						   int __base,
-						   int __group) __THROW;
-# define __wcstoull_internal_defined	1
-#endif
-
-
-#if defined __OPTIMIZE__ && __GNUC__ >= 2
-/* Define inline functions which call the internal entry points.  */
-__BEGIN_NAMESPACE_C99
-
-__extern_inline double
-__NTH (wcstod (__const wchar_t *__restrict __nptr,
-	       wchar_t **__restrict __endptr))
-{ return __wcstod_internal (__nptr, __endptr, 0); }
-__extern_inline long int
-__NTH (wcstol (__const wchar_t *__restrict __nptr,
-	       wchar_t **__restrict __endptr, int __base))
-{ return __wcstol_internal (__nptr, __endptr, __base, 0); }
-__extern_inline unsigned long int
-__NTH (wcstoul (__const wchar_t *__restrict __nptr,
-		wchar_t **__restrict __endptr, int __base))
-{ return __wcstoul_internal (__nptr, __endptr, __base, 0); }
-__END_NAMESPACE_C99
-
-# ifdef __USE_GNU
-__extern_inline float
-__NTH (wcstof (__const wchar_t *__restrict __nptr,
-	       wchar_t **__restrict __endptr))
-{ return __wcstof_internal (__nptr, __endptr, 0); }
-#  ifndef __LDBL_COMPAT
-__extern_inline long double
-__NTH (wcstold (__const wchar_t *__restrict __nptr,
-		wchar_t **__restrict __endptr))
-{ return __wcstold_internal (__nptr, __endptr, 0); }
-#  endif
-__extension__
-__extern_inline long long int
-__NTH (wcstoq (__const wchar_t *__restrict __nptr,
-	       wchar_t **__restrict __endptr, int __base))
-{ return __wcstoll_internal (__nptr, __endptr, __base, 0); }
-__extension__
-__extern_inline unsigned long long int
-__NTH (wcstouq (__const wchar_t *__restrict __nptr,
-		wchar_t **__restrict __endptr, int __base))
-{ return __wcstoull_internal (__nptr, __endptr, __base, 0); }
-# endif /* Use GNU.  */
-#endif /* Optimizing GCC >=2.  */
-
-
 #ifdef	__USE_GNU
 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
    DEST.  */