From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80171 invoked by alias); 3 Apr 2017 18:39:04 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 80149 invoked by uid 89); 3 Apr 2017 18:39:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=wvEZjYFa6OkmD6VybIn5kTcuD98x9GQe+gj4iGXtQCo=; b=HOI9YOjcgHYcKs5NoC6FdUcK+LGsdKOf1+uxj4BYoSSsU6oWWlUSs2phuTianD0rWl z1sX6hQcDpR1pax5TJo1VOHca043Q2WR+jsQ9CUhxd5WdBH5oNb1/gLHxQvFwp/qfbi1 E3MyDIelSORn7TK4o14W4LMxY4RofC8M7kJlcJogBQXwL1YfbTmNsR6vQreSxr6pHRMz /9AMFuHAORV6SVoDf8Uh/3668+PaRZwrZiO2TZwgb/60iRwL02LAmP2JYoXTKNjFsrx7 lvl78EOdHhu7Ihcqg9d5eCjsSKaL5tZ0vaaj5CLkTMceyPgT0xBsKosDoW7OUB1ffz8d /nuQ== X-Gm-Message-State: AFeK/H0ZLJGcfyi8j7IC1x2JIa9rPuFZV7q7jv3PhsWEl4mHsynAnSoIEojKeziB6iboyI2G X-Received: by 10.200.48.116 with SMTP id g49mr17743564qte.131.1491244741002; Mon, 03 Apr 2017 11:39:01 -0700 (PDT) Subject: Re: [PATCH][BZ 21340] add support for POSIX_SPAWN_SETSID To: libc-alpha@sourceware.org References: <20170401142954.23142-1-quae@daurnimator.com> From: Adhemerval Zanella Message-ID: <79a92f8e-2ec2-9c89-09b6-b495df7fd029@linaro.org> Date: Mon, 03 Apr 2017 18:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170401142954.23142-1-quae@daurnimator.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-SW-Source: 2017-04/txt/msg00027.txt.bz2 It lacks the proper Changelog, but patch looks good. Could you provide one? Also, I assume you checked at least in one architecture (we usually indicate which system we ran the patch and the results). On 01/04/2017 11:29, daurnimator wrote: > 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 > > --- > conform/data/spawn.h-data | 1 + > posix/spawn.h | 1 + > posix/spawnattr_setflags.c | 1 + > sysdeps/mach/hurd/spawni.c | 3 +++ > sysdeps/posix/spawni.c | 7 ++++++- > sysdeps/unix/sysv/linux/spawni.c | 4 ++++ > 6 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/conform/data/spawn.h-data b/conform/data/spawn.h-data > index fb206f7ecf..bcba36c492 100644 > --- a/conform/data/spawn.h-data > +++ b/conform/data/spawn.h-data > @@ -14,6 +14,7 @@ constant POSIX_SPAWN_SETSCHEDPARAM > constant POSIX_SPAWN_SETSCHEDULER > constant POSIX_SPAWN_SETSIGDEF > constant POSIX_SPAWN_SETSIGMASK > +constant POSIX_SPAWN_SETSID > > function int posix_spawnattr_destroy (posix_spawnattr_t*) > function int posix_spawnattr_getsigdefault (const posix_spawnattr_t*, sigset_t*) > diff --git a/posix/spawn.h b/posix/spawn.h > index 36e3867e17..8d2ace1b87 100644 > --- a/posix/spawn.h > +++ b/posix/spawn.h > @@ -60,6 +60,7 @@ typedef struct > #ifdef __USE_GNU > # define POSIX_SPAWN_USEVFORK 0x40 > #endif > +#define POSIX_SPAWN_SETSID 0x80 > > > __BEGIN_DECLS > diff --git a/posix/spawnattr_setflags.c b/posix/spawnattr_setflags.c > index 9b3d1e022a..62d2f00c20 100644 > --- a/posix/spawnattr_setflags.c > +++ b/posix/spawnattr_setflags.c > @@ -25,6 +25,7 @@ > | POSIX_SPAWN_SETSIGMASK \ > | POSIX_SPAWN_SETSCHEDPARAM \ > | POSIX_SPAWN_SETSCHEDULER \ > + | POSIX_SPAWN_SETSID \ > | POSIX_SPAWN_USEVFORK) > > /* Store flags in the attribute structure. */ > diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c > index 284875ac30..74303839e4 100644 > --- a/sysdeps/mach/hurd/spawni.c > +++ b/sysdeps/mach/hurd/spawni.c > @@ -281,6 +281,9 @@ __spawni (pid_t *pid, const char *file, > } > #endif > > + if (!err && (flags & POSIX_SPAWN_SETSID) != 0) > + err = __proc_setsid (proc); > + > /* Set the process group ID. */ > if (!err && (flags & POSIX_SPAWN_SETPGROUP) != 0) > err = __proc_setpgrp (proc, new_pid, attrp->__pgrp); > diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c > index 5cc2ad1363..bc23a1e6ab 100644 > --- a/sysdeps/posix/spawni.c > +++ b/sysdeps/posix/spawni.c > @@ -101,7 +101,8 @@ __spawni (pid_t *pid, const char *file, > to POSIX. */ > || ((flags & (POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF > | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER > - | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS)) == 0 > + | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS > + | POSIX_SPAWN_SETSID)) == 0 > && file_actions == NULL)) > new_pid = __vfork (); > else > @@ -159,6 +160,10 @@ __spawni (pid_t *pid, const char *file, > } > #endif > > + if ((flags & POSIX_SPAWN_SETSID) != 0 > + && __setsid () != 0) > + _exit (SPAWN_ERROR); > + > /* Set the process group ID. */ > if ((flags & POSIX_SPAWN_SETPGROUP) != 0 > && __setpgid (0, attrp->__pgrp) != 0) > diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c > index b82a5e8f3c..318c39a8af 100644 > --- a/sysdeps/unix/sysv/linux/spawni.c > +++ b/sysdeps/unix/sysv/linux/spawni.c > @@ -177,6 +177,10 @@ __spawni_child (void *arguments) > } > #endif > > + if ((attr->__flags & POSIX_SPAWN_SETSID) != 0 > + && (ret = __setsid ()) != 0) > + goto fail; > + > /* Set the process group ID. */ > if ((attr->__flags & POSIX_SPAWN_SETPGROUP) != 0 > && (ret = __setpgid (0, attr->__pgrp)) != 0) >