You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/11/13 18:11:48 UTC
[3/5] mesos git commit: Replaced strerror calls in stout with
os::strerror.
Replaced strerror calls in stout with os::strerror.
Review: https://reviews.apache.org/r/39006
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2fe9f6b6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2fe9f6b6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2fe9f6b6
Branch: refs/heads/master
Commit: 2fe9f6b60e2b6a253b3504053e188c5e034a1e97
Parents: a9dbf21
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Fri Nov 13 17:26:14 2015 +0100
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Fri Nov 13 17:54:18 2015 +0100
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp | 8 ++++----
3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp | 4 ++--
.../3rdparty/stout/include/stout/os/posix/fork.hpp | 8 +++++---
.../libprocess/3rdparty/stout/tests/os/sendfile_tests.cpp | 6 +++---
3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp | 2 +-
5 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fe9f6b6/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
index 12ba1ca..1845b1e 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
@@ -15,10 +15,11 @@
#define __STOUT_ERROR_HPP__
#include <errno.h>
-#include <string.h> // For strerror.
#include <string>
+#include <stout/os/strerror.hpp>
+
// A useful type that can be used to represent a Try that has
// failed. You can also use 'ErrnoError' to append the error message
// associated with the current 'errno' to your own error message.
@@ -44,11 +45,10 @@ public:
class ErrnoError : public Error
{
public:
- ErrnoError()
- : Error(std::string(strerror(errno))) {}
+ ErrnoError() : Error(os::strerror(errno)) {}
ErrnoError(const std::string& message)
- : Error(message + ": " + std::string(strerror(errno))) {}
+ : Error(message + ": " + os::strerror(errno)) {}
};
#endif // __STOUT_ERROR_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fe9f6b6/3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp
index dc7c652..6709f5e 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp
@@ -55,6 +55,7 @@
#include <stout/none.hpp>
#include <stout/numify.hpp>
#include <stout/option.hpp>
+#include <stout/os/strerror.hpp>
#include <stout/result.hpp>
#include <stout/stringify.hpp>
#include <stout/strings.hpp>
@@ -242,8 +243,7 @@ inline std::ostream& operator<<(std::ostream& stream, const IP& ip)
// We do not expect inet_ntop to fail because all parameters
// passed in are valid.
ABORT("Failed to get human-readable IP for " +
- stringify(ntohl(in.s_addr)) +
- ": " + strerror(errno));
+ stringify(ntohl(in.s_addr)) + ": " + os::strerror(errno));
}
stream << buffer;
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fe9f6b6/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 1baf142..a5719bd 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/fork.hpp
@@ -31,6 +31,7 @@
#include <stout/error.hpp>
#include <stout/exit.hpp>
#include <stout/foreach.hpp>
+#include <stout/os/strerror.hpp>
#include <stout/stringify.hpp>
#include <stout/try.hpp>
@@ -262,11 +263,11 @@ private:
void operator()(Tree::Memory* process) const
{
if (munmap(process, sizeof(Tree::Memory)) == -1) {
- ABORT(std::string("Failed to unmap memory: ") + strerror(errno));
+ ABORT(std::string("Failed to unmap memory: ") + os::strerror(errno));
}
if (::close(fd) == -1) {
ABORT(std::string("Failed to close shared memory file descriptor: ") +
- strerror(errno));
+ os::strerror(errno));
}
}
@@ -366,7 +367,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 << "': " << strerror(errno);
+ EXIT(1) << "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.
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fe9f6b6/3rdparty/libprocess/3rdparty/stout/tests/os/sendfile_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/os/sendfile_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/os/sendfile_tests.cpp
index e740d5b..0a0fbaa 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os/sendfile_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os/sendfile_tests.cpp
@@ -61,7 +61,7 @@ TEST_F(OsSendfileTest, Sendfile)
// Construct a socket pair and use sendfile to transmit the text.
int s[2];
- ASSERT_NE(-1, socketpair(AF_UNIX, SOCK_STREAM, 0, s)) << strerror(errno);
+ ASSERT_NE(-1, socketpair(AF_UNIX, SOCK_STREAM, 0, s)) << os::strerror(errno);
ASSERT_EQ(
LOREM_IPSUM.size(),
os::sendfile(s[0], fd.get(), 0, LOREM_IPSUM.size()));
@@ -82,9 +82,9 @@ TEST_F(OsSendfileTest, Sendfile)
ASSERT_EQ(-1, result);
#ifdef __linux__
- ASSERT_EQ(EPIPE, _errno) << strerror(_errno);
+ ASSERT_EQ(EPIPE, _errno) << os::strerror(_errno);
#elif defined __APPLE__
- ASSERT_EQ(ENOTCONN, _errno) << strerror(_errno);
+ ASSERT_EQ(ENOTCONN, _errno) << os::strerror(_errno);
#endif
ASSERT_SOME(os::close(fd.get()));
http://git-wip-us.apache.org/repos/asf/mesos/blob/2fe9f6b6/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
index 5a1da57..8791cfe 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp
@@ -543,7 +543,7 @@ TEST_F(OsTest, Processes)
void dosetsid(void)
{
if (::setsid() == -1) {
- ABORT(string("Failed to setsid: ") + strerror(errno));
+ ABORT(string("Failed to setsid: ") + os::strerror(errno));
}
}