mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [40/50] [abbrv] mesos git commit: Moved stout from libprocess/3rdparty/ to 3rdparty/.
Date Wed, 11 May 2016 22:25:02 GMT
http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
deleted file mode 100644
index c3cbcdb..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
+++ /dev/null
@@ -1,855 +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_FLAGS_FLAGS_HPP__
-#define __STOUT_FLAGS_FLAGS_HPP__
-
-#include <algorithm>
-#include <map>
-#include <ostream>
-#include <string>
-#include <tuple>
-#include <type_traits>
-#include <typeinfo> // For typeid.
-#include <vector>
-
-#include <stout/error.hpp>
-#include <stout/exit.hpp>
-#include <stout/foreach.hpp>
-#include <stout/lambda.hpp>
-#include <stout/none.hpp>
-#include <stout/nothing.hpp>
-#include <stout/option.hpp>
-#include <stout/path.hpp>
-#include <stout/some.hpp>
-#include <stout/stringify.hpp>
-#include <stout/strings.hpp>
-#include <stout/try.hpp>
-
-#include <stout/flags/fetch.hpp>
-#include <stout/flags/flag.hpp>
-
-#include <stout/os/environment.hpp>
-
-namespace flags {
-
-class FlagsBase
-{
-public:
-  FlagsBase() { add(&help, "help", "Prints this help message", false); }
-  virtual ~FlagsBase() {}
-
-  // Load any flags from the environment given the variable prefix,
-  // i.e., given prefix 'STOUT_' will load a flag named 'foo' via
-  // environment variables 'STOUT_foo' or 'STOUT_FOO'.
-  virtual Try<Nothing> load(const std::string& prefix);
-
-  // Load any flags from the environment given the variable prefix
-  // (see above) followed by loading from the command line (via 'argc'
-  // and 'argv'). If 'unknowns' is true then we'll ignore unknown
-  // flags we see while loading. If 'duplicates' is true then we'll
-  // ignore any duplicates we see while loading.
-  virtual Try<Nothing> load(
-      const Option<std::string>& prefix,
-      int argc,
-      const char* const* argv,
-      bool unknowns = false,
-      bool duplicates = false);
-
-  // Load any flags from the environment as above but remove processed
-  // flags from 'argv' and update 'argc' appropriately. For example:
-  //
-  // argv = ["/path/program", "--arg1", "hi", "--arg2", "--", "bye"]
-  //
-  // Becomes:
-  //
-  // argv = ["/path/program", "hi", "bye"]
-  virtual Try<Nothing> load(
-      const Option<std::string>& prefix,
-      int* argc,
-      char*** argv,
-      bool unknowns = false,
-      bool duplicates = false);
-
-  virtual Try<Nothing> load(
-      const std::map<std::string, Option<std::string>>& values,
-      bool unknowns = false);
-
-  virtual Try<Nothing> load(
-      const std::map<std::string, std::string>& values,
-      bool unknowns = false);
-
-  // Returns a string describing the flags, preceded by a "usage
-  // message" that will be prepended to that description (see
-  // 'FlagsBase::usageMessage_').
-  //
-  // The optional 'message' passed to this function will be prepended
-  // to the generated string returned from this function.
-  //
-  // Derived classes and clients can modify the standard usage message
-  // by setting it before calling this method via 'setUsageMessage()'.
-  //
-  // This allows one to set a generic message that will be used for
-  // each invocation of this method, and to additionally add one for
-  // the particular invocation:
-  //
-  //    MyFlags flags;
-  //    flags.setUsageMessage("Custom Usage Message");
-  //    ...
-  //    if (flags.foo.isNone()) {
-  //      std::cerr << flags.usage("Missing required --foo flag");
-  //    }
-  //
-  // The 'message' would be emitted first, followed by a blank line,
-  // then the 'usageMessage_', finally followed by the flags'
-  // description, for example:
-  //
-  //    Missing required --foo flag
-  //
-  //    Custom Usage Message
-  //
-  //      --[no-]help       Prints this help message. (default: false)
-  //      --foo=VALUE       Description about 'foo' here.
-  //      --bar=VALUE       Description about 'bar' here. (default: 42)
-  //
-  std::string usage(const Option<std::string>& message = None()) const;
-
-  // Sets the default message that is prepended to the flags'
-  // description in 'usage()'.
-  void setUsageMessage(const std::string& message)
-  {
-    usageMessage_ = Some(message);
-  }
-
-  typedef std::map<std::string, Flag>::const_iterator const_iterator;
-
-  const_iterator begin() const { return flags_.begin(); }
-  const_iterator end() const { return flags_.end(); }
-
-  typedef std::map<std::string, Flag>::iterator iterator;
-
-  iterator begin() { return flags_.begin(); }
-  iterator end() { return flags_.end(); }
-
-  template <typename T1, typename T2, typename F>
-  void add(
-      T1* t1,
-      const std::string& name,
-      const std::string& help,
-      const T2& t2,
-      F validate);
-
-  template <typename T1, typename T2>
-  void add(
-      T1* t1,
-      const std::string& name,
-      const std::string& help,
-      const T2& t2)
-  {
-    add(t1, name, help, t2, [](const T1&) { return None(); });
-  }
-
-  template <typename T, typename F>
-  void add(
-      Option<T>* option,
-      const std::string& name,
-      const std::string& help,
-      F validate);
-
-  template <typename T>
-  void add(
-      Option<T>* option,
-      const std::string& name,
-      const std::string& help)
-  {
-    add(option, name, help, [](const Option<T>&) { return None(); });
-  }
-
-protected:
-  template <typename Flags, typename T1, typename T2, typename F>
-  void add(
-      T1 Flags::*t1,
-      const std::string& name,
-      const std::string& help,
-      const T2& t2,
-      F validate);
-
-  template <typename Flags, typename T1, typename T2>
-  void add(
-      T1 Flags::*t1,
-      const std::string& name,
-      const std::string& help,
-      const T2& t2)
-  {
-    add(t1, name, help, t2, [](const T1&) { return None(); });
-  }
-
-  template <typename Flags, typename T, typename F>
-  void add(
-      Option<T> Flags::*option,
-      const std::string& name,
-      const std::string& help,
-      F validate);
-
-  template <typename Flags, typename T>
-  void add(
-      Option<T> Flags::*option,
-      const std::string& name,
-      const std::string& help)
-  {
-    add(option, name, help, [](const Option<T>&) { return None(); });
-  }
-
-  void add(const Flag& flag);
-
-public:
-  // TODO(marco): IMO the entire --help functionality should be
-  // encapsulated inside the FlagsBase class.
-  // For now, exposing this for the caller(s) to decide what to
-  // do when the user asks for help.
-  bool help;
-
-protected:
-  // The program's name, extracted from argv[0] by default;
-  // declared 'protected' so that derived classes can alter this
-  // behavior.
-  std::string programName_;
-
-  // An optional custom usage message, will be printed 'as is'
-  // just above the list of flags and their explanation.
-  // It is 'None' by default, in which case the default
-  // behavior is to print "Usage:" followed by the 'programName_'.
-  Option<std::string> usageMessage_;
-
-private:
-  // Extract environment variable "flags" with the specified prefix.
-  std::map<std::string, Option<std::string>> extract(
-      const std::string& prefix);
-
-  std::map<std::string, Flag> flags_;
-};
-
-
-template <typename... FlagsTypes>
-class Flags : public virtual FlagsTypes...
-{
-  // Construct tuple types of sizeof...(FlagsTypes) compile-time bools to check
-  // non-recursively that all FlagsTypes derive from FlagsBase; as a helper we
-  // use is_object<FlagTypes> to construct sizeof...(FlagTypes) true types for
-  // the RHS (is_object<T> is a true type for anything one would inherit from).
-  static_assert(
-    std::is_same<
-      std::tuple<typename std::is_base_of<FlagsBase, FlagsTypes>::type...>,
-      std::tuple<typename std::is_object<FlagsTypes>::type...>>::value,
-    "Can only instantiate Flags with FlagsBase types.");
-};
-
-template <>
-class Flags<> : public virtual FlagsBase {};
-
-
-template <typename T1, typename T2, typename F>
-void FlagsBase::add(
-    T1* t1,
-    const std::string& name,
-    const std::string& help,
-    const T2& t2,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is NULL.
-  if (t1 == NULL) {
-    return;
-  }
-
-  *t1 = t2; // Set the default.
-
-  Flag flag;
-  flag.name = name;
-  flag.help = help;
-  flag.boolean = typeid(T1) == typeid(bool);
-
-  // NOTE: We need to take FlagsBase* (or const FlagsBase&) as the
-  // first argument to match the function signature of the 'load',
-  // 'stringify', and 'validate' lambdas used in other overloads of
-  // FlagsBase::add. Since we don't need to use the pointer here we
-  // don't name it as a parameter.
-
-  flag.load = [t1](FlagsBase*, const std::string& value) -> Try<Nothing> {
-    // NOTE: 'fetch' "retrieves" the value if necessary and then
-    // invokes 'parse'. See 'fetch' for more details.
-    Try<T1> t = fetch<T1>(value);
-    if (t.isSome()) {
-      *t1 = t.get();
-    } else {
-      return Error("Failed to load value '" + value + "': " + t.error());
-    }
-    return Nothing();
-  };
-
-  flag.stringify = [t1](const FlagsBase&) -> Option<std::string> {
-    return stringify(*t1);
-  };
-
-  flag.validate = [t1, validate](const FlagsBase&) -> Option<Error> {
-    return validate(*t1);
-  };
-
-  // Update the help string to include the default value.
-  flag.help += help.size() > 0 && help.find_last_of("\n\r") != help.size() - 1
-    ? " (default: " // On same line, add space.
-    : "(default: "; // On newline.
-  flag.help += stringify(t2);
-  flag.help += ")";
-
-  add(flag);
-}
-
-
-template <typename T, typename F>
-void FlagsBase::add(
-    Option<T>* option,
-    const std::string& name,
-    const std::string& help,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is NULL.
-  if (option == NULL) {
-    return;
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.help = help;
-  flag.boolean = typeid(T) == typeid(bool);
-
-  // NOTE: See comment above in T* overload of FlagsBase::add for why
-  // we need to take the FlagsBase* parameter.
-
-  flag.load = [option](FlagsBase*, const std::string& value) -> Try<Nothing> {
-    // NOTE: 'fetch' "retrieves" the value if necessary and then
-    // invokes 'parse'. See 'fetch' for more details.
-    Try<T> t = fetch<T>(value);
-    if (t.isSome()) {
-      *option = Some(t.get());
-    } else {
-      return Error("Failed to load value '" + value + "': " + t.error());
-    }
-    return Nothing();
-  };
-
-  flag.stringify = [option](const FlagsBase&) -> Option<std::string> {
-    if (option->isSome()) {
-      return stringify(option->get());
-    }
-    return None();
-  };
-
-  flag.validate = [option, validate](const FlagsBase&) -> Option<Error> {
-    return validate(*option);
-  };
-
-  add(flag);
-}
-
-
-template <typename Flags, typename T1, typename T2, typename F>
-void FlagsBase::add(
-    T1 Flags::*t1,
-    const std::string& name,
-    const std::string& help,
-    const T2& t2,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is NULL.
-  if (t1 == NULL) {
-    return;
-  }
-
-  Flags* flags = dynamic_cast<Flags*>(this);
-  if (flags == NULL) {
-    ABORT("Attempted to add flag '" + name + "' with incompatible type");
-  } else {
-    flags->*t1 = t2; // Set the default.
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.help = help;
-  flag.boolean = typeid(T1) == typeid(bool);
-
-  // NOTE: We need to take FlagsBase* (or const FlagsBase&) as the
-  // first argument to 'load', 'stringify', and 'validate' so that we
-  // use the correct instance of FlagsBase. In other words, we can't
-  // capture 'this' here because it's possible that the FlagsBase
-  // object that we're working with when we invoke FlagsBase::add is
-  // not the same instance as 'this' when these lambdas get invoked.
-
-  flag.load = [t1](FlagsBase* base, const std::string& value) -> Try<Nothing> {
-    Flags* flags = dynamic_cast<Flags*>(base);
-    if (base != NULL) {
-      // NOTE: 'fetch' "retrieves" the value if necessary and then
-      // invokes 'parse'. See 'fetch' for more details.
-      Try<T1> t = fetch<T1>(value);
-      if (t.isSome()) {
-        flags->*t1 = t.get();
-      } else {
-        return Error("Failed to load value '" + value + "': " + t.error());
-      }
-    }
-    return Nothing();
-  };
-
-  flag.stringify = [t1](const FlagsBase& base) -> Option<std::string> {
-    const Flags* flags = dynamic_cast<const Flags*>(&base);
-    if (flags != NULL) {
-      return stringify(flags->*t1);
-    }
-    return None();
-  };
-
-  flag.validate = [t1, validate](const FlagsBase& base) -> Option<Error> {
-    const Flags* flags = dynamic_cast<const Flags*>(&base);
-    if (flags != NULL) {
-      return validate(flags->*t1);
-    }
-    return None();
-  };
-
-  // Update the help string to include the default value.
-  flag.help += help.size() > 0 && help.find_last_of("\n\r") != help.size() - 1
-    ? " (default: " // On same line, add space.
-    : "(default: "; // On newline.
-  flag.help += stringify(t2);
-  flag.help += ")";
-
-  add(flag);
-}
-
-
-template <typename Flags, typename T, typename F>
-void FlagsBase::add(
-    Option<T> Flags::*option,
-    const std::string& name,
-    const std::string& help,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is NULL.
-  if (option == NULL) {
-    return;
-  }
-
-  Flags* flags = dynamic_cast<Flags*>(this);
-  if (flags == NULL) {
-    ABORT("Attempted to add flag '" + name + "' with incompatible type");
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.help = help;
-  flag.boolean = typeid(T) == typeid(bool);
-
-  // NOTE: See comment above in Flags::T* overload of FLagsBase::add
-  // for why we need to pass FlagsBase* (or const FlagsBase&) as a
-  // parameter.
-
-  flag.load =
-    [option](FlagsBase* base, const std::string& value) -> Try<Nothing> {
-      Flags* flags = dynamic_cast<Flags*>(base);
-      if (flags != NULL) {
-        // NOTE: 'fetch' "retrieves" the value if necessary and then
-        // invokes 'parse'. See 'fetch' for more details.
-        Try<T> t = fetch<T>(value);
-        if (t.isSome()) {
-          flags->*option = Some(t.get());
-        } else {
-          return Error("Failed to load value '" + value + "': " + t.error());
-        }
-      }
-      return Nothing();
-    };
-
-  flag.stringify = [option](const FlagsBase& base) -> Option<std::string> {
-    const Flags* flags = dynamic_cast<const Flags*>(&base);
-    if (flags != NULL) {
-      if ((flags->*option).isSome()) {
-        return stringify((flags->*option).get());
-      }
-    }
-    return None();
-  };
-
-  flag.validate = [option, validate](const FlagsBase& base) -> Option<Error> {
-    const Flags* flags = dynamic_cast<const Flags*>(&base);
-    if (flags != NULL) {
-      return validate(flags->*option);
-    }
-    return None();
-  };
-
-  add(flag);
-}
-
-
-inline void FlagsBase::add(const Flag& flag)
-{
-  if (flags_.count(flag.name) > 0) {
-    EXIT(EXIT_FAILURE)
-      << "Attempted to add duplicate flag '" << flag.name << "'";
-  } else if (flag.name.find("no-") == 0) {
-    EXIT(EXIT_FAILURE)
-      << "Attempted to add flag '" << flag.name
-      << "' that starts with the reserved 'no-' prefix";
-  }
-
-  flags_[flag.name] = flag;
-}
-
-
-// Extract environment variable "flags" with the specified prefix.
-inline std::map<std::string, Option<std::string>> FlagsBase::extract(
-    const std::string& prefix)
-{
-  std::map<std::string, Option<std::string>> values;
-
-  foreachpair (const std::string& key,
-               const std::string& value,
-               os::environment()) {
-    if (key.find(prefix) == 0) {
-      std::string name = key.substr(prefix.size());
-      name = strings::lower(name); // Allow PREFIX_NAME or PREFIX_name.
-
-      // Only add if it's a known flag.
-      if (flags_.count(name) > 0 ||
-          (name.find("no-") == 0 && flags_.count(name.substr(3)) > 0)) {
-        values[name] = Some(value);
-      }
-    }
-  }
-
-  return values;
-}
-
-
-inline Try<Nothing> FlagsBase::load(const std::string& prefix)
-{
-  return load(extract(prefix));
-}
-
-
-inline Try<Nothing> FlagsBase::load(
-    const Option<std::string>& prefix,
-    int argc,
-    const char* const *argv,
-    bool unknowns,
-    bool duplicates)
-{
-  std::map<std::string, Option<std::string>> envValues;
-  std::map<std::string, Option<std::string>> cmdValues;
-
-  // Grab the program name from argv[0].
-  programName_ = argc > 0 ? Path(argv[0]).basename() : "";
-
-  if (prefix.isSome()) {
-    envValues = extract(prefix.get());
-  }
-
-  // Read flags from the command line.
-  for (int i = 1; i < argc; i++) {
-    const std::string arg(strings::trim(argv[i]));
-
-    // Stop parsing flags after '--' is encountered.
-    if (arg == "--") {
-      break;
-    }
-
-    // Skip anything that doesn't look like a flag.
-    if (arg.find("--") != 0) {
-      continue;
-    }
-
-    std::string name;
-    Option<std::string> value = None();
-
-    size_t eq = arg.find_first_of("=");
-    if (eq == std::string::npos && arg.find("--no-") == 0) { // --no-name
-      name = arg.substr(2);
-    } else if (eq == std::string::npos) {                    // --name
-      name = arg.substr(2);
-    } else {                                                 // --name=value
-      name = arg.substr(2, eq - 2);
-      value = arg.substr(eq + 1);
-    }
-
-    name = strings::lower(name);
-
-    if (!duplicates) {
-      if (cmdValues.count(name) > 0 ||
-          (name.find("no-") == 0 && cmdValues.count(name.substr(3)) > 0)) {
-        return Error("Duplicate flag '" + name + "' on command line");
-      }
-    }
-
-    cmdValues[name] = value;
-  }
-
-  cmdValues.insert(envValues.begin(), envValues.end());
-
-  return load(cmdValues, unknowns);
-}
-
-
-inline Try<Nothing> FlagsBase::load(
-    const Option<std::string>& prefix,
-    int* argc,
-    char*** argv,
-    bool unknowns,
-    bool duplicates)
-{
-  std::map<std::string, Option<std::string>> envValues;
-  std::map<std::string, Option<std::string>> cmdValues;
-
-  if (prefix.isSome()) {
-    envValues = extract(prefix.get());
-  }
-
-  // Grab the program name from argv, without removing it.
-  programName_ = *argc > 0 ? Path(*(argv[0])).basename() : "";
-
-  // Keep the arguments that are not being processed as flags.
-  std::vector<char*> args;
-
-  // Read flags from the command line.
-  for (int i = 1; i < *argc; i++) {
-    const std::string arg(strings::trim((*argv)[i]));
-
-    // Stop parsing flags after '--' is encountered.
-    if (arg == "--") {
-      // Save the rest of the arguments.
-      for (int j = i + 1; j < *argc; j++) {
-        args.push_back((*argv)[j]);
-      }
-      break;
-    }
-
-    // Skip anything that doesn't look like a flag.
-    if (arg.find("--") != 0) {
-      args.push_back((*argv)[i]);
-      continue;
-    }
-
-    std::string name;
-    Option<std::string> value = None();
-
-    size_t eq = arg.find_first_of("=");
-    if (eq == std::string::npos && arg.find("--no-") == 0) { // --no-name
-      name = arg.substr(2);
-    } else if (eq == std::string::npos) {                    // --name
-      name = arg.substr(2);
-    } else {                                                 // --name=value
-      name = arg.substr(2, eq - 2);
-      value = arg.substr(eq + 1);
-    }
-
-    name = strings::lower(name);
-
-    if (!duplicates) {
-      if (cmdValues.count(name) > 0 ||
-          (name.find("no-") == 0 && cmdValues.count(name.substr(3)) > 0)) {
-        return Error("Duplicate flag '" + name + "' on command line");
-      }
-    }
-
-    cmdValues[name] = value;
-  }
-
-  cmdValues.insert(envValues.begin(), envValues.end());
-
-  Try<Nothing> result = load(cmdValues, unknowns);
-
-  // Update 'argc' and 'argv' if we successfully loaded the flags.
-  if (!result.isError()) {
-    CHECK_LE(args.size(), (size_t) *argc);
-    size_t i = 1; // Start at '1' to skip argv[0].
-    foreach (char* arg, args) {
-      (*argv)[i++] = arg;
-    }
-
-    *argc = i;
-
-    // Now null terminate the array. Note that we'll "leak" the
-    // arguments that were processed here but it's not like they would
-    // have gotten deleted in normal operations anyway.
-    (*argv)[i++] = NULL;
-  }
-
-  return result;
-}
-
-
-inline Try<Nothing> FlagsBase::load(
-    const std::map<std::string, Option<std::string>>& values,
-    bool unknowns)
-{
-  std::map<std::string, Option<std::string>>::const_iterator iterator;
-
-  for (iterator = values.begin(); iterator != values.end(); ++iterator) {
-    const std::string& name = iterator->first;
-    const Option<std::string>& value = iterator->second;
-
-    if (flags_.count(name) > 0) {
-      if (value.isSome()) {                        // --name=value
-        if (flags_[name].boolean && value.get() == "") {
-          flags_[name].load(this, "true"); // Should never fail.
-        } else {
-          Try<Nothing> load = flags_[name].load(this, value.get());
-          if (load.isError()) {
-            return Error(
-                "Failed to load flag '" + name + "': " + load.error());
-          }
-        }
-      } else {                                     // --name
-        if (flags_[name].boolean) {
-          flags_[name].load(this, "true"); // Should never fail.
-        } else {
-          return Error(
-              "Failed to load non-boolean flag '" + name + "': Missing value");
-        }
-      }
-    } else if (name.find("no-") == 0) {
-      if (flags_.count(name.substr(3)) > 0) {       // --no-name
-        if (flags_[name.substr(3)].boolean) {
-          if (value.isNone() || value.get() == "") {
-            flags_[name.substr(3)].load(this, "false"); // Should never fail.
-          } else {
-            return Error(
-                "Failed to load boolean flag '" + name.substr(3) +
-                "' via '" + name + "' with value '" + value.get() + "'");
-          }
-        } else {
-          return Error(
-              "Failed to load non-boolean flag '" + name.substr(3) +
-              "' via '" + name + "'");
-        }
-      } else {
-        return Error(
-            "Failed to load unknown flag '" + name.substr(3) +
-            "' via '" + name + "'");
-      }
-    } else if (!unknowns) {
-      return Error("Failed to load unknown flag '" + name + "'");
-    }
-  }
-
-  // Validate the flags value.
-  //
-  // TODO(benh): Consider validating all flags at the same time in
-  // order to provide more feedback rather than requiring a user to
-  // fix one at a time.
-  foreachvalue (const Flag& flag, flags_) {
-    Option<Error> error = flag.validate(*this);
-    if (error.isSome()) {
-      return error.get();
-    }
-  }
-
-  return Nothing();
-}
-
-
-inline Try<Nothing> FlagsBase::load(
-    const std::map<std::string, std::string>& _values,
-    bool unknowns)
-{
-  std::map<std::string, Option<std::string>> values;
-  std::map<std::string, std::string>::const_iterator iterator;
-  for (iterator = _values.begin(); iterator != _values.end(); ++iterator) {
-    const std::string& name = iterator->first;
-    const std::string& value = iterator->second;
-    values[name] = Some(value);
-  }
-  return load(values, unknowns);
-}
-
-
-inline std::string FlagsBase::usage( const Option<std::string>& message) const
-{
-  const int PAD = 5;
-
-  std::string usage;
-
-  if (message.isSome()) {
-    usage = message.get() + "\n\n";
-  }
-
-  if (usageMessage_.isNone()) {
-    usage += "Usage: " + programName_ + " [options]\n\n";
-  } else {
-    usage += usageMessage_.get() + "\n\n";
-  }
-
-  std::map<std::string, std::string> col1; // key -> col 1 string.
-
-  // Construct string for the first column and store width of column.
-  size_t width = 0;
-
-  foreachvalue (const flags::Flag& flag, *this) {
-    if (flag.boolean) {
-      col1[flag.name] = "  --[no-]" + flag.name;
-    } else {
-      col1[flag.name] = "  --" + flag.name + "=VALUE";
-    }
-    width = std::max(width, col1[flag.name].size());
-  }
-
-  foreachvalue (const flags::Flag& flag, *this) {
-    std::string line = col1[flag.name];
-
-    std::string pad(PAD + width - line.size(), ' ');
-    line += pad;
-
-    size_t pos1 = 0, pos2 = 0;
-    pos2 = flag.help.find_first_of("\n\r", pos1);
-    line += flag.help.substr(pos1, pos2 - pos1) + "\n";
-    usage += line;
-
-    while (pos2 != std::string::npos) {  // Handle multi-line help strings.
-      line = "";
-      pos1 = pos2 + 1;
-      std::string pad2(PAD + width, ' ');
-      line += pad2;
-      pos2 = flag.help.find_first_of("\n\r", pos1);
-      line += flag.help.substr(pos1, pos2 - pos1) + "\n";
-      usage += line;
-    }
-  }
-
-  return usage;
-}
-
-
-inline std::ostream& operator<<(std::ostream& stream, const FlagsBase& flags)
-{
-  std::vector<std::string> _flags;
-
-  foreachvalue (const flags::Flag& flag, flags) {
-    const Option<std::string> value = flag.stringify(flags);
-    if (value.isSome()) {
-      _flags.push_back("--" + flag.name + "=\"" + value.get() + '"');
-    }
-  }
-
-  return stream << strings::join(" ", _flags);
-}
-
-} // namespace flags {
-
-#endif // __STOUT_FLAGS_FLAGS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/flags/parse.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/parse.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/parse.hpp
deleted file mode 100644
index ef365e4..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/parse.hpp
+++ /dev/null
@@ -1,113 +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_FLAGS_PARSE_HPP__
-#define __STOUT_FLAGS_PARSE_HPP__
-
-#include <sstream> // For istringstream.
-#include <string>
-
-#include <stout/bytes.hpp>
-#include <stout/duration.hpp>
-#include <stout/error.hpp>
-#include <stout/json.hpp>
-#include <stout/path.hpp>
-#include <stout/strings.hpp>
-#include <stout/try.hpp>
-
-#include <stout/os/read.hpp>
-
-namespace flags {
-
-template <typename T>
-Try<T> parse(const std::string& value)
-{
-  T t;
-  std::istringstream in(value);
-  in >> t;
-
-  if (in && in.eof()) {
-    return t;
-  }
-
-  return Error("Failed to convert into required type");
-}
-
-
-template <>
-inline Try<std::string> parse(const std::string& value)
-{
-  return value;
-}
-
-
-template <>
-inline Try<bool> parse(const std::string& value)
-{
-  if (value == "true" || value == "1") {
-    return true;
-  } else if (value == "false" || value == "0") {
-    return false;
-  }
-  return Error("Expecting a boolean (e.g., true or false)");
-}
-
-
-template <>
-inline Try<Duration> parse(const std::string& value)
-{
-  return Duration::parse(value);
-}
-
-
-template <>
-inline Try<Bytes> parse(const std::string& value)
-{
-  return Bytes::parse(value);
-}
-
-
-template <>
-inline Try<JSON::Object> parse(const std::string& value)
-{
-  // A value that already starts with 'file://' will properly be
-  // loaded from the file and put into 'value' but if it starts with
-  // '/' we need to explicitly handle it for backwards compatibility
-  // reasons (because we used to handle it before we introduced the
-  // 'fetch' mechanism for flags that first fetches the data from URIs
-  // such as 'file://').
-  if (strings::startsWith(value, "/")) {
-    LOG(WARNING) << "Specifying an absolute filename to read a command line "
-                    "option out of without using 'file:// is deprecated and "
-                    "will be removed in a future release. Simply adding "
-                    "'file://' to the beginning of the path should eliminate "
-                    "this warning.";
-
-    Try<std::string> read = os::read(value);
-    if (read.isError()) {
-      return Error("Error reading file '" + value + "': " + read.error());
-    }
-    return JSON::parse<JSON::Object>(read.get());
-  }
-  return JSON::parse<JSON::Object>(value);
-}
-
-
-template <>
-inline Try<Path> parse(const std::string& value)
-{
-  return Path(value);
-}
-
-} // namespace flags {
-
-#endif // __STOUT_FLAGS_PARSE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
deleted file mode 100644
index abd661e..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
+++ /dev/null
@@ -1,79 +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_FOREACH_HPP__
-#define __STOUT_FOREACH_HPP__
-
-#include <tuple>
-#include <utility>
-
-#include <stout/preprocessor.hpp>
-
-#define STOUT_FOREACH_PREFIX CAT(__foreach_, __LINE__)
-#define STOUT_FOREACH_BODY CAT(STOUT_FOREACH_PREFIX, _body__)
-#define STOUT_FOREACH_BREAK CAT(STOUT_FOREACH_PREFIX, _break__)
-#define STOUT_FOREACH_CONTINUE CAT(STOUT_FOREACH_PREFIX, _continue__)
-#define STOUT_FOREACH_ELEM CAT(STOUT_FOREACH_PREFIX, _elem__)
-#define STOUT_FOREACH_ONCE CAT(STOUT_FOREACH_PREFIX, _once__)
-
-
-// `foreach` is a trivial expansion to the range-based `for`.
-#define foreach(ELEM, ELEMS) for (ELEM : ELEMS)
-
-
-// `foreachpair` is used to unpack the key and value of the pairs coming out of
-// a sequence. e.g., std::map.
-//
-// Control flow:
-//
-// Labels:
-//   * `STOUT_FOREACH_BREAK` is the label that when jumped to, breaks out of
-//     the loop.
-//   * `STOUT_FOREACH_BODY` is the label that helps to skip the loop exit checks
-//     (break or continue) until we finish the current iteration.
-//
-// Flags:
-//   * `STOUT_FOREACH_CONTINUE` determines whether the loop should continue or
-//     not. If we encounter a `break`, this will be `false`. If we encounter a
-//     `continue` or run the current iteration to completion,
-//     `STOUT_FOREACH_CONTINUE` will be set to `true`.
-//   * `STOUT_FOREACH_ONCE` is used to execute a `for` loop exactly once.
-//
-#define foreachpair(KEY, VALUE, ELEMS)                                       \
-  foreach (auto&& STOUT_FOREACH_ELEM, ELEMS)                                 \
-    if (false) STOUT_FOREACH_BREAK: break; /* set up the break path */       \
-    else if (bool STOUT_FOREACH_CONTINUE = false) {} /* var decl */          \
-    else if (true) goto STOUT_FOREACH_BODY; /* skip the loop exit checks */  \
-    else for (;;) /* determine whether we should break or continue. */       \
-      if (!STOUT_FOREACH_CONTINUE) goto STOUT_FOREACH_BREAK; /* break */     \
-      else if (true) break; /* continue */                                   \
-      else                                                                   \
-        STOUT_FOREACH_BODY:                                                  \
-        if (bool STOUT_FOREACH_ONCE = false) {} /* var decl */               \
-        else for (KEY = std::get<0>(                                         \
-                      std::forward<decltype(STOUT_FOREACH_ELEM)>(            \
-                          STOUT_FOREACH_ELEM));                              \
-                  !STOUT_FOREACH_ONCE;                                       \
-                  STOUT_FOREACH_ONCE = true)                                 \
-          for (VALUE = std::get<1>(                                          \
-                   std::forward<decltype(STOUT_FOREACH_ELEM)>(               \
-                       STOUT_FOREACH_ELEM));                                 \
-               !STOUT_FOREACH_CONTINUE;                                      \
-               STOUT_FOREACH_CONTINUE = true)
-
-
-#define foreachkey(KEY, ELEMS) foreachpair (KEY, std::ignore, ELEMS)
-
-
-#define foreachvalue(VALUE, ELEMS) foreachpair (std::ignore, VALUE, ELEMS)
-
-#endif // __STOUT_FOREACH_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
deleted file mode 100644
index 3db2ddb..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/format.hpp
+++ /dev/null
@@ -1,128 +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_FORMAT_HPP__
-#define __STOUT_FORMAT_HPP__
-
-#include <stdarg.h> // For 'va_list', 'va_start', 'va_end'.
-
-// For 'vasprintf'.
-#ifdef __WINDOWS__
-#include <stout/windows/format.hpp>
-#else
-#include <stdio.h>
-#endif // __WINDOWS__
-
-#include <string>
-#include <type_traits> // For 'is_pod'.
-
-#include <stout/error.hpp>
-#include <stout/stringify.hpp>
-#include <stout/try.hpp>
-
-
-// The 'strings::format' functions produces strings based on the
-// printf family of functions. Except, unlike the printf family of
-// functions, the 'strings::format' routines attempt to "stringify"
-// any arguments that are not POD types (i.e., "plain old data":
-// primitives, pointers, certain structs/classes and unions,
-// etc). This enables passing structs/classes to 'strings::format'
-// provided there is a definition/specialization of 'ostream::operator
-// <<' available for that type. Note that the '%s' format specifier is
-// expected for each argument that gets stringified. A specialization
-// for std::string is also provided so that std::string::c_str is not
-// necessary (but again, '%s' is expected as the format specifier).
-
-namespace strings {
-namespace internal {
-
-Try<std::string> format(const std::string& fmt, va_list args);
-Try<std::string> format(const std::string fmt, ...);
-
-template <typename T, bool b>
-struct stringify;
-
-} // namespace internal {
-
-
-template <typename... T>
-Try<std::string> format(const std::string& s, const T&... t)
-{
-  return internal::format(
-      s,
-      internal::stringify<T, !std::is_pod<T>::value>(t).get()...);
-}
-
-
-namespace internal {
-
-inline Try<std::string> format(const std::string& fmt, va_list args)
-{
-  char* temp;
-  if (vasprintf(&temp, fmt.c_str(), args) == -1) {
-    // Note that temp is undefined, so we do not need to call free.
-    return Error("Failed to format '" + fmt + "' (possibly out of memory)");
-  }
-  std::string result(temp);
-  free(temp);
-  return result;
-}
-
-
-// NOTE: 'fmt' cannot be 'const std::string&' because passing an
-// argument of reference type as the second argument of 'va_start'
-// results in undefined behavior.
-// Refer to http://stackoverflow.com/a/222314 for further details.
-inline Try<std::string> format(const std::string fmt, ...)
-{
-  va_list args;
-  va_start(args, fmt);
-  const Try<std::string> result = format(fmt, args);
-  va_end(args);
-  return result;
-}
-
-
-template <typename T>
-struct stringify<T, false>
-{
-  stringify(const T& _t) : t(_t) {}
-  const T& get() { return t; }
-  const T& t;
-};
-
-
-template <typename T>
-struct stringify<T, true>
-{
-  stringify(const T& _t) : s(::stringify(_t)) {}
-  const char* get() { return s.c_str(); }
-
-  // NOTE: We need to do the copy here, because the temporary returned by
-  // ::stringify() doesn't outlive the get() call inside strings::format().
-  // TODO(vinod): Figure out a fix for using const ref here.
-  const std::string s;
-};
-
-
-template <>
-struct stringify<std::string, true>
-{
-  stringify(const std::string& _s) : s(_s) {}
-  const char* get() { return s.c_str(); }
-  const std::string& s;
-};
-
-} // namespace internal {
-} // namespace strings {
-
-#endif // __STOUT_FORMAT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/fs.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/fs.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/fs.hpp
deleted file mode 100644
index 0e11fb8..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/fs.hpp
+++ /dev/null
@@ -1,25 +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_FS_HPP__
-#define __STOUT_FS_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/windows/fs.hpp>
-#else
-#include <stout/posix/fs.hpp>
-#endif // __WINDOWS__
-
-
-#endif // __STOUT_FS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/gtest.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/gtest.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/gtest.hpp
deleted file mode 100644
index 8881159..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/gtest.hpp
+++ /dev/null
@@ -1,175 +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_GTEST_HPP__
-#define __STOUT_GTEST_HPP__
-
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <stout/option.hpp>
-#include <stout/result.hpp>
-#include <stout/try.hpp>
-
-
-template <typename T>
-::testing::AssertionResult AssertSome(
-    const char* expr,
-    const Option<T>& actual)
-{
-  if (actual.isNone()) {
-    return ::testing::AssertionFailure()
-      << expr << " is NONE";
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-
-template <typename T>
-::testing::AssertionResult AssertSome(
-    const char* expr,
-    const Try<T>& actual)
-{
-  if (actual.isError()) {
-    return ::testing::AssertionFailure()
-      << expr << ": " << actual.error();
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-
-template <typename T>
-::testing::AssertionResult AssertSome(
-    const char* expr,
-    const Result<T>& actual)
-{
-  if (actual.isNone()) {
-    return ::testing::AssertionFailure()
-      << expr << " is NONE";
-  } else if (actual.isError()) {
-    return ::testing::AssertionFailure()
-      << expr << ": " << actual.error();
-  }
-
-  return ::testing::AssertionSuccess();
-}
-
-
-template <typename T1, typename T2>
-::testing::AssertionResult AssertSomeEq(
-    const char* expectedExpr,
-    const char* actualExpr,
-    const T1& expected,
-    const T2& actual) // Duck typing!
-{
-  const ::testing::AssertionResult result = AssertSome(actualExpr, actual);
-
-  if (result) {
-    if (expected == actual.get()) {
-      return ::testing::AssertionSuccess();
-    } else {
-      return ::testing::AssertionFailure()
-        << "Value of: (" << actualExpr << ").get()\n"
-        << "  Actual: " << ::testing::PrintToString(actual.get()) << "\n"
-        << "Expected: " << expectedExpr << "\n"
-        << "Which is: " << ::testing::PrintToString(expected);
-    }
-  }
-
-  return result;
-}
-
-
-template <typename T1, typename T2>
-::testing::AssertionResult AssertSomeNe(
-    const char* notExpectedExpr,
-    const char* actualExpr,
-    const T1& notExpected,
-    const T2& actual) // Duck typing!
-{
-  const ::testing::AssertionResult result = AssertSome(actualExpr, actual);
-
-  if (result) {
-    if (notExpected == actual.get()) {
-      return ::testing::AssertionFailure()
-        << "    Value of: (" << actualExpr << ").get()\n"
-        << "      Actual: " << ::testing::PrintToString(actual.get()) << "\n"
-        << "Not expected: " << notExpectedExpr << "\n"
-        << "    Which is: " << ::testing::PrintToString(notExpected);
-    } else {
-      return ::testing::AssertionSuccess();
-    }
-  }
-
-  return result;
-}
-
-
-#define ASSERT_SOME(actual)                     \
-  ASSERT_PRED_FORMAT1(AssertSome, actual)
-
-
-#define EXPECT_SOME(actual)                     \
-  EXPECT_PRED_FORMAT1(AssertSome, actual)
-
-
-#define ASSERT_SOME_EQ(expected, actual)                \
-  ASSERT_PRED_FORMAT2(AssertSomeEq, expected, actual)
-
-
-#define EXPECT_SOME_EQ(expected, actual)                \
-  EXPECT_PRED_FORMAT2(AssertSomeEq, expected, actual)
-
-
-#define ASSERT_SOME_NE(notExpected, actual)             \
-  ASSERT_PRED_FORMAT2(AssertSomeNe, notExpected, actual)
-
-
-#define EXPECT_SOME_NE(notExpected, actual)             \
-  EXPECT_PRED_FORMAT2(AssertSomeNe, notExpected, actual)
-
-
-#define ASSERT_SOME_TRUE(actual)                        \
-  ASSERT_PRED_FORMAT2(AssertSomeEq, true, actual)
-
-
-#define EXPECT_SOME_TRUE(actual)                        \
-  EXPECT_PRED_FORMAT2(AssertSomeEq, true, actual)
-
-
-#define ASSERT_SOME_FALSE(actual)                       \
-  ASSERT_PRED_FORMAT2(AssertSomeEq, false, actual)
-
-
-#define EXPECT_SOME_FALSE(actual)                       \
-  EXPECT_PRED_FORMAT2(AssertSomeEq, false, actual)
-
-
-#define ASSERT_ERROR(actual)                    \
-  ASSERT_TRUE(actual.isError())
-
-
-#define EXPECT_ERROR(actual)                    \
-  EXPECT_TRUE(actual.isError())
-
-
-#define ASSERT_NONE(actual)                     \
-  ASSERT_TRUE(actual.isNone())
-
-
-#define EXPECT_NONE(actual)                     \
-  EXPECT_TRUE(actual.isNone())
-
-#endif // __STOUT_GTEST_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/gzip.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/gzip.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/gzip.hpp
deleted file mode 100644
index b78a8a3..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/gzip.hpp
+++ /dev/null
@@ -1,149 +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_GZIP_HPP__
-#define __STOUT_GZIP_HPP__
-
-#include <zlib.h>
-
-#include <string>
-
-#include <stout/error.hpp>
-#include <stout/stringify.hpp>
-#include <stout/try.hpp>
-
-
-// Compression utilities.
-// TODO(bmahler): Provide streaming compression / decompression as well.
-namespace gzip {
-
-// We use a 16KB buffer with zlib compression / decompression.
-#define GZIP_BUFFER_SIZE 16384
-
-// Returns a gzip compressed version of the provided string.
-// The compression level should be within the range [-1, 9].
-// See zlib.h:
-//   #define Z_NO_COMPRESSION         0
-//   #define Z_BEST_SPEED             1
-//   #define Z_BEST_COMPRESSION       9
-//   #define Z_DEFAULT_COMPRESSION  (-1)
-inline Try<std::string> compress(
-    const std::string& decompressed,
-    int level = Z_DEFAULT_COMPRESSION)
-{
-  // Verify the level is within range.
-  if (!(level == Z_DEFAULT_COMPRESSION ||
-      (level >= Z_NO_COMPRESSION && level <= Z_BEST_COMPRESSION))) {
-    return Error("Invalid compression level: " + stringify(level));
-  }
-
-  z_stream_s stream;
-  stream.next_in =
-    const_cast<Bytef*>(reinterpret_cast<const Bytef*>(decompressed.data()));
-  stream.avail_in = decompressed.length();
-  stream.zalloc = Z_NULL;
-  stream.zfree = Z_NULL;
-  stream.opaque = Z_NULL;
-
-  int code = deflateInit2(
-      &stream,
-      level,          // Compression level.
-      Z_DEFLATED,     // Compression method.
-      MAX_WBITS + 16, // Zlib magic for gzip compression / decompression.
-      8,              // Default memLevel value.
-      Z_DEFAULT_STRATEGY);
-
-  if (code != Z_OK) {
-    return Error("Failed to initialize zlib: " + std::string(stream.msg));
-  }
-
-  // Build up the compressed result.
-  Bytef buffer[GZIP_BUFFER_SIZE];
-  std::string result = "";
-  do {
-    stream.next_out = buffer;
-    stream.avail_out = GZIP_BUFFER_SIZE;
-    code = deflate(&stream, stream.avail_in > 0 ? Z_NO_FLUSH : Z_FINISH);
-
-    if (code != Z_OK && code != Z_STREAM_END) {
-      Error error(std::string(stream.msg));
-      deflateEnd(&stream);
-      return error;
-    }
-
-    // Consume output and reset the buffer.
-    result.append(
-        reinterpret_cast<char*>(buffer),
-        GZIP_BUFFER_SIZE - stream.avail_out);
-    stream.next_out = buffer;
-    stream.avail_out = GZIP_BUFFER_SIZE;
-  } while (code != Z_STREAM_END);
-
-  code = deflateEnd(&stream);
-  if (code != Z_OK) {
-    return Error("Failed to clean up zlib: " + std::string(stream.msg));
-  }
-  return result;
-}
-
-
-// Returns a gzip decompressed version of the provided string.
-inline Try<std::string> decompress(const std::string& compressed)
-{
-  z_stream_s stream;
-  stream.next_in =
-    const_cast<Bytef*>(reinterpret_cast<const Bytef*>(compressed.data()));
-  stream.avail_in = compressed.length();
-  stream.zalloc = Z_NULL;
-  stream.zfree = Z_NULL;
-  stream.opaque = Z_NULL;
-
-  int code = inflateInit2(
-      &stream,
-      MAX_WBITS + 16); // Zlib magic for gzip compression / decompression.
-
-  if (code != Z_OK) {
-    return Error("Failed to initialize zlib: " + std::string(stream.msg));
-  }
-
-  // Build up the decompressed result.
-  Bytef buffer[GZIP_BUFFER_SIZE];
-  std::string result = "";
-  do {
-    stream.next_out = buffer;
-    stream.avail_out = GZIP_BUFFER_SIZE;
-    code = inflate(&stream, stream.avail_in > 0 ? Z_NO_FLUSH : Z_FINISH);
-
-    if (code != Z_OK && code != Z_STREAM_END) {
-      Error error(std::string(stream.msg));
-      inflateEnd(&stream);
-      return error;
-    }
-
-    // Consume output and reset the buffer.
-    result.append(
-        reinterpret_cast<char*>(buffer),
-        GZIP_BUFFER_SIZE - stream.avail_out);
-    stream.next_out = buffer;
-    stream.avail_out = GZIP_BUFFER_SIZE;
-  } while (code != Z_STREAM_END);
-
-  code = inflateEnd(&stream);
-  if (code != Z_OK) {
-    return Error("Failed to clean up zlib: " + std::string(stream.msg));
-  }
-  return result;
-}
-
-} // namespace gzip {
-
-#endif // __STOUT_GZIP_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/hashmap.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/hashmap.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/hashmap.hpp
deleted file mode 100644
index a1bebcb..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/hashmap.hpp
+++ /dev/null
@@ -1,143 +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_HASHMAP_HPP__
-#define __STOUT_HASHMAP_HPP__
-
-#include <functional>
-#include <list>
-#include <map>
-#include <unordered_map>
-#include <utility>
-
-#include <boost/get_pointer.hpp>
-
-#include "foreach.hpp"
-#include "hashset.hpp"
-#include "none.hpp"
-#include "option.hpp"
-
-
-// Provides a hash map via 'std::unordered_map'. We inherit from it to add
-// new functions as well as to provide better names for some of the
-// existing functions.
-
-template <typename Key,
-          typename Value,
-          typename Hash = std::hash<Key>,
-          typename Equal = std::equal_to<Key>>
-class hashmap : public std::unordered_map<Key, Value, Hash, Equal>
-{
-public:
-  // An explicit default constructor is needed so
-  // 'const hashmap<T> map;' is not an error.
-  hashmap() {}
-
-  // An implicit constructor for converting from a std::map.
-  //
-  // TODO(benh): Allow any arbitrary type that supports 'begin()' and
-  // 'end()' passed into the specified 'emplace'?
-  hashmap(const std::map<Key, Value>& map)
-  {
-    std::unordered_map<Key, Value, Hash, Equal>::reserve(map.size());
-
-    for (auto iterator = map.begin(); iterator != map.end(); ++iterator) {
-      std::unordered_map<Key, Value, Hash, Equal>::emplace(
-          iterator->first,
-          iterator->second);
-    }
-  }
-
-  // An implicit constructor for converting from an r-value std::map.
-  //
-  // TODO(benh): Allow any arbitrary type that supports 'begin()' and
-  // 'end()' passed into the specified 'insert'?
-  hashmap(std::map<Key, Value>&& map)
-  {
-    // NOTE: We're using 'insert' here with a move iterator in order
-    // to avoid copies because we know we have an r-value paramater.
-    std::unordered_map<Key, Value, Hash, Equal>::insert(
-        std::make_move_iterator(map.begin()),
-        std::make_move_iterator(map.end()));
-  }
-
-  // Allow simple construction via initializer list.
-  hashmap(std::initializer_list<std::pair<Key, Value>> list)
-  {
-    std::unordered_map<Key, Value, Hash, Equal>::reserve(list.size());
-
-    for (auto iterator = list.begin(); iterator != list.end(); ++iterator) {
-      std::unordered_map<Key, Value, Hash, Equal>::emplace(
-          iterator->first,
-          iterator->second);
-    }
-  }
-
-  // Checks whether this map contains a binding for a key.
-  bool contains(const Key& key) const
-  {
-    return std::unordered_map<Key, Value, Hash, Equal>::count(key) > 0;
-  }
-
-  // Checks whether there exists a bound value in this map.
-  bool containsValue(const Value& v) const
-  {
-    foreachvalue (const Value& value, *this) {
-      if (value == v) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  // Inserts a key, value pair into the map replacing an old value
-  // if the key is already present.
-  void put(const Key& key, const Value& value)
-  {
-    std::unordered_map<Key, Value, Hash, Equal>::erase(key);
-    std::unordered_map<Key, Value, Hash, Equal>::insert(
-        std::pair<Key, Value>(key, value));
-  }
-
-  // Returns an Option for the binding to the key.
-  Option<Value> get(const Key& key) const
-  {
-    auto it = std::unordered_map<Key, Value, Hash, Equal>::find(key);
-    if (it == std::unordered_map<Key, Value, Hash, Equal>::end()) {
-      return None();
-    }
-    return it->second;
-  }
-
-  // Returns the set of keys in this map.
-  // TODO(vinod/bmahler): Should return a list instead.
-  hashset<Key> keys() const
-  {
-    hashset<Key> result;
-    foreachkey (const Key& key, *this) {
-      result.insert(key);
-    }
-    return result;
-  }
-
-  // Returns the list of values in this map.
-  std::list<Value> values() const
-  {
-    std::list<Value> result;
-    foreachvalue (const Value& value, *this) {
-      result.push_back(value);
-    }
-    return result;
-  }
-};
-
-#endif // __STOUT_HASHMAP_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/hashset.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/hashset.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/hashset.hpp
deleted file mode 100644
index 8f633ca..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/hashset.hpp
+++ /dev/null
@@ -1,133 +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_HASHSET_HPP__
-#define __STOUT_HASHSET_HPP__
-
-#include <set>
-#include <unordered_set>
-#include <utility>
-
-#include <boost/get_pointer.hpp>
-
-#include "foreach.hpp"
-
-
-// Provides a hash set via 'std::unordered_set'. We inherit from it to add
-// new functions as well as to provide better naming for some of the
-// existing functions.
-
-template <typename Elem,
-          typename Hash = std::hash<Elem>,
-          typename Equal = std::equal_to<Elem>>
-class hashset : public std::unordered_set<Elem, Hash, Equal>
-{
-public:
-  static const hashset<Elem, Hash, Equal>& EMPTY;
-
-  // An explicit default constructor is needed so
-  // 'const hashset<T> map;' is not an error.
-  hashset() {}
-
-  // An implicit constructor for converting from a std::set.
-  //
-  // TODO(arojas): Allow any arbitrary type that supports 'begin()'
-  // and 'end()' passed into the specified 'emplace'?
-  hashset(const std::set<Elem>& set)
-  {
-    std::unordered_set<Elem, Hash, Equal>::reserve(set.size());
-
-    for (auto iterator = set.begin(); iterator != set.end(); ++iterator) {
-      std::unordered_set<Elem, Hash, Equal>::emplace(*iterator);
-    }
-  }
-
-  // An implicit constructor for converting from an r-value std::set.
-  //
-  // TODO(arojas): Allow any arbitrary type that supports 'begin()'
-  // and 'end()' passed into the specified 'insert'?
-  hashset(std::set<Elem>&& set)
-  {
-    // An implementation based on the move constructor of 'hashmap'
-    // fails to compile on all major compilers except gcc 5.1 and up.
-    // See http://stackoverflow.com/q/31051466/118750?sem=2.
-    std::unordered_set<Elem, Hash, Equal>::reserve(set.size());
-
-    for (auto iterator = set.begin(); iterator != set.end(); ++iterator) {
-      std::unordered_set<Elem, Hash, Equal>::emplace(std::move(*iterator));
-    }
-  }
-
-  // Allow simple construction via initializer list.
-  hashset(std::initializer_list<Elem> list)
-  {
-    std::unordered_set<Elem, Hash, Equal>::reserve(list.size());
-
-    for (auto iterator = list.begin(); iterator != list.end(); ++iterator) {
-      std::unordered_set<Elem, Hash, Equal>::emplace(*iterator);
-    }
-  }
-
-  // Checks whether this map contains a binding for a key.
-  bool contains(const Elem& elem) const
-  {
-    return std::unordered_set<Elem, Hash, Equal>::count(elem) > 0;
-  }
-
-  // Checks whether there exists a value in this set that returns the
-  // a result equal to 'r' when the specified method is invoked.
-  template <typename R, typename T>
-  bool exists(R (T::*method)(), R r) const
-  {
-    foreach (const Elem& elem, *this) {
-      const T* t = boost::get_pointer(elem);
-      if (t->*method() == r) {
-        return true;
-      }
-    }
-  }
-
-  // Checks whether there exists an element in this set whose
-  // specified member is equal to 'r'.
-  template <typename R, typename T>
-  bool exists(R (T::*member), R r) const
-  {
-    foreach (const Elem& elem, *this) {
-      const T* t = boost::get_pointer(elem);
-      if (t->*member == r) {
-        return true;
-      }
-    }
-  }
-};
-
-
-// TODO(jmlvanre): Possibly remove this reference as per MESOS-2694.
-template <typename Elem, typename Hash, typename Equal>
-const hashset<Elem, Hash, Equal>& hashset<Elem, Hash, Equal>::EMPTY =
-  *new hashset<Elem, Hash, Equal>();
-
-
-// Union operator.
-template <typename Elem, typename Hash, typename Equal>
-hashset<Elem, Hash, Equal> operator|(
-    const hashset<Elem, Hash, Equal>& left,
-    const hashset<Elem, Hash, Equal>& right)
-{
-  // Note, we're not using 'set_union' since it affords us no benefit
-  // in efficiency and is more complicated to use given we have sets.
-  hashset<Elem, Hash, Equal> result = left;
-  result.insert(right.begin(), right.end());
-  return result;
-}
-
-#endif // __STOUT_HASHSET_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/dirent.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/dirent.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/dirent.hpp
deleted file mode 100644
index c1113e5..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/dirent.hpp
+++ /dev/null
@@ -1,259 +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_INTERNAL_WINDOWS_DIRENT_HPP__
-#define __STOUT_INTERNAL_WINDOWS_DIRENT_HPP__
-
-#include <assert.h>
-#include <malloc.h>
-
-#include <stout/windows.hpp>
-
-
-// Abbreviated version of the POSIX `dirent` struct. cf. specification[1].
-//
-// [1] http://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html
-struct dirent
-{
-  char d_name[MAX_PATH];
-  unsigned short d_namlen;
-};
-
-
-// `DIR` is normally an opaque struct in the standard, we expose the
-// implementation here because this header is intended for internal use only.
-struct DIR
-{
-  struct dirent curr;
-  char *d_name;
-  WIN32_FIND_DATA fd;
-  HANDLE handle;
-};
-
-
-// Avoid the C++-style name-mangling linkage, and use C-style instead to give
-// the appearance that this code is part of the real C standard library.
-extern "C" {
-namespace internal {
-
-void free_dir(DIR* directory);
-
-bool open_dir_stream(DIR* directory);
-
-bool reentrant_advance_dir_stream(DIR* directory);
-
-} // namespace internal {
-
-
-// Windows implementation of POSIX standard `opendir`. cf. specification[1].
-//
-// [1] http://www.gnu.org/software/libc/manual/html_node/Opening-a-Directory.html#Opening-a-Directory
-inline DIR* opendir(const char* path)
-{
-  if (path == NULL) {
-    errno = ENOTDIR;
-    return NULL;
-  }
-
-  const size_t path_size = strlen(path);
-
-  if (path_size == 0 || path_size >= MAX_PATH) {
-    errno = ENOENT;
-    return NULL;
-  }
-
-  const char windows_folder_separator = '\\';
-  const char windows_drive_separator = ':';
-  const char wildcard[] = "*";
-  const char dir_separator_and_wildcard[] = "\\*";
-
-  // Allocate space for directory. Be sure to leave room at the end of
-  // `directory->d_name` for a directory separator and a wildcard.
-  DIR* directory = (DIR*) malloc(sizeof(DIR));
-
-  if (directory == NULL) {
-    errno = ENOMEM;
-    return NULL;
-  }
-
-  directory->d_name =
-    (char*) malloc(path_size + strlen(dir_separator_and_wildcard) + 1);
-
-  if (directory->d_name == NULL) {
-    errno = ENOMEM;
-    free(directory);
-    return NULL;
-  }
-
-  // Copy path over and append the appropriate postfix.
-  strcpy(directory->d_name, path);
-
-  const size_t last_char_in_name =
-    directory->d_name[strlen(directory->d_name) - 1];
-
-  if (last_char_in_name != windows_folder_separator &&
-      last_char_in_name != windows_drive_separator) {
-    strcat(directory->d_name, dir_separator_and_wildcard);
-  } else {
-    strcat(directory->d_name, wildcard);
-  }
-
-  if (!internal::open_dir_stream(directory)) {
-    internal::free_dir(directory);
-    return NULL;
-  }
-
-  return directory;
-}
-
-
-// Implementation of the standard POSIX function. See documentation[1].
-//
-// On success: returns a pointer to the next directory entry, or `NULL` if
-// we've reached the end of the stream.
-//
-// On failure: returns `NULL` and sets `errno`.
-//
-// NOTE: as with most POSIX implementations of this function, you must reset
-// `errno` before calling `readdir`.
-//
-// [1] http://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html#Reading_002fClosing-Directory
-inline struct dirent* readdir(DIR* directory)
-{
-  if (directory == NULL) {
-    errno = EBADF;
-    return NULL;
-  }
-
-  if (!internal::reentrant_advance_dir_stream(directory)) {
-    return NULL;
-  }
-
-  return &directory->curr;
-}
-
-
-// Implementation of the standard POSIX function. See documentation[1].
-//
-// On success: return 0 and set `*result` (note that `result` is not the same
-// as `*result`) to point at the next directory entry, or `NULL` if we've
-// reached the end of the stream.
-//
-// On failure: return a positive error number and set `*result` (not `result`)
-// to point at `NULL`.
-//
-// [1] https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html
-inline int readdir_r(
-    DIR* directory,
-    struct dirent* entry,
-    struct dirent** result)
-{
-  if (directory == NULL) {
-    errno = EBADF;
-    *result = NULL;
-    return 1;
-  }
-
-  if (!internal::reentrant_advance_dir_stream(directory)) {
-    *result = NULL;
-    return 0;
-  }
-
-  memcpy(entry, &directory->curr, sizeof(*entry));
-  *result = &directory->curr;
-
-  return 0;
-}
-
-
-// Implementation of the standard POSIX function. See documentation[1].
-//
-// On success, return 0; on failure, return -1 and set `errno` appropriately.
-//
-// [1] http://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html#Reading_002fClosing-Directory
-inline int closedir(DIR* directory)
-{
-  if (directory == NULL) {
-    errno = EBADF;
-    return -1;
-  }
-
-  BOOL search_closed = false;
-
-  if (directory->handle != INVALID_HANDLE_VALUE) {
-    search_closed = FindClose(directory->handle);
-  }
-
-  internal::free_dir(directory);
-
-  return search_closed ? 0 : -1;
-}
-
-namespace internal {
-
-inline void free_dir(DIR* directory)
-{
-  if (directory != NULL) {
-    free(directory->d_name);
-  }
-
-  free(directory);
-}
-
-
-inline bool open_dir_stream(DIR* directory)
-{
-  assert(directory != NULL);
-
-  directory->handle = FindFirstFile(directory->d_name, &directory->fd);
-
-  if (directory->handle == INVALID_HANDLE_VALUE) {
-    errno = ENOENT;
-    return false;
-  }
-
-  // NOTE: `d_name` can be a statically-sized array of `MAX_PATH` size because
-  // `cFileName` is. See[1]. This simplifies this copy operation because we
-  // don't have to `malloc`.
-  //
-  // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365740(v=vs.85).aspx
-  strcpy(directory->curr.d_name, directory->fd.cFileName);
-  directory->curr.d_namlen = strlen(directory->curr.d_name);
-
-  return true;
-}
-
-
-inline bool reentrant_advance_dir_stream(DIR* directory)
-{
-  assert(directory != NULL);
-
-  if (!FindNextFile(directory->handle, &directory->fd)) {
-    return false;
-  }
-
-  // NOTE: `d_name` can be a statically-sized array of `MAX_PATH` size because
-  // `cFileName` is. See[1]. This simplifies this copy operation because we
-  // don't have to `malloc`.
-  //
-  // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365740(v=vs.85).aspx
-  strcpy(directory->curr.d_name, directory->fd.cFileName);
-  directory->curr.d_namlen = strlen(directory->curr.d_name);
-
-  return true;
-}
-
-} // namespace internal {
-} // extern "C" {
-
-
-#endif // __STOUT_INTERNAL_WINDOWS_DIRENT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/grp.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/grp.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/grp.hpp
deleted file mode 100644
index 232588c..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/grp.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you 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_INTERNAL_WINDOWS_GRP_HPP__
-#define __STOUT_INTERNAL_WINDOWS_GRP_HPP__
-
-#include <sys/types.h>
-
-#include <stout/windows.hpp>
-
-
-// Dummy struct for POSIX compliance.
-struct group
-{
-  char* gr_name; // The name of the group.
-  gid_t gr_gid;  // Numerical group ID.
-  char** gr_mem; // Pointer to a null-terminated array of character pointers to
-                 // member names.
-};
-
-
-// Dummy implementation of `getgrgid` for POSIX compliance. Per the POSIX
-// specification[1], we are to return `NULL` if an entry matching the GID is
-// not found. On Windows, we will never find such an entry, so we always return
-// `NULL`. Just to be safe, we also set `errno` to `ENOSYS` which indicates the
-// function is not implemented.
-//
-// [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html
-inline struct group* getgrgid(gid_t)
-{
-  errno = ENOSYS;
-  return NULL;
-}
-
-#endif // __STOUT_INTERNAL_WINDOWS_GRP_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/pwd.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/pwd.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/pwd.hpp
deleted file mode 100644
index 46e3ec2..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/pwd.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you 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_INTERNAL_WINDOWS_PWD_HPP__
-#define __STOUT_INTERNAL_WINDOWS_PWD_HPP__
-
-#include <sys/types.h>
-
-#include <stout/windows.hpp>
-
-
-// Dummy struct for POSIX compliance.
-struct passwd
-{
-  char* pw_name;  // User's login name.
-  uid_t pw_uid;   // Numerical user ID.
-  gid_t pw_gid;   // Numerical group ID.
-  char* pw_dir;   // Initial working directory.
-  char* pw_shell; // Program to use as shell.
-};
-
-
-// Dummy implementation of `getpwuid` for POSIX compliance. Per the POSIX
-// specification[1], we are to return `NULL` if an entry matching the UID is
-// not found. On Windows, we will never find such an entry, so we always return
-// `NULL`. Just to be safe, we also set `errno` to `ENOSYS` which indicates the
-// function is not implemented.
-//
-// [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html
-inline struct passwd* getpwuid(uid_t)
-{
-  errno = ENOSYS;
-  return NULL;
-}
-
-#endif // __STOUT_INTERNAL_WINDOWS_PWD_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c235f7c1/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
deleted file mode 100644
index 85eb0be..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
+++ /dev/null
@@ -1,346 +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_INTERNAL_WINDOWS_REPARSEPOINT_HPP__
-#define __STOUT_INTERNAL_WINDOWS_REPARSEPOINT_HPP__
-
-#include <mutex>
-#include <string>
-
-#include <stout/nothing.hpp>
-#include <stout/synchronized.hpp>
-#include <stout/try.hpp>
-#include <stout/windows.hpp>
-
-#include <stout/os/mkdir.hpp>
-#include <stout/os/realpath.hpp>
-
-// We pass this struct to `DeviceIoControl` to get information about a reparse
-// point (including things like whether it's a symlink). It is normally part of
-// the Device Driver Kit (DDK), specifically `nitfs.h`, but rather than taking
-// a dependency on the DDK, we choose to simply copy the struct here. This is a
-// well-worn path used by Boost FS[1], among others. See documentation
-// here[2][3].
-//
-// [1] http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/src/operations.cpp
-// [2] https://msdn.microsoft.com/en-us/library/cc232007.aspx
-// [3] https://msdn.microsoft.com/en-us/library/cc232005.aspx
-//
-// We are declaring this structure (and the REPARSE_DATA_BUFFER_HEADER_SIZE
-// macro right below it in the global namespace, to be consistent with the
-// original Windows DDK declarations.
-typedef struct _REPARSE_DATA_BUFFER
-{
-  // Describes, among other things, which type of reparse point this is (e.g.,
-  // a symlink).
-  ULONG  ReparseTag;
-  // Size in bytes of common portion of the `REPARSE_DATA_BUFFER`.
-  USHORT  ReparseDataLength;
-  // Unused. Ignore.
-  USHORT  Reserved;
-  union
-  {
-    // Holds symlink data.
-    struct
-    {
-      // Byte offset in `PathBuffer` where the substitute name begins.
-      // Calculated as an offset from 0.
-      USHORT SubstituteNameOffset;
-      // Length in bytes of the substitute name.
-      USHORT SubstituteNameLength;
-      // Byte offset in `PathBuffer` where the print name begins. Calculated as
-      // an offset from 0.
-      USHORT PrintNameOffset;
-      // Length in bytes of the print name.
-      USHORT PrintNameLength;
-      // Indicates whether symlink is absolute or relative. If flags containing
-      // `SYMLINK_FLAG_RELATIVE`, then the substitute name is a relative
-      // symlink.
-      ULONG Flags;
-      // The first byte of the path string -- according to the documentation[1],
-      // this is followed in memory by the rest of the path string. The "path
-      // string" itself is a unicode char array containing both substitute name
-      // and print name. They can occur in any order. Use the offset and length
-      // of each in this struct to calculate where each starts and ends.
-      //
-      // [1] https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx
-      WCHAR PathBuffer[1];
-    } SymbolicLinkReparseBuffer;
-
-    // Unused: holds mount point data.
-    struct
-    {
-      USHORT SubstituteNameOffset;
-      USHORT SubstituteNameLength;
-      USHORT PrintNameOffset;
-      USHORT PrintNameLength;
-      WCHAR PathBuffer[1];
-    } MountPointReparseBuffer;
-    struct
-    {
-      UCHAR DataBuffer[1];
-    } GenericReparseBuffer;
-  };
-} REPARSE_DATA_BUFFER;
-
-#define REPARSE_DATA_BUFFER_HEADER_SIZE \
-  FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
-
-namespace internal {
-namespace windows {
-
-// Convenience struct for holding symlink data, meant purely for internal use.
-// We pass this around instead of the `REPARSE_DATA_BUFFER` struct, simply
-// because this struct is easier to deal with and reason about.
-struct SymbolicLink
-{
-  std::wstring substitute_name;
-  std::wstring print_name;
-  ULONG flags;
-};
-
-
-// Checks file/folder attributes for a path to see if the reparse point
-// attribute is set; this indicates whether the path points at a reparse point,
-// rather than a "normal" file or folder.
-inline Try<bool> reparse_point_attribute_set(const std::string& absolute_path)
-{
-  const DWORD attributes = ::GetFileAttributes(absolute_path.c_str());
-  if (attributes == INVALID_FILE_ATTRIBUTES) {
-    return WindowsError(
-        "Failed to get attributes for file '" + absolute_path + "'");
-  }
-
-  return (attributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0;
-}
-
-
-// Attempts to extract symlink data out of a `REPARSE_DATA_BUFFER` (which could
-// hold other things, e.g., mount point data).
-inline Try<SymbolicLink> build_symbolic_link(const REPARSE_DATA_BUFFER& data)
-{
-  const bool is_symLink = (data.ReparseTag & IO_REPARSE_TAG_SYMLINK) != 0;
-  if (!is_symLink) {
-    return Error("Data buffer is not a symlink");
-  }
-
-  // NOTE: This buffer is not null terminated.
-  const WCHAR* substitute_name =
-    data.SymbolicLinkReparseBuffer.PathBuffer +
-    data.SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(WCHAR);
-  const size_t substitute_name_length =
-    data.SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
-
-  // NOTE: This buffer is not null terminated.
-  const WCHAR* print_name =
-    data.SymbolicLinkReparseBuffer.PathBuffer +
-    data.SymbolicLinkReparseBuffer.PrintNameOffset / sizeof(WCHAR);
-  const size_t print_name_length =
-    data.SymbolicLinkReparseBuffer.PrintNameLength / sizeof(WCHAR);
-
-  return SymbolicLink{
-      std::wstring(substitute_name, substitute_name_length),
-      std::wstring(print_name, print_name_length),
-      data.SymbolicLinkReparseBuffer.Flags};
-}
-
-
-// Attempts to get a file or folder handle for an absolute path, and does not
-// follow symlinks. That is, if the path points at a symlink, the handle will
-// refer to the symlink rather than the file or folder the symlink points at.
-inline Try<SharedHandle> get_handle_no_follow(const std::string& absolute_path)
-{
-  struct _stat absolute_path_stat;
-  bool resolved_path_is_directory = false;
-  if (::_stat(absolute_path.c_str(), &absolute_path_stat) == 0) {
-    resolved_path_is_directory = S_ISDIR(absolute_path_stat.st_mode);
-  } else {
-    return ErrnoError("'_stat' failed on path '" + absolute_path + "'");
-  }
-
-  // NOTE: According to the `CreateFile` documentation[1], the `OPEN_EXISTING`
-  // and `FILE_FLAG_OPEN_REPARSE_POINT` flags need to be used when getting a
-  // handle for the symlink.
-  //
-  // Note also that `CreateFile` will appropriately generate a handle for
-  // either a folder or a file, as long as the appropriate flag is being set:
-  // `FILE_FLAG_BACKUP_SEMANTICS` or `FILE_FLAG_OPEN_REPARSE_POINT`.
-  //
-  // The `FILE_FLAG_BACKUP_SEMANTICS` flag is being set whenever the target is
-  // a directory. According to MSDN[1]: "You must set this flag to obtain a
-  // handle to a directory. A directory handle can be passed to some functions
-  // instead of a file handle". More `FILE_FLAG_BACKUP_SEMANTICS` documentation
-  // can be found in MSDN[2].
-  //
-  // The `GENERIC_READ` flag is being used because it's the most common way of
-  // opening a file for reading only. The `FILE_SHARE_READ` allows other
-  // processes to read the file at the same time. MSDN[1] provides a more
-  // detailed explanation of these flags.
-  //
-  // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
-  // [2] https://msdn.microsoft.com/en-us/library/windows/desktop/aa364399(v=vs.85).aspx
-  const DWORD access_flags = resolved_path_is_directory
-    ? (FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS)
-    : FILE_FLAG_OPEN_REPARSE_POINT;
-
-  const HANDLE handle = ::CreateFile(
-      absolute_path.c_str(),
-      GENERIC_READ,     // Open the file for reading only.
-      FILE_SHARE_READ,  // Just reading this file, allow others to do the same.
-      NULL,             // Ignored.
-      OPEN_EXISTING,    // Open existing symlink.
-      access_flags,      // Open symlink, not the file it points to.
-      NULL);            // Ignored.
-
-  if (handle == INVALID_HANDLE_VALUE) {
-    return WindowsError(
-        "'internal::windows::get_handle_no_follow': 'CreateFile' call failed "
-        "at path '" + absolute_path + "'");
-  }
-
-  return SharedHandle(handle, CloseHandle);
-}
-
-
-// Attempts to get the symlink data for a file or folder handle.
-inline Try<SymbolicLink> get_symbolic_link_data(const HANDLE handle)
-{
-  // To get the symlink data, we call `DeviceIoControl`. This function is part
-  // of the Device Driver Kit (DDK)[1] and, along with `FSCTL_GET_REPARSE_POINT`
-  // is used to emit information about reparse points (and, thus, symlinks,
-  // since symlinks are implemented with reparse points). This technique is
-  // being used in Boost FS code as well[2].
-  //
-  // Summarized, the documentation tells us that we need to pass in
-  // `FSCTL_GET_REPARSE_POINT` to get the function to populate a
-  // `REPARSE_DATA_BUFFER` struct with data about a reparse point.
-  // The `REPARSE_DATA_BUFFER` struct is defined in a DDK header file,
-  // so to avoid bringing in a multitude of DDK headers we take a cue from
-  // Boost FS, and copy the struct into this header (see above).
-  //
-  // Finally, for context, it may be worth looking at the MSDN
-  // documentation[3] for `DeviceIoControl` itself.
-  //
-  // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa364571(v=vs.85).aspx
-  // [2] https://svn.boost.org/trac/boost/ticket/4663
-  // [3] https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx
-  const size_t reparse_point_data_size = MAXIMUM_REPARSE_DATA_BUFFER_SIZE;
-  BYTE buffer[reparse_point_data_size];
-  REPARSE_DATA_BUFFER* reparse_point_data =
-    reinterpret_cast<REPARSE_DATA_BUFFER*>(buffer);
-
-  DWORD ignored = 0;
-
-  // The semantics of this function are: get the reparse data associated with
-  // the `handle` of some open directory or file, and that data in
-  // `reparse_point_data`.
-  const BOOL reparse_data_obtained = ::DeviceIoControl(
-      handle,                   // Handle to file or directory.
-      FSCTL_GET_REPARSE_POINT,  // Gets reparse point data for file/folder.
-      NULL,                     // Ignored.
-      0,                        // Ignored.
-      reparse_point_data,
-      reparse_point_data_size,
-      &ignored,                 // Ignored.
-      NULL);                    // Ignored.
-
-  if (!reparse_data_obtained) {
-    return WindowsError(
-        "'internal::windows::get_symbolic_link_data': 'DeviceIoControl' call "
-        "failed");
-  }
-
-  return build_symbolic_link(*reparse_point_data);
-}
-
-
-// Creates a reparse point with the specified target. The target can be either
-// a file (in which case a junction is created), or a folder (in which case a
-// mount point is created).
-//
-// Calling this function results in a temporary elevation of the process token's
-// privileges (if those privileges are not already held), to allow for junction
-// or mount point creation. This operation is gated by a static mutex, which
-// makes it thread-safe.
-inline Try<Nothing> create_symbolic_link(
-    const std::string& target,
-    const std::string& reparse_point)
-{
-  // Normalize input paths.
-  const Result<std::string> real_reparse_point_path =
-    os::realpath(reparse_point);
-
-  const Result<std::string> real_target_path = os::realpath(target);
-
-  if (!real_reparse_point_path.isSome()) {
-    return Error(
-        "Failed to get realpath for '" +
-        reparse_point + "': " + (real_reparse_point_path.isError() ?
-        real_reparse_point_path.error() : "No such directory"));
-  }
-
-  if (!real_target_path.isSome()) {
-    return Error(
-        "Failed to get realpath for '" +
-        target + "': " + (real_target_path.isError() ?
-        real_target_path.error() : "No such directory"));
-  }
-
-  const std::string& absolute_target_path = real_target_path.get();
-
-  // Determine if target is a folder or a file. This makes a difference
-  // in the way we call `create_symbolic_link`.
-  struct _stat absolute_target_path_stat;
-  if (::_stat(absolute_target_path.c_str(), &absolute_target_path_stat) != 0) {
-    return ErrnoError("'_stat' failed on path '" + absolute_target_path + "'");
-  }
-
-  const bool target_is_folder = S_ISDIR(absolute_target_path_stat.st_mode);
-
-  // Bail out if target is already a reparse point.
-  Try<bool> attribute_set = reparse_point_attribute_set(absolute_target_path);
-  if (!attribute_set.isSome()) {
-    return Error(
-        "Could not get reparse point attribute for '" + absolute_target_path +
-        "'" + (attribute_set.isError() ? ": " + attribute_set.error() : ""));
-  }
-
-  if (attribute_set.get()) {
-    return Error(
-        "Path '" + absolute_target_path + "' is already a reparse point");
-  }
-
-  // `CreateSymbolicLink` adjusts the process token's privileges to allow for
-  // symlink creation. MSDN[1] makes no guarantee when it comes to the thread
-  // safety of this operation, so we are making use of a mutex to prevent
-  // multiple concurrent calls.
-  //
-  // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa363866(v=vs.85).aspx
-  static std::mutex adjust_privileges_mutex;
-  synchronized(adjust_privileges_mutex) {
-    if (!::CreateSymbolicLink(
-        reparse_point.c_str(),  // path to the symbolic link
-        target.c_str(),        // symlink target
-        target_is_folder ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0)) {
-      return WindowsError(
-          "'internal::windows::create_symbolic_link': 'CreateSymbolicLink' "
-          "call failed");
-    }
-  }
-
-  return Nothing();
-}
-
-} // namespace windows {
-} // namespace internal {
-
-#endif // __STOUT_INTERNAL_WINDOWS_REPARSEPOINT_HPP__


Mime
View raw message