posix_spawn: add POSIX_SPAWN_SETSID.

see http://austingroupbugs.net/view.php?id=1044

Change-Id: I9ae4fe07ea0fa7e20eb9a1d8c64e971e7353bcff
Reviewed-on: https://review.haiku-os.org/c/1008
Reviewed-by: Rene Gollent <rene@gollent.com>
This commit is contained in:
Jérôme Duval 2019-02-04 19:34:13 +01:00 committed by Adrien Destugues
parent f0a99f2bea
commit af61539918
2 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#endif /* 0 */
#define POSIX_SPAWN_SETSIGDEF 0x10
#define POSIX_SPAWN_SETSIGMASK 0x20
#define POSIX_SPAWN_SETSID 0x40
typedef struct _posix_spawnattr *posix_spawnattr_t;

View File

@ -361,6 +361,11 @@ process_spawnattr(const posix_spawnattr_t *_attr)
return errno;
}
if ((attr->flags & POSIX_SPAWN_SETSID) != 0) {
if (setsid() != 0)
return errno;
}
if ((attr->flags & POSIX_SPAWN_SETPGROUP) != 0) {
if (setpgid(0, attr->pgroup) != 0)
return errno;