mailing list of musl libc
 help / color / mirror / code / Atom feed
From: daurnimator <quae@daurnimator.com>
To: musl@lists.openwall.com
Cc: daurnimator <quae@daurnimator.com>
Subject: [PATCH] add support for POSIX_SPAWN_SETSID
Date: Fri, 31 Mar 2017 16:02:43 +1100	[thread overview]
Message-ID: <20170331050243.4485-1-quae@daurnimator.com> (raw)

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



             reply	other threads:[~2017-03-31  5:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  5:02 daurnimator [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170331050243.4485-1-quae@daurnimator.com \
    --to=quae@daurnimator.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).