aboutsummaryrefslogtreecommitdiff
path: root/utils/lxc/patches/012-tree-wide-use-struct-clone_args-directly.patch
blob: 7ab536e9b7910b9d7024f5ca10f238ab9882423b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 63468abd3287ebd5cc4ed9205334217031049fb4 Mon Sep 17 00:00:00 2001
From: Christian Brauner <brauner@kernel.org>
Date: Wed, 10 Aug 2022 12:03:54 +0200
Subject: tree-wide: use struct clone_args directly

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
---
 meson.build             | 1 -
 src/lxc/process_utils.c | 2 +-
 src/lxc/process_utils.h | 7 ++++---
 src/lxc/start.c         | 2 +-
 src/lxc/start.h         | 1 -
 src/tests/reboot.c      | 2 --
 6 files changed, 6 insertions(+), 9 deletions(-)

--- a/meson.build
+++ b/meson.build
@@ -582,7 +582,6 @@ decl_headers = '''
 #include <linux/fs.h>
 #include <linux/if_link.h>
 #include <linux/openat2.h>
-#include <linux/sched.h>
 #include <linux/types.h>
 '''
 
--- a/src/lxc/process_utils.c
+++ b/src/lxc/process_utils.c
@@ -90,7 +90,7 @@ __returns_twice pid_t lxc_raw_legacy_clo
 __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),
 	};
--- a/src/lxc/process_utils.h
+++ b/src/lxc/process_utils.h
@@ -5,7 +5,6 @@
 
 #include "config.h"
 
-#include <linux/sched.h>
 #include <sched.h>
 #include <signal.h>
 #include <stdbool.h>
@@ -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);
 }
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -1673,7 +1673,7 @@ static int lxc_spawn(struct lxc_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,
--- a/src/lxc/start.h
+++ b/src/lxc/start.h
@@ -5,7 +5,6 @@
 
 #include "config.h"
 
-#include <linux/sched.h>
 #include <sched.h>
 #include <signal.h>
 #include <stdbool.h>
--- a/src/tests/reboot.c
+++ b/src/tests/reboot.c
@@ -32,8 +32,6 @@
 
 #include "namespace.h"
 
-#include <sched.h>
-#include <linux/sched.h>
 #include <linux/reboot.h>
 
 int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...);