You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/04/10 01:18:49 UTC

[6/8] mesos git commit: Stout: Moved `os::libraries::` namespace back to `stout/os.hpp`.

Stout: Moved `os::libraries::` namespace back to `stout/os.hpp`.

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


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

Branch: refs/heads/master
Commit: 1ffa4838846591036a343b444d659127269ecfb1
Parents: d80f9ce
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sat Apr 9 15:55:57 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Sat Apr 9 15:58:35 2016 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/os.hpp         | 79 ++++++++++++++++++++
 .../3rdparty/stout/include/stout/posix/os.hpp   | 60 ---------------
 2 files changed, 79 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1ffa4838/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 79e30ca..06bf04e 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
@@ -67,4 +67,83 @@
 #include <stout/posix/os.hpp>
 #endif // __WINDOWS__
 
+
+namespace os {
+namespace libraries {
+namespace Library {
+
+// Library prefix; e.g., the `lib` in `libprocess`. NOTE: there is no prefix
+// on Windows; `libprocess.a` would be `process.lib`.
+constexpr const char* prefix =
+#ifdef __WINDOWS__
+    "";
+#else
+    "lib";
+#endif // __WINDOWS__
+
+
+// The suffix for a shared library; e.g., `.so` on Linux.
+constexpr const char* extension =
+#ifdef __APPLE__
+    ".dylib";
+#elif defined(__WINDOWS__)
+    ".dll";
+#else
+    ".so";
+#endif // __APPLE__
+
+
+// The name of the environment variable that contains paths on which the
+// linker should search for libraries. NOTE: Windows does not have an
+// environment variable that controls the paths the linker searches through.
+constexpr const char* ldPathEnvironmentVariable =
+#ifdef __APPLE__
+    "DYLD_LIBRARY_PATH";
+#elif defined(__WINDOWS__)
+    "";
+#else
+    "LD_LIBRARY_PATH";
+#endif
+
+} // namespace Library {
+
+// Returns the full library name by adding prefix and extension to
+// library name.
+inline std::string expandName(const std::string& libraryName)
+{
+  return Library::prefix + libraryName + Library::extension;
+}
+
+
+// Returns the current value of LD_LIBRARY_PATH environment variable.
+inline std::string paths()
+{
+  const Option<std::string> path = getenv(Library::ldPathEnvironmentVariable);
+  return path.isSome() ? path.get() : std::string();
+}
+
+
+// Updates the value of LD_LIBRARY_PATH environment variable.
+// Note that setPaths has an effect only for child processes
+// launched after calling it.
+inline void setPaths(const std::string& newPaths)
+{
+  os::setenv(Library::ldPathEnvironmentVariable, newPaths);
+}
+
+
+// Append newPath to the current value of LD_LIBRARY_PATH environment
+// variable.
+inline void appendPaths(const std::string& newPaths)
+{
+  if (paths().empty()) {
+    setPaths(newPaths);
+  } else {
+    setPaths(paths() + ":" + newPaths);
+  }
+}
+
+} // namespace libraries {
+} // namespace os {
+
 #endif // __STOUT_OS_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/1ffa4838/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 edaa76a..e25d43b 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
@@ -470,66 +470,6 @@ inline int pagesize()
   return sysconf(_SC_PAGESIZE);
 }
 
-namespace libraries {
-
-// Returns the full library name by adding prefix and extension to
-// library name.
-inline std::string expandName(const std::string& libraryName)
-{
-  const char* prefix = "lib";
-  const char* extension =
-#ifdef __APPLE__
-    ".dylib";
-#else
-    ".so";
-#endif
-
-  return prefix + libraryName + extension;
-}
-
-
-// Returns the current value of LD_LIBRARY_PATH environment variable.
-inline std::string paths()
-{
-  const char* environmentVariable =
-#ifdef __APPLE__
-    "DYLD_LIBRARY_PATH";
-#else
-    "LD_LIBRARY_PATH";
-#endif
-  const Option<std::string> path = getenv(environmentVariable);
-  return path.isSome() ? path.get() : std::string();
-}
-
-
-// Updates the value of LD_LIBRARY_PATH environment variable.
-// Note that setPaths has an effect only for child processes
-// launched after calling it.
-inline void setPaths(const std::string& newPaths)
-{
-  const char* environmentVariable =
-#ifdef __APPLE__
-    "DYLD_LIBRARY_PATH";
-#else
-    "LD_LIBRARY_PATH";
-#endif
-  setenv(environmentVariable, newPaths);
-}
-
-
-// Append newPath to the current value of LD_LIBRARY_PATH environment
-// variable.
-inline void appendPaths(const std::string& newPaths)
-{
-  if (paths().empty()) {
-    setPaths(newPaths);
-  } else {
-    setPaths(paths() + ":" + newPaths);
-  }
-}
-
-} // namespace libraries {
-
 /* /TODO */
 
 } // namespace os {