[gnome-builder] subprocess-launcher: use PR_SET_PDEATHSIG on Linux
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] subprocess-launcher: use PR_SET_PDEATHSIG on Linux
- Date: Sun, 30 Oct 2016 05:12:31 +0000 (UTC)
commit 75e0114b6dc6232b773ed62244227eead6869898
Author: Christian Hergert <chergert redhat com>
Date: Sat Oct 29 22:11:36 2016 -0700
subprocess-launcher: use PR_SET_PDEATHSIG on Linux
If we are spawning a process using GSubprocess, then set the "die with
parent process" bit using prctl() to ensure our children processes are
torn down with Builder.
This is a bit more reslient to crashes or unclean shutdowns to ensure we
tear down our child processes.
libide/subprocess/ide-subprocess-launcher.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/libide/subprocess/ide-subprocess-launcher.c b/libide/subprocess/ide-subprocess-launcher.c
index d1c874e..fa1fb85 100644
--- a/libide/subprocess/ide-subprocess-launcher.c
+++ b/libide/subprocess/ide-subprocess-launcher.c
@@ -23,6 +23,10 @@
#include <string.h>
#include <unistd.h>
+#ifdef __linux
+# include <sys/prctl.h>
+#endif
+
#include "ide-debug.h"
#include "ide-macros.h"
@@ -75,6 +79,11 @@ child_setup_func (gpointer data)
*/
setsid ();
#endif
+
+#ifdef __linux
+ /* Ensure we are killed with our parent */
+ prctl (PR_SET_PDEATHSIG, 15);
+#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]