commit 2e0d508f304a64e47ff2f24c07e6c27c13c5651c
parent 959752a062c4c4a1bd294f18a6b4da87b977a059
Author: ccx <root@dorje.wpr.cz>
Date: Wed, 15 Sep 2021 21:21:25 +0200
ship the definition of clone_args struct so newer headers don't break compat
Diffstat:
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/s6_clone3_newpid.patch b/s6_clone3_newpid.patch
@@ -1,32 +1,47 @@
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
-index cc6779a..a814f8e 100644
+index cc6779a..8b7e56b 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
-@@ -12,6 +12,11 @@
+@@ -12,6 +12,14 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#ifdef WANT_CLONE_NEWPID
+# include <syscall.h> /* For calling clone3 syscall (currently not in libc) */
++# include <linux/types.h> /* For vendored definition of struct clone_args */
++#if 0
+# include <linux/sched.h> /* Definition of struct clone_args */
++#endif
+# include <sched.h> /* Definition of CLONE_* constants */
+#endif
#include <skalibs/allreadwrite.h>
#include <skalibs/bytestr.h>
-@@ -231,6 +236,38 @@ static void failcoe (int fd)
+@@ -231,6 +239,50 @@ static void failcoe (int fd)
errno = e ;
}
+#ifdef WANT_CLONE_NEWPID
+pid_t newpid_fork(void)
+{
-+ struct clone_args args = {
++ struct clone_args {
++ __aligned_u64 flags;
++ __aligned_u64 pidfd;
++ __aligned_u64 child_tid;
++ __aligned_u64 parent_tid;
++ __aligned_u64 exit_signal;
++ __aligned_u64 stack;
++ __aligned_u64 stack_size;
++ __aligned_u64 tls;
++ __aligned_u64 set_tid;
++ __aligned_u64 set_tid_size;
++ __aligned_u64 cgroup;
++ } args = {
+ .flags = CLONE_NEWPID,
+ .exit_signal = SIGCHLD,
+ };
+
-+ return syscall(__NR_clone3, &args, sizeof(struct clone_args));
++ return syscall(__NR_clone3, &args, sizeof(args));
+}
+
+pid_t conditional_newpid_fork(void)
@@ -53,7 +68,7 @@ index cc6779a..a814f8e 100644
static void trystart (void)
{
int p[2] ;
-@@ -296,7 +333,7 @@ static void trystart (void)
+@@ -296,7 +348,7 @@ static void trystart (void)
strerr_warnwu2sys("pipe", " (waiting 60 seconds)") ;
goto errn ;
}