fcntl.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_LINUX_FCNTL_H
  3. #define _UAPI_LINUX_FCNTL_H
  4. #include <asm/fcntl.h>
  5. #include <linux/openat2.h>
  6. #define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
  7. #define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
  8. /*
  9. * Cancel a blocking posix lock; internal use only until we expose an
  10. * asynchronous lock api to userspace:
  11. */
  12. #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
  13. /* Create a file descriptor with FD_CLOEXEC set. */
  14. #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
  15. /*
  16. * Request nofications on a directory.
  17. * See below for events that may be notified.
  18. */
  19. #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
  20. /*
  21. * Set and get of pipe page size array
  22. */
  23. #define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
  24. #define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
  25. /*
  26. * Set/Get seals
  27. */
  28. #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
  29. #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
  30. /*
  31. * Types of seals
  32. */
  33. #define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
  34. #define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
  35. #define F_SEAL_GROW 0x0004 /* prevent file from growing */
  36. #define F_SEAL_WRITE 0x0008 /* prevent writes */
  37. #define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */
  38. /* (1U << 31) is reserved for signed error codes */
  39. /*
  40. * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the
  41. * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on
  42. * the specific file.
  43. */
  44. #define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11)
  45. #define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
  46. #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
  47. #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
  48. /*
  49. * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
  50. * used to clear any hints previously set.
  51. */
  52. #define RWH_WRITE_LIFE_NOT_SET 0
  53. #define RWH_WRITE_LIFE_NONE 1
  54. #define RWH_WRITE_LIFE_SHORT 2
  55. #define RWH_WRITE_LIFE_MEDIUM 3
  56. #define RWH_WRITE_LIFE_LONG 4
  57. #define RWH_WRITE_LIFE_EXTREME 5
  58. /*
  59. * The originally introduced spelling is remained from the first
  60. * versions of the patch set that introduced the feature, see commit
  61. * v4.13-rc1~212^2~51.
  62. */
  63. #define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET
  64. /*
  65. * Types of directory notifications that may be requested.
  66. */
  67. #define DN_ACCESS 0x00000001 /* File accessed */
  68. #define DN_MODIFY 0x00000002 /* File modified */
  69. #define DN_CREATE 0x00000004 /* File created */
  70. #define DN_DELETE 0x00000008 /* File removed */
  71. #define DN_RENAME 0x00000010 /* File renamed */
  72. #define DN_ATTRIB 0x00000020 /* File changed attibutes */
  73. #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
  74. /*
  75. * The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is
  76. * meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
  77. * unlinkat. The two functions do completely different things and therefore,
  78. * the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
  79. * faccessat would be undefined behavior and thus treating it equivalent to
  80. * AT_EACCESS is valid undefined behavior.
  81. */
  82. #define AT_FDCWD -100 /* Special value used to indicate
  83. openat should use the current
  84. working directory. */
  85. #define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
  86. #define AT_EACCESS 0x200 /* Test access permitted for
  87. effective IDs, not real IDs. */
  88. #define AT_REMOVEDIR 0x200 /* Remove directory instead of
  89. unlinking file. */
  90. #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
  91. #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
  92. #define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
  93. #define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
  94. #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
  95. #define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */
  96. #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */
  97. #define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
  98. #endif /* _UAPI_LINUX_FCNTL_H */