# FS ## **Overview** Provides functions for file system, include file operations, directory operations and so on. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Defines the file tree walker (FTW). |
|
fallocate64 fallocate |
Pre-allocates space to a file. See fallocate. |
Unreadable directory. Its subdirectories will not be traversed. |
|
The data of the stat structure cannot be obtained. The possible cause is that the permission is incorrect. |
|
FTW_DP 6 |
|
Symbolic links that are not traversed. If not set, symbolic links are traversed by default. |
|
chdir is called to go to the directory before reading the directory. |
|
All subdirectories will be traversed before the directory itself. |
|
Append a slash (/) to each path, which corresponds to a directory. |
|
In the pglob parameter of the glob() function, reserve a string that has a length of pglob->gl_offs and ends with \0 at the beginning of the string list in pglob->pathv. That is, the newly matched string is appended to a position where the distance from the beginning of pglob->pathv is the length of pglob->gl_offs. |
|
Append the results of this call to the results returned by a previous call to glob(). |
|
Carry out tilde expansion. If a tilde (~) is the only character in the pattern, or an initial tilde is followed immediately by a slash (/), then the home directory of the caller is substituted for the tilde. |
|
Similar to GLOB_TILDE. The difference is that if the username is invalid, or the home directory cannot be determined, glob() returns GLOB_NOMATCH to indicate an error. |
|
DIR * |
|
struct dirent * |
|
readdir_r (DIR *__restrict dirp, struct dirent *__restrict entry, struct dirent **__restrict result) |
|
alphasort (const struct dirent **a, const struct dirent **b) |
|
scandir (const char *dir, struct dirent ***namelist, int(*sel)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **)) |
|
Sets the position of the next readdir call in the directory stream. |
|
Obtains the current position in the specified directory stream. |
|
creat (const char *path, mode_t mode) |
|
open (const char *path, int oflags,...) |
|
fallocate (int fd, int mode, off_t offset, off_t len) |
|
fcntl (int fd, int cmd,...) |
|
ftw (const char *path, int(*fn)(const char *file, const struct stat *sb, int flag), int depth) |
|
nftw (const char *path, int(*fn)(const char *file, const struct stat *sb, int flag, struct FTW *s), int fd_limit, int flags) |
|
glob (const char *__restrict pattern, int flags, int(*errfunc)(const char *, int), glob_t *__restrict pglob) |
|
Frees allocated memory from a call to glob(). |
|
dirname (char *path) |
|
basename (char *path) |
Obtains a file name (excluding the directory) in a specified path. |
ioctl (int fd, int cmd,...) |
|
mount (const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data) |
|
umount (const char *target) |
|
umount2 (const char *target, int flags) |
|
stat (const char *__restrict path, struct stat *__restrict buf) |
|
lstat (const char *__restrict path, struct stat *__restrict buf) |
|
mkdir (const char *pathname, mode_t mode) |
|
mkfifo (const char *name, mode_t mode) |
Creates a named pipe to implement inter-process communication. |
mkdirat (int fd, const char *pathname, mode_t mode) |
|
chmod (const char *pathname, mode_t mode) |
|
umask (mode_t mode) |
|
statfs (const char *path, struct statfs *buf) |
Obtains file system information of a file in a specified path. |
statvfs (const char *__restrict path, struct statvfs *__restrict buf) |
|
a | Indicates the pointer to directory entry a. |
a | Indicates the pointer to directory entry b. |
path | Indicates the pointer to the path. |
pathname | Indicates the pointer to the path of the file. |
mode | Indicates the new file permission. |
The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix directory. |
|
The path name length is greater than the value of NAME_MAX. |
|
A component of the path prefix is the name of an existing file. The file is neither a directory nor a symbolic link of a directory. |
|
Operation not permitted or access denied because the access is prohibited or the directory is full. |
|
dirp | Indicates the pointer to the structure representing the directory to close. |
path | Indicates the pointer to the name of the file to create or rewrite. |
mode | Indicates permissions on the file. |
The length of path is greater than the value of NAME_MAX. |
|
All file descriptors that can be used by the process are opened. |
|
The file structure corresponding to the file descriptor cannot be obtained. |
|
A hardware error occurs at the low-level disk I/O layer. As a result, the physical drive cannot work. |
|
The number of opened files in the system has reached the maximum. |
|
A component of the path prefix is the name of an existing file and is not a directory. |
|
The operation is rejected according to the file sharing policy. |
|
path | Indicates the pointer to the path. |
The value of len or offset is less than 0 or greater than that of INT_MAX, or the value of mode is not FALLOC_FL_KEEP_SIZE. |
|
fd is not a valid file descriptor, or the basic file system does not support this operation. |
|
An I/O error occurs when data is read from or written to the file system. |
|
The operation is rejected according to the file sharing policy. |
fd | Indicates the file descriptor. |
cmd | Indicates the command used to manipulate the file descriptor. |
Obtain the status of the file specified by fd. (fd is a file or sockets are available.) |
|
Set the file descriptor status. (fd is a file or sockets are available.) |
Too many segment locks open, lock table is full, or a remote locking protocol failed. |
|
Attempt to clear the O_APPEND flag on a file that has the append-only attribute set. |
fd | Indicates the file descriptor. |
buf | Indicates the pointer to a stat structure into which file information is placed. |
A component of path does not name an existing file or path is an empty string. |
|
The path name length is greater than the value of NAME_MAX. |
|
Search permission is denied on a component of the path prefix. |
|
An I/O error occurs when data is read from or written to the file system. |
|
Operation not permitted or access denied because the access is prohibited or the directory is full. |
|
The operation is rejected according to the file sharing policy. |
|
path | Indicates the pointer to the file directory to traverse. |
fn | Indicates the pointer to the function to be called for the found entry. For the fn function, file identifies the path of the file relative to path, and sb indicates the pointer to the stat structure. flag indicates the flag. The values of flag are as follows: |
depth | Indicates the number of files that can be opened during traversal. |
Unreadable directory. Its subdirectories will not be traversed. |
|
The data of the stat structure cannot be obtained. The possible cause is that the permission is incorrect. |
pattern | Indicates the pattern you want to match. |
flags | Indicates the matching mode. |
errfunc | Indicates the pointer to the error processing callback function. If errfunc is not a null pointer, errfunc() is called when an error occurs (opendir(), readdir(), or stat() fails) during the search. If the function returns a non-zero value or GLOB_ERR is set, glob() terminates the entire search process. |
pglob | Indicates the pointer to the address storing the matched path names. |
pglob | Indicates the pointer to the address of memory dynamically allocated for a glob call. |
fd | Indicates the file descriptor of the device (file-related file descriptors are not supported). |
cmd | Indicates the operation instruction for the device. You can define it based on the specific device. |
path | Indicates the file path. |
buf | Indicates the pointer to a stat structure into which file information is placed. |
A component of path does not name an existing file or path is an empty string. |
|
The path name length is greater than the value of NAME_MAX. |
|
The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix component. |
|
An I/O error occurs when data is read from or written to the file system. |
|
The number of opened files in the system has reached the maximum. |
|
A component of the path prefix is the name of an existing file. The file is neither a directory nor a symbolic link of a directory. |
|
Operation not permitted or access denied because the access is prohibited or the directory is full. |
|
The operation is rejected according to the file sharing policy. |
|
pathname | Indicates the pointer to the name of the directory to create. |
mode | Indicates the directory permission. |
The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix directory. |
|
The path name length is greater than the value of NAME_MAX. |
|
An I/O error occurs when data is read from or written to the file system. |
|
Operation not permitted or access denied because the access is prohibited or the directory is full. |
|
The operation is rejected according to the file sharing policy. |
|
The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix directory. |
|
The path name length is greater than the value of NAME_MAX. |
|
An I/O error occurs when data is read from or written to the file system. |
|
Operation not permitted or access denied because the access is prohibited or the directory is full. |
|
The operation is rejected according to the file sharing policy. |
|
name | Indicates the pointer to the name of the pipe to create. |
mode | Not supported. |
Invalid input parameter (for example, empty address, file name too long or the file is not in the /dev directory). |
|
source | Indicates the pointer to the device to mount. |
target | Indicates the pointer to the path of the mount point. |
filesystemtype | Indicates the pointer to the file system type. |
mountflags | Indicates the mounting flag. |
data | Indicates the pointer to the mounting data. |
One of the pointer parameters points outside the user address space. |
|
The path name length is greater than the value of MAXPATHLEN. |
|
path | Indicates the pointer to the file directory to traverse. |
fn | Indicates the pointer to the function to be called for the found entry. For the fn function, file identifies the path of the file relative to path, and sb indicates the pointer to the stat structure. flag indicates the flag. The values of flag are as follows: The fourth argument of fn() is a pointer to a FTW structure. |
fd_limit | Indicates the number of files that can be opened during traversal. |
flags | Indicates the traversal action. It is a bitwise inclusive-OR of zero or more of the following flags: |
Unreadable directory. Its subdirectories will not be traversed. |
|
The data of the stat structure cannot be obtained. The possible cause is that the permission is incorrect. |
|
path | Indicates the pointer to the name of the file to open. |
oflags | Indicates the file access mode. Available values are as follows: |
If set, the file offset will be set to the end of the file prior to each write. |
|
If the file is opened successfully with O_WRONLY or O_RDWR, its length is truncated to 0. |
|
Used together with O_CREAT. This function fails if the file exists. |
|
This flag must be added for opening a directory. Otherwise, the directory fails to be opened. |
Search permission is denied on a component of the path prefix. |
|
The length of path is greater than the value of NAME_MAX. |
|
The O_CREAT flag is not set and the named file does not exist. |
|
Inode is invalid, not a normal character driver, or not a mount point. |
|
The file structure corresponding to the file descriptor cannot be obtained. |
|
A hardware error occurs at the low-level disk I/O layer. As a result, the physical drive cannot work. |
|
The named file resides on a read-only file system, and either O_WRONLY, O_RDWR, O_CREAT (if file does not exist), or O_TRUNC is set in the oflags parameter. |
|
The directory or file system that would contain the new file cannot be expanded, the file does not exist, and O_CREAT is specified. |
|
The number of opened files in the system has reached the maximum. |
|
The named file is a directory, and oflags includes O_WRONLY, O_RDWR, or O_CREAT without O_DIRECTORY. |
|
A component of the path prefix names an existing file that is not a directory. |
|
The operation is rejected according to the file sharing policy. |
|
dirname | Indicates the pointer to the name of directory to open. |
The length of the path name string is longer than the value of NAME_MAX. |
|
dirp | Indicates the pointer to the directory structure. |
The path name length is greater than the value of NAME_MAX. |
|
dirp | Indicates the pointer to the directory structure. |
entry | Indicates the entry read from the dirp stream. |
result | Indicates the pointer to the returned buffer. |
The path name length is greater than the value of NAME_MAX. |
|
dirp | Indicates the pointer to the directory stream whose read position needs to be reset. |
The length of the path name string is greater than the value of NAME_MAX. |
|
dirp | Indicates the pointer to the directory stream in which the position of the next readdir call needs to be set. |
offset | Indicates the offset of the position relative to the current position. |
path | Indicates the file path. |
buf | Indicates the pointer to a stat structure into which file information is placed. |
A component of path does not name an existing file or path is an empty string. |
|
The path name length is greater than the value of NAME_MAX. |
|
The permission bit of the file mode does not allow the requested access, or the search permission is denied on the path prefix component. |
|
An I/O error occurs when data is read from or written to the file system. |
|
The number of opened files in the system has reached the maximum. |
|
A component of the path prefix is the name of an existing file. The file is neither a directory nor a symbolic link of a directory. |
|
Operation not permitted or access denied because the access is prohibited or the directory is full. |
|
The operation is rejected according to the file sharing policy. |
|
path | Indicates the pointer to the name of the target file. |
buf | Indicates the pointer to a statfs structure that stores the information about the file system. |
Search permission is denied on a component of the path prefix. |
|
path | Indicates the pointer to the path name of the file. |
buf | Indicates the pointer to the statvfs structure that stores the obtained file system information. |
Search permission is denied on a component of the path prefix. |
|
dirp | Indicates the pointer to the directory stream. |
mode | Used to specify the umask value of a process. |
target | Indicates the pointer to the path of the file system to unmount. |
target | Indicates the pointer to the path of the file system to unmount. |
flags | Indicates the control flag. (Currently, the value of flags can only be 0. In this case, this function is the same as umount().) |
The length of the component in the path name is greater than the value of NAME_MAX. |
|