1 From 63468abd3287ebd5cc4ed9205334217031049fb4 Mon Sep 17 00:00:00 2001
2 From: Christian Brauner <brauner@kernel.org>
3 Date: Wed, 10 Aug 2022 12:03:54 +0200
4 Subject: tree-wide: use struct clone_args directly
6 Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
9 src/lxc/process_utils.c | 2 +-
10 src/lxc/process_utils.h | 7 ++++---
11 src/lxc/start.c | 2 +-
13 src/tests/reboot.c | 2 --
14 6 files changed, 6 insertions(+), 9 deletions(-)
18 @@ -582,7 +582,6 @@ decl_headers = '''
20 #include <linux/if_link.h>
21 #include <linux/openat2.h>
22 -#include <linux/sched.h>
23 #include <linux/types.h>
26 --- a/src/lxc/process_utils.c
27 +++ b/src/lxc/process_utils.c
28 @@ -90,7 +90,7 @@ __returns_twice pid_t lxc_raw_legacy_clo
29 __returns_twice pid_t lxc_raw_clone(unsigned long flags, int *pidfd)
32 - struct lxc_clone_args args = {
33 + struct clone_args args = {
35 .pidfd = ptr_to_u64(pidfd),
37 --- a/src/lxc/process_utils.h
38 +++ b/src/lxc/process_utils.h
43 -#include <linux/sched.h>
48 #define u64_to_ptr(x) ((void *)(uintptr_t)x)
51 -struct lxc_clone_args {
52 +#if !HAVE_STRUCT_CLONE_ARGS
56 __aligned_u64 child_tid;
57 @@ -178,8 +178,9 @@ struct lxc_clone_args {
58 __aligned_u64 set_tid_size;
63 -__returns_twice static inline pid_t lxc_clone3(struct lxc_clone_args *args, size_t size)
64 +__returns_twice static inline pid_t lxc_clone3(struct clone_args *args, size_t size)
66 return syscall(__NR_clone3, args, size);
70 @@ -1673,7 +1673,7 @@ static int lxc_spawn(struct lxc_handler
72 int cgroup_fd = -EBADF;
74 - struct lxc_clone_args clone_args = {
75 + struct clone_args clone_args = {
76 .flags = handler->clone_flags,
77 .pidfd = ptr_to_u64(&handler->pidfd),
78 .exit_signal = SIGCHLD,
85 -#include <linux/sched.h>
89 --- a/src/tests/reboot.c
90 +++ b/src/tests/reboot.c
93 #include "namespace.h"
96 -#include <linux/sched.h>
97 #include <linux/reboot.h>
99 int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...);