libwreport
3.5
|
Wrap a path on the file system opened with O_PATH. More...
#include <sys.h>
Data Structures | |
struct | iterator |
Iterator for directory entries. More... | |
Public Member Functions | |
Path (const char *pathname, int flags=0) | |
Open the given pathname with flags | O_PATH. | |
Path (const std::string &pathname, int flags=0) | |
Open the given pathname with flags | O_PATH. | |
Path (Path &parent, const char *pathname, int flags=0) | |
Open the given pathname calling parent.openat, with flags | O_PATH. | |
Path (const Path &)=delete | |
Path (Path &&)=default | |
Path & | operator= (const Path &)=delete |
Path & | operator= (Path &&)=default |
~Path () | |
The destructor closes the file descriptor, but does not check errors on ::close(). More... | |
DIR * | fdopendir () |
iterator | begin () |
Begin iterator on all directory entries. | |
iterator | end () |
End iterator on all directory entries. | |
int | openat (const char *pathname, int flags, mode_t mode=0777) |
void | fstatat (const char *pathname, struct stat &st) |
void | lstatat (const char *pathname, struct stat &st) |
fstatat with the AT_SYMLINK_NOFOLLOW flag set | |
void | unlinkat (const char *pathname) |
void | rmdirat (const char *pathname) |
unlinkat with the AT_REMOVEDIR flag set | |
void | rmtree () |
Delete the directory pointed to by this Path, with all its contents. More... | |
![]() | |
NamedFileDescriptor (int fd, const std::string &pathname) | |
NamedFileDescriptor (NamedFileDescriptor &&) | |
NamedFileDescriptor & | operator= (NamedFileDescriptor &&) |
virtual void | throw_error (const char *desc) |
Throw an exception based on errno and the given message. More... | |
const std::string & | name () const |
Return the file pathname. | |
![]() | |
FileDescriptor (FileDescriptor &&o) | |
FileDescriptor (int fd) | |
void | close () |
void | fstat (struct stat &st) |
void | fchmod (mode_t mode) |
size_t | write (const void *buf, size_t count) |
void | write_all (const void *buf, size_t count) |
Write all the data in buf, retrying partial writes. | |
MMap | mmap (size_t length, int prot, int flags, off_t offset=0) |
operator int () const | |
Additional Inherited Members | |
![]() | |
std::string | pathname |
![]() | |
int | fd = -1 |
Wrap a path on the file system opened with O_PATH.
wreport::sys::Path::~Path | ( | ) |
The destructor closes the file descriptor, but does not check errors on ::close().
In normal program flow, it is a good idea to explicitly call Path::close() in places where it can throw safely.
void wreport::sys::Path::rmtree | ( | ) |
Delete the directory pointed to by this Path, with all its contents.
The path must point to a directory.