openat2.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* openat2 definition. Linux specific.
  2. Copyright (C) 2025-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _FCNTL_H
  16. # error "Never use <bits/openat2.h> directly; include <fcntl.h> instead."
  17. #endif
  18. #ifndef __glibc_has_open_how
  19. /* Arguments for how openat2 should open the target path. */
  20. struct open_how
  21. {
  22. __uint64_t flags;
  23. __uint64_t mode;
  24. __uint64_t resolve;
  25. };
  26. #endif
  27. /* how->resolve flags for openat2. */
  28. #ifndef RESOLVE_NO_XDEV
  29. # define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings
  30. (includes bind-mounts). */
  31. #endif
  32. #ifndef RESOLVE_NO_MAGICLINKS
  33. # define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style
  34. "magic-links". */
  35. #endif
  36. #ifndef RESOLVE_NO_SYMLINKS
  37. # define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks. */
  38. #endif
  39. #ifndef RESOLVE_BENEATH
  40. # define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like
  41. "..", symlinks, and absolute
  42. paths which escape the dirfd. */
  43. #endif
  44. #ifndef RESOLVE_IN_ROOT
  45. # define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".."
  46. be scoped inside the dirfd
  47. (similar to chroot). */
  48. #endif
  49. #ifndef RESOLVE_CACHED
  50. # define RESOLVE_CACHED 0x20 /* Only complete if resolution can be
  51. completed through cached lookup. May
  52. return -EAGAIN if that's not
  53. possible. */
  54. #endif