13 #ifndef __STOUT_OS_POSIX_STAT_HPP__ 14 #define __STOUT_OS_POSIX_STAT_HPP__ 17 #include <sys/statvfs.h> 46 const std::string&
path,
53 if (::lstat(path.c_str(), &s) < 0) {
54 return ErrnoError(
"Failed to lstat '" + path +
"'");
58 if (::
stat(path.c_str(), &s) < 0) {
59 return ErrnoError(
"Failed to stat '" + path +
"'");
72 if (::fstat(fd, &s) < 0) {
92 const std::string&
path,
109 const std::string&
path,
118 const std::string&
path,
131 const std::string&
path,
139 return Bytes(s->st_size);
151 return Bytes(s->st_size);
156 const std::string&
path,
169 const std::string&
path,
182 const std::string&
path,
195 const std::string&
path,
204 return Error(
"Not a special file: " + path);
212 const std::string&
path,
225 const std::string&
path,
240 #endif // __STOUT_OS_POSIX_STAT_HPP__
Try< uid_t > uid(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:224
bool isfile(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:108
Definition: errorbase.hpp:36
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:130
bool issocket(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:117
bool S_ISDIR(const int mode)
Definition: windows.hpp:200
bool islink(const std::string &path)
Definition: stat.hpp:80
bool S_ISSOCK(const int mode)
Definition: windows.hpp:230
bool S_ISREG(const int mode)
Definition: windows.hpp:206
Definition: errorbase.hpp:50
Try< long > mtime(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:155
Definition: posix_signalhandler.hpp:23
Try< ino_t > inode(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:211
FollowSymlink
Definition: reparsepoint.hpp:35
Try< dev_t > dev(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:181
Try< dev_t > rdev(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:194
bool isSome() const
Definition: try.hpp:77
Try< struct::stat > stat(const int_fd fd)
Definition: stat.hpp:68
bool S_ISBLK(const int mode)
Definition: windows.hpp:224
static Try error(const E &e)
Definition: try.hpp:43
#define UNREACHABLE()
Definition: unreachable.hpp:22
Definition: attributes.hpp:24
bool isError() const
Definition: try.hpp:78
bool isdir(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:91
bool S_ISLNK(const int mode)
Definition: windows.hpp:236
Try< mode_t > mode(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:168
bool S_ISCHR(const int mode)
Definition: windows.hpp:212
int int_fd
Definition: int_fd.hpp:35
Try< struct::stat > stat(const std::string &path, const FollowSymlink follow)
Definition: stat.hpp:45