mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] add support for POSIX_SPAWN_SETSID
@ 2017-03-31  5:02 daurnimator
  2017-03-31 16:01 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: daurnimator @ 2017-03-31  5:02 UTC (permalink / raw)
  To: musl; +Cc: daurnimator

This patch adds support for the POSIX_SPAWN_SETSID flag.

It was recently accepted by the Austin Group:
http://austingroupbugs.net/view.php?id=1044

---
 include/spawn.h           | 1 +
 src/process/posix_spawn.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/include/spawn.h b/include/spawn.h
index 29c799ee..7dee7cfa 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -21,6 +21,7 @@ struct sched_param;
 #define POSIX_SPAWN_SETSIGMASK 8
 #define POSIX_SPAWN_SETSCHEDPARAM 16
 #define POSIX_SPAWN_SETSCHEDULER 32
+#define POSIX_SPAWN_SETSID 64
 
 typedef struct {
 	int __flags;
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
index 0bdf71cd..03392ba8 100644
--- a/src/process/posix_spawn.c
+++ b/src/process/posix_spawn.c
@@ -73,6 +73,10 @@ static int child(void *args_vp)
 		__libc_sigaction(i, &sa, 0);
 	}
 
+	if (attr->__flags & POSIX_SPAWN_SETSID)
+		if ((ret=__syscall(SYS_setsid)))
+			goto fail;
+
 	if (attr->__flags & POSIX_SPAWN_SETPGROUP)
 		if ((ret=__syscall(SYS_setpgid, 0, attr->__pgrp)))
 			goto fail;
-- 
2.12.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-22 23:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31  5:02 [PATCH] add support for POSIX_SPAWN_SETSID daurnimator
2017-03-31 16:01 ` Rich Felker
2017-04-22 23:19   ` Rich Felker
2017-04-22 23:43     ` [musl] " Zack Weinberg
2017-04-22 23:47       ` Rich Felker
2017-04-22 23:49         ` [musl] " Zack Weinberg

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).