commit 061894128ab2ff7f9b3872c6fa15078a56a57697
parent 9bf94d170fd0d5540be8c6337f53ed71dbca268a
Author: ccx <ccx@te2000.cz>
Date: Fri, 31 May 2024 20:17:44 +0000
Implement CLONE_NEWPID functionality
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
@@ -328,7 +328,18 @@ static void trystart (void)
fa[1].x.fd2[1] = notifyp[1] ;
}
- status.pid = cspawn(cargv[orig], cargv + orig, (char const *const *)environ, CSPAWN_FLAGS_SELFPIPE_FINISH | CSPAWN_FLAGS_SETSID, fa, notifyp[1] >= 0 ? 2 : 0) ;
+ uint16_t cspawn_flags = CSPAWN_FLAGS_SELFPIPE_FINISH | CSPAWN_FLAGS_SETSID;
+ if (access("clone-newpid", F_OK) == 0)
+ {
+ cspawn_flags |= CSPAWN_FLAGS_LINUX_NEWPID;
+ }
+ else if(errno != ENOENT) {
+ strerr_warnwu1sys("check for clone-newpid file") ;
+ return ;
+ /* TODO: Close stuff from above? Exit instead? */
+ }
+
+ status.pid = cspawn(cargv[orig], cargv + orig, (char const *const *)environ, cspawn_flags, fa, notifyp[1] >= 0 ? 2 : 0) ;
if (!status.pid)
{
settimeout(60) ;