|
enum | {
OWNER_READONLY = 0400,
GROUP_READONLY = 0440,
PUBLIC_READONLY = 0444,
OWNER_PRIVATE = 0600,
OWNER_PUBLIC = 0644,
GROUP_PRIVATE = 0660,
GROUP_PUBLIC = 0664,
EVERYONE = 0666,
DIR_TEMPORARY = 01777
} |
| Most of the common chmod values are predefined.
|
|
enum | access_t {
RDONLY,
WRONLY,
REWRITE,
RDWR = REWRITE,
APPEND,
SHARED,
EXCLUSIVE,
DEVICE,
STREAM,
RANDOM
} |
| Enumerated file access modes.
|
|
typedef struct stat | fileinfo_t |
|
typedef long | offset_t |
| File offset type.
|
|
|
void | assign (fd_t descriptor) |
| Assign descriptor directly. More...
|
|
int | close (void) |
| Close a fsys resource. More...
|
|
int | drop (offset_t size=0) |
| Drop cached data from start of file. More...
|
|
int | err (void) const |
| Get last error. More...
|
|
| fsys () |
| Construct an unattached fsys descriptor.
|
|
| fsys (fd_t handle) |
| Contruct fsys from raw file handle.
|
|
| fsys (const fsys &descriptor) |
| Copy (dup) an existing fsys descriptor. More...
|
|
| fsys (const char *path, access_t access) |
| Create a fsys descriptor by opening an existing file or directory. More...
|
|
| fsys (const char *path, unsigned permission, access_t access) |
| Create a fsys descriptor by creating a file. More...
|
|
fd_t | handle (void) const |
| Get the native system descriptor handle of the file descriptor. More...
|
|
int | info (fileinfo_t *buffer) |
| Get status of open descriptor. More...
|
|
bool | is_tty (void) const |
| See if current file stream is a tty device. More...
|
|
void | open (const char *path, access_t access) |
| Open a file or directory. More...
|
|
void | open (const char *path, unsigned mode, access_t access) |
| Open a file descriptor directly. More...
|
|
fd_t | operator * () const |
| Get the descriptor from the object by pointer reference. More...
|
|
fsys & | operator *= (fd_t &descriptor) |
| Replace current file descriptor with an external descriptor. More...
|
|
| operator bool () const |
| Test if file descriptor is open. More...
|
|
| operator fd_t () const |
| Get the descriptor from the object by casting reference. More...
|
|
bool | operator! () const |
| Test if file descriptor is closed. More...
|
|
fsys & | operator= (const fsys &descriptor) |
| Assign file descriptor by duplicating another descriptor. More...
|
|
fsys & | operator= (fd_t descriptor) |
| Assing file descriptor from system descriptor. More...
|
|
ssize_t | read (void *buffer, size_t count) |
| Read data from descriptor or scan directory. More...
|
|
fd_t | release (void) |
| Release descriptor, do not close. More...
|
|
void | reset (void) |
| Reset error flag.
|
|
int | seek (offset_t offset) |
| Set the position of a file descriptor. More...
|
|
void | set (fd_t descriptor) |
| Set with external descriptor. More...
|
|
int | sync (void) |
| Commit changes to the filesystem. More...
|
|
int | trunc (offset_t offset) |
| Truncate file to specified length. More...
|
|
ssize_t | write (const void *buffer, size_t count) |
| Write data to descriptor. More...
|
|
| ~fsys () |
| Close and release a file descriptor.
|
|
|
static fd_t | append (const char *path) |
| Direct means to create or append a writable path and return descriptor. More...
|
|
static void | assign (fsys &object, fd_t descriptor) |
| Assign a descriptor directly. More...
|
|
static int | copy (const char *source, const char *target, size_t size=1024) |
| Copy a file. More...
|
|
static int | erase (const char *path) |
| Erase (remove) a file only. More...
|
|
static int | exec (const char *path, char **argv, char **envp=NULL) |
| Execute a process and get exit code. More...
|
|
static int | hardlink (const char *path, const char *target) |
| Create a hard link. More...
|
|
static int | info (const char *path, fileinfo_t *buffer) |
| Stat a file. More...
|
|
static int | inherit (fd_t &descriptor, bool enable) |
| Changle inheritable handle. More...
|
|
static fd_t | input (const char *path) |
| Direct means to open a read-only file path and return a descriptor. More...
|
|
static bool | is_char (struct stat *inode) |
|
static bool | is_dev (struct stat *inode) |
|
static bool | is_device (const char *path) |
| Test if path is a device path. More...
|
|
static bool | is_dir (const char *path) |
| Test if path is a directory. More...
|
|
static bool | is_dir (struct stat *inode) |
|
static bool | is_disk (struct stat *inode) |
|
static bool | is_executable (const char *path) |
| Test if path is executable. More...
|
|
static bool | is_exists (const char *path) |
| Test if path exists. More...
|
|
static bool | is_file (const char *path) |
| Test if path is a file. More...
|
|
static bool | is_file (struct stat *inode) |
|
static bool | is_hidden (const char *path) |
| Test if path is a hidden file. More...
|
|
static bool | is_link (const char *path) |
| Test if path is a symlink. More...
|
|
static bool | is_link (struct stat *inode) |
|
static bool | is_readable (const char *path) |
| Test if path readable. More...
|
|
static bool | is_sys (struct stat *inode) |
|
static bool | is_tty (fd_t fd) |
| See if the file handle is a tty device. More...
|
|
static bool | is_writable (const char *path) |
| Test if path writable. More...
|
|
static int | link (const char *path, const char *target) |
| Create a symbolic link. More...
|
|
static int | linkinfo (const char *path, char *buffer, size_t size) |
| Read a symbolic link to get it's target. More...
|
|
static int | load (const char *path) |
| Load a library into memory. More...
|
|
static int | mode (const char *path, unsigned value) |
| Change file access mode. More...
|
|
static fd_t | null (void) |
| Create inheritable /dev/null handle. More...
|
|
static fd_t | output (const char *path) |
| Direct means to create or access a writable path and return descriptor. More...
|
|
static int | pipe (fd_t &input, fd_t &output, size_t size=0) |
| Create pipe. More...
|
|
static int | prefix (const char *path) |
| Set directory prefix (chdir). More...
|
|
static int | prefix (char *path, size_t size) |
| Get current directory prefix (pwd). More...
|
|
static stringref_t | prefix (void) |
|
static void | release (fd_t descriptor) |
| Release a file descriptor. More...
|
|
static int | remapError (void) |
|
static int | rename (const char *oldpath, const char *newpath) |
| Rename a file. More...
|
|
static int | unlink (const char *path) |
| Remove a symbolic link explicitly. More...
|
|
A container for generic and o/s portable threadsafe file system functions.
These are based roughly on their posix equivilents. For libpth, the system calls are wrapped. The native file descriptor or handle may be used, but it is best to use "class fsys" instead because it can capture the errno of a file operation in a threadsafe and platform independent manner, including for mswindows targets.
Definition at line 125 of file fsys.h.