|
MentOS
0.8.0
The Mentoring Operating System
|
Implementation of functions fcntl() and open(). More...
Macros | |
| #define | __DEBUG_HEADER__ "[NAMEI ]" |
| Change header. | |
| #define | __DEBUG_LEVEL__ LOGLEVEL_NOTICE |
| Set log level. | |
| #define | APPEND_PATH_SEPARATOR(buffer, buflen) |
| Appends the path with a "/" as separator. More... | |
| #define | APPEND_PATH(buffer, token) |
| Appends the path. More... | |
Functions | |
| int | sys_unlink (const char *path) |
| Delete a name and possibly the file it refers to. More... | |
| int | sys_mkdir (const char *path, mode_t mode) |
| Creates a new directory at the given path. More... | |
| int | sys_rmdir (const char *path) |
| Removes the given directory. More... | |
| int | sys_creat (const char *path, mode_t mode) |
| Creates a new file or rewrite an existing one. More... | |
| int | sys_symlink (const char *linkname, const char *path) |
| Creates a symbolic link. More... | |
| int | sys_readlink (const char *path, char *buffer, size_t bufsize) |
| Read the symbolic link, if present. More... | |
| char * | realpath (const char *path, char *buffer, size_t buflen) |
| Return the canonicalized absolute pathname. More... | |
| static int | __is_a_link (const char *path) |
| Determines if the path points to a link. More... | |
| static int | __get_link_content (const char *path, char *buffer, size_t buflen) |
| Returns the content of the link. More... | |
| int | __resolve_path (const char *path, char *abspath, size_t buflen, int flags, int link_depth) |
| Resolve the path by following all symbolic links. More... | |
| int | resolve_path (const char *path, char *buffer, size_t buflen, int flags) |
Implementation of functions fcntl() and open().
| #define APPEND_PATH | ( | buffer, | |
| token | |||
| ) |
| #define APPEND_PATH_SEPARATOR | ( | buffer, | |
| buflen | |||
| ) |
Appends the path with a "/" as separator.
|
inlinestatic |
Returns the content of the link.
| path | the path to the file. |
| buffer | the buffer where we store the link content. |
| buflen | length of the buffer. |
|
inlinestatic |
Determines if the path points to a link.
| path | the path to the file. |
| int __resolve_path | ( | const char * | path, |
| char * | abspath, | ||
| size_t | buflen, | ||
| int | flags, | ||
| int | link_depth | ||
| ) |
Resolve the path by following all symbolic links.
| path | the path to resolve. |
| abspath | the buffer where the resolved path is stored. |
| buflen | the size of the provided resolved_path buffer. |
| flags | the flags controlling how the path is resolved. |
| link_depth | the current link depth. |
| char* realpath | ( | const char * | path, |
| char * | buffer, | ||
| size_t | buflen | ||
| ) |
Return the canonicalized absolute pathname.
| path | the path we are canonicalizing. |
| buffer | where we will store the canonicalized path. |
| buflen | the size of the buffer. |
| int sys_creat | ( | const char * | path, |
| mode_t | mode | ||
| ) |
Creates a new file or rewrite an existing one.
| path | path to the file. |
| mode | mode for file creation. |
It is equivalent to: open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)
| int sys_mkdir | ( | const char * | path, |
| mode_t | mode | ||
| ) |
Creates a new directory at the given path.
| path | The path of the new directory. |
| mode | The permission of the new directory. |
| int sys_readlink | ( | const char * | path, |
| char * | buffer, | ||
| size_t | bufsize | ||
| ) |
Read the symbolic link, if present.
| path | the file for which we want to read the symbolic link information. |
| buffer | the buffer where we will store the symbolic link path. |
| bufsize | the size of the buffer. |
| int sys_rmdir | ( | const char * | path | ) |
Removes the given directory.
| path | The path to the directory to remove. |
| int sys_symlink | ( | const char * | linkname, |
| const char * | path | ||
| ) |
Creates a symbolic link.
| linkname | the name of the link. |
| path | the entity it is linking to. |
| int sys_unlink | ( | const char * | path | ) |
Delete a name and possibly the file it refers to.
| path | A pathname for a file. |