Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_OPENAT2_H
0003 #define _UAPI_LINUX_OPENAT2_H
0004 
0005 #include <linux/types.h>
0006 
0007 /*
0008  * Arguments for how openat2(2) should open the target path. If only @flags and
0009  * @mode are non-zero, then openat2(2) operates very similarly to openat(2).
0010  *
0011  * However, unlike openat(2), unknown or invalid bits in @flags result in
0012  * -EINVAL rather than being silently ignored. @mode must be zero unless one of
0013  * {O_CREAT, O_TMPFILE} are set.
0014  *
0015  * @flags: O_* flags.
0016  * @mode: O_CREAT/O_TMPFILE file mode.
0017  * @resolve: RESOLVE_* flags.
0018  */
0019 struct open_how {
0020     __u64 flags;
0021     __u64 mode;
0022     __u64 resolve;
0023 };
0024 
0025 /* how->resolve flags for openat2(2). */
0026 #define RESOLVE_NO_XDEV     0x01 /* Block mount-point crossings
0027                     (includes bind-mounts). */
0028 #define RESOLVE_NO_MAGICLINKS   0x02 /* Block traversal through procfs-style
0029                     "magic-links". */
0030 #define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks
0031                     (implies OEXT_NO_MAGICLINKS) */
0032 #define RESOLVE_BENEATH     0x08 /* Block "lexical" trickery like
0033                     "..", symlinks, and absolute
0034                     paths which escape the dirfd. */
0035 #define RESOLVE_IN_ROOT     0x10 /* Make all jumps to "/" and ".."
0036                     be scoped inside the dirfd
0037                     (similar to chroot(2)). */
0038 #define RESOLVE_CACHED      0x20 /* Only complete if resolution can be
0039                     completed through cached lookup. May
0040                     return -EAGAIN if that's not
0041                     possible. */
0042 
0043 #endif /* _UAPI_LINUX_OPENAT2_H */