You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/03/01 23:40:42 UTC

[2/2] mesos git commit: Stout: Marked `os::chroot` as deleted on Windows.

Stout: Marked `os::chroot` as deleted on Windows.

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


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

Branch: refs/heads/master
Commit: a1f731746657b1cbcf136ddb2bf154ca3da271fc
Parents: 12de948
Author: Daniel Pravat <dp...@outlook.com>
Authored: Tue Mar 1 14:16:08 2016 -0800
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Mar 1 14:40:15 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/Makefile.am          |  3 ++
 .../3rdparty/stout/include/stout/os.hpp         |  1 +
 .../3rdparty/stout/include/stout/os/chroot.hpp  | 26 +++++++++++++
 .../stout/include/stout/os/posix/chroot.hpp     | 39 +++++++++++++++++++
 .../stout/include/stout/os/windows/chroot.hpp   | 40 ++++++++++++++++++++
 .../3rdparty/stout/include/stout/posix/os.hpp   | 10 -----
 .../3rdparty/stout/include/stout/windows/os.hpp |  6 ---
 7 files changed, 109 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
index 57a5732..f447a86 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
@@ -59,6 +59,7 @@ nobase_include_HEADERS =		\
   stout/os.hpp				\
   stout/os/bootid.hpp			\
   stout/os/chdir.hpp			\
+  stout/os/chroot.hpp			\
   stout/os/close.hpp			\
   stout/os/constants.hpp		\
   stout/os/direntsize.hpp		\
@@ -98,6 +99,7 @@ nobase_include_HEADERS =		\
   stout/os/write.hpp			\
   stout/os/posix/bootid.hpp		\
   stout/os/posix/chown.hpp		\
+  stout/os/posix/chroot.hpp		\
   stout/os/posix/direntsize.hpp		\
   stout/os/posix/exists.hpp		\
   stout/os/posix/fcntl.hpp		\
@@ -113,6 +115,7 @@ nobase_include_HEADERS =		\
   stout/os/posix/stat.hpp		\
   stout/os/raw/environment.hpp		\
   stout/os/windows/bootid.hpp		\
+  stout/os/windows/chroot.hpp		\
   stout/os/windows/direntsize.hpp	\
   stout/os/windows/exists.hpp		\
   stout/os/windows/fcntl.hpp		\

http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/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 f1d3802..40584bb 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
@@ -44,6 +44,7 @@
 
 #include <stout/os/bootid.hpp>
 #include <stout/os/chdir.hpp>
+#include <stout/os/chroot.hpp>
 #include <stout/os/exists.hpp>
 #include <stout/os/ls.hpp>
 #include <stout/os/mkdir.hpp>

http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/3rdparty/libprocess/3rdparty/stout/include/stout/os/chroot.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/chroot.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/chroot.hpp
new file mode 100644
index 0000000..d487ec0
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/chroot.hpp
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef __STOUT_OS_CHROOT_CLOSE_HPP__
+#define __STOUT_OS_CHROOT_CLOSE_HPP__
+
+#ifdef __WINDOWS__
+#include <stout/os/windows/chroot.hpp>
+#else
+#include <stout/os/posix/chroot.hpp>
+#endif // __WINDOWS__
+
+#endif // __STOUT_OS_CHROOT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/chroot.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/chroot.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/chroot.hpp
new file mode 100644
index 0000000..1309c52
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/chroot.hpp
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef __STOUT_OS_POSIX_CHROOT_HPP__
+#define __STOUT_OS_POSIX_CHROOT_HPP__
+
+#include <string>
+
+#include <stout/error.hpp>
+#include <stout/nothing.hpp>
+#include <stout/try.hpp>
+
+namespace os {
+
+inline Try<Nothing> chroot(const std::string& directory)
+{
+  if (::chroot(directory.c_str()) < 0) {
+    return ErrnoError();
+  }
+
+  return Nothing();
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_POSIX_CHROOT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/chroot.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/chroot.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/chroot.hpp
new file mode 100644
index 0000000..0833d2f
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/chroot.hpp
@@ -0,0 +1,40 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef __STOUT_OS_WINDOWS_CHROOT_HPP__
+#define __STOUT_OS_WINDOWS_CHROOT_HPP__
+
+#include <string>
+
+#include <stout/nothing.hpp>
+#include <stout/try.hpp>
+
+
+namespace os {
+
+// NOTE: `chroot` is deleted because Windows does not support POSIX `chroot`
+// semantics. On POSIX platforms it remains important to (e.g.) the launcher
+// API; passing in the `rootfs` flag, for example, will tell the launcher to
+// `chroot` to that directory, before launching the process. On Windows, we
+// simply conditionally compile out the `rootfs` flag so we can be guaranteed
+// to never have to invoke `chroot`.
+
+inline Try<Nothing> chroot(const std::string& directory) = delete;
+
+} // namespace os {
+
+
+#endif // __STOUT_OS_WINDOWS_CHROOT_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
index 84a2a02..1a340aa 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
@@ -141,16 +141,6 @@ inline Try<Nothing> chmod(const std::string& path, int mode)
 }
 
 
-inline Try<Nothing> chroot(const std::string& directory)
-{
-  if (::chroot(directory.c_str()) < 0) {
-    return ErrnoError();
-  }
-
-  return Nothing();
-}
-
-
 inline Try<Nothing> mknod(
     const std::string& path,
     mode_t mode,

http://git-wip-us.apache.org/repos/asf/mesos/blob/a1f73174/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
index c8e19f4..6a391ff 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
@@ -98,12 +98,6 @@ inline Try<Nothing> chmod(const std::string& path, int mode)
 }
 
 
-inline Try<Nothing> chroot(const std::string& directory)
-{
-  UNIMPLEMENTED;
-}
-
-
 inline Try<Nothing> mknod(
     const std::string& path,
     mode_t mode,