Miosix
2.0alpha1
|
#include <file_access.h>
Public Member Functions | |
FileDescriptorTable () | |
FileDescriptorTable (const FileDescriptorTable &rhs) | |
FileDescriptorTable & | operator= (const FileDescriptorTable &rhs) |
int | open (const char *name, int flags, int mode) |
int | close (int fd) |
void | closeAll () |
ssize_t | write (int fd, const void *data, size_t len) |
ssize_t | read (int fd, void *data, size_t len) |
off_t | lseek (int fd, off_t pos, int whence) |
int | fstat (int fd, struct stat *pstat) const |
int | isatty (int fd) const |
int | stat (const char *name, struct stat *pstat) |
int | lstat (const char *name, struct stat *pstat) |
int | fcntl (int fd, int cmd, int opt) |
int | ioctl (int fd, int cmd, void *arg) |
int | getdents (int fd, void *dp, int len) |
int | getcwd (char *buf, size_t len) |
int | chdir (const char *name) |
int | mkdir (const char *name, int mode) |
int | rmdir (const char *name) |
int | unlink (const char *name) |
int | rename (const char *oldName, const char *newName) |
intrusive_ref_ptr< FileBase > | getFile (int fd) const |
~FileDescriptorTable () | |
This class maps file descriptors to file objects, allowing to perform file operations
miosix::FileDescriptorTable::FileDescriptorTable | ( | ) |
Constructor
miosix::FileDescriptorTable::FileDescriptorTable | ( | const FileDescriptorTable & | rhs | ) |
Copy constructor
rhs | object to copy from |
miosix::FileDescriptorTable::~FileDescriptorTable | ( | ) |
Destructor
int miosix::FileDescriptorTable::chdir | ( | const char * | name | ) |
Change current directory
path | new current directory |
int miosix::FileDescriptorTable::close | ( | int | fd | ) |
Close a file
fd | file descriptor to close |
void miosix::FileDescriptorTable::closeAll | ( | ) |
Close all files
|
inline |
Perform various operations on a file descriptor
cmd | specifies the operation to perform |
opt | optional argument that some operation require |
|
inline |
Return file information.
pstat | pointer to stat struct |
int miosix::FileDescriptorTable::getcwd | ( | char * | buf, |
size_t | len | ||
) |
Return current directory
buf | the current directory is stored here |
len | buffer length, if it is not big enough, ERANGE is returned |
|
inline |
List directory content
dp | dp pointer to a memory buffer where one or more struct dirent will be placed. dp must be four words aligned. |
len | memory buffer size. |
|
inline |
Retrieves an entry in the file descriptor table
fd | file descriptor, index into the table |
|
inline |
Perform various operations on a file descriptor
cmd | specifies the operation to perform |
arg | optional argument that some operation require |
|
inline |
Check whether the file refers to a terminal.
|
inline |
Move file pointer, if the file supports random-access.
pos | offset to sum to the beginning of the file, current position or end of file, depending on whence |
whence | SEEK_SET, SEEK_CUR or SEEK_END |
|
inline |
Return file information, does not follow last symlink
path | file to stat |
pstat | pointer to stat struct |
int miosix::FileDescriptorTable::mkdir | ( | const char * | name, |
int | mode | ||
) |
Create a directory
name | directory to create |
mode | directory permissions |
int miosix::FileDescriptorTable::open | ( | const char * | name, |
int | flags, | ||
int | mode | ||
) |
Open a file
name | file name |
flags | file open mode |
mode | allows to set file permissions |
FileDescriptorTable & miosix::FileDescriptorTable::operator= | ( | const FileDescriptorTable & | rhs | ) |
Operator=
rhs | object to copy from |
|
inline |
Read data from the file, if the file supports reading.
data | buffer to store read data |
len | the number of bytes to read |
int miosix::FileDescriptorTable::rename | ( | const char * | oldName, |
const char * | newName | ||
) |
Rename a file or directory
oldName | old file name |
newName | new file name |
int miosix::FileDescriptorTable::rmdir | ( | const char * | name | ) |
Remove a directory if empty
name | directory to create |
|
inline |
Return file information, follows last symlink
path | file to stat |
pstat | pointer to stat struct |
int miosix::FileDescriptorTable::unlink | ( | const char * | name | ) |
Remove a file or directory
name | file or directory to remove |
|
inline |
Write data to the file, if the file supports writing.
data | the data to write |
len | the number of bytes to write |