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 2016/12/05 05:42:39 UTC

[7/9] mesos git commit: Added os::dup2 to stout.

Added os::dup2 to stout.

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


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

Branch: refs/heads/master
Commit: f0350822dbfa8ee599a4748b79887b46bab11eac
Parents: 9248867
Author: Jie Yu <yu...@gmail.com>
Authored: Sat Dec 3 11:22:24 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Sun Dec 4 21:41:51 2016 -0800

----------------------------------------------------------------------
 3rdparty/stout/include/stout/posix/os.hpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f0350822/3rdparty/stout/include/stout/posix/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/stout/include/stout/posix/os.hpp
index a8f7108..09196be 100644
--- a/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/stout/include/stout/posix/os.hpp
@@ -475,6 +475,19 @@ inline Try<Nothing> pipe(int pipe_fd[2])
 }
 
 
+inline Try<Nothing> dup2(int oldFd, int newFd)
+{
+  while (::dup2(oldFd, newFd) == -1) {
+    if (errno == EINTR) {
+      continue;
+    } else {
+      return ErrnoError();
+    }
+  }
+  return Nothing();
+}
+
+
 inline Try<std::string> ptsname(int master)
 {
   // 'ptsname' is not thread safe. Therefore, we use mutex here to