1 //===-- Definition of macros from fcntl.h ---------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef __LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H 10 #define __LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H 11 12 // File creation flags 13 #define O_CLOEXEC 02000000 14 #define O_CREAT 00000100 15 16 #ifdef __aarch64__ 17 #define O_DIRECTORY 040000 18 #else 19 #define O_DIRECTORY 00200000 20 #endif 21 22 #define O_EXCL 00000200 23 #define O_NOCTTY 00000400 24 25 #ifdef __aarch64__ 26 #define O_NOFOLLOW 0100000 27 #else 28 #define O_NOFOLLOW 00400000 29 #endif 30 31 #define O_TRUNC 00001000 32 #define O_TMPFILE (020000000 | O_DIRECTORY) 33 34 // File status flags 35 #define O_APPEND 00002000 36 #define O_DSYNC 00010000 37 #define O_NONBLOCK 00004000 38 #define O_SYNC 04000000 | O_DSYNC 39 40 // File access mode mask 41 #define O_ACCMODE 00000003 42 43 // File access mode flags 44 #define O_RDONLY 00000000 45 #define O_RDWR 00000002 46 #define O_WRONLY 00000001 47 48 // File mode flags 49 #define S_IRWXU 0700 50 #define S_IRUSR 0400 51 #define S_IWUSR 0200 52 #define S_IXUSR 0100 53 #define S_IRWXG 070 54 #define S_IRGRP 040 55 #define S_IWGRP 020 56 #define S_IXGRP 010 57 #define S_IRWXO 07 58 #define S_IROTH 04 59 #define S_IWOTH 02 60 #define S_IXOTH 01 61 #define S_ISUID 04000 62 #define S_ISGID 02000 63 64 // Special directory FD to indicate that the path argument to 65 // openat is relative to the current directory. 66 #define AT_FDCWD -100 67 68 // Special flag to the function unlinkat to indicate that it 69 // has to perform the equivalent of "rmdir" on the path argument. 70 #define AT_REMOVEDIR 0x200 71 72 #endif // __LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H 73