Repository: mesos
Updated Branches:
  refs/heads/master 8661672d8 -> 5aa050bfa


http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/read.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/read.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/read.hpp
new file mode 100644
index 0000000..abde7a4
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/read.hpp
@@ -0,0 +1,129 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_POSIX_READ_HPP__
+#define __STOUT_OS_POSIX_READ_HPP__
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include <string>
+
+#ifdef __sun
+#include <fstream>
+#endif // __sun
+
+#include <stout/error.hpp>
+#include <stout/result.hpp>
+#include <stout/try.hpp>
+
+
+namespace os {
+
+// Reads 'size' bytes from a file from its current offset.
+// If EOF is encountered before reading 'size' bytes then the result
+// will contain the bytes read and a subsequent read will return None.
+inline Result<std::string> read(int fd, size_t size)
+{
+  char* buffer = new char[size];
+  size_t offset = 0;
+
+  while (offset < size) {
+    ssize_t length = ::read(fd, buffer + offset, size - offset);
+
+    if (length < 0) {
+      // TODO(bmahler): Handle a non-blocking fd? (EAGAIN, EWOULDBLOCK)
+      if (errno == EINTR) {
+        continue;
+      }
+      ErrnoError error; // Constructed before 'delete' to capture errno.
+      delete[] buffer;
+      return error;
+    } else if (length == 0) {
+      // Reached EOF before expected! Only return as much data as
+      // available or None if we haven't read anything yet.
+      if (offset > 0) {
+        std::string result(buffer, offset);
+        delete[] buffer;
+        return result;
+      }
+      delete[] buffer;
+      return None();
+    }
+
+    offset += length;
+  }
+
+  std::string result(buffer, size);
+  delete[] buffer;
+  return result;
+}
+
+
+// Returns the contents of the file.
+#ifdef __sun // getline is not available on Solaris, using STL.
+inline Try<std::string> read(const std::string& path)
+{
+  std::ifstream ifs(path.c_str());
+  if (!ifs.is_open())
+  {
+    return ErrnoError("Failed to open file '" + path + "'");
+  }
+  return std::string((std::istreambuf_iterator<char>(ifs)),
+                     (std::istreambuf_iterator<char>()));
+}
+#else
+inline Try<std::string> read(const std::string& path)
+{
+  FILE* file = fopen(path.c_str(), "r");
+  if (file == NULL) {
+    return ErrnoError("Failed to open file '" + path + "'");
+  }
+
+  // Initially the 'line' is NULL and length 0, getline() allocates
+  // ('malloc') a buffer for reading the line.
+  // In subsequent iterations, if the buffer is not large enough to
+  // hold the line, getline() resizes it with 'realloc' and updates
+  // 'line' and 'length' as necessary. See:
+  // - http://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html
+  // - http://man7.org/linux/man-pages/man3/getline.3.html
+  std::string result;
+  char* line = NULL;
+  size_t length = 0;
+  ssize_t read;
+
+  while ((read = getline(&line, &length, file)) != -1) {
+    result.append(line, read);
+  }
+
+  // getline() requires the line buffer to be freed by the caller.
+  free(line);
+
+  if (ferror(file)) {
+    ErrnoError error;
+    // NOTE: We ignore the error from fclose(). This is because
+    // users calling this function are interested in the return value
+    // of read(). Also an unsuccessful fclose() does not affect the
+    // read.
+    fclose(file);
+    return error;
+  }
+
+  fclose(file);
+  return result;
+}
+#endif // __sun
+
+} // namespace os {
+
+#endif // __STOUT_OS_POSIX_READ_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/sendfile.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/sendfile.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/sendfile.hpp
new file mode 100644
index 0000000..50ad49e
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/sendfile.hpp
@@ -0,0 +1,65 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_POSIX_SENDFILE_HPP__
+#define __STOUT_OS_POSIX_SENDFILE_HPP__
+
+#include <errno.h>
+
+#if defined(__linux__) || defined(__sun)
+#include <sys/sendfile.h>
+#endif
+#ifdef __APPLE__
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#endif // __APPLE__
+
+#include <stout/os/signals.hpp>
+#include <stout/unreachable.hpp>
+
+namespace os {
+
+// Returns the amount of bytes written from the input file
+// descriptor to the output socket. On error, returns -1 and
+// errno indicates the error.
+// NOTE: The following limitations exist because of the OS X
+// implementation of sendfile:
+//   1. s must be a stream oriented socket descriptor.
+//   2. fd must be a regular file descriptor.
+inline ssize_t sendfile(int s, int fd, off_t offset, size_t length)
+{
+#if defined(__linux__) || defined(__sun)
+  suppress (SIGPIPE) {
+    // This will set errno to EPIPE if a SIGPIPE occurs.
+    return ::sendfile(s, fd, &offset, length);
+  }
+  UNREACHABLE();
+#elif defined __APPLE__
+  // On OS X, sendfile does not need to have SIGPIPE suppressed.
+  off_t _length = static_cast<off_t>(length);
+
+  if (::sendfile(fd, s, offset, &_length, NULL, 0) < 0) {
+    if (errno == EAGAIN && _length > 0) {
+      return _length;
+    }
+    return -1;
+  }
+
+  return _length;
+#endif // __APPLE__
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_POSIX_SENDFILE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/shell.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/shell.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/shell.hpp
new file mode 100644
index 0000000..53f14e1
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/shell.hpp
@@ -0,0 +1,76 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_POSIX_SHELL_HPP__
+#define __STOUT_OS_POSIX_SHELL_HPP__
+
+#include <stdarg.h> // For va_list, va_start, etc.
+#include <stdio.h> // For ferror, fgets, FILE, pclose, popen.
+
+#include <ostream>
+#include <string>
+
+#include <stout/error.hpp>
+#include <stout/format.hpp>
+#include <stout/try.hpp>
+
+
+namespace os {
+
+// Runs a shell command formatted with varargs and return the return value
+// of the command. Optionally, the output is returned via an argument.
+// TODO(vinod): Pass an istream object that can provide input to the command.
+inline Try<int> shell(std::ostream* os, const std::string fmt, ...)
+{
+  va_list args;
+  va_start(args, fmt);
+
+  const Try<std::string> command = strings::internal::format(fmt, args);
+
+  va_end(args);
+
+  if (command.isError()) {
+    return Error(command.error());
+  }
+
+  FILE* file;
+
+  if ((file = popen(command.get().c_str(), "r")) == NULL) {
+    return Error("Failed to run '" + command.get() + "'");
+  }
+
+  char line[1024];
+  // NOTE(vinod): Ideally the if and while loops should be interchanged. But
+  // we get a broken pipe error if we don't read the output and simply close.
+  while (fgets(line, sizeof(line), file) != NULL) {
+    if (os != NULL) {
+      *os << line;
+    }
+  }
+
+  if (ferror(file) != 0) {
+    pclose(file); // Ignoring result since we already have an error.
+    return Error("Error reading output of '" + command.get() + "'");
+  }
+
+  int status;
+  if ((status = pclose(file)) == -1) {
+    return Error("Failed to get status of '" + command.get() + "'");
+  }
+
+  return status;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_POSIX_SHELL_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/signals.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/signals.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/signals.hpp
new file mode 100644
index 0000000..420d5bb
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/signals.hpp
@@ -0,0 +1,185 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_POSIX_SIGNALS_HPP__
+#define __STOUT_OS_POSIX_SIGNALS_HPP__
+
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+
+namespace os {
+
+namespace signals {
+
+// Installs the given signal handler.
+inline int install(int signal, void(*handler)(int))
+{
+  struct sigaction action;
+  memset(&action, 0, sizeof(action));
+  sigemptyset(&action.sa_mask);
+  action.sa_handler = handler;
+  return sigaction(signal, &action, NULL);
+}
+
+
+// Resets the signal handler to the default handler of the signal.
+inline int reset(int signal)
+{
+  struct sigaction action;
+  memset(&action, 0, sizeof(action));
+  sigemptyset(&action.sa_mask);
+  action.sa_handler = SIG_DFL;
+  return sigaction(signal, &action, NULL);
+}
+
+
+// Returns true iff the signal is pending.
+inline bool pending(int signal)
+{
+  sigset_t set;
+  sigemptyset(&set);
+  sigpending(&set);
+  return sigismember(&set, signal);
+}
+
+
+// Returns true if the signal has been blocked, or false if the
+// signal was already blocked.
+inline bool block(int signal)
+{
+  sigset_t set;
+  sigemptyset(&set);
+  sigaddset(&set, signal);
+
+  sigset_t oldset;
+  sigemptyset(&oldset);
+
+  // We ignore errors here as the only documented one is
+  // EINVAL due to a bad value of the SIG_* argument.
+  pthread_sigmask(SIG_BLOCK, &set, &oldset);
+
+  return !sigismember(&oldset, signal);
+}
+
+
+// Returns true if the signal has been unblocked, or false if the
+// signal was not previously blocked.
+inline bool unblock(int signal)
+{
+  sigset_t set;
+  sigemptyset(&set);
+  sigaddset(&set, signal);
+
+  sigset_t oldset;
+  sigemptyset(&oldset);
+
+  pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
+
+  return sigismember(&oldset, signal);
+}
+
+namespace internal {
+
+// Suppresses a signal on the current thread for the lifetime of
+// the Suppressor. The signal *must* be synchronous and delivered
+// per-thread. The suppression occurs only on the thread of
+// execution of the Suppressor.
+struct Suppressor
+{
+  Suppressor(int _signal)
+    : signal(_signal), pending(false), unblock(false)
+  {
+    // Check to see if the signal is already reported as pending.
+    // If pending, it means the thread already blocks the signal!
+    // Therefore, any new instances of the signal will also be
+    // blocked and merged with the pending one since there is no
+    // queuing for signals.
+    pending = signals::pending(signal);
+
+    if (!pending) {
+      // Block the signal for this thread only. If already blocked,
+      // there's no need to unblock it.
+      unblock = signals::block(signal);
+    }
+  }
+
+  ~Suppressor()
+  {
+    // We want to preserve errno when the Suppressor drops out of
+    // scope. Otherwise, one needs to potentially store errno when
+    // using the suppress() macro.
+    int _errno = errno;
+
+    // If the signal has become pending after we blocked it, we
+    // need to clear it before unblocking it.
+    if (!pending && signals::pending(signal)) {
+      // It is possible that in between having observed the pending
+      // signal with sigpending() and clearing it with sigwait(),
+      // the signal was delivered to another thread before we were
+      // able to clear it here. This can happen if the signal was
+      // generated for the whole process (e.g. a kill was issued).
+      // See 2.4.1 here:
+      // 
http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
+      // To handle the above scenario, one can either:
+      //   1. Use sigtimedwait() with a timeout of 0, to ensure we
+      //      don't block forever. However, this only works on Linux
+      //      and we may still swallow the signal intended for the
+      //      process.
+      //   2. After seeing the pending signal, signal ourselves with
+      //      pthread_kill prior to calling sigwait(). This can still
+      //      swallow the signal intended for the process.
+      // We chose to use the latter technique as it works on all
+      // POSIX systems and is less likely to swallow process signals,
+      // provided the thread signal and process signal are not merged.
+      pthread_kill(pthread_self(), signal);
+
+      sigset_t mask;
+      sigemptyset(&mask);
+      sigaddset(&mask, signal);
+
+      int result;
+      do {
+        int _ignored;
+        result = sigwait(&mask, &_ignored);
+      } while (result == -1 && errno == EINTR);
+    }
+
+    // Unblock the signal (only if we were the ones to block it).
+    if (unblock) {
+      signals::unblock(signal);
+    }
+
+    // Restore errno.
+    errno = _errno;
+  }
+
+  // Needed for the suppress() macro.
+  operator bool () { return true; }
+
+private:
+  const int signal;
+  bool pending; // Whether the signal is already pending.
+  bool unblock; // Whether to unblock the signal on destruction.
+};
+
+} // namespace internal {
+
+} // namespace signals {
+
+} // namespace os {
+
+#endif // __STOUT_OS_POSIX_SIGNALS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/stat.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/stat.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/stat.hpp
new file mode 100644
index 0000000..c7084f1
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/stat.hpp
@@ -0,0 +1,160 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_POSIX_STAT_HPP__
+#define __STOUT_OS_POSIX_STAT_HPP__
+
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+
+#include <string>
+
+#include <stout/bytes.hpp>
+#include <stout/try.hpp>
+#include <stout/unreachable.hpp>
+
+
+namespace os {
+
+namespace stat {
+
+inline bool isdir(const std::string& path)
+{
+  struct stat s;
+
+  if (::stat(path.c_str(), &s) < 0) {
+    return false;
+  }
+  return S_ISDIR(s.st_mode);
+}
+
+
+inline bool isfile(const std::string& path)
+{
+  struct stat s;
+
+  if (::stat(path.c_str(), &s) < 0) {
+    return false;
+  }
+  return S_ISREG(s.st_mode);
+}
+
+
+inline bool islink(const std::string& path)
+{
+  struct stat s;
+
+  if (::lstat(path.c_str(), &s) < 0) {
+    return false;
+  }
+  return S_ISLNK(s.st_mode);
+}
+
+
+// Describes the different semantics supported for the implementation
+// of `size` defined below.
+enum FollowSymlink
+{
+  DO_NOT_FOLLOW_SYMLINK,
+  FOLLOW_SYMLINK
+};
+
+
+// Returns the size in Bytes of a given file system entry. When
+// applied to a symbolic link with `follow` set to
+// `DO_NOT_FOLLOW_SYMLINK`, this will return the length of the entry
+// name (strlen).
+inline Try<Bytes> size(
+    const std::string& path,
+    const FollowSymlink follow = FOLLOW_SYMLINK)
+{
+  struct stat s;
+
+  switch (follow) {
+    case DO_NOT_FOLLOW_SYMLINK: {
+      if (::lstat(path.c_str(), &s) < 0) {
+        return ErrnoError("Error invoking lstat for '" + path + "'");
+      }
+      break;
+    }
+    case FOLLOW_SYMLINK: {
+      if (::stat(path.c_str(), &s) < 0) {
+        return ErrnoError("Error invoking stat for '" + path + "'");
+      }
+      break;
+    }
+    default: {
+      UNREACHABLE();
+    }
+  }
+
+  return Bytes(s.st_size);
+}
+
+
+inline Try<long> mtime(const std::string& path)
+{
+  struct stat s;
+
+  if (::lstat(path.c_str(), &s) < 0) {
+    return ErrnoError("Error invoking stat for '" + path + "'");
+  }
+
+  return s.st_mtime;
+}
+
+
+inline Try<mode_t> mode(const std::string& path)
+{
+  struct stat s;
+
+  if (::stat(path.c_str(), &s) < 0) {
+    return ErrnoError("Error invoking stat for '" + path + "'");
+  }
+
+  return s.st_mode;
+}
+
+
+inline Try<dev_t> rdev(const std::string& path)
+{
+  struct stat s;
+
+  if (::stat(path.c_str(), &s) < 0) {
+    return ErrnoError("Error invoking stat for '" + path + "'");
+  }
+
+  if (!S_ISCHR(s.st_mode) && !S_ISBLK(s.st_mode)) {
+    return Error("Not a special file: " + path);
+  }
+
+  return s.st_rdev;
+}
+
+
+inline Try<ino_t> inode(const std::string& path)
+{
+  struct stat s;
+
+  if (::stat(path.c_str(), &s) < 0) {
+    return ErrnoError("Error invoking stat for '" + path + "'");
+  }
+
+  return s.st_ino;
+}
+
+} // namespace stat {
+
+} // namespace os {
+
+#endif // __STOUT_OS_STAT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/process.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/process.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/process.hpp
index 26f4fbe..204acaf 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/process.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/process.hpp
@@ -14,166 +14,14 @@
 #ifndef __STOUT_OS_PROCESS_HPP__
 #define __STOUT_OS_PROCESS_HPP__
 
-#include <sys/types.h> // For pid_t.
 
-#include <list>
-#include <ostream>
-#include <sstream>
-#include <string>
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/process.hpp>
+#else
+#include <stout/os/posix/process.hpp>
+#endif // __WINDOWS__
 
-#include <stout/bytes.hpp>
-#include <stout/duration.hpp>
-#include <stout/none.hpp>
-#include <stout/option.hpp>
-#include <stout/strings.hpp>
-
-namespace os {
-
-struct Process
-{
-  Process(pid_t _pid,
-          pid_t _parent,
-          pid_t _group,
-          const Option<pid_t>& _session,
-          const Option<Bytes>& _rss,
-          const Option<Duration>& _utime,
-          const Option<Duration>& _stime,
-          const std::string& _command,
-          bool _zombie)
-    : pid(_pid),
-      parent(_parent),
-      group(_group),
-      session(_session),
-      rss(_rss),
-      utime(_utime),
-      stime(_stime),
-      command(_command),
-      zombie(_zombie) {}
-
-  const pid_t pid;
-  const pid_t parent;
-  const pid_t group;
-  const Option<pid_t> session;
-  const Option<Bytes> rss;
-  const Option<Duration> utime;
-  const Option<Duration> stime;
-  const std::string command;
-  const bool zombie;
-
-  // TODO(bmahler): Add additional data as needed.
-
-  bool operator <  (const Process& p) const { return pid <  p.pid; }
-  bool operator <= (const Process& p) const { return pid <= p.pid; }
-  bool operator >  (const Process& p) const { return pid >  p.pid; }
-  bool operator >= (const Process& p) const { return pid >= p.pid; }
-  bool operator == (const Process& p) const { return pid == p.pid; }
-  bool operator != (const Process& p) const { return pid != p.pid; }
-};
-
-
-class ProcessTree
-{
-public:
-  // Returns a process subtree rooted at the specified PID, or none if
-  // the specified pid could not be found in this process tree.
-  Option<ProcessTree> find(pid_t pid) const
-  {
-    if (process.pid == pid) {
-      return *this;
-    }
-
-    foreach (const ProcessTree& tree, children) {
-      Option<ProcessTree> option = tree.find(pid);
-      if (option.isSome()) {
-        return option;
-      }
-    }
-
-    return None();
-  }
-
-  // Checks if the specified pid is contained in this process tree.
-  bool contains(pid_t pid) const
-  {
-    return find(pid).isSome();
-  }
-
-  operator Process () const
-  {
-    return process;
-  }
-
-  operator pid_t () const
-  {
-    return process.pid;
-  }
-
-  const Process process;
-  const std::list<ProcessTree> children;
-
-private:
-  friend struct Fork;
-  friend Try<ProcessTree> pstree(pid_t, const std::list<Process>&);
-
-  ProcessTree(
-      const Process& _process,
-      const std::list<ProcessTree>& _children)
-    : process(_process),
-      children(_children) {}
-};
-
-
-inline std::ostream& operator << (
-    std::ostream& stream,
-    const ProcessTree& tree)
-{
-  if (tree.children.empty()) {
-    stream << "--- " << tree.process.pid << " ";
-    if (tree.process.zombie) {
-      stream << "(" << tree.process.command << ")";
-    } else {
-      stream << tree.process.command;
-    }
-  } else {
-    stream << "-+- " << tree.process.pid << " ";
-    if (tree.process.zombie) {
-      stream << "(" << tree.process.command << ")";
-    } else {
-      stream << tree.process.command;
-    }
-    size_t size = tree.children.size();
-    foreach (const ProcessTree& child, tree.children) {
-      std::ostringstream out;
-      out << child;
-      stream << "\n";
-      if (--size != 0) {
-        stream << " |" << strings::replace(out.str(), "\n", "\n |");
-      } else {
-        stream << " \\" << strings::replace(out.str(), "\n", "\n  ");
-      }
-    }
-  }
-  return stream;
-}
-
-} // namespace os {
-
-
-// An overload of stringify for printing a list of process trees
-// (since printing a process tree is rather particular).
-inline std::string stringify(const std::list<os::ProcessTree>& list)
-{
-  std::ostringstream out;
-  out << "[ " << std::endl;
-  std::list<os::ProcessTree>::const_iterator iterator = list.begin();
-  while (iterator != list.end()) {
-    out << stringify(*iterator);
-    if (++iterator != list.end()) {
-      out << std::endl << std::endl;
-    }
-  }
-  out << std::endl << "]";
-  return out.str();
-}
 
 #endif // __STOUT_OS_PROCESS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/pstree.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/pstree.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/pstree.hpp
index ba8e579..9baa2fb 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/pstree.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/pstree.hpp
@@ -14,119 +14,14 @@
 #ifndef __STOUT_OS_PSTREE_HPP__
 #define __STOUT_OS_PSTREE_HPP__
 
-#include <list>
-#include <set>
 
-#include <stout/error.hpp>
-#include <stout/foreach.hpp>
-#include <stout/none.hpp>
-#include <stout/option.hpp>
-#include <stout/os.hpp>
-#include <stout/stringify.hpp>
-#include <stout/try.hpp>
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/pstree.hpp>
+#else
+#include <stout/os/posix/pstree.hpp>
+#endif // __WINDOWS__
 
-#include <stout/os/process.hpp>
-
-namespace os {
-
-// Forward declaration.
-inline Try<std::list<Process> > processes();
-
-
-// Returns a process tree rooted at the specified pid using the
-// specified list of processes (or an error if one occurs).
-inline Try<ProcessTree> pstree(
-    pid_t pid,
-    const std::list<Process>& processes)
-{
-  std::list<ProcessTree> children;
-  foreach (const Process& process, processes) {
-    if (process.parent == pid) {
-      Try<ProcessTree> tree = pstree(process.pid, processes);
-      if (tree.isError()) {
-        return Error(tree.error());
-      }
-      children.push_back(tree.get());
-    }
-  }
-
-  foreach (const Process& process, processes) {
-    if (process.pid == pid) {
-      return ProcessTree(process, children);
-    }
-  }
-
-  return Error("No process found at " + stringify(pid));
-}
-
-
-// Returns a process tree for the specified pid (or all processes if
-// pid is none or the current process if pid is 0).
-inline Try<ProcessTree> pstree(Option<pid_t> pid = None())
-{
-  if (pid.isNone()) {
-    pid = 1;
-  } else if (pid.get() == 0) {
-    pid = getpid();
-  }
-
-  const Try<std::list<Process>> processes = os::processes();
-
-  if (processes.isError()) {
-    return Error(processes.error());
-  }
-
-  return pstree(pid.get(), processes.get());
-}
-
-
-// Returns the minimum list of process trees that include all of the
-// specified pids using the specified list of processes.
-inline Try<std::list<ProcessTree> > pstrees(
-    const std::set<pid_t>& pids,
-    const std::list<Process>& processes)
-{
-  std::list<ProcessTree> trees;
-
-  foreach (pid_t pid, pids) {
-    // First, check if the pid is already connected to one of the
-    // process trees we've constructed.
-    bool disconnected = true;
-    foreach (const ProcessTree& tree, trees) {
-      if (tree.contains(pid)) {
-        disconnected = false;
-        break;
-      }
-    }
-
-    if (disconnected) {
-      Try<ProcessTree> tree = pstree(pid, processes);
-      if (tree.isError()) {
-        return Error(tree.error());
-      }
-
-      // Now see if any of the existing process trees are actually
-      // contained within the process tree we just created and only
-      // include the disjoint process trees.
-      // C++11:
-      // trees = trees.filter([](const ProcessTree& t) {
-      //   return tree.get().contains(t);
-      // });
-      std::list<ProcessTree> trees_ = trees;
-      trees.clear();
-      foreach (const ProcessTree& t, trees_) {
-        if (tree.get().contains(t.process.pid)) {
-          continue;
-        }
-        trees.push_back(t);
-      }
-      trees.push_back(tree.get());
-    }
-  }
-
-  return trees;
-}
-
-} // namespace os {
 
 #endif // __STOUT_OS_PSTREE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp
index fed005e..d5698a5 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/read.hpp
@@ -14,115 +14,14 @@
 #ifndef __STOUT_OS_READ_HPP__
 #define __STOUT_OS_READ_HPP__
 
-#include <stdio.h>
-#include <unistd.h>
 
-#include <string>
-
-#ifdef __sun
-#include <fstream>
-#endif // __sun
-
-#include <stout/error.hpp>
-#include <stout/result.hpp>
-#include <stout/try.hpp>
-
-namespace os {
-
-// Reads 'size' bytes from a file from its current offset.
-// If EOF is encountered before reading 'size' bytes then the result
-// will contain the bytes read and a subsequent read will return None.
-inline Result<std::string> read(int fd, size_t size)
-{
-  char* buffer = new char[size];
-  size_t offset = 0;
-
-  while (offset < size) {
-    ssize_t length = ::read(fd, buffer + offset, size - offset);
-
-    if (length < 0) {
-      // TODO(bmahler): Handle a non-blocking fd? (EAGAIN, EWOULDBLOCK)
-      if (errno == EINTR) {
-        continue;
-      }
-      ErrnoError error; // Constructed before 'delete' to capture errno.
-      delete[] buffer;
-      return error;
-    } else if (length == 0) {
-      // Reached EOF before expected! Only return as much data as
-      // available or None if we haven't read anything yet.
-      if (offset > 0) {
-        std::string result(buffer, offset);
-        delete[] buffer;
-        return result;
-      }
-      delete[] buffer;
-      return None();
-    }
-
-    offset += length;
-  }
-
-  std::string result(buffer, size);
-  delete[] buffer;
-  return result;
-}
-
-
-// Returns the contents of the file.
-#ifdef __sun // getline is not available on Solaris, using STL.
-inline Try<std::string> read(const std::string& path)
-{
-  std::ifstream ifs(path.c_str());
-  if (!ifs.is_open())
-  {
-    return ErrnoError("Failed to open file '" + path + "'");
-  }
-  return std::string((std::istreambuf_iterator<char>(ifs)),
-                     (std::istreambuf_iterator<char>()));
-}
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/read.hpp>
 #else
-inline Try<std::string> read(const std::string& path)
-{
-  FILE* file = fopen(path.c_str(), "r");
-  if (file == NULL) {
-    return ErrnoError("Failed to open file '" + path + "'");
-  }
-
-  // Initially the 'line' is NULL and length 0, getline() allocates
-  // ('malloc') a buffer for reading the line.
-  // In subsequent iterations, if the buffer is not large enough to
-  // hold the line, getline() resizes it with 'realloc' and updates
-  // 'line' and 'length' as necessary. See:
-  // - http://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html
-  // - http://man7.org/linux/man-pages/man3/getline.3.html
-  std::string result;
-  char* line = NULL;
-  size_t length = 0;
-  ssize_t read;
-
-  while ((read = getline(&line, &length, file)) != -1) {
-    result.append(line, read);
-  }
-
-  // getline() requires the line buffer to be freed by the caller.
-  free(line);
-
-  if (ferror(file)) {
-    ErrnoError error;
-    // NOTE: We ignore the error from fclose(). This is because
-    // users calling this function are interested in the return value
-    // of read(). Also an unsuccessful fclose() does not affect the
-    // read.
-    fclose(file);
-    return error;
-  }
-
-  fclose(file);
-  return result;
-}
-#endif // __sun
+#include <stout/os/posix/read.hpp>
+#endif // __WINDOWS__
 
-} // namespace os {
 
 #endif // __STOUT_OS_READ_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/sendfile.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/sendfile.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/sendfile.hpp
index 4485e41..580df06 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/sendfile.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/sendfile.hpp
@@ -14,52 +14,14 @@
 #ifndef __STOUT_OS_SENDFILE_HPP__
 #define __STOUT_OS_SENDFILE_HPP__
 
-#include <errno.h>
 
-#if defined(__linux__) || defined(__sun)
-#include <sys/sendfile.h>
-#endif
-#ifdef __APPLE__
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#endif // __APPLE__
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/sendfile.hpp>
+#else
+#include <stout/os/posix/sendfile.hpp>
+#endif // __WINDOWS__
 
-#include <stout/os/signals.hpp>
-#include <stout/unreachable.hpp>
-
-namespace os {
-
-// Returns the amount of bytes written from the input file
-// descriptor to the output socket. On error, returns -1 and
-// errno indicates the error.
-// NOTE: The following limitations exist because of the OS X
-// implementation of sendfile:
-//   1. s must be a stream oriented socket descriptor.
-//   2. fd must be a regular file descriptor.
-inline ssize_t sendfile(int s, int fd, off_t offset, size_t length)
-{
-#if defined(__linux__) || defined(__sun)
-  suppress (SIGPIPE) {
-    // This will set errno to EPIPE if a SIGPIPE occurs.
-    return ::sendfile(s, fd, &offset, length);
-  }
-  UNREACHABLE();
-#elif defined __APPLE__
-  // On OS X, sendfile does not need to have SIGPIPE suppressed.
-  off_t _length = static_cast<off_t>(length);
-
-  if (::sendfile(fd, s, offset, &_length, NULL, 0) < 0) {
-    if (errno == EAGAIN && _length > 0) {
-      return _length;
-    }
-    return -1;
-  }
-
-  return _length;
-#endif // __APPLE__
-}
-
-} // namespace os {
 
 #endif // __STOUT_OS_SENDFILE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/shell.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/shell.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/shell.hpp
index f6d3b76..ca71645 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/shell.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/shell.hpp
@@ -14,62 +14,14 @@
 #ifndef __STOUT_OS_SHELL_HPP__
 #define __STOUT_OS_SHELL_HPP__
 
-#include <stdarg.h> // For va_list, va_start, etc.
-#include <stdio.h> // For ferror, fgets, FILE, pclose, popen.
 
-#include <ostream>
-#include <string>
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/shell.hpp>
+#else
+#include <stout/os/posix/shell.hpp>
+#endif // __WINDOWS__
 
-#include <stout/error.hpp>
-#include <stout/format.hpp>
-#include <stout/try.hpp>
-
-namespace os {
-
-// Runs a shell command formatted with varargs and return the return value
-// of the command. Optionally, the output is returned via an argument.
-// TODO(vinod): Pass an istream object that can provide input to the command.
-inline Try<int> shell(std::ostream* os, const std::string fmt, ...)
-{
-  va_list args;
-  va_start(args, fmt);
-
-  const Try<std::string> command = strings::internal::format(fmt, args);
-
-  va_end(args);
-
-  if (command.isError()) {
-    return Error(command.error());
-  }
-
-  FILE* file;
-
-  if ((file = popen(command.get().c_str(), "r")) == NULL) {
-    return Error("Failed to run '" + command.get() + "'");
-  }
-
-  char line[1024];
-  // NOTE(vinod): Ideally the if and while loops should be interchanged. But
-  // we get a broken pipe error if we don't read the output and simply close.
-  while (fgets(line, sizeof(line), file) != NULL) {
-    if (os != NULL) {
-      *os << line;
-    }
-  }
-
-  if (ferror(file) != 0) {
-    pclose(file); // Ignoring result since we already have an error.
-    return Error("Error reading output of '" + command.get() + "'");
-  }
-
-  int status;
-  if ((status = pclose(file)) == -1) {
-    return Error("Failed to get status of '" + command.get() + "'");
-  }
-
-  return status;
-}
-
-} // namespace os {
 
 #endif // __STOUT_OS_SHELL_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/signals.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/signals.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/signals.hpp
index 3523070..7a79024 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/signals.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/signals.hpp
@@ -14,175 +14,19 @@
 #ifndef __STOUT_OS_SIGNALS_HPP__
 #define __STOUT_OS_SIGNALS_HPP__
 
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
 
-namespace os {
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/signals.hpp>
+#else
+#include <stout/os/posix/signals.hpp>
+#endif // __WINDOWS__
 
-namespace signals {
-
-// Installs the given signal handler.
-inline int install(int signal, void(*handler)(int))
-{
-  struct sigaction action;
-  memset(&action, 0, sizeof(action));
-  sigemptyset(&action.sa_mask);
-  action.sa_handler = handler;
-  return sigaction(signal, &action, NULL);
-}
-
-
-// Resets the signal handler to the default handler of the signal.
-inline int reset(int signal)
-{
-  struct sigaction action;
-  memset(&action, 0, sizeof(action));
-  sigemptyset(&action.sa_mask);
-  action.sa_handler = SIG_DFL;
-  return sigaction(signal, &action, NULL);
-}
-
-
-// Returns true iff the signal is pending.
-inline bool pending(int signal)
-{
-  sigset_t set;
-  sigemptyset(&set);
-  sigpending(&set);
-  return sigismember(&set, signal);
-}
-
-
-// Returns true if the signal has been blocked, or false if the
-// signal was already blocked.
-inline bool block(int signal)
-{
-  sigset_t set;
-  sigemptyset(&set);
-  sigaddset(&set, signal);
-
-  sigset_t oldset;
-  sigemptyset(&oldset);
-
-  // We ignore errors here as the only documented one is
-  // EINVAL due to a bad value of the SIG_* argument.
-  pthread_sigmask(SIG_BLOCK, &set, &oldset);
-
-  return !sigismember(&oldset, signal);
-}
-
-
-// Returns true if the signal has been unblocked, or false if the
-// signal was not previously blocked.
-inline bool unblock(int signal)
-{
-  sigset_t set;
-  sigemptyset(&set);
-  sigaddset(&set, signal);
-
-  sigset_t oldset;
-  sigemptyset(&oldset);
-
-  pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
-
-  return sigismember(&oldset, signal);
-}
-
-namespace internal {
-
-// Suppresses a signal on the current thread for the lifetime of
-// the Suppressor. The signal *must* be synchronous and delivered
-// per-thread. The suppression occurs only on the thread of
-// execution of the Suppressor.
-struct Suppressor
-{
-  Suppressor(int _signal)
-    : signal(_signal), pending(false), unblock(false)
-  {
-    // Check to see if the signal is already reported as pending.
-    // If pending, it means the thread already blocks the signal!
-    // Therefore, any new instances of the signal will also be
-    // blocked and merged with the pending one since there is no
-    // queuing for signals.
-    pending = signals::pending(signal);
-
-    if (!pending) {
-      // Block the signal for this thread only. If already blocked,
-      // there's no need to unblock it.
-      unblock = signals::block(signal);
-    }
-  }
-
-  ~Suppressor()
-  {
-    // We want to preserve errno when the Suppressor drops out of
-    // scope. Otherwise, one needs to potentially store errno when
-    // using the suppress() macro.
-    int _errno = errno;
-
-    // If the signal has become pending after we blocked it, we
-    // need to clear it before unblocking it.
-    if (!pending && signals::pending(signal)) {
-      // It is possible that in between having observed the pending
-      // signal with sigpending() and clearing it with sigwait(),
-      // the signal was delivered to another thread before we were
-      // able to clear it here. This can happen if the signal was
-      // generated for the whole process (e.g. a kill was issued).
-      // See 2.4.1 here:
-      // 
http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html
-      // To handle the above scenario, one can either:
-      //   1. Use sigtimedwait() with a timeout of 0, to ensure we
-      //      don't block forever. However, this only works on Linux
-      //      and we may still swallow the signal intended for the
-      //      process.
-      //   2. After seeing the pending signal, signal ourselves with
-      //      pthread_kill prior to calling sigwait(). This can still
-      //      swallow the signal intended for the process.
-      // We chose to use the latter technique as it works on all
-      // POSIX systems and is less likely to swallow process signals,
-      // provided the thread signal and process signal are not merged.
-      pthread_kill(pthread_self(), signal);
-
-      sigset_t mask;
-      sigemptyset(&mask);
-      sigaddset(&mask, signal);
-
-      int result;
-      do {
-        int _ignored;
-        result = sigwait(&mask, &_ignored);
-      } while (result == -1 && errno == EINTR);
-    }
-
-    // Unblock the signal (only if we were the ones to block it).
-    if (unblock) {
-      signals::unblock(signal);
-    }
-
-    // Restore errno.
-    errno = _errno;
-  }
-
-  // Needed for the suppress() macro.
-  operator bool () { return true; }
-
-private:
-  const int signal;
-  bool pending; // Whether the signal is already pending.
-  bool unblock; // Whether to unblock the signal on destruction.
-};
-
-} // namespace internal {
 
 #define suppress(signal) \
   if (os::signals::internal::Suppressor suppressor ## signal = \
       os::signals::internal::Suppressor(signal))
 
-} // namespace signals {
-
-} // namespace os {
 
 #endif // __STOUT_OS_SIGNALS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
index c8203d6..45d4641 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
@@ -14,144 +14,14 @@
 #ifndef __STOUT_OS_STAT_HPP__
 #define __STOUT_OS_STAT_HPP__
 
-#include <sys/stat.h>
-#include <sys/statvfs.h>
 
-#include <string>
+// For readability, we minimize the number of #ifdef blocks in the code by
+// splitting platform specifc system calls into separate directories.
+#ifdef __WINDOWS__
+#include <stout/os/windows/stat.hpp>
+#else
+#include <stout/os/posix/stat.hpp>
+#endif // __WINDOWS__
 
-#include <stout/bytes.hpp>
-#include <stout/try.hpp>
-#include <stout/unreachable.hpp>
 
-namespace os {
-namespace stat {
-
-inline bool isdir(const std::string& path)
-{
-  struct stat s;
-
-  if (::stat(path.c_str(), &s) < 0) {
-    return false;
-  }
-  return S_ISDIR(s.st_mode);
-}
-
-
-inline bool isfile(const std::string& path)
-{
-  struct stat s;
-
-  if (::stat(path.c_str(), &s) < 0) {
-    return false;
-  }
-  return S_ISREG(s.st_mode);
-}
-
-
-
-inline bool islink(const std::string& path)
-{
-  struct stat s;
-
-  if (::lstat(path.c_str(), &s) < 0) {
-    return false;
-  }
-  return S_ISLNK(s.st_mode);
-}
-
-
-// Describes the different semantics supported for the implementation
-// of `size` defined below.
-enum FollowSymlink
-{
-  DO_NOT_FOLLOW_SYMLINK,
-  FOLLOW_SYMLINK
-};
-
-
-// Returns the size in Bytes of a given file system entry. When
-// applied to a symbolic link with `follow` set to
-// `DO_NOT_FOLLOW_SYMLINK`, this will return the length of the entry
-// name (strlen).
-inline Try<Bytes> size(
-    const std::string& path,
-    const FollowSymlink follow = FOLLOW_SYMLINK)
-{
-  struct stat s;
-
-  switch (follow) {
-    case DO_NOT_FOLLOW_SYMLINK: {
-      if (::lstat(path.c_str(), &s) < 0) {
-        return ErrnoError("Error invoking lstat for '" + path + "'");
-      }
-      break;
-    }
-    case FOLLOW_SYMLINK: {
-      if (::stat(path.c_str(), &s) < 0) {
-        return ErrnoError("Error invoking stat for '" + path + "'");
-      }
-      break;
-    }
-    default: {
-      UNREACHABLE();
-    }
-  }
-
-  return Bytes(s.st_size);
-}
-
-
-inline Try<long> mtime(const std::string& path)
-{
-  struct stat s;
-
-  if (::lstat(path.c_str(), &s) < 0) {
-    return ErrnoError("Error invoking stat for '" + path + "'");
-  }
-
-  return s.st_mtime;
-}
-
-
-inline Try<mode_t> mode(const std::string& path)
-{
-  struct stat s;
-
-  if (::stat(path.c_str(), &s) < 0) {
-    return ErrnoError("Error invoking stat for '" + path + "'");
-  }
-
-  return s.st_mode;
-}
-
-
-inline Try<dev_t> rdev(const std::string& path)
-{
-  struct stat s;
-
-  if (::stat(path.c_str(), &s) < 0) {
-    return ErrnoError("Error invoking stat for '" + path + "'");
-  }
-
-  if (!S_ISCHR(s.st_mode) && !S_ISBLK(s.st_mode)) {
-    return Error("Not a special file: " + path);
-  }
-
-  return s.st_rdev;
-}
-
-
-inline Try<ino_t> inode(const std::string& path)
-{
-  struct stat s;
-
-  if (::stat(path.c_str(), &s) < 0) {
-    return ErrnoError("Error invoking stat for '" + path + "'");
-  }
-
-  return s.st_ino;
-}
-
-} // namespace stat {
-} // namespace os {
 #endif // __STOUT_OS_STAT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp
new file mode 100644
index 0000000..134a26b
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/close.hpp
@@ -0,0 +1,31 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __STOUT_OS_WINDOWS_CLOSE_HPP__
+#define __STOUT_OS_WINDOWS_CLOSE_HPP__
+
+#include <stout/nothing.hpp>
+#include <stout/try.hpp>
+
+
+namespace os {
+
+inline Try<Nothing> close(int fd)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_CLOSE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/exists.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/exists.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/exists.hpp
new file mode 100644
index 0000000..46f8fd2
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/exists.hpp
@@ -0,0 +1,38 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_EXISTS_HPP__
+#define __STOUT_OS_WINDOWS_EXISTS_HPP__
+
+#include <string>
+
+
+namespace os {
+
+inline bool exists(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Determine if the process identified by pid exists.
+// NOTE: Zombie processes have a pid and therefore exist. See os::process(pid)
+// to get details of a process.
+inline bool exists(pid_t pid)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_EXISTS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fcntl.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fcntl.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fcntl.hpp
new file mode 100644
index 0000000..0bad615
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fcntl.hpp
@@ -0,0 +1,49 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __STOUT_OS_WINDOWS_FCNTL_HPP__
+#define __STOUT_OS_WINDOWS_FCNTL_HPP__
+
+#include <stout/nothing.hpp>
+#include <stout/try.hpp>
+
+
+namespace os {
+
+inline Try<Nothing> cloexec(int fd)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<bool> isCloexec(int fd)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<Nothing> nonblock(int fd)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<bool> isNonblock(int fd)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_FCNTL_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fork.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fork.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fork.hpp
new file mode 100644
index 0000000..3b92eb8
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/fork.hpp
@@ -0,0 +1,34 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_FORK_HPP__
+#define __STOUT_OS_WINDOWS_FORK_HPP__
+
+
+struct Exec
+{
+  UNIMPLEMENTED;
+};
+
+
+struct Wait {};
+
+
+struct Fork
+{
+  UNIMPLEMENTED;
+};
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_FORK_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/killtree.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/killtree.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/killtree.hpp
new file mode 100644
index 0000000..ec645ca
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/killtree.hpp
@@ -0,0 +1,50 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_KILLTREE_HPP__
+#define __STOUT_OS_WINDOWS_KILLTREE_HPP__
+
+#include <stdlib.h>
+
+
+namespace os {
+
+// Sends a signal to a process tree rooted at the specified pid.
+// If groups is true, this also sends the signal to all encountered
+// process groups.
+// If sessions is true, this also sends the signal to all encountered
+// process sessions.
+// Note that processes of the group and session of the parent of the
+// root process is not included unless they are part of the root
+// process tree.
+// Note that if the process 'pid' has exited we'll signal the process
+// tree(s) rooted at pids in the group or session led by the process
+// if groups = true or sessions = true, respectively.
+// Returns the process trees that were succesfully or unsuccessfully
+// signaled. Note that the process trees can be stringified.
+// TODO(benh): Allow excluding the root pid from stopping, killing,
+// and continuing so as to provide a means for expressing "kill all of
+// my children". This is non-trivial because of the current
+// implementation.
+inline Try<std::list<ProcessTree>> killtree(
+    pid_t pid,
+    int signal,
+    bool groups = false,
+    bool sessions = false)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_KILLTREE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp
new file mode 100644
index 0000000..5b6fba1
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp
@@ -0,0 +1,30 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_LS_HPP__
+#define __STOUT_OS_WINDOWS_LS_HPP__
+
+#include <list>
+#include <string>
+
+
+namespace os {
+
+inline Try<std::list<std::string>> ls(const std::string& directory)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_LS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/open.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/open.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/open.hpp
new file mode 100644
index 0000000..14fa117
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/open.hpp
@@ -0,0 +1,34 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __STOUT_OS_WINDOWS_OPEN_HPP__
+#define __STOUT_OS_WINDOWS_OPEN_HPP__
+
+#include <sys/types.h>
+
+#include <string>
+
+#include <stout/try.hpp>
+
+
+namespace os {
+
+inline Try<int> open(const std::string& path, int oflag, mode_t mode = 0)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_OPEN_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/permissions.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/permissions.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/permissions.hpp
new file mode 100644
index 0000000..daed4b4
--- /dev/null
+++ 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/permissions.hpp
@@ -0,0 +1,41 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_PERMISSIONS_HPP__
+#define __STOUT_OS_WINDOWS_PERMISSIONS_HPP__
+
+#include <sys/stat.h>
+
+#include <string>
+
+
+namespace os {
+
+// Forward declaration.
+struct Permissions
+{
+  explicit Permissions(mode_t mode)
+  {
+    UNIMPLEMENTED;
+  }
+};
+
+
+inline Try<Permissions> permissions(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_PERMISSIONS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/process.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/process.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/process.hpp
new file mode 100644
index 0000000..bbb796d
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/process.hpp
@@ -0,0 +1,54 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_PROCESS_HPP__
+#define __STOUT_OS_WINDOWS_PROCESS_HPP__
+
+#include <list>
+#include <ostream>
+#include <string>
+
+
+namespace os {
+
+struct Process
+{
+  UNIMPLEMENTED;
+};
+
+
+class ProcessTree
+{
+  UNIMPLEMENTED;
+};
+
+
+inline std::ostream& operator << (
+    std::ostream& stream,
+    const ProcessTree& tree)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+
+// An overload of stringify for printing a list of process trees
+// (since printing a process tree is rather particular).
+inline std::string stringify(const std::list<os::ProcessTree>& list)
+{
+  UNIMPLEMENTED;
+}
+
+
+#endif // __STOUT_OS_WINDOWS_PROCESS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/pstree.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/pstree.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/pstree.hpp
new file mode 100644
index 0000000..f75a77f
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/pstree.hpp
@@ -0,0 +1,57 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_PSTREE_HPP__
+#define __STOUT_OS_WINDOWS_PSTREE_HPP__
+
+#include <list>
+#include <set>
+
+#include <stout/option.hpp>
+#include <stout/try.hpp>
+
+#include <stout/os/process.hpp>
+
+
+namespace os {
+
+// Returns a process tree rooted at the specified pid using the
+// specified list of processes (or an error if one occurs).
+inline Try<ProcessTree> pstree(
+    pid_t pid,
+    const std::list<Process>& processes)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Returns a process tree for the specified pid (or all processes if
+// pid is none or the current process if pid is 0).
+inline Try<ProcessTree> pstree(Option<pid_t> pid = None())
+{
+  UNIMPLEMENTED;
+}
+
+
+// Returns the minimum list of process trees that include all of the
+// specified pids using the specified list of processes.
+inline Try<std::list<ProcessTree>> pstrees(
+    const std::set<pid_t>& pids,
+    const std::list<Process>& processes)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_PSTREE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/read.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/read.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/read.hpp
new file mode 100644
index 0000000..09d6332
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/read.hpp
@@ -0,0 +1,44 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_READ_HPP__
+#define __STOUT_OS_WINDOWS_READ_HPP__
+
+#include <stdio.h>
+
+#include <string>
+
+#include <stout/result.hpp>
+#include <stout/try.hpp>
+
+
+namespace os {
+
+// Reads 'size' bytes from a file from its current offset.
+// If EOF is encountered before reading 'size' bytes then the result
+// will contain the bytes read and a subsequent read will return None.
+inline Result<std::string> read(int fd, size_t size)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Returns the contents of the file.
+inline Try<std::string> read(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_READ_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/sendfile.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/sendfile.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/sendfile.hpp
new file mode 100644
index 0000000..9658bb8
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/sendfile.hpp
@@ -0,0 +1,36 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_SENDFILE_HPP__
+#define __STOUT_OS_WINDOWS_SENDFILE_HPP__
+
+#include <errno.h>
+
+
+namespace os {
+
+// Returns the amount of bytes written from the input file
+// descriptor to the output socket. On error, returns -1 and
+// errno indicates the error.
+// NOTE: The following limitations exist because of the OS X
+// implementation of sendfile:
+//   1. s must be a stream oriented socket descriptor.
+//   2. fd must be a regular file descriptor.
+inline ssize_t sendfile(int s, int fd, off_t offset, size_t length)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_SENDFILE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/shell.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/shell.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/shell.hpp
new file mode 100644
index 0000000..4b7a7ba
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/shell.hpp
@@ -0,0 +1,37 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_SHELL_HPP__
+#define __STOUT_OS_WINDOWS_SHELL_HPP__
+
+#include <stdarg.h> // For va_list, va_start, etc.
+
+#include <ostream>
+#include <string>
+
+#include <stout/try.hpp>
+
+
+namespace os {
+
+// Runs a shell command formatted with varargs and return the return value
+// of the command. Optionally, the output is returned via an argument.
+// TODO(vinod): Pass an istream object that can provide input to the command.
+inline Try<int> shell(std::ostream* os, const std::string fmt, ...)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_SHELL_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/signals.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/signals.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/signals.hpp
new file mode 100644
index 0000000..70e9b15
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/signals.hpp
@@ -0,0 +1,92 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_SIGNALS_HPP__
+#define __STOUT_OS_WINDOWS_SIGNALS_HPP__
+
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <string.h>
+
+
+namespace os {
+
+namespace signals {
+
+// Installs the given signal handler.
+inline int install(int signal, void(*handler)(int))
+{
+  UNIMPLEMENTED;
+}
+
+
+// Resets the signal handler to the default handler of the signal.
+inline int reset(int signal)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Returns true iff the signal is pending.
+inline bool pending(int signal)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Returns true if the signal has been blocked, or false if the
+// signal was already blocked.
+inline bool block(int signal)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Returns true if the signal has been unblocked, or false if the
+// signal was not previously blocked.
+inline bool unblock(int signal)
+{
+  UNIMPLEMENTED;
+}
+
+namespace internal {
+
+// Suppresses a signal on the current thread for the lifetime of
+// the Suppressor. The signal *must* be synchronous and delivered
+// per-thread. The suppression occurs only on the thread of
+// execution of the Suppressor.
+struct Suppressor
+{
+  Suppressor(int _signal)
+    : signal(_signal), pending(false), unblock(false)
+  {
+    UNIMPLEMENTED;
+  }
+
+  ~Suppressor()
+  {
+    UNIMPLEMENTED;
+  }
+
+  // Needed for the suppress() macro.
+  operator bool () { return true; }
+};
+
+} // namespace internal {
+
+} // namespace signals {
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_SIGNALS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp
new file mode 100644
index 0000000..675b2e7
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp
@@ -0,0 +1,93 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_OS_WINDOWS_STAT_HPP__
+#define __STOUT_OS_WINDOWS_STAT_HPP__
+
+#include <string>
+
+#include <stout/try.hpp>
+
+
+namespace os {
+
+namespace stat {
+
+inline bool isdir(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline bool isfile(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+
+inline bool islink(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+// Describes the different semantics supported for the implementation
+// of `size` defined below.
+enum FollowSymlink
+{
+  DO_NOT_FOLLOW_SYMLINK,
+  FOLLOW_SYMLINK
+};
+
+
+// Returns the size in Bytes of a given file system entry. When
+// applied to a symbolic link with `follow` set to
+// `DO_NOT_FOLLOW_SYMLINK`, this will return the length of the entry
+// name (strlen).
+inline Try<Bytes> size(
+    const std::string& path,
+    const FollowSymlink follow = FOLLOW_SYMLINK)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<long> mtime(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<mode_t> mode(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<dev_t> rdev(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+
+inline Try<ino_t> inode(const std::string& path)
+{
+  UNIMPLEMENTED;
+}
+
+} // namespace stat {
+
+} // namespace os {
+
+#endif // __STOUT_OS_WINDOWS_STAT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
new file mode 100644
index 0000000..7ab75ec
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp
@@ -0,0 +1,61 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __STOUT_WINDOWS_PREPROCESSOR_HPP__
+#define __STOUT_WINDOWS_PREPROCESSOR_HPP__
+
+// Provides aliases to Windows-specific nuances.
+
+// Normally defined in unistd.h.
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+// Alias for method in stdio.h.
+#define write(fd, buf, count) _write(fd, buf, count)
+
+// Aliases for 'inet_pton' and 'inet_ntop'.
+#define inet_pton(af, cp, buf) InetPton(af, cp, buf)
+#define inet_ntop(af, cp, buf, len) InetNtop(af, cp, buf, len)
+
+// TODO(aclemmer): Not defined on Windows.  This value is temporary.
+#define MAXHOSTNAMELEN 64
+
+// Macros associated with ::access, usually defined in unistd.h.
+#define access(path, how) _access(path, how)
+#define R_OK 0x4
+#define W_OK 0x2
+#define X_OK 0x0 // No such permission on Windows
+#define F_OK 0x0
+
+// Aliases for file access modes (defined in fcntl.h).
+#define O_RDONLY _O_RDONLY
+#define O_WRONLY _O_WRONLY
+#define O_RDWR _O_RDWR
+#define O_CREAT _O_CREAT
+#define O_TRUNC _O_TRUNC
+#define O_APPEND _O_APPEND
+// TODO(josephw): No equivalent for O_NONBLOCK or O_SYNC
+
+// Alias for mkstemp (requires io.h).
+#define mkstemp(path) _mktemp_s(path, strlen(path) + 1)
+
+// Alias for realpath.
+#define PATH_MAX MAX_PATH
+#define realpath(path, resolved) _fullpath(resolved, path, PATH_MAX)
+
+// Alias for mkdir (requires direct.h).
+#define mkdir(path, mode) _mkdir(path)
+
+
+#endif // __STOUT_WINDOWS_PREPROCESSOR_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
index 7e1b0f8..2b09668 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
@@ -17,7 +17,6 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 
 #include <sys/types.h>
 
@@ -32,7 +31,7 @@
 #include <stout/option.hpp>
 #include <stout/path.hpp>
 #include <stout/try.hpp>
-#include <stout/windows/preprocessor.hpp>
+#include <stout/windows.hpp>
 
 
 namespace os {

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aa050bf/3rdparty/libprocess/3rdparty/stout/include/stout/windows/preprocessor.hpp
----------------------------------------------------------------------
diff --git 
a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/preprocessor.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/windows/preprocessor.hpp
deleted file mode 100644
index 7ab75ec..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/preprocessor.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __STOUT_WINDOWS_PREPROCESSOR_HPP__
-#define __STOUT_WINDOWS_PREPROCESSOR_HPP__
-
-// Provides aliases to Windows-specific nuances.
-
-// Normally defined in unistd.h.
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-// Alias for method in stdio.h.
-#define write(fd, buf, count) _write(fd, buf, count)
-
-// Aliases for 'inet_pton' and 'inet_ntop'.
-#define inet_pton(af, cp, buf) InetPton(af, cp, buf)
-#define inet_ntop(af, cp, buf, len) InetNtop(af, cp, buf, len)
-
-// TODO(aclemmer): Not defined on Windows.  This value is temporary.
-#define MAXHOSTNAMELEN 64
-
-// Macros associated with ::access, usually defined in unistd.h.
-#define access(path, how) _access(path, how)
-#define R_OK 0x4
-#define W_OK 0x2
-#define X_OK 0x0 // No such permission on Windows
-#define F_OK 0x0
-
-// Aliases for file access modes (defined in fcntl.h).
-#define O_RDONLY _O_RDONLY
-#define O_WRONLY _O_WRONLY
-#define O_RDWR _O_RDWR
-#define O_CREAT _O_CREAT
-#define O_TRUNC _O_TRUNC
-#define O_APPEND _O_APPEND
-// TODO(josephw): No equivalent for O_NONBLOCK or O_SYNC
-
-// Alias for mkstemp (requires io.h).
-#define mkstemp(path) _mktemp_s(path, strlen(path) + 1)
-
-// Alias for realpath.
-#define PATH_MAX MAX_PATH
-#define realpath(path, resolved) _fullpath(resolved, path, PATH_MAX)
-
-// Alias for mkdir (requires direct.h).
-#define mkdir(path, mode) _mkdir(path)
-
-
-#endif // __STOUT_WINDOWS_PREPROCESSOR_HPP__

Reply via email to