diff options
Diffstat (limited to 'io/fcntl.h')
-rw-r--r-- | io/fcntl.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/io/fcntl.h b/io/fcntl.h index 71f5e52e88..c6812c467b 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -34,6 +34,15 @@ __BEGIN_DECLS numbers and flag bits for `open', `fcntl', et al. */ #include <bits/fcntl.h> +/* Detect if open needs mode as a third argument (or for openat as a fourth + argument). */ +#ifdef __O_TMPFILE +# define __OPEN_NEEDS_MODE(oflag) \ + (((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE) +#else +# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0) +#endif + /* POSIX.1-2001 specifies that these types are defined by <fcntl.h>. Earlier POSIX standards permitted any type ending in `_t' to be defined by any POSIX header, so we don't conditionalize the definitions here. */ @@ -160,8 +169,9 @@ typedef __pid_t pid_t; extern int fcntl (int __fd, int __cmd, ...); /* Open FILE and return a new file descriptor for it, or -1 on error. - OFLAG determines the type of access used. If O_CREAT is on OFLAG, - the third argument is taken as a `mode_t', the mode of the created file. + OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set + in OFLAG, the third argument is taken as a `mode_t', the mode of the + created file. This function is a cancellation point and therefore not marked with __THROW. */ |