Bump version to 19.1.0 (final)
[llvm-project.git] / libc / include / llvm-libc-macros / linux / fcntl-macros.h
blob8ee95863728e15540ce6f6a026980fd7b7bbbd30
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
10 #define LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
12 // File creation flags
13 #define O_CLOEXEC 02000000
14 #define O_CREAT 00000100
15 #define O_PATH 010000000
17 #ifdef __aarch64__
18 #define O_DIRECTORY 040000
19 #else
20 #define O_DIRECTORY 00200000
21 #endif
23 #define O_EXCL 00000200
24 #define O_NOCTTY 00000400
26 #ifdef __aarch64__
27 #define O_NOFOLLOW 0100000
28 #else
29 #define O_NOFOLLOW 00400000
30 #endif
32 #define O_TRUNC 00001000
33 #define O_TMPFILE (020000000 | O_DIRECTORY)
35 // File status flags
36 #define O_APPEND 00002000
37 #define O_DSYNC 00010000
38 #define O_NONBLOCK 00004000
39 #define O_SYNC 04000000 | O_DSYNC
41 // File access mode mask
42 #define O_ACCMODE 00000003
44 // File access mode flags
45 #define O_RDONLY 00000000
46 #define O_RDWR 00000002
47 #define O_WRONLY 00000001
49 // Special directory FD to indicate that the path argument to
50 // openat is relative to the current directory.
51 #define AT_FDCWD -100
53 // Special flag to the function unlinkat to indicate that it
54 // has to perform the equivalent of "rmdir" on the path argument.
55 #define AT_REMOVEDIR 0x200
57 // Special flag for functions like lstat to convey that symlinks
58 // should not be followed.
59 #define AT_SYMLINK_NOFOLLOW 0x100
61 // Allow empty relative pathname.
62 #define AT_EMPTY_PATH 0x1000
64 // Values of SYS_fcntl commands.
65 #define F_DUPFD 0
66 #define F_GETFD 1
67 #define F_SETFD 2
68 #define F_GETFL 3
69 #define F_SETFL 4
70 #define F_GETLK 5
71 #define F_SETLK 6
72 #define F_SETLKW 7
73 #define F_SETOWN 8
74 #define F_GETOWN 9
75 #define F_SETSIG 10
76 #define F_GETSIG 11
77 #define F_GETLK64 12
78 #define F_SETLK64 13
79 #define F_SETLKW64 14
80 #define F_SETOWN_EX 15
81 #define F_GETOWN_EX 16
83 // Open File Description Locks.
84 #define F_OFD_GETLK 36
85 #define F_OFD_SETLK 37
86 #define F_OFD_SETLKW 38
88 // Close on succesful
89 #define F_CLOEXEC 1
91 #define F_RDLCK 0
92 #define F_WRLCK 1
93 #define F_UNLCK 2
95 // For Large File Support
96 #if defined(_LARGEFILE64_SOURCE)
97 #define F_GETLK F_GETLK64
98 #define F_SETLK F_SETLK64
99 #define F_SETLKW F_SETLKW64
100 #endif
102 #endif // LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H