From: Christian Brauner Date: Wed, 10 Aug 2022 10:03:54 +0000 (+0200) Subject: tree-wide: use struct clone_args directly X-Git-Tag: lxc-5.0.2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9bca33263ed82190edc77960cdc19c3088167e6;p=thirdparty%2Flxc.git tree-wide: use struct clone_args directly Signed-off-by: Christian Brauner (Microsoft) --- diff --git a/meson.build b/meson.build index dbbe46e7a..3a500cbdb 100644 --- a/meson.build +++ b/meson.build @@ -611,7 +611,6 @@ decl_headers = ''' #include #include #include -#include #include ''' diff --git a/src/lxc/process_utils.c b/src/lxc/process_utils.c index 76e27da0f..eb52736b6 100644 --- a/src/lxc/process_utils.c +++ b/src/lxc/process_utils.c @@ -90,7 +90,7 @@ __returns_twice pid_t lxc_raw_legacy_clone(unsigned long flags, int *pidfd) __returns_twice pid_t lxc_raw_clone(unsigned long flags, int *pidfd) { pid_t pid; - struct lxc_clone_args args = { + struct clone_args args = { .flags = flags, .pidfd = ptr_to_u64(pidfd), }; diff --git a/src/lxc/process_utils.h b/src/lxc/process_utils.h index ed84741d0..d2bf97802 100644 --- a/src/lxc/process_utils.h +++ b/src/lxc/process_utils.h @@ -5,7 +5,6 @@ #include "config.h" -#include #include #include #include @@ -165,7 +164,8 @@ #define u64_to_ptr(x) ((void *)(uintptr_t)x) #endif -struct lxc_clone_args { +#if !HAVE_STRUCT_CLONE_ARGS +struct clone_args { __aligned_u64 flags; __aligned_u64 pidfd; __aligned_u64 child_tid; @@ -178,8 +178,9 @@ struct lxc_clone_args { __aligned_u64 set_tid_size; __aligned_u64 cgroup; }; +#endif -__returns_twice static inline pid_t lxc_clone3(struct lxc_clone_args *args, size_t size) +__returns_twice static inline pid_t lxc_clone3(struct clone_args *args, size_t size) { return syscall(__NR_clone3, args, size); } diff --git a/src/lxc/start.c b/src/lxc/start.c index 7751b7e90..9f68304bf 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -1673,7 +1673,7 @@ static int lxc_spawn(struct lxc_handler *handler) } else { int cgroup_fd = -EBADF; - struct lxc_clone_args clone_args = { + struct clone_args clone_args = { .flags = handler->clone_flags, .pidfd = ptr_to_u64(&handler->pidfd), .exit_signal = SIGCHLD, diff --git a/src/lxc/start.h b/src/lxc/start.h index 86b4c29a4..cd36bc55f 100644 --- a/src/lxc/start.h +++ b/src/lxc/start.h @@ -5,7 +5,6 @@ #include "config.h" -#include #include #include #include diff --git a/src/tests/reboot.c b/src/tests/reboot.c index 0a07bf467..005e9863d 100644 --- a/src/tests/reboot.c +++ b/src/tests/reboot.c @@ -32,8 +32,6 @@ #include "namespace.h" -#include -#include #include int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...);