mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mp...@apache.org
Subject [1/4] mesos git commit: Refactored the `os::access` function between POSIX and Windows.
Date Thu, 26 May 2016 06:59:31 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 617d5707d -> 7dbbc75a8


Refactored the `os::access` function between POSIX and Windows.

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


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

Branch: refs/heads/master
Commit: 116f2022628fdcccbb421a175d8a3f293cd7a1c0
Parents: 617d570
Author: Michael Park <mpark@apache.org>
Authored: Wed May 25 14:51:28 2016 -0700
Committer: Michael Park <mpark@apache.org>
Committed: Wed May 25 14:51:28 2016 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/Makefile.am          |  1 +
 3rdparty/stout/include/stout/os.hpp         |  1 +
 3rdparty/stout/include/stout/os/access.hpp  | 42 ++++++++++++++++++++++++
 3rdparty/stout/include/stout/posix/os.hpp   | 13 --------
 3rdparty/stout/include/stout/windows/os.hpp | 10 ------
 5 files changed, 44 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/116f2022/3rdparty/stout/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/Makefile.am b/3rdparty/stout/include/Makefile.am
index ae4116b..7f31582 100644
--- a/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/stout/include/Makefile.am
@@ -57,6 +57,7 @@ nobase_include_HEADERS =			\
   stout/numify.hpp				\
   stout/option.hpp				\
   stout/os.hpp					\
+  stout/os/access.hpp				\
   stout/os/bootid.hpp				\
   stout/os/chdir.hpp				\
   stout/os/chroot.hpp				\

http://git-wip-us.apache.org/repos/asf/mesos/blob/116f2022/3rdparty/stout/include/stout/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os.hpp b/3rdparty/stout/include/stout/os.hpp
index 2a306ae..53b0093 100644
--- a/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/stout/include/stout/os.hpp
@@ -43,6 +43,7 @@
 #include <stout/unreachable.hpp>
 #include <stout/version.hpp>
 
+#include <stout/os/access.hpp>
 #include <stout/os/bootid.hpp>
 #include <stout/os/chdir.hpp>
 #include <stout/os/chroot.hpp>

http://git-wip-us.apache.org/repos/asf/mesos/blob/116f2022/3rdparty/stout/include/stout/os/access.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/access.hpp b/3rdparty/stout/include/stout/os/access.hpp
new file mode 100644
index 0000000..d87762a
--- /dev/null
+++ b/3rdparty/stout/include/stout/os/access.hpp
@@ -0,0 +1,42 @@
+// Licensed 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_ACCESS_HPP__
+#define __STOUT_OS_ACCESS_HPP__
+
+#include <string>
+
+#include <stout/error.hpp>
+#include <stout/try.hpp>
+
+#ifdef __WINDOWS__
+#include <stout/windows.hpp> // To be certain we're using the right `access`.
+#endif // __WINDOWS__
+
+namespace os {
+
+inline Try<bool> access(const std::string& path, int how)
+{
+  if (::access(path.c_str(), how) < 0) {
+    if (errno == EACCES) {
+      return false;
+    } else {
+      return ErrnoError();
+    }
+  }
+
+  return true;
+}
+
+} // namespace os {
+
+#endif // __STOUT_OS_ACCESS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/116f2022/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 1a66184..f08604c 100644
--- a/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/stout/include/stout/posix/os.hpp
@@ -371,19 +371,6 @@ inline Option<std::string> getenv(const std::string& key)
 }
 
 
-inline Try<bool> access(const std::string& path, int how)
-{
-  if (::access(path.c_str(), how) < 0) {
-    if (errno == EACCES) {
-      return false;
-    } else {
-      return ErrnoError();
-    }
-  }
-  return true;
-}
-
-
 // Creates a tar 'archive' with gzip compression, of the given 'path'.
 inline Try<Nothing> tar(const std::string& path, const std::string& archive)
 {

http://git-wip-us.apache.org/repos/asf/mesos/blob/116f2022/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp
index 71a8c61..1363be1 100644
--- a/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/stout/include/stout/windows/os.hpp
@@ -522,16 +522,6 @@ inline tm* gmtime_r(const time_t* timep, tm* result)
 }
 
 
-inline Try<bool> access(const std::string& fileName, int how)
-{
-  if (::_access(fileName.c_str(), how) != 0) {
-    return ErrnoError("os::access: Call to `_access` failed for path '" +
-                      fileName + "'");
-  }
-
-  return true;
-}
-
 inline Result<PROCESSENTRY32> process_entry(pid_t pid)
 {
   // Get a snapshot of the processes in the system. NOTE: We should not check


Mime
View raw message