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 2015/10/28 23:11:19 UTC
[3/7] mesos git commit: Windows: Moved `os::touch` to its own file,
`stout/os/touch.hpp`.
Windows: Moved `os::touch` to its own file, `stout/os/touch.hpp`.
Review: https://reviews.apache.org/r/39538
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0cd54ff7
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0cd54ff7
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0cd54ff7
Branch: refs/heads/master
Commit: 0cd54ff76b8ea6c4fdb9103b1477c9e7fdbd795c
Parents: 522517e
Author: Alex Clemmer <cl...@gmail.com>
Authored: Mon Oct 26 12:33:31 2015 -0500
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Wed Oct 28 17:11:03 2015 -0500
----------------------------------------------------------------------
.../3rdparty/stout/include/Makefile.am | 1 +
.../3rdparty/stout/include/stout/os.hpp | 1 +
.../3rdparty/stout/include/stout/os/touch.hpp | 54 ++++++++++++++++++++
.../3rdparty/stout/include/stout/posix/os.hpp | 20 --------
.../3rdparty/stout/include/stout/windows/os.hpp | 6 ---
5 files changed, 56 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0cd54ff7/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 d2b6fe8..13e4380 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
@@ -90,6 +90,7 @@ nobase_include_HEADERS = \
stout/os/permissions.hpp \
stout/os/pstree.hpp \
stout/os/sysctl.hpp \
+ stout/os/touch.hpp \
stout/os/utime.hpp \
stout/os/write.hpp \
stout/os/raw/environment.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/0cd54ff7/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 95bdb0f..a702e6b 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
@@ -89,6 +89,7 @@
#include <stout/os/shell.hpp>
#include <stout/os/signals.hpp>
#include <stout/os/stat.hpp>
+#include <stout/os/touch.hpp>
#include <stout/os/utime.hpp>
#include <stout/os/write.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/0cd54ff7/3rdparty/libprocess/3rdparty/stout/include/stout/os/touch.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/touch.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/touch.hpp
new file mode 100644
index 0000000..25f51a5
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/touch.hpp
@@ -0,0 +1,54 @@
+/**
+ * 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_TOUCH_HPP__
+#define __STOUT_OS_TOUCH_HPP__
+
+#include <stout/nothing.hpp>
+#include <stout/try.hpp>
+
+#include <stout/os/close.hpp>
+#include <stout/os/exists.hpp>
+#include <stout/os/open.hpp>
+#include <stout/os/utime.hpp>
+
+#ifdef __WINDOWS__
+#include <stout/windows.hpp>
+#endif // __WINDOWS__
+
+
+namespace os {
+
+inline Try<Nothing> touch(const std::string& path)
+{
+ if (!os::exists(path)) {
+ Try<int> fd = os::open(
+ path,
+ O_RDWR | O_CREAT,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ if (fd.isError()) {
+ return Error("Failed to open file: " + fd.error());
+ }
+
+ return os::close(fd.get());
+ }
+
+ // Update the access and modification times.
+ return os::utime(path);
+}
+
+} // namespace os {
+
+
+#endif // __STOUT_OS_TOUCH_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/0cd54ff7/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 b6afe0e..9a38733 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp
@@ -107,26 +107,6 @@ inline void unsetenv(const std::string& key)
}
-inline Try<Nothing> touch(const std::string& path)
-{
- if (!exists(path)) {
- Try<int> fd = open(
- path,
- O_RDWR | O_CREAT,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-
- if (fd.isError()) {
- return Error("Failed to open file: " + fd.error());
- }
-
- return close(fd.get());
- }
-
- // Update the access and modification times.
- return utime(path);
-}
-
-
// Creates a temporary directory using the specified path
// template. The template may be any path with _6_ `Xs' appended to
// it, for example /tmp/temp.XXXXXX. The trailing `Xs' are replaced
http://git-wip-us.apache.org/repos/asf/mesos/blob/0cd54ff7/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 3e6f2aa..eec8f0f 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp
@@ -56,12 +56,6 @@ inline void unsetenv(const std::string& key)
}
-inline Try<Nothing> touch(const std::string& path)
-{
- UNIMPLEMENTED;
-}
-
-
// Creates a temporary directory using the specified path
// template. The template may be any path with _6_ `Xs' appended to
// it, for example /tmp/temp.XXXXXX. The trailing `Xs' are replaced