summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build6
-rw-r--r--src/basic/missing_syscall.h95
2 files changed, 101 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 93d3c26a22..f30b7eef79 100644
--- a/meson.build
+++ b/meson.build
@@ -480,11 +480,14 @@ conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h
decl_headers = '''
#include <uchar.h>
+#include <sys/mount.h>
#include <sys/stat.h>
+#include <linux/fs.h>
'''
foreach decl : ['char16_t',
'char32_t',
+ 'struct mount_attr',
'struct statx',
]
@@ -555,6 +558,9 @@ foreach ident : [
['execveat', '''#include <unistd.h>'''],
['close_range', '''#include <unistd.h>'''],
['epoll_pwait2', '''#include <sys/epoll.h>'''],
+ ['mount_setattr', '''#include <sys/mount.h>'''],
+ ['move_mount', '''#include <sys/mount.h>'''],
+ ['open_tree', '''#include <sys/mount.h>'''],
]
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
index 1384324804..9e3a165857 100644
--- a/src/basic/missing_syscall.h
+++ b/src/basic/missing_syscall.h
@@ -425,3 +425,98 @@ static inline int missing_epoll_pwait2(
# define epoll_pwait2 missing_epoll_pwait2
#endif
+
+/* ======================================================================= */
+
+#if !HAVE_MOUNT_SETATTR
+
+#if !HAVE_STRUCT_MOUNT_ATTR
+struct mount_attr {
+ uint64_t attr_set;
+ uint64_t attr_clr;
+ uint64_t propagation;
+ uint64_t userns_fd;
+};
+#else
+struct mount_attr;
+#endif
+
+#ifndef MOUNT_ATTR_IDMAP
+#define MOUNT_ATTR_IDMAP 0x00100000
+#endif
+
+#ifndef AT_RECURSIVE
+#define AT_RECURSIVE 0x8000
+#endif
+
+static inline int missing_mount_setattr(
+ int dfd,
+ const char *path,
+ unsigned flags,
+ struct mount_attr *attr,
+ size_t size) {
+
+# if defined __NR_mount_setattr && __NR_mount_setattr >= 0
+ return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
+# else
+ errno = ENOSYS;
+ return -1;
+# endif
+}
+
+# define mount_setattr missing_mount_setattr
+#endif
+
+/* ======================================================================= */
+
+#if !HAVE_OPEN_TREE
+
+#ifndef OPEN_TREE_CLONE
+#define OPEN_TREE_CLONE 1
+#endif
+
+#ifndef OPEN_TREE_CLOEXEC
+#define OPEN_TREE_CLOEXEC O_CLOEXEC
+#endif
+
+static inline int missing_open_tree(
+ int dfd,
+ const char *filename,
+ unsigned flags) {
+
+# if defined __NR_open_tree && __NR_open_tree >= 0
+ return syscall(__NR_open_tree, dfd, filename, flags);
+# else
+ errno = ENOSYS;
+ return -1;
+# endif
+}
+
+# define open_tree missing_open_tree
+#endif
+
+/* ======================================================================= */
+
+#if !HAVE_MOVE_MOUNT
+
+#ifndef MOVE_MOUNT_F_EMPTY_PATH
+#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
+#endif
+
+static inline int missing_move_mount(
+ int from_dfd,
+ const char *from_pathname,
+ int to_dfd,
+ const char *to_pathname,
+ unsigned flags) {
+
+# if defined __NR_move_mount && __NR_move_mount >= 0
+ return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd, to_pathname, flags);
+# else
+ errno = ENOSYS;
+ return -1;
+# endif
+}
+
+# define move_mount missing_move_mount
+#endif