mirror of
https://github.com/ohwgiles/laminar.git
synced 2025-06-13 12:54:29 +00:00
fe FreeBSD port: block prctl in leader.cpp
This commit is contained in:
parent
3b349f7caa
commit
080cc14493
@ -21,7 +21,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#if !defined(__FreeBSD__)
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <kj/async-io.h>
|
#include <kj/async-io.h>
|
||||||
@ -313,12 +315,14 @@ int leader_main(void) {
|
|||||||
// reap orphaned child processes. Stick with the more fundamental onSignal.
|
// reap orphaned child processes. Stick with the more fundamental onSignal.
|
||||||
kj::UnixEventPort::captureSignal(SIGCHLD);
|
kj::UnixEventPort::captureSignal(SIGCHLD);
|
||||||
|
|
||||||
|
#if !defined(__FreeBSD__)
|
||||||
// Becoming a subreaper means any descendent process whose parent process disappears
|
// Becoming a subreaper means any descendent process whose parent process disappears
|
||||||
// will be reparented to this one instead of init (or higher layer subreaper).
|
// will be reparented to this one instead of init (or higher layer subreaper).
|
||||||
// We do this so that the run will wait until all descedents exit before executing
|
// We do this so that the run will wait until all descedents exit before executing
|
||||||
// the next step.
|
// the next step.
|
||||||
prctl(PR_SET_CHILD_SUBREAPER, 1, NULL, NULL, NULL);
|
prctl(PR_SET_CHILD_SUBREAPER, 1, NULL, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Become the leader of a new process group. This is so that all child processes
|
// Become the leader of a new process group. This is so that all child processes
|
||||||
// will also get a kill signal when the run is aborted
|
// will also get a kill signal when the run is aborted
|
||||||
setpgid(0, 0);
|
setpgid(0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user