Windows: Fixed mock signal values in stout.

Removed `SIGSTOP` and `SIGCONT` on Windows, since they are meaningless,
and never unused. Also, fixed the WEXITSTATUS macro to cast the exit
code instead of bit-masking it, since Windows exit codes are 32 bit
unsigned ints.

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


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

Branch: refs/heads/master
Commit: eccd0a9f9aa53acd2b1daf7512868eb6faff93a7
Parents: 7d8ae37
Author: Akash Gupta <akash-gu...@hotmail.com>
Authored: Wed Jan 17 13:51:32 2018 -0800
Committer: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Committed: Wed Jan 17 16:11:14 2018 -0800

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/windows/kill.hpp | 10 +++++-----
 3rdparty/stout/include/stout/windows.hpp         | 13 ++++++-------
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/eccd0a9f/3rdparty/stout/include/stout/os/windows/kill.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/windows/kill.hpp 
b/3rdparty/stout/include/stout/os/windows/kill.hpp
index b2a36b5..9cec111 100644
--- a/3rdparty/stout/include/stout/os/windows/kill.hpp
+++ b/3rdparty/stout/include/stout/os/windows/kill.hpp
@@ -51,18 +51,18 @@ inline int kill_process(pid_t pid)
 
 inline int kill(pid_t pid, int sig)
 {
-  // SIGCONT is not supported.
-  // SIGKILL call TerminateProcess.
-  // SIGSTOP  and SIGTERM have the same behaviour as SIGKILL.
+  // SIGCONT and SIGSTOP are not supported.
+  // SIGKILL calls TerminateProcess.
+  // SIGTERM has the same behaviour as SIGKILL.
 
-  if (sig == SIGKILL || sig == SIGSTOP || sig == SIGTERM) {
+  if (sig == SIGKILL || sig == SIGTERM) {
     return os::internal::kill_process(pid);
   }
 
   LOG(ERROR) << "Failed call to os::kill(): "
              << "Signal value: '" << sig << "' is not handled. "
              << "Valid Signal values for Windows os::kill() are "
-             << "'SIGSTOP' and 'SIGKILL'";
+             << "'SIGTERM' and 'SIGKILL'";
 
   _set_errno(EINVAL);
   return KILL_FAIL;

http://git-wip-us.apache.org/repos/asf/mesos/blob/eccd0a9f/3rdparty/stout/include/stout/windows.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows.hpp 
b/3rdparty/stout/include/stout/windows.hpp
index 7aa0ba7..b35e6b9 100644
--- a/3rdparty/stout/include/stout/windows.hpp
+++ b/3rdparty/stout/include/stout/windows.hpp
@@ -340,12 +340,10 @@ const mode_t S_ISVTX = 0x02000000;        // No-op.
 const mode_t O_SYNC     = 0x00000000;     // No-op.
 const mode_t O_NONBLOCK = 0x00000000;     // No-op.
 
-// Linux signal flags not used in Windows. We define them per
-// `Linux sys/signal.h` to branch properly for Windows
-//  processes' stop, resume and kill.
-const mode_t SIGCONT = 0x00000009;     // Signal Cont.
-const mode_t SIGSTOP = 0x00000011;     // Signal Stop.
-const mode_t SIGKILL = 0x00000013;     // Signal Kill.
+// Even though SIGKILL doesn't exist on Windows, we define
+// it here, because Docker defines it. So, the docker
+// executor needs this signal value to properly kill containers.
+const mode_t SIGKILL = 0x00000009;     // Signal Kill.
 
 inline auto strerror_r(int errnum, char* buffer, size_t length) ->
 decltype(strerror_s(buffer, length, errnum))
@@ -373,8 +371,9 @@ inline const char* strsignal(int signum)
 #endif // WIFEXITED
 
 // Returns the exit status of the child.
+// On Windows, they are a 32 bit unsigned integer.
 #ifndef WEXITSTATUS
-#define WEXITSTATUS(x) (x & 0xFF)
+#define WEXITSTATUS(x) static_cast<DWORD>(x)
 #endif // WEXITSTATUS
 
 #ifndef WIFSIGNALED

Reply via email to