You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2015/03/11 01:24:45 UTC
[03/10] mesos git commit: Add os::stat::mode().
Add os::stat::mode().
Review: https://reviews.apache.org/r/31440/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0f9cf3ec
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0f9cf3ec
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0f9cf3ec
Branch: refs/heads/master
Commit: 0f9cf3ec425cceececd40cad906be67279064f9f
Parents: 5beab91
Author: Ian Downes <id...@twitter.com>
Authored: Tue Mar 3 14:42:25 2015 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Tue Mar 10 17:18:25 2015 -0700
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/os/stat.hpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f9cf3ec/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
index 17bfc6f..5ea4cfb 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
@@ -69,6 +69,19 @@ inline Try<long> mtime(const std::string& path)
return s.st_mtime;
}
+
+inline Try<mode_t> mode(const std::string& path)
+{
+ struct stat s;
+
+ if (::stat(path.c_str(), &s) < 0) {
+ return ErrnoError("Error invoking stat for '" + path + "'");
+ }
+
+ return s.st_mode;
+}
+
+
} // namespace stat {
} // namespace os {
#endif // __STOUT_OS_STAT_HPP__