|
16 | 16 |
|
17 | 17 | #define F_DUPFD_QUERY (F_LINUX_SPECIFIC_BASE + 3) |
18 | 18 |
|
| 19 | +/* Was the file just created? */ |
| 20 | +#define F_CREATED_QUERY (F_LINUX_SPECIFIC_BASE + 4) |
| 21 | + |
19 | 22 | /* |
20 | 23 | * Cancel a blocking posix lock; internal use only until we expose an |
21 | 24 | * asynchronous lock api to userspace: |
|
87 | 90 | #define DN_ATTRIB 0x00000020 /* File changed attibutes */ |
88 | 91 | #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ |
89 | 92 |
|
| 93 | +#define AT_FDCWD -100 /* Special value for dirfd used to |
| 94 | + indicate openat should use the |
| 95 | + current working directory. */ |
| 96 | + |
| 97 | + |
| 98 | +/* Generic flags for the *at(2) family of syscalls. */ |
| 99 | + |
| 100 | +/* Reserved for per-syscall flags 0xff. */ |
| 101 | +#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic |
| 102 | + links. */ |
| 103 | +/* Reserved for per-syscall flags 0x200 */ |
| 104 | +#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ |
| 105 | +#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount |
| 106 | + traversal. */ |
| 107 | +#define AT_EMPTY_PATH 0x1000 /* Allow empty relative |
| 108 | + pathname to operate on dirfd |
| 109 | + directly. */ |
| 110 | +/* |
| 111 | + * These flags are currently statx(2)-specific, but they could be made generic |
| 112 | + * in the future and so they should not be used for other per-syscall flags. |
| 113 | + */ |
| 114 | +#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */ |
| 115 | +#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ |
| 116 | +#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ |
| 117 | +#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ |
| 118 | + |
| 119 | +#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ |
| 120 | + |
90 | 121 | /* |
91 | | - * The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is |
92 | | - * meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to |
93 | | - * unlinkat. The two functions do completely different things and therefore, |
94 | | - * the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to |
95 | | - * faccessat would be undefined behavior and thus treating it equivalent to |
96 | | - * AT_EACCESS is valid undefined behavior. |
| 122 | + * Per-syscall flags for the *at(2) family of syscalls. |
| 123 | + * |
| 124 | + * These are flags that are so syscall-specific that a user passing these flags |
| 125 | + * to the wrong syscall is so "clearly wrong" that we can safely call such |
| 126 | + * usage "undefined behaviour". |
| 127 | + * |
| 128 | + * For example, the constants AT_REMOVEDIR and AT_EACCESS have the same value. |
| 129 | + * AT_EACCESS is meaningful only to faccessat, while AT_REMOVEDIR is meaningful |
| 130 | + * only to unlinkat. The two functions do completely different things and |
| 131 | + * therefore, the flags can be allowed to overlap. For example, passing |
| 132 | + * AT_REMOVEDIR to faccessat would be undefined behavior and thus treating it |
| 133 | + * equivalent to AT_EACCESS is valid undefined behavior. |
| 134 | + * |
| 135 | + * Note for implementers: When picking a new per-syscall AT_* flag, try to |
| 136 | + * reuse already existing flags first. This leaves us with as many unused bits |
| 137 | + * as possible, so we can use them for generic bits in the future if necessary. |
97 | 138 | */ |
98 | | -#define AT_FDCWD -100 /* Special value used to indicate |
99 | | - openat should use the current |
100 | | - working directory. */ |
101 | | -#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ |
| 139 | + |
| 140 | +/* Flags for renameat2(2) (must match legacy RENAME_* flags). */ |
| 141 | +#define AT_RENAME_NOREPLACE 0x0001 |
| 142 | +#define AT_RENAME_EXCHANGE 0x0002 |
| 143 | +#define AT_RENAME_WHITEOUT 0x0004 |
| 144 | + |
| 145 | +/* Flag for faccessat(2). */ |
102 | 146 | #define AT_EACCESS 0x200 /* Test access permitted for |
103 | 147 | effective IDs, not real IDs. */ |
| 148 | +/* Flag for unlinkat(2). */ |
104 | 149 | #define AT_REMOVEDIR 0x200 /* Remove directory instead of |
105 | 150 | unlinking file. */ |
106 | | -#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ |
107 | | -#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ |
108 | | -#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ |
109 | | - |
110 | | -#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */ |
111 | | -#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ |
112 | | -#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ |
113 | | -#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ |
114 | | - |
115 | | -#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ |
| 151 | +/* Flags for name_to_handle_at(2). */ |
| 152 | +#define AT_HANDLE_FID 0x200 /* File handle is needed to compare |
| 153 | + object identity and may not be |
| 154 | + usable with open_by_handle_at(2). */ |
| 155 | +#define AT_HANDLE_MNT_ID_UNIQUE 0x001 /* Return the u64 unique mount ID. */ |
116 | 156 |
|
117 | | -/* Flags for name_to_handle_at(2). We reuse AT_ flag space to save bits... */ |
118 | | -#define AT_HANDLE_FID AT_REMOVEDIR /* file handle is needed to |
119 | | - compare object identity and may not |
120 | | - be usable to open_by_handle_at(2) */ |
121 | 157 | #if defined(__KERNEL__) |
122 | 158 | #define AT_GETATTR_NOSEC 0x80000000 |
123 | 159 | #endif |
|
0 commit comments