summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--io/bits/fcntl2.h74
-rw-r--r--nptl/init.c2
3 files changed, 66 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 40feb1215b..58622d2f0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-05-25  Jakub Jelinek  <jakub@redhat.com>
+
+	* io/bits/fcntl2.h (__open_2): Add nonnull attribute.
+	(open): Fix comment typos.  Don't call __open_2 if flags
+	is a compile time constant without O_CREAT.
+	(__open64_2): Add nonnull attribute.
+	(open64): Fix comment typos.  Don't call __open64_2 if flags
+	is a compile time constant without O_CREAT.
+	(__openat_2): Add nonnull attribute, fix nonnull attribute
+	on redirect.
+	(openat): Fix comment typos.  Don't call __openat_2 if flags
+	is a compile time constant without O_CREAT.
+	(__openat64_2): Add nonnull attribute, fix nonnull attribute
+	on redirect.
+	(openat64): Fix comment typos.  Don't call __openat64_2 if flags
+	is a compile time constant without O_CREAT.
+
 2007-05-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* Makerules (sysd-rules): Define PTW for ptw-* files.
diff --git a/io/bits/fcntl2.h b/io/bits/fcntl2.h
index 25ca4110b3..a1b03f6194 100644
--- a/io/bits/fcntl2.h
+++ b/io/bits/fcntl2.h
@@ -24,7 +24,7 @@
 /* Check that calls to open and openat with O_CREAT set have an
    appropriate third/fourth parameter.  */
 #ifndef __USE_FILE_OFFSET64
-extern int __open_2 (__const char *__path, int __oflag);
+extern int __open_2 (__const char *__path, int __oflag) __nonnull ((1));
 #else
 extern int __REDIRECT (__open_2, (__const char *__file, int __oflag),
 		       __open64_2) __nonnull ((1));
@@ -33,22 +33,27 @@ extern int __REDIRECT (__open_2, (__const char *__file, int __oflag),
 #define open(fname, flags, ...) \
   ({ int ___r;								      \
      /* If the compiler complains about an invalid type, excess elements, etc \
-	in the initialization this means a paraleter of the wrong type has    \
+	in the initialization this means a parameter of the wrong type has    \
 	been passed to open. */						      \
      int ___arr[] = { __VA_ARGS__ };					      \
      if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0)	      \
        {								      \
-	 /* If the compile complains about the size of this array type the    \
-	    the mode parameter is missing since O_CREAT has been used.  */    \
+	 /* If the compiler complains about the size of this array type the   \
+	    mode parameter is missing since O_CREAT has been used.  */	      \
 	 typedef int __open_missing_mode[((flags) & O_CREAT) != 0	      \
 					 ? ((long int) sizeof (___arr)	      \
 					    - (long int) sizeof (int)) : 1];  \
        }								      \
      if (sizeof (___arr) == 0)						      \
-       ___r = __open_2 (fname, flags);					      \
+       {								      \
+	 if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0)	      \
+	   ___r = open (fname, flags);					      \
+	 else     							      \
+	   ___r = __open_2 (fname, flags);				      \
+       }								      \
      else								      \
        {								      \
-	 /* If the compile complains about the size of this array type too    \
+	 /* If the compiler complains about the size of this array type too   \
 	    many parameters have been passed to open.  */		      \
 	 typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \
 	 ___r = open (fname, flags, ___arr[0]);				      \
@@ -58,27 +63,32 @@ extern int __REDIRECT (__open_2, (__const char *__file, int __oflag),
 
 
 #ifdef __USE_LARGEFILE64
-extern int __open64_2 (__const char *__path, int __oflag);
+extern int __open64_2 (__const char *__path, int __oflag) __nonnull ((1));
 
 # define open64(fname, flags, ...) \
   ({ int ___r;								      \
      /* If the compiler complains about an invalid type, excess elements, etc \
-	in the initialization this means a paraleter of the wrong type has    \
+	in the initialization this means a parameter of the wrong type has    \
 	been passed to open64. */					      \
      int ___arr[] = { __VA_ARGS__ };					      \
      if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0)	      \
        {								      \
-	 /* If the compile complains about the size of this array type the    \
-	    the mode parameter is missing since O_CREAT has been used.  */    \
+	 /* If the compiler complains about the size of this array type the   \
+	    mode parameter is missing since O_CREAT has been used.  */	      \
 	 typedef int __open_missing_mode[((flags) & O_CREAT) != 0	      \
 					 ? ((long int) sizeof (___arr)	      \
 					    - (long int) sizeof (int)) : 1];  \
        }								      \
      if (sizeof (___arr) == 0)						      \
-       ___r = __open64_2 (fname, flags);				      \
+       {								      \
+	 if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0)	      \
+	   ___r = open64 (fname, flags);				      \
+	 else     							      \
+	   ___r = __open64_2 (fname, flags);				      \
+       }								      \
      else								      \
        {								      \
-	 /* If the compile complains about the size of this array type too    \
+	 /* If the compiler complains about the size of this array type too   \
 	    many parameters have been passed to open64.  */		      \
 	 typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \
 	 ___r = open64 (fname, flags, ___arr[0]);			      \
@@ -89,32 +99,38 @@ extern int __open64_2 (__const char *__path, int __oflag);
 
 #ifdef __USE_ATFILE
 # ifndef __USE_FILE_OFFSET64
-extern int __openat_2 (int __fd, __const char *__path, int __oflag);
+extern int __openat_2 (int __fd, __const char *__path, int __oflag)
+     __nonnull ((2));
 # else
 extern int __REDIRECT (__openat_2, (int __fd, __const char *__file,
 				    int __oflag), __openat64_2)
-     __nonnull ((1));
+     __nonnull ((2));
 # endif
 
 # define openat(fd, fname, flags, ...) \
   ({ int ___r;								      \
      /* If the compiler complains about an invalid type, excess elements, etc \
-	in the initialization this means a paraleter of the wrong type has    \
+	in the initialization this means a parameter of the wrong type has    \
 	been passed to openat. */					      \
      int ___arr[] = { __VA_ARGS__ };					      \
      if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0)	      \
        {								      \
-	 /* If the compile complains about the size of this array type the    \
-	    the mode parameter is missing since O_CREAT has been used.  */    \
+	 /* If the compiler complains about the size of this array type the   \
+	    mode parameter is missing since O_CREAT has been used.  */	      \
 	 typedef int __open_missing_mode[((flags) & O_CREAT) != 0	      \
 					 ? ((long int) sizeof (___arr)	      \
 					    - (long int) sizeof (int)) : 1];  \
        }								      \
      if (sizeof (___arr) == 0)						      \
-       ___r = __openat_2 (fd, fname, flags);				      \
+       {								      \
+	 if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0)	      \
+	   ___r = openat (fd, fname, flags);				      \
+	 else     							      \
+	   ___r = __openat_2 (fd, fname, flags);			      \
+       }								      \
      else								      \
        {								      \
-	 /* If the compile complains about the size of this array type too    \
+	 /* If the compiler complains about the size of this array type too   \
 	    many parameters have been passed to openat.  */		      \
 	 typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \
 	 ___r = openat (fd, fname, flags, ___arr[0]);			      \
@@ -124,28 +140,34 @@ extern int __REDIRECT (__openat_2, (int __fd, __const char *__file,
 
 
 # ifdef __USE_LARGEFILE64
-extern int __openat64_2 (int __fd, __const char *__path, int __oflag);
+extern int __openat64_2 (int __fd, __const char *__path, int __oflag)
+     __nonnull ((2));
 
 #  define openat64(fd, fname, flags, ...) \
   ({ int ___r;								      \
      /* If the compiler complains about an invalid type, excess elements, etc \
-	in the initialization this means a paraleter of the wrong type has    \
+	in the initialization this means a parameter of the wrong type has    \
 	been passed to openat64. */					      \
      int ___arr[] = { __VA_ARGS__ };					      \
      if (__builtin_constant_p (flags) && ((flags) & O_CREAT) != 0)	      \
        {								      \
-	 /* If the compile complains about the size of this array type the    \
-	    the mode parameter is missing since O_CREAT has been used.  */    \
+	 /* If the compiler complains about the size of this array type the   \
+	    mode parameter is missing since O_CREAT has been used.  */	      \
 	 typedef int __open_missing_mode[((flags) & O_CREAT) != 0	      \
 					 ? ((long int) sizeof (___arr)	      \
 					    - (long int) sizeof (int)) : 1];  \
        }								      \
      if (sizeof (___arr) == 0)						      \
-       ___r = __openat64_2 (fd, fname, flags);				      \
+       {								      \
+	 if (__builtin_constant_p (flags) && ((flags) & O_CREAT) == 0)	      \
+	   ___r = openat64 (fd, fname, flags);				      \
+	 else     							      \
+	   ___r = __openat64_2 (fd, fname, flags);			      \
+       }								      \
      else								      \
        {								      \
-	 /* If the compile complains about the size of this array type too    \
-	    many parameters have been passed to openat.  */		      \
+	 /* If the compiler complains about the size of this array type too   \
+	    many parameters have been passed to openat64.  */		      \
 	 typedef int __open_too_many_args[-(sizeof (___arr) > sizeof (int))]; \
 	 ___r = openat64 (fd, fname, flags, ___arr[0]);			      \
        }								      \
diff --git a/nptl/init.c b/nptl/init.c
index 03862a147f..d7c74d4e1c 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -284,7 +284,7 @@ __pthread_initialize_minimal_internal (void)
     res = INTERNAL_SYSCALL (futex, err, 3, &word,
 			    FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
     if (!INTERNAL_SYSCALL_ERROR_P (res, err))
-      THREAD_SET_PRIVATE_FUTEX (pd, FUTEX_PRIVATE_FLAG);
+      THREAD_SET_PRIVATE_FUTEX (FUTEX_PRIVATE_FLAG);
   }
 #endif