diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-04-27 14:16:06 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-28 15:41:34 +0200 |
commit | 84e8edec308dd157a013c811c3fa351fc0340f63 (patch) | |
tree | 50f25d856de7b8b92f3426338155780e9c296049 /src/basic/missing_syscall.h | |
parent | 9899580a586522330bdb657bf228402638b6dbc2 (diff) | |
download | systemd-84e8edec308dd157a013c811c3fa351fc0340f63.tar.gz |
missing: add syscall wrappers for new mount API
Diffstat (limited to 'src/basic/missing_syscall.h')
-rw-r--r-- | src/basic/missing_syscall.h | 95 |
1 files changed, 95 insertions, 0 deletions
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 |