Repository: mesos
Updated Branches:
  refs/heads/master 9e0845415 -> cd5e924ad


Windows: Fixed subprocess and setsid compilation errors.

This changes the `ChildHook::SETSID` to a noop on Windows
as there is no equivalent functionality on this OS.

By default, the lifetime of child processes on Windows are not
tied to the parent process (`setsid()` on Posix prevents child
processes from dying when the parent dies).

Review: https://reviews.apache.org/r/52129/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cd5e924a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cd5e924a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cd5e924a

Branch: refs/heads/master
Commit: cd5e924ad1b0a003fd2a1b711631357ccde0edc0
Parents: 9e08454
Author: Joseph Wu <jos...@mesosphere.io>
Authored: Wed Sep 21 13:32:32 2016 -0700
Committer: Joseph Wu <josep...@apache.org>
Committed: Wed Sep 21 13:32:32 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/subprocess.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cd5e924a/3rdparty/libprocess/src/subprocess.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess.cpp 
b/3rdparty/libprocess/src/subprocess.cpp
index 6f50a71..8b24443 100644
--- a/3rdparty/libprocess/src/subprocess.cpp
+++ b/3rdparty/libprocess/src/subprocess.cpp
@@ -75,17 +75,23 @@ Subprocess::ChildHook Subprocess::ChildHook::CHDIR(
 Subprocess::ChildHook Subprocess::ChildHook::SETSID()
 {
   return Subprocess::ChildHook([]() -> Try<Nothing> {
+    // TODO(josephw): By default, child processes on Windows do not
+    // terminate when the parent terminates. We need to implement
+    // `JobObject` support to change this default.
+#ifndef __WINDOWS__
     // Put child into its own process session to prevent slave suicide
     // on child process SIGKILL/SIGTERM.
     if (::setsid() == -1) {
       return Error("Could not setsid");
     }
+#endif // __WINDOWS__
 
     return Nothing();
   });
 }
 
 
+#ifdef __linux__
 inline void signalHandler(int signal)
 {
   // Send SIGKILL to every process in the process group of the
@@ -93,6 +99,7 @@ inline void signalHandler(int signal)
   kill(0, SIGKILL);
   abort();
 }
+#endif // __linux__
 
 
 Subprocess::ChildHook Subprocess::ChildHook::SUPERVISOR()
@@ -158,7 +165,7 @@ Subprocess::ChildHook Subprocess::ChildHook::SUPERVISOR()
       abort();
       UNREACHABLE();
     }
-#endif
+#endif // __linux__
     return Nothing();
   });
 }

Reply via email to