You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/08/14 05:52:55 UTC
[1/4] git commit: Updated subprocess to use os::execvpe.
Repository: mesos
Updated Branches:
refs/heads/master 5a7f66e13 -> 93c39b89e
Updated subprocess to use os::execvpe.
Review: https://reviews.apache.org/r/24681
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/49e94f3a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/49e94f3a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/49e94f3a
Branch: refs/heads/master
Commit: 49e94f3abbc9a04cc8896f61e55975fbae5d888e
Parents: bc5ab04
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 13 16:26:28 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Aug 13 20:52:34 2014 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/subprocess.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/49e94f3a/3rdparty/libprocess/src/subprocess.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess.cpp b/3rdparty/libprocess/src/subprocess.cpp
index 68bfd5d..5b92200 100644
--- a/3rdparty/libprocess/src/subprocess.cpp
+++ b/3rdparty/libprocess/src/subprocess.cpp
@@ -160,9 +160,9 @@ static int childMain(
}
}
- execve(path.c_str(), argv, (*envp)());
+ os::execvpe(path.c_str(), argv, (*envp)());
- ABORT("Failed to execve in childMain\n");
+ ABORT("Failed to os::execvpe in childMain\n");
return UNREACHABLE();
}
@@ -315,8 +315,8 @@ Try<Subprocess> subprocess(
}
}
- // The real arguments that will be passed to 'execve'. We need to
- // construct them here before doing the clone as it might not be
+ // The real arguments that will be passed to 'os::execvpe'. We need
+ // to construct them here before doing the clone as it might not be
// async signal safe.
char** _argv = new char*[argv.size() + 1];
for (int i = 0; i < argv.size(); i++) {
[2/4] git commit: Added os::execvpe to stout.
Posted by ji...@apache.org.
Added os::execvpe to stout.
Review: https://reviews.apache.org/r/24679
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bc5ab04d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bc5ab04d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bc5ab04d
Branch: refs/heads/master
Commit: bc5ab04d780af836ae8b0d2a9b3a7bf14b80766d
Parents: 5a7f66e
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 13 15:50:34 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Aug 13 20:52:34 2014 -0700
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/os.hpp | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/bc5ab04d/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
index 4d67186..5bbf829 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
@@ -114,6 +114,22 @@ inline char** environ()
}
+// Returns the address of os::environ().
+inline char*** environp()
+{
+ // Accessing the list of environment variables is platform-specific.
+ // On OS X, the 'environ' symbol isn't visible to shared libraries,
+ // so we must use the _NSGetEnviron() function (see 'man environ' on
+ // OS X). On other platforms, it's fine to access 'environ' from
+ // shared libraries.
+#ifdef __APPLE__
+ return _NSGetEnviron();
+#else
+ return &::environ;
+#endif
+}
+
+
inline hashmap<std::string, std::string> environment()
{
char** environ = os::environ();
@@ -578,6 +594,27 @@ inline int system(const std::string& command)
}
+// This function is a portable version of execvpe ('p' means searching
+// executable from PATH and 'e' means setting environments). We add
+// this function because it is not available on all systems.
+//
+// NOTE: This function is not thread safe. It is supposed to be used
+// only after fork (when there is only one thread). This function is
+// async signal safe.
+inline int execvpe(const char* file, char** argv, char** envp)
+{
+ char** saved = os::environ();
+
+ *os::environp() = envp;
+
+ int result = execvp(file, argv);
+
+ *os::environp() = saved;
+
+ return result;
+}
+
+
// Changes the specified path's user and group ownership to that of
// the specified user..
inline Try<Nothing> chown(
[3/4] git commit: Updated mesos to use os::execvpe.
Posted by ji...@apache.org.
Updated mesos to use os::execvpe.
Review: https://reviews.apache.org/r/24682
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8efdb510
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8efdb510
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8efdb510
Branch: refs/heads/master
Commit: 8efdb5107391876083383730610e94311d1f3b80
Parents: 49e94f3
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 13 16:28:38 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Aug 13 20:52:35 2014 -0700
----------------------------------------------------------------------
src/health-check/main.cpp | 2 +-
src/launcher/executor.cpp | 2 +-
src/slave/containerizer/mesos/launch.cpp | 4 ++--
src/tests/health_check_tests.cpp | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/8efdb510/src/health-check/main.cpp
----------------------------------------------------------------------
diff --git a/src/health-check/main.cpp b/src/health-check/main.cpp
index 730a7a2..a4ce742 100644
--- a/src/health-check/main.cpp
+++ b/src/health-check/main.cpp
@@ -176,7 +176,7 @@ private:
Subprocess::FD(STDERR_FILENO),
environment);
} else {
- // Use the execve variant.
+ // Use the exec variant.
if (!command.has_value()) {
promise.fail("Executable path is not specified");
return;
http://git-wip-us.apache.org/repos/asf/mesos/blob/8efdb510/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index 9b767a5..1aa2c99 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -452,7 +452,7 @@ private:
if (task.has_health_check()) {
JSON::Object json = JSON::Protobuf(task.health_check());
- // Launch the subprocess using 'execve' style so that quotes can
+ // Launch the subprocess using 'exec' style so that quotes can
// be properly handled.
vector<string> argv(4);
argv[0] = "mesos-health-check";
http://git-wip-us.apache.org/repos/asf/mesos/blob/8efdb510/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index 35b57b3..9819381 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -232,14 +232,14 @@ int MesosContainerizerLaunch::execute()
(char*) NULL,
envp());
} else {
- // Use execve to launch the command.
+ // Use os::execvpe to launch the command.
char** argv = new char*[command.get().arguments().size() + 1];
for (int i = 0; i < command.get().arguments().size(); i++) {
argv[i] = strdup(command.get().arguments(i).c_str());
}
argv[command.get().arguments().size()] = NULL;
- execve(command.get().value().c_str(), argv, envp());
+ os::execvpe(command.get().value().c_str(), argv, envp());
}
// If we get here, the execle call failed.
http://git-wip-us.apache.org/repos/asf/mesos/blob/8efdb510/src/tests/health_check_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/health_check_tests.cpp b/src/tests/health_check_tests.cpp
index b6d7fa8..aed1101 100644
--- a/src/tests/health_check_tests.cpp
+++ b/src/tests/health_check_tests.cpp
@@ -230,7 +230,7 @@ TEST_F(HealthCheckTest, HealthyTaskNonShell)
CommandInfo command;
command.set_shell(false);
- command.set_value("/bin/true");
+ command.set_value("true");
command.add_arguments("true");
vector<TaskInfo> tasks =
[4/4] git commit: Fixed the flaky SlaveRecoveryTest.ShutdownSlave.
Posted by ji...@apache.org.
Fixed the flaky SlaveRecoveryTest.ShutdownSlave.
Review: https://reviews.apache.org/r/24678
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/93c39b89
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/93c39b89
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/93c39b89
Branch: refs/heads/master
Commit: 93c39b89e031acd227da23e1088f306b45caa9b2
Parents: 8efdb51
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 13 16:44:26 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Aug 13 20:52:35 2014 -0700
----------------------------------------------------------------------
src/tests/slave_recovery_tests.cpp | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/93c39b89/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index b53353c..357edfc 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -1748,6 +1748,9 @@ TYPED_TEST(SlaveRecoveryTest, ShutdownSlave)
Clock::resume();
+ EXPECT_CALL(sched, slaveLost(_, _))
+ .Times(AtMost(1));
+
this->Stop(slave.get(), true); // Send a "shut down".
delete containerizer1.get();