summaryrefslogtreecommitdiff
path: root/bundled
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2021-02-20 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2021-02-20 08:00:00 +0000
commita093c413b3965c6058e9b58fbf08285da14e2661 (patch)
tree3179a83a777f32d4032b3fb5647bd6ac966722ca /bundled
parent87859aa1d7541afc0ba46114903b660e3870eb4f (diff)
downloadstrace-a093c413b3965c6058e9b58fbf08285da14e2661.tar.gz
Switch to use bundled <linux/fcntl.h>
* bundled/linux/include/uapi/linux/fcntl.h: New file, copied from headers_install'ed Linux kernel v5.11. * bundled/Makefile.am (EXTRA_DIST): Add it. * configure.ac (AC_CHECK_TYPES): Remove struct flock, struct flock64, struct __kernel_flock, struct __kernel_flock64, struct f_owner_ex, and struct __kernel_f_owner_ex. * src/f_owner_ex.h: Remove. * src/flock.h: Likewise. * src/Makefile.am (libstrace_a_SOURCES): Remove f_owner_ex.h and flock.h. * src/fcntl.c: Include <linux/fcntl.h> instead of "flock.h". (print_struct_flock64, printflock64, printflock): Replace struct_kernel_flock64 with struct flock64. * src/fetch_struct_flock.c: Include <linux/fcntl.h> instead of "flock.h". Replace struct_kernel_flock64 with struct flock64 and struct_kernel_flock with struct flock. * src/file_handle.c: Include <linux/fcntl.h>. * src/open.c: Likewise. * src/open_tree.c: Likewise. * src/statx.c: Likewise. * src/link.c: Include <linux/fcntl.h> instead of <fcntl.h>. * src/xlat/at_flags.in: Add #unconditional, remove fallback definitions. * src/xlat/f_owner_types.in: Likewise. * src/xlat/f_seals.in: Likewise. * src/xlat/fcntlcmds.in: Likewise. * src/xlat/name_to_handle_at_flags.in: Likewise. * src/xlat/open_tree_flags.in: Likewise. * src/xlat/fdflags.in: Add #unconditional. * src/xlat/lockfcmds.in: Likewise. * src/xlat/notifyflags.in: Likewise. * tests/fcntl-common.c: Include <linux/fcntl.h> instead of "flock.h", do not include "f_owner_ex.h", always define and invoke test_f_owner_ex, assume <linux/fcntl.h> defines all its types and constants, replace struct_kernel_flock64 with struct flock64, struct_kernel_flock with struct flock, and struct_kernel_f_owner_ex with struct f_owner_ex. * tests/fcntl.c (test_flock64_undecoded): Replace struct_kernel_flock64 with struct flock64. * tests/fcntl64.c (test_flock64_lk64): Likewise. * tests/openat2.c: Include <linux/fcntl.h>, assume it defines all its types and constants.
Diffstat (limited to 'bundled')
-rw-r--r--bundled/Makefile.am1
-rw-r--r--bundled/linux/include/uapi/linux/fcntl.h114
2 files changed, 115 insertions, 0 deletions
diff --git a/bundled/Makefile.am b/bundled/Makefile.am
index 771a764ce..029ec6575 100644
--- a/bundled/Makefile.am
+++ b/bundled/Makefile.am
@@ -29,6 +29,7 @@ EXTRA_DIST = \
linux/include/uapi/linux/dm-ioctl.h \
linux/include/uapi/linux/dqblk_xfs.h \
linux/include/uapi/linux/falloc.h \
+ linux/include/uapi/linux/fcntl.h \
linux/include/uapi/linux/fib_rules.h \
linux/include/uapi/linux/fiemap.h \
linux/include/uapi/linux/fs.h \
diff --git a/bundled/linux/include/uapi/linux/fcntl.h b/bundled/linux/include/uapi/linux/fcntl.h
new file mode 100644
index 000000000..598de9876
--- /dev/null
+++ b/bundled/linux/include/uapi/linux/fcntl.h
@@ -0,0 +1,114 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _LINUX_FCNTL_H
+#define _LINUX_FCNTL_H
+
+#include <asm/fcntl.h>
+#include <linux/openat2.h>
+
+#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
+#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
+
+/*
+ * Cancel a blocking posix lock; internal use only until we expose an
+ * asynchronous lock api to userspace:
+ */
+#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
+
+/* Create a file descriptor with FD_CLOEXEC set. */
+#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
+
+/*
+ * Request nofications on a directory.
+ * See below for events that may be notified.
+ */
+#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
+
+/*
+ * Set and get of pipe page size array
+ */
+#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
+#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
+
+/*
+ * Set/Get seals
+ */
+#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
+#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
+
+/*
+ * Types of seals
+ */
+#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
+#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
+#define F_SEAL_GROW 0x0004 /* prevent file from growing */
+#define F_SEAL_WRITE 0x0008 /* prevent writes */
+#define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */
+/* (1U << 31) is reserved for signed error codes */
+
+/*
+ * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the
+ * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on
+ * the specific file.
+ */
+#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11)
+#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
+#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
+#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
+
+/*
+ * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
+ * used to clear any hints previously set.
+ */
+#define RWH_WRITE_LIFE_NOT_SET 0
+#define RWH_WRITE_LIFE_NONE 1
+#define RWH_WRITE_LIFE_SHORT 2
+#define RWH_WRITE_LIFE_MEDIUM 3
+#define RWH_WRITE_LIFE_LONG 4
+#define RWH_WRITE_LIFE_EXTREME 5
+
+/*
+ * The originally introduced spelling is remained from the first
+ * versions of the patch set that introduced the feature, see commit
+ * v4.13-rc1~212^2~51.
+ */
+#define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET
+
+/*
+ * Types of directory notifications that may be requested.
+ */
+#define DN_ACCESS 0x00000001 /* File accessed */
+#define DN_MODIFY 0x00000002 /* File modified */
+#define DN_CREATE 0x00000004 /* File created */
+#define DN_DELETE 0x00000008 /* File removed */
+#define DN_RENAME 0x00000010 /* File renamed */
+#define DN_ATTRIB 0x00000020 /* File changed attibutes */
+#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
+
+/*
+ * The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is
+ * meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
+ * unlinkat. The two functions do completely different things and therefore,
+ * the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
+ * faccessat would be undefined behavior and thus treating it equivalent to
+ * AT_EACCESS is valid undefined behavior.
+ */
+#define AT_FDCWD -100 /* Special value used to indicate
+ openat should use the current
+ working directory. */
+#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
+#define AT_EACCESS 0x200 /* Test access permitted for
+ effective IDs, not real IDs. */
+#define AT_REMOVEDIR 0x200 /* Remove directory instead of
+ unlinking file. */
+#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
+#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
+#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
+
+#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */
+#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
+#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */
+#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */
+
+#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
+
+#endif /* _LINUX_FCNTL_H */