diff options
Diffstat (limited to 'include/fcntl.h')
-rw-r--r-- | include/fcntl.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/include/fcntl.h b/include/fcntl.h index 98020bdfb1..a746471411 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -1,8 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef __FCNTL_H #define __FCNTL_H #include <linux/types.h> +#define AT_FDCWD -100 /* Special value used to indicate + openat should use the current + working directory. */ + +#define AT_REMOVEDIR 0x200 /* Remove directory instead of + unlinking file. */ + /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ #define O_ACCMODE 00000003 @@ -24,7 +32,22 @@ #define O_RWSIZE_4 004000000 #define O_RWSIZE_8 010000000 -int open(const char *pathname, int flags, ...); -int creat(const char *pathname, mode_t mode); +#define __O_TMPFILE 020000000 +#define O_PATH 040000000 /* open as path */ +#define O_CHROOT 0100000000 /* dirfd: stay within filesystem root */ + +#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) + +int openat(int dirfd, const char *pathname, int flags); + +static inline int open(const char *pathname, int flags, ...) +{ + return openat(AT_FDCWD, pathname, flags); +} + +static inline int creat(const char *pathname, mode_t mode) +{ + return open(pathname, O_CREAT | O_WRONLY | O_TRUNC); +} #endif /* __FCNTL_H */ |