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 2017/01/12 19:11:59 UTC

[2/4] mesos git commit: Fixed Mesos to use the updated os::Stack abstraction.

Fixed Mesos to use the updated os::Stack abstraction.

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


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

Branch: refs/heads/master
Commit: 37f9903f60bbf35e3f5df9a5bd777fbd354c734a
Parents: c351289
Author: Aaron Wood <aa...@verizon.com>
Authored: Thu Jan 12 10:16:22 2017 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Jan 12 10:56:27 2017 -0800

----------------------------------------------------------------------
 src/linux/ns.hpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/37f9903f/src/linux/ns.hpp
----------------------------------------------------------------------
diff --git a/src/linux/ns.hpp b/src/linux/ns.hpp
index 7778971..da43266 100644
--- a/src/linux/ns.hpp
+++ b/src/linux/ns.hpp
@@ -429,21 +429,21 @@ inline Try<pid_t> clone(
   // allocate the stack here in order to keep the call to os::clone
   // async signal safe, since otherwise it would be doing the dynamic
   // allocation itself).
-  os::Stack stack;
-  stack.size = 8 * 1024 * 1024,
-  stack.address =
-    new unsigned long long[stack.size / sizeof(unsigned long long)];
+  Try<os::Stack> stack = os::Stack::create(os::Stack::DEFAULT_SIZE);
+  if (stack.isError()) {
+    return Error("Failed to allocate stack: " + stack.error());
+  }
 
   pid_t child = fork();
   if (child < 0) {
-    delete[] stack.address;
+    stack->deallocate();
     close(fds.values());
     ::close(sockets[0]);
     ::close(sockets[1]);
     return ErrnoError();
   } else if (child > 0) {
     // Parent.
-    delete[] stack.address;
+    stack->deallocate();
 
     close(fds.values());
     ::close(sockets[1]);
@@ -597,7 +597,7 @@ inline Try<pid_t> clone(
       return f();
     },
     flags,
-    stack);
+    stack.get());
 
     ::close(sockets[1]);