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:48 UTC
[06/10] mesos git commit: Add os::stat::rdev().
Add os::stat::rdev().
Review: https://reviews.apache.org/r/31438/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7d82bb72
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7d82bb72
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7d82bb72
Branch: refs/heads/master
Commit: 7d82bb72e9b9b9d64ac65e6aa8e6193f2438fb1f
Parents: 0f9cf3e
Author: Ian Downes <id...@twitter.com>
Authored: Tue Mar 3 14:42:48 2015 -0800
Committer: Ian Downes <id...@twitter.com>
Committed: Tue Mar 10 17:18:25 2015 -0700
----------------------------------------------------------------------
.../3rdparty/stout/include/stout/os/stat.hpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/7d82bb72/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 5ea4cfb..af940a4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os/stat.hpp
@@ -82,6 +82,22 @@ inline Try<mode_t> mode(const std::string& path)
}
+inline Try<dev_t> rdev(const std::string& path)
+{
+ struct stat s;
+
+ if (::stat(path.c_str(), &s) < 0) {
+ return ErrnoError("Error invoking stat for '" + path + "'");
+ }
+
+ if (!S_ISCHR(s.st_mode) && !S_ISBLK(s.st_mode)) {
+ return Error("Not a special file: " + path);
+ }
+
+ return s.st_rdev;
+}
+
+
} // namespace stat {
} // namespace os {
#endif // __STOUT_OS_STAT_HPP__