You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/03/24 12:48:02 UTC

[1/3] mesos git commit: Replaced EXIT(1) with EXIT(EXIT_FAILURE).

Repository: mesos
Updated Branches:
  refs/heads/master b87f01b85 -> 1a9fd2a07


Replaced EXIT(1) with EXIT(EXIT_FAILURE).

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


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

Branch: refs/heads/master
Commit: 1a9fd2a072917596acc2d0a5e8b86d3bd4cc6b54
Parents: e1c9ec4
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Mar 7 14:02:56 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Mar 24 12:46:56 2016 +0100

----------------------------------------------------------------------
 src/examples/balloon_framework.cpp              |   6 +-
 src/examples/docker_no_executor_framework.cpp   |   6 +-
 src/examples/load_generator_framework.cpp       |   2 +-
 src/examples/long_lived_framework.cpp           |   6 +-
 src/examples/test_framework.cpp                 |  10 +-
 src/examples/test_http_executor.cpp             |   6 +-
 src/examples/test_http_framework.cpp            |  20 +-
 src/executor/executor.cpp                       |  19 +-
 src/jvm/jvm.cpp                                 |   2 +-
 src/launcher/fetcher.cpp                        |   8 +-
 src/local/local.cpp                             |  66 ++++---
 src/logging/logging.cpp                         |  12 +-
 src/master/master.cpp                           | 150 ++++++++-------
 src/sched/sched.cpp                             |   7 +-
 src/scheduler/scheduler.cpp                     |   5 +-
 src/slave/containerizer/mesos/launcher.cpp      |   2 +-
 .../containerizer/mesos/provisioner/store.cpp   |   8 +-
 src/slave/slave.cpp                             | 184 +++++++++++--------
 src/tests/cluster.cpp                           |  18 +-
 src/tests/containerizer/cgroups_tests.cpp       |   2 +-
 src/tests/environment.cpp                       |   2 +-
 21 files changed, 308 insertions(+), 233 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/balloon_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_framework.cpp b/src/examples/balloon_framework.cpp
index 16eea37..1665e5b 100644
--- a/src/examples/balloon_framework.cpp
+++ b/src/examples/balloon_framework.cpp
@@ -239,7 +239,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_PRINCIPAL");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication principal in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication principal in the environment";
     }
 
     Credential credential;
@@ -249,7 +250,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_SECRET");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication secret in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication secret in the environment";
     }
 
     credential.set_secret(value.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/docker_no_executor_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/docker_no_executor_framework.cpp b/src/examples/docker_no_executor_framework.cpp
index cf7b4e1..2b82b4f 100644
--- a/src/examples/docker_no_executor_framework.cpp
+++ b/src/examples/docker_no_executor_framework.cpp
@@ -187,7 +187,8 @@ int main(int argc, char** argv)
 
     Option<string> value = os::getenv("DEFAULT_PRINCIPAL");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication principal in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication principal in the environment";
     }
 
     Credential credential;
@@ -197,7 +198,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_SECRET");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication secret in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication secret in the environment";
     }
 
     credential.set_secret(value.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/load_generator_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/load_generator_framework.cpp b/src/examples/load_generator_framework.cpp
index 7d64b66..b22a09e 100644
--- a/src/examples/load_generator_framework.cpp
+++ b/src/examples/load_generator_framework.cpp
@@ -214,7 +214,7 @@ public:
   {
     // Terminating process with EXIT here because we cannot interrupt
     // LoadGenerator's long-running loop.
-    EXIT(1) << "Error received: " << error;
+    EXIT(EXIT_FAILURE) << "Error received: " << error;
   }
 
 private:

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/long_lived_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/long_lived_framework.cpp b/src/examples/long_lived_framework.cpp
index 0000289..ef498d6 100644
--- a/src/examples/long_lived_framework.cpp
+++ b/src/examples/long_lived_framework.cpp
@@ -194,7 +194,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_PRINCIPAL");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication principal in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication principal in the environment";
     }
 
     Credential credential;
@@ -204,7 +205,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_SECRET");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication secret in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication secret in the environment";
     }
 
     credential.set_secret(value.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/test_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_framework.cpp b/src/examples/test_framework.cpp
index c9695c4..79113fb 100644
--- a/src/examples/test_framework.cpp
+++ b/src/examples/test_framework.cpp
@@ -221,11 +221,11 @@ int main(int argc, char** argv)
   if (load.isError()) {
     cerr << load.error() << endl;
     usage(argv[0], flags);
-    exit(1);
+    exit(EXIT_FAILURE);
   } else if (master.isNone()) {
     cerr << "Missing --master" << endl;
     usage(argv[0], flags);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
 
   internal::logging::initialize(argv[0], flags, true); // Catch signals.
@@ -262,7 +262,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_PRINCIPAL");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication principal in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication principal in the environment";
     }
 
     Credential credential;
@@ -272,7 +273,8 @@ int main(int argc, char** argv)
 
     value = os::getenv("DEFAULT_SECRET");
     if (value.isNone()) {
-      EXIT(1) << "Expecting authentication secret in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting authentication secret in the environment";
     }
 
     credential.set_secret(value.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/test_http_executor.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_http_executor.cpp b/src/examples/test_http_executor.cpp
index 55a427f..562b0ac 100644
--- a/src/examples/test_http_executor.cpp
+++ b/src/examples/test_http_executor.cpp
@@ -229,13 +229,15 @@ int main()
 
   value = os::getenv("MESOS_FRAMEWORK_ID");
   if (value.isNone()) {
-    EXIT(1) << "Expecting 'MESOS_FRAMEWORK_ID' to be set in the environment";
+    EXIT(EXIT_FAILURE)
+      << "Expecting 'MESOS_FRAMEWORK_ID' to be set in the environment";
   }
   frameworkId.set_value(value.get());
 
   value = os::getenv("MESOS_EXECUTOR_ID");
   if (value.isNone()) {
-    EXIT(1) << "Expecting 'MESOS_EXECUTOR_ID' to be set in the environment";
+    EXIT(EXIT_FAILURE)
+      << "Expecting 'MESOS_EXECUTOR_ID' to be set in the environment";
   }
   executorId.set_value(value.get());
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/examples/test_http_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_http_framework.cpp b/src/examples/test_http_framework.cpp
index 64c5097..52fc1e4 100644
--- a/src/examples/test_http_framework.cpp
+++ b/src/examples/test_http_framework.cpp
@@ -183,7 +183,7 @@ public:
         }
 
         default: {
-          EXIT(1) << "Received an UNKNOWN event";
+          EXIT(EXIT_FAILURE) << "Received an UNKNOWN event";
         }
       }
     }
@@ -292,11 +292,12 @@ private:
     if (status.state() == TASK_LOST ||
         status.state() == TASK_KILLED ||
         status.state() == TASK_FAILED) {
-      EXIT(1) << "Exiting because task " << status.task_id()
-              << " is in unexpected state " << status.state()
-              << " with reason " << status.reason()
-              << " from source " << status.source()
-              << " with message '" << status.message() << "'";
+      EXIT(EXIT_FAILURE)
+        << "Exiting because task " << status.task_id()
+        << " is in unexpected state " << status.state()
+        << " with reason " << status.reason()
+        << " from source " << status.source()
+        << " with message '" << status.message() << "'";
     }
 
     if (tasksFinished == totalTasks) {
@@ -395,11 +396,11 @@ int main(int argc, char** argv)
   if (load.isError()) {
     cerr << load.error() << endl;
     usage(argv[0], flags);
-    EXIT(1);
+    EXIT(EXIT_FAILURE);
   } else if (master.isNone()) {
     cerr << "Missing --master" << endl;
     usage(argv[0], flags);
-    EXIT(1);
+    EXIT(EXIT_FAILURE);
   }
 
   process::initialize();
@@ -428,7 +429,8 @@ int main(int argc, char** argv)
 
   value = os::getenv("DEFAULT_PRINCIPAL");
   if (value.isNone()) {
-    EXIT(1) << "Expecting authentication principal in the environment";
+    EXIT(EXIT_FAILURE)
+      << "Expecting authentication principal in the environment";
   }
 
   framework.set_principal(value.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/executor/executor.cpp
----------------------------------------------------------------------
diff --git a/src/executor/executor.cpp b/src/executor/executor.cpp
index 48b0050..c7187ea 100644
--- a/src/executor/executor.cpp
+++ b/src/executor/executor.cpp
@@ -158,7 +158,7 @@ public:
     Try<Nothing> load = flags.load("MESOS_");
 
     if (load.isError()) {
-      EXIT(1) << "Failed to load flags: " << load.error();
+      EXIT(EXIT_FAILURE) << "Failed to load flags: " << load.error();
     }
 
     // Initialize libprocess.
@@ -183,7 +183,8 @@ public:
     // Get agent PID from environment.
     value = os::getenv("MESOS_SLAVE_PID");
     if (value.isNone()) {
-      EXIT(1) << "Expecting 'MESOS_SLAVE_PID' to be set in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting 'MESOS_SLAVE_PID' to be set in the environment";
     }
 
     UPID upid(value.get());
@@ -212,8 +213,8 @@ public:
 
         recoveryTimeout = _recoveryTimeout.get();
       } else {
-        EXIT(1) << "Expecting 'MESOS_RECOVERY_TIMEOUT' to be set in the "
-                << "environment";
+        EXIT(EXIT_FAILURE)
+          << "Expecting 'MESOS_RECOVERY_TIMEOUT' to be set in the environment";
       }
 
       // Get maximum backoff factor from environment.
@@ -227,8 +228,9 @@ public:
 
         maxBackoff = _maxBackoff.get();
       } else {
-        EXIT(1) << "Expecting 'MESOS_SUBSCRIPTION_BACKOFF_MAX' to be set "
-                << "in the environment";
+        EXIT(EXIT_FAILURE)
+          << "Expecting 'MESOS_SUBSCRIPTION_BACKOFF_MAX' to be set"
+          << " in the environment";
       }
     }
 
@@ -243,8 +245,9 @@ public:
 
       shutdownGracePeriod = _shutdownGracePeriod.get();
     } else {
-      EXIT(1) << "Expecting 'MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD' to be set "
-              << "in the environment";
+      EXIT(EXIT_FAILURE)
+        << "Expecting 'MESOS_EXECUTOR_SHUTDOWN_GRACE_PERIOD' to be set"
+        << " in the environment";
     }
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/jvm/jvm.cpp
----------------------------------------------------------------------
diff --git a/src/jvm/jvm.cpp b/src/jvm/jvm.cpp
index 909d34a..779f8b9 100644
--- a/src/jvm/jvm.cpp
+++ b/src/jvm/jvm.cpp
@@ -841,7 +841,7 @@ void Jvm::check(JNIEnv* env)
   if (env->ExceptionCheck() == JNI_TRUE) {
     if (!exceptions) {
       env->ExceptionDescribe();
-      EXIT(1) << "Caught a JVM exception, not propagating";
+      EXIT(EXIT_FAILURE) << "Caught a JVM exception, not propagating";
     } else {
       java::lang::Throwable throwable;
       Object* object = &throwable;

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/launcher/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/fetcher.cpp b/src/launcher/fetcher.cpp
index 28dbb98..3f79358 100644
--- a/src/launcher/fetcher.cpp
+++ b/src/launcher/fetcher.cpp
@@ -456,8 +456,8 @@ int main(int argc, char* argv[])
     Try<string> fetched =
       fetch(item, cacheDirectory, sandboxDirectory, frameworksHome);
     if (fetched.isError()) {
-      EXIT(1) << "Failed to fetch '" << item.uri().value()
-              << "': " + fetched.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to fetch '" << item.uri().value() << "': " + fetched.error();
     } else {
       LOG(INFO) << "Fetched '" << item.uri().value()
                 << "' to '" << fetched.get() << "'";
@@ -470,8 +470,8 @@ int main(int argc, char* argv[])
         fetcherInfo.get().user(),
         sandboxDirectory);
     if (chowned.isError()) {
-      EXIT(1) << "Failed to chown " << sandboxDirectory
-              << ": " << chowned.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to chown " << sandboxDirectory << ": " << chowned.error();
     }
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index f8599e7..e777ea2 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -141,8 +141,9 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
     // Create a default allocator.
     Try<Allocator*> defaultAllocator = HierarchicalDRFAllocator::create();
     if (defaultAllocator.isError()) {
-      EXIT(1) << "Failed to create an instance of HierarchicalDRFAllocator: "
-              << defaultAllocator.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to create an instance of HierarchicalDRFAllocator: "
+        << defaultAllocator.error();
     }
 
     // Update caller's instance.
@@ -162,8 +163,9 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
     master::Flags flags;
     Try<Nothing> load = flags.load("MESOS_");
     if (load.isError()) {
-      EXIT(1) << "Failed to start a local cluster while loading "
-              << "master flags from the environment: " << load.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to start a local cluster while loading"
+        << " master flags from the environment: " << load.error();
     }
 
     // Load modules. Note that this covers both, master and slave
@@ -171,14 +173,15 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
     if (flags.modules.isSome()) {
       Try<Nothing> result = ModuleManager::load(flags.modules.get());
       if (result.isError()) {
-        EXIT(1) << "Error loading modules: " << result.error();
+        EXIT(EXIT_FAILURE) << "Error loading modules: " << result.error();
       }
     }
 
     if (flags.registry == "in_memory") {
       if (flags.registry_strict) {
-        EXIT(1) << "Cannot use '--registry_strict' when using in-memory storage"
-                << " based registry";
+        EXIT(EXIT_FAILURE)
+          << "Cannot use '--registry_strict' when using in-memory storage"
+          << " based registry";
       }
       storage = new state::InMemoryStorage();
     } else if (flags.registry == "replicated_log") {
@@ -199,8 +202,9 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
           flags.log_auto_initialize);
       storage = new state::LogStorage(log);
     } else {
-      EXIT(1) << "'" << flags.registry << "' is not a supported"
-              << " option for registry persistence";
+      EXIT(EXIT_FAILURE)
+        << "'" << flags.registry << "' is not a supported"
+        << " option for registry persistence";
     }
 
     CHECK_NOTNULL(storage);
@@ -255,25 +259,28 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
         strings::tokenize(flags.slave_removal_rate_limit.get(), "/");
 
       if (tokens.size() != 2) {
-        EXIT(1) << "Invalid slave_removal_rate_limit: "
-                << flags.slave_removal_rate_limit.get()
-                << ". Format is <Number of slaves>/<Duration>";
+        EXIT(EXIT_FAILURE)
+          << "Invalid slave_removal_rate_limit: "
+          << flags.slave_removal_rate_limit.get()
+          << ". Format is <Number of slaves>/<Duration>";
       }
 
       Try<int> permits = numify<int>(tokens[0]);
       if (permits.isError()) {
-        EXIT(1) << "Invalid slave_removal_rate_limit: "
-                << flags.slave_removal_rate_limit.get()
-                << ". Format is <Number of slaves>/<Duration>"
-                << ": " << permits.error();
+        EXIT(EXIT_FAILURE)
+          << "Invalid slave_removal_rate_limit: "
+          << flags.slave_removal_rate_limit.get()
+          << ". Format is <Number of slaves>/<Duration>"
+          << ": " << permits.error();
       }
 
       Try<Duration> duration = Duration::parse(tokens[1]);
       if (duration.isError()) {
-        EXIT(1) << "Invalid slave_removal_rate_limit: "
-                << flags.slave_removal_rate_limit.get()
-                << ". Format is <Number of slaves>/<Duration>"
-                << ": " << duration.error();
+        EXIT(EXIT_FAILURE)
+          << "Invalid slave_removal_rate_limit: "
+          << flags.slave_removal_rate_limit.get()
+          << ". Format is <Number of slaves>/<Duration>"
+          << ": " << duration.error();
       }
 
       slaveRemovalLimiter = new RateLimiter(permits.get(), duration.get());
@@ -283,7 +290,8 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
     foreach (const string& name, ModuleManager::find<Anonymous>()) {
       Try<Anonymous*> create = ModuleManager::create<Anonymous>(name);
       if (create.isError()) {
-        EXIT(1) << "Failed to create anonymous module named '" << name << "'";
+        EXIT(EXIT_FAILURE)
+          << "Failed to create anonymous module named '" << name << "'";
       }
 
       // We don't bother keeping around the pointer to this anonymous
@@ -324,8 +332,9 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
     Try<Nothing> load = flags.load("MESOS_");
 
     if (load.isError()) {
-      EXIT(1) << "Failed to start a local cluster while loading "
-              << "slave flags from the environment: " << load.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to start a local cluster while loading"
+        << " slave flags from the environment: " << load.error();
     }
 
     // Use a different work directory for each slave.
@@ -339,8 +348,8 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
       ResourceEstimator::create(flags.resource_estimator);
 
     if (resourceEstimator.isError()) {
-      EXIT(1) << "Failed to create resource estimator: "
-              << resourceEstimator.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to create resource estimator: " << resourceEstimator.error();
     }
 
     resourceEstimators->push_back(resourceEstimator.get());
@@ -349,8 +358,8 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
       QoSController::create(flags.qos_controller);
 
     if (qosController.isError()) {
-      EXIT(1) << "Failed to create QoS Controller: "
-              << qosController.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to create QoS Controller: " << qosController.error();
     }
 
     qosControllers->push_back(qosController.get());
@@ -364,7 +373,8 @@ PID<Master> launch(const Flags& flags, Allocator* _allocator)
       Containerizer::create(flags, true, fetchers->back());
 
     if (containerizer.isError()) {
-      EXIT(1) << "Failed to create a containerizer: " << containerizer.error();
+      EXIT(EXIT_FAILURE)
+        << "Failed to create a containerizer: " << containerizer.error();
     }
 
     // NOTE: At this point detector is already initialized by the

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/logging/logging.cpp
----------------------------------------------------------------------
diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp
index 8d9e4e9..20d2f63 100644
--- a/src/logging/logging.cpp
+++ b/src/logging/logging.cpp
@@ -131,9 +131,10 @@ void initialize(
   if (flags.logging_level != "INFO" &&
       flags.logging_level != "WARNING" &&
       flags.logging_level != "ERROR") {
-    EXIT(1) << "'" << flags.logging_level << "' is not a valid logging level."
-               " Possible values for 'logging_level' flag are: "
-               " 'INFO', 'WARNING', 'ERROR'.";
+    EXIT(EXIT_FAILURE)
+      << "'" << flags.logging_level
+      << "' is not a valid logging level. Possible values for"
+      << " 'logging_level' flag are: 'INFO', 'WARNING', 'ERROR'.";
   }
 
   FLAGS_minloglevel = getLogSeverity(flags.logging_level);
@@ -141,8 +142,9 @@ void initialize(
   if (flags.log_dir.isSome()) {
     Try<Nothing> mkdir = os::mkdir(flags.log_dir.get());
     if (mkdir.isError()) {
-      EXIT(1) << "Could not initialize logging: Failed to create directory "
-              << flags.log_dir.get() << ": " << mkdir.error();
+      EXIT(EXIT_FAILURE)
+        << "Could not initialize logging: Failed to create directory "
+        << flags.log_dir.get() << ": " << mkdir.error();
     }
     FLAGS_log_dir = flags.log_dir.get();
     // Do not log to stderr instead of log files.

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 32914a2..655b0b8 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -389,16 +389,18 @@ void Master::initialize()
   // NOTE: We enforce a minimum slave re-register timeout because the
   // slave bounds its (re-)registration retries based on the minimum.
   if (flags.slave_reregister_timeout < MIN_SLAVE_REREGISTER_TIMEOUT) {
-    EXIT(1) << "Invalid value '" << flags.slave_reregister_timeout << "' "
-            << "for --slave_reregister_timeout: "
-            << "Must be at least " << MIN_SLAVE_REREGISTER_TIMEOUT;
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.slave_reregister_timeout << "'"
+      << " for --slave_reregister_timeout:"
+      << " Must be at least " << MIN_SLAVE_REREGISTER_TIMEOUT;
   }
 
   // Parse the percentage for the slave removal limit.
   // TODO(bmahler): Add a 'Percentage' abstraction.
   if (!strings::endsWith(flags.recovery_slave_removal_limit, "%")) {
-    EXIT(1) << "Invalid value '" << flags.recovery_slave_removal_limit << "' "
-            << "for --recovery_slave_removal_percent_limit: " << "missing '%'";
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.recovery_slave_removal_limit << "'"
+      << " for --recovery_slave_removal_percent_limit: " << "missing '%'";
   }
 
   Try<double> limit = numify<double>(
@@ -408,14 +410,16 @@ void Master::initialize()
           strings::SUFFIX));
 
   if (limit.isError()) {
-    EXIT(1) << "Invalid value '" << flags.recovery_slave_removal_limit << "' "
-            << "for --recovery_slave_removal_percent_limit: " << limit.error();
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.recovery_slave_removal_limit << "'"
+      << " for --recovery_slave_removal_percent_limit: " << limit.error();
   }
 
   if (limit.get() < 0.0 || limit.get() > 100.0) {
-    EXIT(1) << "Invalid value '" << flags.recovery_slave_removal_limit << "' "
-            << "for --recovery_slave_removal_percent_limit: "
-            << "Must be within [0%-100%]";
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.recovery_slave_removal_limit << "'"
+      << " for --recovery_slave_removal_percent_limit:"
+      << " Must be within [0%-100%]";
   }
 
   // Log authentication state.
@@ -436,10 +440,11 @@ void Master::initialize()
     Result<Credentials> _credentials =
       credentials::read(flags.credentials.get());
     if (_credentials.isError()) {
-      EXIT(1) << _credentials.error() << " (see --credentials flag)";
+      EXIT(EXIT_FAILURE) << _credentials.error() << " (see --credentials flag)";
     } else if (_credentials.isNone()) {
-      EXIT(1) << "Credentials file must contain at least one credential"
-              << " (see --credentials flag)";
+      EXIT(EXIT_FAILURE)
+        << "Credentials file must contain at least one credential"
+        << " (see --credentials flag)";
     }
     // Store credentials in master to use them in routes.
     credentials = _credentials.get();
@@ -448,18 +453,19 @@ void Master::initialize()
   // Extract authenticator names and validate them.
   authenticatorNames = strings::split(flags.authenticators, ",");
   if (authenticatorNames.empty()) {
-    EXIT(1) << "No authenticator specified";
+    EXIT(EXIT_FAILURE) << "No authenticator specified";
   }
   if (authenticatorNames.size() > 1) {
-    EXIT(1) << "Multiple authenticators not supported";
+    EXIT(EXIT_FAILURE) << "Multiple authenticators not supported";
   }
   if (authenticatorNames[0] != DEFAULT_AUTHENTICATOR &&
       !modules::ModuleManager::contains<Authenticator>(
           authenticatorNames[0])) {
-    EXIT(1) << "Authenticator '" << authenticatorNames[0] << "' not found. "
-            << "Check the spelling (compare to '" << DEFAULT_AUTHENTICATOR
-            << "'') or verify that the authenticator was loaded successfully "
-            << "(see --modules)";
+    EXIT(EXIT_FAILURE)
+      << "Authenticator '" << authenticatorNames[0] << "' not found."
+      << " Check the spelling (compare to '" << DEFAULT_AUTHENTICATOR << "')"
+      << " or verify that the authenticator was loaded successfully"
+      << " (see --modules)";
   }
 
   // TODO(tillt): Allow multiple authenticators to be loaded and enable
@@ -472,8 +478,9 @@ void Master::initialize()
     Try<Authenticator*> module =
       modules::ModuleManager::create<Authenticator>(authenticatorNames[0]);
     if (module.isError()) {
-      EXIT(1) << "Could not create authenticator module '"
-              << authenticatorNames[0] << "': " << module.error();
+      EXIT(EXIT_FAILURE)
+        << "Could not create authenticator module '"
+        << authenticatorNames[0] << "': " << module.error();
     }
     LOG(INFO) << "Using '" << authenticatorNames[0] << "' authenticator";
     authenticator = module.get();
@@ -487,8 +494,8 @@ void Master::initialize()
       "Failed to initialize authenticator '" + authenticatorNames[0] +
       "': " + initialize.error();
     if (flags.authenticate_frameworks || flags.authenticate_slaves) {
-      EXIT(1) << "Failed to start master with authentication enabled: "
-              << error;
+      EXIT(EXIT_FAILURE)
+        << "Failed to start master with authentication enabled: " << error;
     } else {
       // A failure to initialize the authenticator does lead to
       // unusable authentication but still allows non authenticating
@@ -510,18 +517,19 @@ void Master::initialize()
   // Passing an empty string into the `http_authenticators`
   // flag is considered an error.
   if (httpAuthenticatorNames.empty()) {
-    EXIT(1) << "No HTTP authenticator specified";
+    EXIT(EXIT_FAILURE) << "No HTTP authenticator specified";
   }
   if (httpAuthenticatorNames.size() > 1) {
-    EXIT(1) << "Multiple HTTP authenticators not supported";
+    EXIT(EXIT_FAILURE) << "Multiple HTTP authenticators not supported";
   }
   if (httpAuthenticatorNames[0] != DEFAULT_HTTP_AUTHENTICATOR &&
       !modules::ModuleManager::contains<authentication::Authenticator>(
           httpAuthenticatorNames[0])) {
-    EXIT(1) << "HTTP authenticator '" << httpAuthenticatorNames[0] << "' not "
-            << "found. Check the spelling (compare to '"
-            << DEFAULT_HTTP_AUTHENTICATOR << "'') or verify that the "
-            << "authenticator was loaded successfully (see --modules)";
+    EXIT(EXIT_FAILURE)
+      << "HTTP authenticator '" << httpAuthenticatorNames[0] << "' not"
+      << " found. Check the spelling (compare to '"
+      << DEFAULT_HTTP_AUTHENTICATOR << "') or verify that the"
+      << " authenticator was loaded successfully (see --modules)";
   }
 
   Option<authentication::Authenticator*> httpAuthenticator;
@@ -529,9 +537,9 @@ void Master::initialize()
   if (flags.authenticate_http) {
     if (httpAuthenticatorNames[0] == DEFAULT_HTTP_AUTHENTICATOR) {
       if (credentials.isNone()) {
-        EXIT(1) << "No credentials provided for the default '"
-                << DEFAULT_HTTP_AUTHENTICATOR
-                << "' HTTP authenticator";
+        EXIT(EXIT_FAILURE)
+          << "No credentials provided for the default '"
+          << DEFAULT_HTTP_AUTHENTICATOR << "' HTTP authenticator";
       }
 
       LOG(INFO) << "Using default '" << DEFAULT_HTTP_AUTHENTICATOR
@@ -542,8 +550,9 @@ void Master::initialize()
             DEFAULT_HTTP_AUTHENTICATION_REALM,
             credentials.get());
       if (authenticator.isError()) {
-        EXIT(1) << "Could not create HTTP authenticator module '"
-                << httpAuthenticatorNames[0] << "': " << authenticator.error();
+        EXIT(EXIT_FAILURE)
+          << "Could not create HTTP authenticator module '"
+          << httpAuthenticatorNames[0] << "': " << authenticator.error();
       }
 
       httpAuthenticator = authenticator.get();
@@ -552,8 +561,9 @@ void Master::initialize()
         modules::ModuleManager::create<authentication::Authenticator>(
             httpAuthenticatorNames[0]);
       if (module.isError()) {
-        EXIT(1) << "Could not create HTTP authenticator module '"
-                << httpAuthenticatorNames[0] << "': " << module.error();
+        EXIT(EXIT_FAILURE)
+          << "Could not create HTTP authenticator module '"
+          << httpAuthenticatorNames[0] << "': " << module.error();
       }
       LOG(INFO) << "Using '" << httpAuthenticatorNames[0]
                 << "' HTTP authenticator";
@@ -577,13 +587,15 @@ void Master::initialize()
     // Add framework rate limiters.
     foreach (const RateLimit& limit_, flags.rate_limits.get().limits()) {
       if (frameworks.limiters.contains(limit_.principal())) {
-        EXIT(1) << "Duplicate principal " << limit_.principal()
-                << " found in RateLimits configuration";
+        EXIT(EXIT_FAILURE)
+          << "Duplicate principal " << limit_.principal()
+          << " found in RateLimits configuration";
       }
 
       if (limit_.has_qps() && limit_.qps() <= 0) {
-        EXIT(1) << "Invalid qps: " << limit_.qps()
-                << ". It must be a positive number";
+        EXIT(EXIT_FAILURE)
+          << "Invalid qps: " << limit_.qps()
+          << ". It must be a positive number";
       }
 
       if (limit_.has_qps()) {
@@ -602,9 +614,10 @@ void Master::initialize()
 
     if (flags.rate_limits.get().has_aggregate_default_qps() &&
         flags.rate_limits.get().aggregate_default_qps() <= 0) {
-      EXIT(1) << "Invalid aggregate_default_qps: "
-              << flags.rate_limits.get().aggregate_default_qps()
-              << ". It must be a positive number";
+      EXIT(EXIT_FAILURE)
+        << "Invalid aggregate_default_qps: "
+        << flags.rate_limits.get().aggregate_default_qps()
+        << ". It must be a positive number";
     }
 
     if (flags.rate_limits.get().has_aggregate_default_qps()) {
@@ -636,7 +649,7 @@ void Master::initialize()
 
     Try<vector<string>> roles = roles::parse(flags.roles.get());
     if (roles.isError()) {
-      EXIT(1) << "Failed to parse roles: " << roles.error();
+      EXIT(EXIT_FAILURE) << "Failed to parse roles: " << roles.error();
     }
 
     roleWhitelist = hashset<string>();
@@ -659,17 +672,19 @@ void Master::initialize()
     foreach (const string& token, tokens) {
       vector<string> pair = strings::tokenize(token, "=");
       if (pair.size() != 2) {
-        EXIT(1) << "Invalid weight: '" << token << "'. --weights should"
-          "be of the form 'role=weight,role=weight'\n";
+        EXIT(EXIT_FAILURE)
+          << "Invalid weight: '" << token << "'. --weights should"
+          << " be of the form 'role=weight,role=weight'";
       } else if (!isWhitelistedRole(pair[0])) {
-        EXIT(1) << "Invalid weight: '" << token << "'. " << pair[0]
-                << " is not a valid role.";
+        EXIT(EXIT_FAILURE)
+          << "Invalid weight: '" << token << "'. " << pair[0]
+          << " is not a valid role";
       }
 
       double weight = atof(pair[1].c_str());
       if (weight <= 0) {
-        EXIT(1) << "Invalid weight: '" << token
-                << "'. Weights must be positive.";
+        EXIT(EXIT_FAILURE)
+          << "Invalid weight: '" << token << "'. Weights must be positive";
       }
 
       weights[pair[0]] = weight;
@@ -679,8 +694,9 @@ void Master::initialize()
   // Verify the timeout is greater than zero.
   if (flags.offer_timeout.isSome() &&
       flags.offer_timeout.get() <= Duration::zero()) {
-    EXIT(1) << "Invalid value '" << flags.offer_timeout.get() << "' "
-            << "for --offer_timeout: Must be greater than zero.";
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.offer_timeout.get() << "'"
+      << " for --offer_timeout: Must be greater than zero";
   }
 
   // Initialize the allocator.
@@ -1646,14 +1662,15 @@ void Master::recoveredSlavesTimeout(const Registry& registry)
     (1.0 * registry.slaves().slaves().size());
 
   if (removalPercentage > limit) {
-    EXIT(1) << "Post-recovery slave removal limit exceeded! After "
-            << flags.slave_reregister_timeout
-            << " there were " << slaves.recovered.size()
-            << " (" << removalPercentage * 100 << "%) slaves recovered from the"
-            << " registry that did not re-register: \n"
-            << stringify(slaves.recovered) << "\n "
-            << " The configured removal limit is " << limit * 100 << "%. Please"
-            << " investigate or increase this limit to proceed further";
+    EXIT(EXIT_FAILURE)
+      << "Post-recovery slave removal limit exceeded! After "
+      << flags.slave_reregister_timeout
+      << " there were " << slaves.recovered.size()
+      << " (" << removalPercentage * 100 << "%) slaves recovered from the"
+      << " registry that did not re-register: \n"
+      << stringify(slaves.recovered) << "\n "
+      << " The configured removal limit is " << limit * 100 << "%. Please"
+      << " investigate or increase this limit to proceed further";
   }
 
   // Remove the slaves in a rate limited manner, similar to how the
@@ -1766,7 +1783,7 @@ void Master::contended(const Future<Future<Nothing>>& candidacy)
   CHECK(!candidacy.isDiscarded());
 
   if (candidacy.isFailed()) {
-    EXIT(1) << "Failed to contend: " << candidacy.failure();
+    EXIT(EXIT_FAILURE) << "Failed to contend: " << candidacy.failure();
   }
 
   // Watch for candidacy change.
@@ -1780,11 +1797,11 @@ void Master::lostCandidacy(const Future<Nothing>& lost)
   CHECK(!lost.isDiscarded());
 
   if (lost.isFailed()) {
-    EXIT(1) << "Failed to watch for candidacy: " << lost.failure();
+    EXIT(EXIT_FAILURE) << "Failed to watch for candidacy: " << lost.failure();
   }
 
   if (elected()) {
-    EXIT(1) << "Lost leadership... committing suicide!";
+    EXIT(EXIT_FAILURE) << "Lost leadership... committing suicide!";
   }
 
   LOG(INFO) << "Lost candidacy as a follower... Contend again";
@@ -1798,8 +1815,9 @@ void Master::detected(const Future<Option<MasterInfo>>& _leader)
   CHECK(!_leader.isDiscarded());
 
   if (_leader.isFailed()) {
-    EXIT(1) << "Failed to detect the leading master: " << _leader.failure()
-            << "; committing suicide!";
+    EXIT(EXIT_FAILURE)
+      << "Failed to detect the leading master: " << _leader.failure()
+      << "; committing suicide!";
   }
 
   bool wasElected = elected();
@@ -1811,7 +1829,7 @@ void Master::detected(const Future<Option<MasterInfo>>& _leader)
                 : "None");
 
   if (wasElected && !elected()) {
-    EXIT(1) << "Lost leadership... committing suicide!";
+    EXIT(EXIT_FAILURE) << "Lost leadership... committing suicide!";
   }
 
   if (elected()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/sched/sched.cpp
----------------------------------------------------------------------
diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp
index 525255e..ade6907 100644
--- a/src/sched/sched.cpp
+++ b/src/sched/sched.cpp
@@ -294,7 +294,7 @@ protected:
     CHECK(!_master.isDiscarded());
 
     if (_master.isFailed()) {
-      EXIT(1) << "Failed to detect a master: " << _master.failure();
+      EXIT(EXIT_FAILURE) << "Failed to detect a master: " << _master.failure();
     }
 
     if (_master.get().isSome()) {
@@ -392,8 +392,9 @@ protected:
       Try<Authenticatee*> module =
         modules::ModuleManager::create<Authenticatee>(flags.authenticatee);
       if (module.isError()) {
-        EXIT(1) << "Could not create authenticatee module '"
-                << flags.authenticatee << "': " << module.error();
+        EXIT(EXIT_FAILURE)
+          << "Could not create authenticatee module '"
+          << flags.authenticatee << "': " << module.error();
       }
       LOG(INFO) << "Using '" << flags.authenticatee << "' authenticatee";
       authenticatee = module.get();

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index 6a83447..1f52a42 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -146,7 +146,7 @@ public:
     Try<Nothing> load = flags.load("MESOS_");
 
     if (load.isError()) {
-      EXIT(1) << "Failed to load flags: " << load.error();
+      EXIT(EXIT_FAILURE) << "Failed to load flags: " << load.error();
     }
 
     // Initialize libprocess (done here since at some point we might
@@ -183,7 +183,8 @@ public:
         MasterDetector::create(pid.isSome() ? string(pid.get()) : master);
 
       if (create.isError()) {
-        EXIT(1) << "Failed to create a master detector: " << create.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to create a master detector: " << create.error();
       }
 
       detector.reset(create.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/slave/containerizer/mesos/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.cpp b/src/slave/containerizer/mesos/launcher.cpp
index c4ae1c5..ba012b1 100644
--- a/src/slave/containerizer/mesos/launcher.cpp
+++ b/src/slave/containerizer/mesos/launcher.cpp
@@ -91,7 +91,7 @@ static int childSetup(const Option<lambda::function<int()>>& setup)
   // mesos-containerizer launch).
   if (::setsid() == -1) {
     perror("Failed to put child in a new session");
-    _exit(1);
+    _exit(EXIT_FAILURE);
   }
 
   if (setup.isSome()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/slave/containerizer/mesos/provisioner/store.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/store.cpp b/src/slave/containerizer/mesos/provisioner/store.cpp
index 8324269..7141d63 100644
--- a/src/slave/containerizer/mesos/provisioner/store.cpp
+++ b/src/slave/containerizer/mesos/provisioner/store.cpp
@@ -71,10 +71,10 @@ Try<hashmap<Image::Type, Owned<Store>>> Store::create(const Flags& flags)
 
   if (stores.contains(Image::DOCKER) &&
       !strings::contains(flags.isolation, "docker/runtime")) {
-    EXIT(1)
-      << "Docker runtime isolator has to be specified if 'DOCKER' is included "
-      << "in 'image_providers'. Please add 'docker/runtime' to '--isolation' "
-      << "flags";
+    EXIT(EXIT_FAILURE)
+      << "Docker runtime isolator has to be specified if 'DOCKER' is included"
+      << " in 'image_providers'. Please add 'docker/runtime' to '--isolation'"
+      << " flags";
   }
 
   return stores;

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 6954f86..08ff1ed 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -228,9 +228,9 @@ void Slave::initialize()
           flags.cgroups_root);
 
       if (hierarchy.isError()) {
-        EXIT(1) << "Failed to prepare cgroup " << flags.cgroups_root
-                << " for subsystem " << subsystem
-                << ": " << hierarchy.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to prepare cgroup " << flags.cgroups_root
+          << " for subsystem " << subsystem << ": " << hierarchy.error();
       }
 
       // Create a cgroup for the slave.
@@ -238,19 +238,21 @@ void Slave::initialize()
 
       Try<bool> exists = cgroups::exists(hierarchy.get(), cgroup);
       if (exists.isError()) {
-        EXIT(1) << "Failed to find cgroup " << cgroup
-                << " for subsystem " << subsystem
-                << " under hierarchy " << hierarchy.get()
-                << " for slave: " << exists.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to find cgroup " << cgroup
+          << " for subsystem " << subsystem
+          << " under hierarchy " << hierarchy.get()
+          << " for slave: " << exists.error();
       }
 
       if (!exists.get()) {
         Try<Nothing> create = cgroups::create(hierarchy.get(), cgroup);
         if (create.isError()) {
-          EXIT(1) << "Failed to create cgroup " << cgroup
-                  << " for subsystem " << subsystem
-                  << " under hierarchy " << hierarchy.get()
-                  << " for slave: " << create.error();
+          EXIT(EXIT_FAILURE)
+            << "Failed to create cgroup " << cgroup
+            << " for subsystem " << subsystem
+            << " under hierarchy " << hierarchy.get()
+            << " for slave: " << create.error();
         }
       }
 
@@ -258,10 +260,11 @@ void Slave::initialize()
       // indicates a prior slave (or child process) is still running.
       Try<set<pid_t>> processes = cgroups::processes(hierarchy.get(), cgroup);
       if (processes.isError()) {
-        EXIT(1) << "Failed to check for existing threads in cgroup " << cgroup
-                << " for subsystem " << subsystem
-                << " under hierarchy " << hierarchy.get()
-                << " for slave: " << processes.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to check for existing threads in cgroup " << cgroup
+          << " for subsystem " << subsystem
+          << " under hierarchy " << hierarchy.get()
+          << " for slave: " << processes.error();
       }
 
       // Log if there are any processes in the slave's cgroup. They
@@ -300,19 +303,21 @@ void Slave::initialize()
       // Move all of our threads into the cgroup.
       Try<Nothing> assign = cgroups::assign(hierarchy.get(), cgroup, getpid());
       if (assign.isError()) {
-        EXIT(1) << "Failed to move slave into cgroup " << cgroup
-                << " for subsystem " << subsystem
-                << " under hierarchy " << hierarchy.get()
-                << " for slave: " << assign.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to move slave into cgroup " << cgroup
+          << " for subsystem " << subsystem
+          << " under hierarchy " << hierarchy.get()
+          << " for slave: " << assign.error();
       }
     }
   }
 #endif // __linux__
 
   if (flags.registration_backoff_factor > REGISTER_RETRY_INTERVAL_MAX) {
-    EXIT(1) << "Invalid value '" << flags.registration_backoff_factor << "' "
-            << "for --registration_backoff_factor: "
-            << "Must be less than " << REGISTER_RETRY_INTERVAL_MAX;
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.registration_backoff_factor << "'"
+      << " for --registration_backoff_factor:"
+      << " Must be less than " << REGISTER_RETRY_INTERVAL_MAX;
   }
 
   authenticateeName = flags.authenticatee;
@@ -322,10 +327,11 @@ void Slave::initialize()
     Result<Credential> _credential =
       credentials::readCredential(flags.credential.get());
     if (_credential.isError()) {
-      EXIT(1) << _credential.error() << " (see --credential flag)";
+      EXIT(EXIT_FAILURE) << _credential.error() << " (see --credential flag)";
     } else if (_credential.isNone()) {
-      EXIT(1) << "Empty credential file '" << flags.credential.get()
-              << "' (see --credential flag)";
+      EXIT(EXIT_FAILURE)
+        << "Empty credential file '" << flags.credential.get() << "'"
+        << " (see --credential flag)";
     } else {
       credential = _credential.get();
       LOG(INFO) << "Slave using credential for: "
@@ -340,18 +346,19 @@ void Slave::initialize()
   // be filled in. Passing an empty string into the `http_authenticators` flag
   // is considered an error.
   if (httpAuthenticatorNames.empty()) {
-    EXIT(1) << "No HTTP authenticator specified";
+    EXIT(EXIT_FAILURE) << "No HTTP authenticator specified";
   }
   if (httpAuthenticatorNames.size() > 1) {
-    EXIT(1) << "Multiple HTTP authenticators not supported";
+    EXIT(EXIT_FAILURE) << "Multiple HTTP authenticators not supported";
   }
   if (httpAuthenticatorNames[0] != DEFAULT_HTTP_AUTHENTICATOR &&
       !modules::ModuleManager::contains<authentication::Authenticator>(
           httpAuthenticatorNames[0])) {
-    EXIT(1) << "HTTP authenticator '" << httpAuthenticatorNames[0]
-            << "' not found. Check the spelling (compare to '"
-            << DEFAULT_HTTP_AUTHENTICATOR << "') or verify that the "
-            << "authenticator was loaded successfully (see --modules)";
+    EXIT(EXIT_FAILURE)
+      << "HTTP authenticator '" << httpAuthenticatorNames[0] << "'"
+      << " not found. Check the spelling (compare to '"
+      << DEFAULT_HTTP_AUTHENTICATOR << "') or verify that the"
+      << " authenticator was loaded successfully (see --modules)";
   }
 
   if (flags.authenticate_http) {
@@ -364,17 +371,19 @@ void Slave::initialize()
         Result<Credentials> credentials =
           credentials::read(flags.http_credentials.get());
         if (credentials.isError()) {
-          EXIT(1) << credentials.error() << " (see --http_credentials flag)";
+          EXIT(EXIT_FAILURE)
+            << credentials.error() << " (see --http_credentials flag)";
         } else if (credentials.isNone()) {
-          EXIT(1) << "Credentials file must contain at least one credential"
-                  << " (see --http_credentials flag)";
+          EXIT(EXIT_FAILURE)
+            << "Credentials file must contain at least one credential"
+            << " (see --http_credentials flag)";
         }
 
         httpCredentials = credentials.get();
       } else {
-        EXIT(1) << "No credentials provided for the default '"
-                << DEFAULT_HTTP_AUTHENTICATOR
-                << "' HTTP authenticator";
+        EXIT(EXIT_FAILURE)
+          << "No credentials provided for the default '"
+          << DEFAULT_HTTP_AUTHENTICATOR << "' HTTP authenticator";
       }
 
       LOG(INFO) << "Using default '" << DEFAULT_HTTP_AUTHENTICATOR
@@ -385,24 +394,27 @@ void Slave::initialize()
             DEFAULT_HTTP_AUTHENTICATION_REALM,
             httpCredentials);
       if (authenticator.isError()) {
-        EXIT(1) << "Could not create HTTP authenticator module '"
-                << httpAuthenticatorNames[0] << "': " << authenticator.error();
+        EXIT(EXIT_FAILURE)
+          << "Could not create HTTP authenticator module '"
+          << httpAuthenticatorNames[0] << "': " << authenticator.error();
       }
 
       httpAuthenticator = authenticator.get();
     } else {
       if (flags.http_credentials.isSome()) {
-        EXIT(1) << "The '--http_credentials' flag is only used by the default "
-                << "basic HTTP authenticator, but a custom authenticator "
-                << "module was specified via '--http_authenticators'";
+        EXIT(EXIT_FAILURE)
+          << "The '--http_credentials' flag is only used by the default"
+          << " basic HTTP authenticator, but a custom authenticator"
+          << " module was specified via '--http_authenticators'";
       }
 
       Try<authentication::Authenticator*> module =
         modules::ModuleManager::create<authentication::Authenticator>(
             httpAuthenticatorNames[0]);
       if (module.isError()) {
-        EXIT(1) << "Could not create HTTP authenticator module '"
-                << httpAuthenticatorNames[0] << "': " << module.error();
+        EXIT(EXIT_FAILURE)
+          << "Could not create HTTP authenticator module '"
+          << httpAuthenticatorNames[0] << "': " << module.error();
       }
 
       LOG(INFO) << "Using '" << httpAuthenticatorNames[0]
@@ -412,8 +424,9 @@ void Slave::initialize()
     }
 
     if (httpAuthenticator == NULL) {
-      EXIT(1) << "An error occurred while initializing the '"
-              << httpAuthenticatorNames[0] << "' HTTP authenticator";
+      EXIT(EXIT_FAILURE)
+        << "An error occurred while initializing the '"
+        << httpAuthenticatorNames[0] << "' HTTP authenticator";
     }
 
     // Ownership of the `httpAuthenticator` is passed to libprocess.
@@ -421,32 +434,35 @@ void Slave::initialize()
         DEFAULT_HTTP_AUTHENTICATION_REALM,
         Owned<authentication::Authenticator>(httpAuthenticator));
   } else if (flags.http_credentials.isSome()) {
-    EXIT(1) << "The '--http_credentials' flag was provided, but HTTP "
-            << "authentication was not enabled via '--authenticate_http'";
+    EXIT(EXIT_FAILURE)
+      << "The '--http_credentials' flag was provided, but HTTP"
+      << " authentication was not enabled via '--authenticate_http'";
   } else if (httpAuthenticatorNames[0] != DEFAULT_HTTP_AUTHENTICATOR) {
-    EXIT(1) << "A custom HTTP authenticator was specified with the "
-            << "'--http_authenticators' flag, but HTTP authentication was not "
-            << "enabled via '--authenticate_http'";
+    EXIT(EXIT_FAILURE)
+      << "A custom HTTP authenticator was specified with the"
+      << " '--http_authenticators' flag, but HTTP authentication was not"
+      << " enabled via '--authenticate_http'";
   }
 
   if ((flags.gc_disk_headroom < 0) || (flags.gc_disk_headroom > 1)) {
-    EXIT(1) << "Invalid value '" << flags.gc_disk_headroom
-            << "' for --gc_disk_headroom. Must be between 0.0 and 1.0.";
+    EXIT(EXIT_FAILURE)
+      << "Invalid value '" << flags.gc_disk_headroom << "'"
+      << " for --gc_disk_headroom. Must be between 0.0 and 1.0";
   }
 
   Try<Nothing> initialize =
     resourceEstimator->initialize(defer(self(), &Self::usage));
 
   if (initialize.isError()) {
-    EXIT(1) << "Failed to initialize the resource estimator: "
-            << initialize.error();
+    EXIT(EXIT_FAILURE)
+      << "Failed to initialize the resource estimator: " << initialize.error();
   }
 
   initialize = qosController->initialize(defer(self(), &Self::usage));
 
   if (initialize.isError()) {
-    EXIT(1) << "Failed to initialize the QoS Controller: "
-            << initialize.error();
+    EXIT(EXIT_FAILURE)
+      << "Failed to initialize the QoS Controller: " << initialize.error();
   }
 
   // Ensure slave work directory exists.
@@ -455,7 +471,8 @@ void Slave::initialize()
 
   Try<Resources> resources = Containerizer::resources(flags);
   if (resources.isError()) {
-    EXIT(1) << "Failed to determine slave resources: " << resources.error();
+    EXIT(EXIT_FAILURE)
+      << "Failed to determine slave resources: " << resources.error();
   }
 
   // Ensure disk `source`s are accessible.
@@ -473,8 +490,9 @@ void Slave::initialize()
         os::mkdir(source.path().root(), true);
 
       if (mkdir.isError()) {
-        EXIT(1) << "Failed to create DiskInfo path directory '"
-                << source.path().root() << "': " << mkdir.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to create DiskInfo path directory '"
+          << source.path().root() << "': " << mkdir.error();
       }
     } else if (source.type() == Resource::DiskInfo::Source::MOUNT) {
       CHECK(source.has_mount());
@@ -492,7 +510,7 @@ void Slave::initialize()
       Result<string> realpath = os::realpath(source.mount().root());
 
       if (!realpath.isSome()) {
-        EXIT(1)
+        EXIT(EXIT_FAILURE)
           << "Failed to determine `realpath` for DiskInfo mount in resource '"
           << resource << "' with path '" << source.mount().root() << "': "
           << (realpath.isError() ? realpath.error() : "no such path");
@@ -501,8 +519,9 @@ void Slave::initialize()
       // TODO(jmlvanre): Consider moving this out of the for loop.
       Try<fs::MountTable> mountTable = fs::MountTable::read("/proc/mounts");
       if (mountTable.isError()) {
-        EXIT(1) << "Failed to open mount table to verify mounts: "
-                << mountTable.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to open mount table to verify mounts: "
+          << mountTable.error();
       }
 
       bool foundEntry = false;
@@ -514,17 +533,19 @@ void Slave::initialize()
       }
 
       if (!foundEntry) {
-        EXIT(1) << "Failed to found mount '" << realpath.get()
-                << "' in /proc/mounts";
+        EXIT(EXIT_FAILURE)
+          << "Failed to found mount '" << realpath.get() << "' in /proc/mounts";
       }
 #else // __linux__
       // On other platforms we test whether that provided `root` exists.
       if (!os::exists(source.mount().root())) {
-        EXIT(1) << "Failed to find mount point '" << source.mount().root();
+        EXIT(EXIT_FAILURE)
+          << "Failed to find mount point '" << source.mount().root() << "'";
       }
 #endif // __linux__
     } else {
-      EXIT(1) << "Unsupported 'DiskInfo.Source.Type' in '" << resource << "'";
+      EXIT(EXIT_FAILURE)
+        << "Unsupported 'DiskInfo.Source.Type' in '" << resource << "'";
     }
   }
 
@@ -741,8 +762,9 @@ void Slave::initialize()
 
   // Check that the recover flag is valid.
   if (flags.recover != "reconnect" && flags.recover != "cleanup") {
-    EXIT(1) << "Unknown option for 'recover' flag " << flags.recover
-            << ". Please run the slave with '--help' to see the valid options";
+    EXIT(EXIT_FAILURE)
+      << "Unknown option for 'recover' flag " << flags.recover << "."
+      << " Please run the slave with '--help' to see the valid options";
   }
 
   struct sigaction action;
@@ -761,7 +783,7 @@ void Slave::initialize()
   action.sa_sigaction = signalHandler;
 
   if (sigaction(SIGUSR1, &action, NULL) < 0) {
-    EXIT(1) << "Failed to set sigaction: " << os::strerror(errno);
+    EXIT(EXIT_FAILURE) << "Failed to set sigaction: " << os::strerror(errno);
   }
 
   // Do recovery.
@@ -885,7 +907,7 @@ void Slave::detected(const Future<Option<MasterInfo>>& _master)
   statusUpdateManager->pause();
 
   if (_master.isFailed()) {
-    EXIT(1) << "Failed to detect a master: " << _master.failure();
+    EXIT(EXIT_FAILURE) << "Failed to detect a master: " << _master.failure();
   }
 
   Option<MasterInfo> latest;
@@ -976,8 +998,9 @@ void Slave::authenticate()
     Try<Authenticatee*> module =
       modules::ModuleManager::create<Authenticatee>(authenticateeName);
     if (module.isError()) {
-      EXIT(1) << "Could not create authenticatee module '"
-              << authenticateeName << "': " << module.error();
+      EXIT(EXIT_FAILURE)
+        << "Could not create authenticatee module '"
+        << authenticateeName << "': " << module.error();
     }
     LOG(INFO) << "Using '" << authenticateeName << "' authenticatee";
     authenticatee = module.get();
@@ -1030,7 +1053,8 @@ void Slave::_authenticate()
   if (!future.get()) {
     // For refused authentication, we exit instead of doing a shutdown
     // to keep possibly active executors running.
-    EXIT(1) << "Master " << master.get() << " refused authentication";
+    EXIT(EXIT_FAILURE)
+      << "Master " << master.get() << " refused authentication";
   }
 
   LOG(INFO) << "Successfully authenticated with master " << master.get();
@@ -1119,8 +1143,9 @@ void Slave::registered(
     case RUNNING:
       // Already registered!
       if (!(info.id() == slaveId)) {
-       EXIT(1) << "Registered but got wrong id: " << slaveId
-               << "(expected: " << info.id() << "). Committing suicide";
+       EXIT(EXIT_FAILURE)
+         << "Registered but got wrong id: " << slaveId
+         << " (expected: " << info.id() << "). Committing suicide";
       }
       LOG(WARNING) << "Already registered with master " << master.get();
 
@@ -1165,8 +1190,9 @@ void Slave::reregistered(
   CHECK_SOME(master);
 
   if (!(info.id() == slaveId)) {
-    EXIT(1) << "Re-registered but got wrong id: " << slaveId
-            << "(expected: " << info.id() << "). Committing suicide";
+    EXIT(EXIT_FAILURE)
+      << "Re-registered but got wrong id: " << slaveId
+      << " (expected: " << info.id() << "). Committing suicide";
   }
 
   if (connection.has_total_ping_timeout_seconds()) {
@@ -4662,7 +4688,7 @@ Future<Nothing> Slave::_recover()
 void Slave::__recover(const Future<Nothing>& future)
 {
   if (!future.isReady()) {
-    EXIT(1)
+    EXIT(EXIT_FAILURE)
       << "Failed to perform recovery: "
       << (future.isFailed() ? future.failure() : "future discarded") << "\n"
       << "To remedy this do as follows:\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/tests/cluster.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.cpp b/src/tests/cluster.cpp
index 22167da..2da0bd7 100644
--- a/src/tests/cluster.cpp
+++ b/src/tests/cluster.cpp
@@ -498,19 +498,21 @@ void Slave::wait()
 
       Try<bool> exists = cgroups::exists(hierarchy, cgroup);
       if (exists.isError() || !exists.get()) {
-        EXIT(1) << "Failed to find cgroup " << cgroup
-                << " for subsystem " << subsystem
-                << " under hierarchy " << hierarchy
-                << " for slave: " + exists.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to find cgroup " << cgroup
+          << " for subsystem " << subsystem
+          << " under hierarchy " << hierarchy
+          << " for slave: " + exists.error();
       }
 
       // Move all of our threads into the root cgroup.
       Try<Nothing> assign = cgroups::assign(hierarchy, "", getpid());
       if (assign.isError()) {
-        EXIT(1) << "Failed to move slave threads into cgroup " << cgroup
-                << " for subsystem " << subsystem
-                << " under hierarchy " << hierarchy
-                << " for slave: " + assign.error();
+        EXIT(EXIT_FAILURE)
+          << "Failed to move slave threads into cgroup " << cgroup
+          << " for subsystem " << subsystem
+          << " under hierarchy " << hierarchy
+          << " for slave: " + assign.error();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/tests/containerizer/cgroups_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cgroups_tests.cpp b/src/tests/containerizer/cgroups_tests.cpp
index acaed9b..b29ce09 100644
--- a/src/tests/containerizer/cgroups_tests.cpp
+++ b/src/tests/containerizer/cgroups_tests.cpp
@@ -472,7 +472,7 @@ TEST_F(CgroupsAnyHierarchyTest, ROOT_CGROUPS_Write)
     while (write(STDERR_FILENO, message, strlen(message)) == -1 &&
            errno == EINTR);
 
-    _exit(1);
+    _exit(EXIT_FAILURE);
   }
 
   // In parent process.

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a9fd2a0/src/tests/environment.cpp
----------------------------------------------------------------------
diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp
index ee59a09..7617e43 100644
--- a/src/tests/environment.cpp
+++ b/src/tests/environment.cpp
@@ -749,7 +749,7 @@ void Environment::SetUp()
   }
 
   if (!GTEST_IS_THREADSAFE) {
-    EXIT(1) << "Testing environment is not thread safe, bailing!";
+    EXIT(EXIT_FAILURE) << "Testing environment is not thread safe, bailing!";
   }
 }
 


[2/3] mesos git commit: Replaced EXIT(1) with EXIT(EXIT_FAILURE) in libprocess.

Posted by al...@apache.org.
Replaced EXIT(1) with EXIT(EXIT_FAILURE) in libprocess.

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


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

Branch: refs/heads/master
Commit: e1c9ec4b522056984c38c83830bd53f6e4fbb8f6
Parents: bbe7638
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Mar 7 14:02:22 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Mar 24 12:46:56 2016 +0100

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/gmock.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e1c9ec4b/3rdparty/libprocess/include/process/gmock.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gmock.hpp b/3rdparty/libprocess/include/process/gmock.hpp
index 15b982f..8b98249 100644
--- a/3rdparty/libprocess/include/process/gmock.hpp
+++ b/3rdparty/libprocess/include/process/gmock.hpp
@@ -275,7 +275,7 @@ public:
   TestsFilter* install()
   {
     if (!started) {
-      EXIT(1)
+      EXIT(EXIT_FAILURE)
         << "To use FUTURE/DROP_MESSAGE/DISPATCH, etc. you need to do the "
         << "following before you invoke RUN_ALL_TESTS():\n\n"
         << "\t::testing::TestEventListeners& listeners =\n"


[3/3] mesos git commit: Replaced EXIT(1) with EXIT(EXIT_FAILURE) in stout.

Posted by al...@apache.org.
Replaced EXIT(1) with EXIT(EXIT_FAILURE) in stout.

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


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

Branch: refs/heads/master
Commit: bbe7638255e04a5870b301baaec9b77319eb8bfe
Parents: b87f01b
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Mar 7 14:02:08 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Mar 24 12:46:56 2016 +0100

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/exit.hpp    | 2 +-
 .../libprocess/3rdparty/stout/include/stout/flags/flags.hpp  | 8 +++++---
 .../3rdparty/stout/include/stout/os/posix/fork.hpp           | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bbe76382/3rdparty/libprocess/3rdparty/stout/include/stout/exit.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/exit.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/exit.hpp
index 061e167..762864a 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/exit.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/exit.hpp
@@ -27,7 +27,7 @@
 // exiting. This is like glog's LOG(FATAL) or CHECK, except that it
 // does _not_ print a stack trace.
 //
-// Ex: EXIT(1) << "Cgroups are not present in this system.";
+// Ex: EXIT(EXIT_FAILURE) << "Cgroups are not present in this system.";
 #define EXIT(status) __Exit(status).stream()
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/bbe76382/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
index 96ffc42..3e43c01 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
@@ -503,10 +503,12 @@ void FlagsBase::add(
 inline void FlagsBase::add(const Flag& flag)
 {
   if (flags_.count(flag.name) > 0) {
-    EXIT(1) << "Attempted to add duplicate flag '" << flag.name << "'";
+    EXIT(EXIT_FAILURE)
+      << "Attempted to add duplicate flag '" << flag.name << "'";
   } else if (flag.name.find("no-") == 0) {
-    EXIT(1) << "Attempted to add flag '" << flag.name
-            << "' that starts with the reserved 'no-' prefix";
+    EXIT(EXIT_FAILURE)
+      << "Attempted to add flag '" << flag.name
+      << "' that starts with the reserved 'no-' prefix";
   }
 
   flags_[flag.name] = flag;

http://git-wip-us.apache.org/repos/asf/mesos/blob/bbe76382/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp
index 8d8ed0b..a6e6767 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp
@@ -369,8 +369,8 @@ private:
       // Execute the command (via '/bin/sh -c command').
       const char* command = exec.get().command.c_str();
       execlp("sh", "sh", "-c", command, (char*) NULL);
-      EXIT(1) << "Failed to execute '" << command
-              << "': " << os::strerror(errno);
+      EXIT(EXIT_FAILURE)
+        << "Failed to execute '" << command << "': " << os::strerror(errno);
     } else if (wait.isSome()) {
       foreach (pid_t pid, pids) {
         // TODO(benh): Check for signal interruption or other errors.