openat2.h 1.4 KB

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