Defines interface for accessing filesystems. More...
#include <FileAccess.h>
Data Structures | |
struct | header_t |
Public Member Functions | |
bool | ping (void) |
bool | setuid (int uid, int gid) |
bool | mkdir (const std::string &path, mode_t mode) |
bool | mkdirp (const std::string &path, mode_t mode) |
bool | link (const std::string &oldpath, const std::string &newpath) |
bool | softlink (const std::string &oldpath, const std::string &newpath) |
bool | copy (const std::string &oldpath, const std::string &newpath, mode_t mode) |
bool | chmod (const std::string &path, mode_t mode) |
bool | stat (const std::string &path, struct stat &st) |
bool | lstat (const std::string &path, struct stat &st) |
bool | fstat (struct stat &st) |
bool | ftruncate (off_t length) |
off_t | fallocate (off_t length) |
bool | readlink (const std::string &path, std::string &linkpath) |
bool | remove (const std::string &path) |
bool | unlink (const std::string &path) |
bool | rmdir (const std::string &path) |
bool | rmdirr (const std::string &path) |
bool | opendir (const std::string &path) |
bool | closedir (void) |
bool | readdir (std::string &name) |
bool | open (const std::string &path, int flags, mode_t mode) |
bool | close (void) |
bool | mkstemp (std::string &path, mode_t mode) |
off_t | lseek (off_t offset, int whence) |
ssize_t | read (void *buf, size_t size) |
ssize_t | write (const void *buf, size_t size) |
ssize_t | pread (void *buf, size_t size, off_t offset) |
ssize_t | pwrite (const void *buf, size_t size, off_t offset) |
int | geterrno () |
operator bool (void) | |
bool | operator! (void) |
Static Public Member Functions | |
static void | testtune (void) |
Defines interface for accessing filesystems.
This class accesses local filesystem through proxy executable which allows to switch user id in multithreaded systems without introducing conflict with other threads. Its methods are mostly replicas of corresponding POSIX functions with some convenience tweaking.
bool Arc::FileAccess::copy | ( | const std::string & | oldpath, | |
const std::string & | newpath, | |||
mode_t | mode | |||
) |
Copy file to new location. If new file is created it is assigned secified mode.
int Arc::FileAccess::geterrno | ( | ) | [inline] |
Get errno of last operation. Every operation resets errno.
bool Arc::FileAccess::mkdirp | ( | const std::string & | path, | |
mode_t | mode | |||
) |
Make a directory and assign it specified mode. If missing all intermediate directories are created too.
bool Arc::FileAccess::mkstemp | ( | std::string & | path, | |
mode_t | mode | |||
) |
Open new temporary file for writing. On input path contains template of file name ending with XXXXXX. On output path is path to created file.
bool Arc::FileAccess::open | ( | const std::string & | path, | |
int | flags, | |||
mode_t | mode | |||
) |
Open file. Only one file may be open at a time.
bool Arc::FileAccess::opendir | ( | const std::string & | path | ) |
Open directory. Only one directory may be open at a time.
bool Arc::FileAccess::setuid | ( | int | uid, | |
int | gid | |||
) |
Modify user uid and gid. If any is set to 0 then executable is switched to original uid/gid.