13 #ifndef __STOUT_OS_POSIX_STAT_HPP__
14 #define __STOUT_OS_POSIX_STAT_HPP__
17 #include <sys/statvfs.h>
44 const std::string& path,
51 if (::lstat(path.c_str(), &s) < 0) {
52 return ErrnoError(
"Failed to lstat '" + path +
"'");
56 if (::
stat(path.c_str(), &s) < 0) {
57 return ErrnoError(
"Failed to stat '" + path +
"'");
67 inline bool islink(
const std::string& path)
79 const std::string& path,
88 const std::string& path,
101 const std::string& path,
109 return Bytes(s->st_size);
114 const std::string& path,
127 const std::string& path,
140 const std::string& path,
153 const std::string& path,
162 return Error(
"Not a special file: " + path);
170 const std::string& path,
183 const std::string& path,
198 #endif // __STOUT_OS_POSIX_STAT_HPP__
Try< uid_t > uid(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:182
bool isfile(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:87
Definition: errorbase.hpp:35
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:100
bool S_ISDIR(const int mode)
Definition: windows.hpp:206
bool islink(const std::string &path)
Definition: stat.hpp:67
bool S_ISREG(const int mode)
Definition: windows.hpp:212
Definition: errorbase.hpp:49
Try< long > mtime(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:113
Try< ino_t > inode(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:169
FollowSymlink
Definition: reparsepoint.hpp:35
Try< dev_t > dev(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:139
Try< dev_t > rdev(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:152
bool isSome() const
Definition: try.hpp:70
bool S_ISBLK(const int mode)
Definition: windows.hpp:230
Try< hashmap< std::string, uint64_t > > stat(const std::string &hierarchy, const std::string &cgroup, const std::string &file)
static Try error(const E &e)
Definition: try.hpp:42
#define UNREACHABLE()
Definition: unreachable.hpp:22
bool isError() const
Definition: try.hpp:71
bool isdir(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:78
bool S_ISLNK(const int mode)
Definition: windows.hpp:242
Try< mode_t > mode(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:126
bool S_ISCHR(const int mode)
Definition: windows.hpp:218
Try< struct::stat > stat(const std::string &path, const FollowSymlink follow)
Definition: stat.hpp:43