* 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.
This commit is contained in:
Ulrich Drepper 2007-05-25 14:41:55 +00:00
parent 86acd59634
commit 47ad95ab96
3 changed files with 66 additions and 27 deletions

View File

@ -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.

View File

@ -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]); \
} \

View File

@ -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