xref: /aosp_15_r20/external/libbpf/include/uapi/linux/openat2.h (revision f7c14bbac8cf49633f2740db462ea43457973ec4)
1*f7c14bbaSAndroid Build Coastguard Worker /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*f7c14bbaSAndroid Build Coastguard Worker #ifndef _UAPI_LINUX_OPENAT2_H
3*f7c14bbaSAndroid Build Coastguard Worker #define _UAPI_LINUX_OPENAT2_H
4*f7c14bbaSAndroid Build Coastguard Worker 
5*f7c14bbaSAndroid Build Coastguard Worker #include <linux/types.h>
6*f7c14bbaSAndroid Build Coastguard Worker 
7*f7c14bbaSAndroid Build Coastguard Worker /*
8*f7c14bbaSAndroid Build Coastguard Worker  * Arguments for how openat2(2) should open the target path. If only @flags and
9*f7c14bbaSAndroid Build Coastguard Worker  * @mode are non-zero, then openat2(2) operates very similarly to openat(2).
10*f7c14bbaSAndroid Build Coastguard Worker  *
11*f7c14bbaSAndroid Build Coastguard Worker  * However, unlike openat(2), unknown or invalid bits in @flags result in
12*f7c14bbaSAndroid Build Coastguard Worker  * -EINVAL rather than being silently ignored. @mode must be zero unless one of
13*f7c14bbaSAndroid Build Coastguard Worker  * {O_CREAT, O_TMPFILE} are set.
14*f7c14bbaSAndroid Build Coastguard Worker  *
15*f7c14bbaSAndroid Build Coastguard Worker  * @flags: O_* flags.
16*f7c14bbaSAndroid Build Coastguard Worker  * @mode: O_CREAT/O_TMPFILE file mode.
17*f7c14bbaSAndroid Build Coastguard Worker  * @resolve: RESOLVE_* flags.
18*f7c14bbaSAndroid Build Coastguard Worker  */
19*f7c14bbaSAndroid Build Coastguard Worker struct open_how {
20*f7c14bbaSAndroid Build Coastguard Worker 	__u64 flags;
21*f7c14bbaSAndroid Build Coastguard Worker 	__u64 mode;
22*f7c14bbaSAndroid Build Coastguard Worker 	__u64 resolve;
23*f7c14bbaSAndroid Build Coastguard Worker };
24*f7c14bbaSAndroid Build Coastguard Worker 
25*f7c14bbaSAndroid Build Coastguard Worker /* how->resolve flags for openat2(2). */
26*f7c14bbaSAndroid Build Coastguard Worker #define RESOLVE_NO_XDEV		0x01 /* Block mount-point crossings
27*f7c14bbaSAndroid Build Coastguard Worker 					(includes bind-mounts). */
28*f7c14bbaSAndroid Build Coastguard Worker #define RESOLVE_NO_MAGICLINKS	0x02 /* Block traversal through procfs-style
29*f7c14bbaSAndroid Build Coastguard Worker 					"magic-links". */
30*f7c14bbaSAndroid Build Coastguard Worker #define RESOLVE_NO_SYMLINKS	0x04 /* Block traversal through all symlinks
31*f7c14bbaSAndroid Build Coastguard Worker 					(implies OEXT_NO_MAGICLINKS) */
32*f7c14bbaSAndroid Build Coastguard Worker #define RESOLVE_BENEATH		0x08 /* Block "lexical" trickery like
33*f7c14bbaSAndroid Build Coastguard Worker 					"..", symlinks, and absolute
34*f7c14bbaSAndroid Build Coastguard Worker 					paths which escape the dirfd. */
35*f7c14bbaSAndroid Build Coastguard Worker #define RESOLVE_IN_ROOT		0x10 /* Make all jumps to "/" and ".."
36*f7c14bbaSAndroid Build Coastguard Worker 					be scoped inside the dirfd
37*f7c14bbaSAndroid Build Coastguard Worker 					(similar to chroot(2)). */
38*f7c14bbaSAndroid Build Coastguard Worker #define RESOLVE_CACHED		0x20 /* Only complete if resolution can be
39*f7c14bbaSAndroid Build Coastguard Worker 					completed through cached lookup. May
40*f7c14bbaSAndroid Build Coastguard Worker 					return -EAGAIN if that's not
41*f7c14bbaSAndroid Build Coastguard Worker 					possible. */
42*f7c14bbaSAndroid Build Coastguard Worker 
43*f7c14bbaSAndroid Build Coastguard Worker #endif /* _UAPI_LINUX_OPENAT2_H */
44