Windows: Enabled `Flags::runtime_directory` for checkpointing.

This had previously been compiled out on Windows, but we bring it back
in order to support checkpointing.

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


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

Branch: refs/heads/master
Commit: bdfee0cbc174c0960c87f05e3572f1b78d66fe9c
Parents: 42d5786
Author: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Authored: Wed Nov 8 11:50:09 2017 -0800
Committer: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Committed: Fri Feb 9 11:55:36 2018 -0800

----------------------------------------------------------------------
 src/slave/containerizer/mesos/launch.cpp | 10 +++++-----
 src/slave/containerizer/mesos/launch.hpp |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bdfee0cb/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp 
b/src/slave/containerizer/mesos/launch.cpp
index 91016ed..cde60fd 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -38,6 +38,8 @@
 #include <stout/path.hpp>
 #include <stout/unreachable.hpp>
 
+#include <stout/os/int_fd.hpp>
+#include <stout/os/open.hpp>
 #include <stout/os/realpath.hpp>
 #include <stout/os/which.hpp>
 #include <stout/os/write.hpp>
@@ -108,11 +110,9 @@ MesosContainerizerLaunch::Flags::Flags()
       "properly in the subprocess. It's used to synchronize with the \n"
       "parent process. If not specified, no synchronization will happen.");
 
-#ifndef __WINDOWS__
   add(&Flags::runtime_directory,
       "runtime_directory",
       "The runtime directory for the container (used for checkpointing)");
-#endif // __WINDOWS__
 
 #ifdef __linux__
   add(&Flags::namespace_mnt_target,
@@ -130,7 +130,7 @@ MesosContainerizerLaunch::Flags::Flags()
 
 static Option<pid_t> containerPid = None();
 static Option<string> containerStatusPath = None();
-static Option<int> containerStatusFd = None();
+static Option<int_fd> containerStatusFd = None();
 
 static void exitWithSignal(int sig);
 static void exitWithStatus(int status);
@@ -472,7 +472,6 @@ int MesosContainerizerLaunch::execute()
     return EXIT_SUCCESS;
   }
 
-#ifndef __WINDOWS__
   // The existence of the `runtime_directory` flag implies that we
   // want to checkpoint the container's status upon exit.
   if (flags.runtime_directory.isSome()) {
@@ -480,7 +479,7 @@ int MesosContainerizerLaunch::execute()
         flags.runtime_directory.get(),
         containerizer::paths::STATUS_FILE);
 
-    Try<int> open = os::open(
+    Try<int_fd> open = os::open(
         containerStatusPath.get(),
         O_WRONLY | O_CREAT | O_CLOEXEC,
         S_IRUSR | S_IWUSR);
@@ -495,6 +494,7 @@ int MesosContainerizerLaunch::execute()
     containerStatusFd = open.get();
   }
 
+#ifndef __WINDOWS__
   // We need a signal fence here to ensure that `containerStatusFd` is
   // actually written to memory and not just to a temporary register.
   // Without this, it's possible that the signal handler we are about

http://git-wip-us.apache.org/repos/asf/mesos/blob/bdfee0cb/src/slave/containerizer/mesos/launch.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.hpp 
b/src/slave/containerizer/mesos/launch.hpp
index 49eb912..0f66d6b 100644
--- a/src/slave/containerizer/mesos/launch.hpp
+++ b/src/slave/containerizer/mesos/launch.hpp
@@ -46,8 +46,8 @@ public:
 #else
     Option<int> pipe_read;
     Option<int> pipe_write;
-    Option<std::string> runtime_directory;
 #endif // __WINDOWS__
+    Option<std::string> runtime_directory;
 #ifdef __linux__
     Option<pid_t> namespace_mnt_target;
     bool unshare_namespace_mnt;

Reply via email to