📄 file system1.txt
字号:
access
SYNOPSIS
int access(const char *pathname, int mode);
PARAMETERS
pathname: [in] the path of the file to test.
mode: [in] indicates what the task wants to test.
DESCRIPTION
Checks whether the calling task has the necessary access rights to perform operations
specified by mode on the file pathname. mode is a mask consisting of one or more of the
values R_OK, W_OK, X_OK and F_OK which respectively test if the taks can read, write,
execute or test if the file exists. The test is performed using the real uid and gid of
the calling task. Only the access bits of the file are tested.
Note: only the final component of the path is checked using the real uid and gid. All the
other components of the path are checked using the effective uid and gid.
RETURN VALUE
On success, zero is returned. On error, -1 is returned and errno is set to one of the
following values:
EINVAL: mode is not a valid value.
EACCESS, EFAULT, ENOENT, ENOTDIR, ENOMEM, ENAMETOOLONG or ELOOP.
**************************************************************************************
chdir and fchdir
SYNOPSIS
int chdir(const char *path);
int fchdir(int fd);
PARAMETERS
path: [in] a pointer to the new current directory.
fd: [in] the file descriptor of the new directory.
DESCRIPTION
chdir changes the current directory to path and fchdir to fd.
RETURN VALUE
On success zero is returned. On error, -1 is returned and errno is set to one of the
following values:
for chdir:
ENOTDIR, EACCESS, EFAULT, ENOENT, ENOMEM ENAMETOOLONG, EROFS or ELOOP.
for fchdir:
EBADF, ENOENT, ENOTDIR or EACCESS.
**************************************************************************************
chmod and fchmod
SYNOPSIS
int chmod(const char *path, mode_t mode);
int fchmod(int fd, mode_t mode);
PARAMETERS
path: [in] points to the path of the file to modify.
fd: [in] the file descriptor to modify.
mode: [in] the new mode.
DESCRIPTION
chmod changes the mode of the file specified by path to mode. fchmod changes the mode of
the file descriptor specified by fd to mode.The possible values of mode are obtained by
or'ing the following constants:
S_ISUID: set uid on execution.
S_ISGID: set gid on execution.
S_ISVTX: sticky bit.
S_IRUSR: readable by owner.
S_IWUSR: writable by owner.
S_IXUSR: executable by owner.
S_IRGRP: readable by group.
S_IWGRP: writable by group.
S_IXGRP: executable by group.
S_IROTH: readable by the world.
S_IWOTH: writable by the world.
S_IXOTH: executable by the world.
RETURN VALUE
On success zero is returned. On error, -1 is returned and errno is set to one of the
following values:
for chmod:
EPERM: the effective uid of the task is not equal the the uid of the file and the task does
not have superuser privileges.
ENOTDIR, EACCESS, EFAULT, ENOENT, ENOMEM ENAMETOOLONG, EROFS or ELOOP.
for fchmod:
EPERM: the effective uid of the task is not equal the the uid of the file and the task does
not have superuser privileges.
ENOENT, EROFS or EBADF.
**************************************************************************************
chown and fchown
SYNOPSIS
int chown(const char *path, uid_t owner, gid_t group);
int fchown(int fd, uid_t owner, gid_t group);
PARAMETERS
path: [in] points to the path of the file to modify.
fd: [in] the file descriptor to modify.
owner: [in] the new uid. -1 for no change.
group: [in] the new gid. -1 for no change.
DESCRIPTION
chown changes the uid and gid of file specified by path to owner and group. fchown changes
the uid and gid of file descriptor fd to owner and group. The superuser may do whatever he
wishes with the uid and gid of a file. The owner of a file may only change the gid of the
file to any group he belongs to.
RETURN VALUE
On success zero is returned. On error, -1 is returned and errno is set to one of the
following values:
for chown:
EPERM: the effective uid of the task is not equal the the uid of the file and the task does
not have superuser privileges.
ENOTDIR, EACCESS, EFAULT, ENOENT, ENOMEM ENAMETOOLONG, EROFS or ELOOP.
for fchown:
EPERM: the effective uid of the task is not equal the the uid of the file and the task does
not have superuser privileges.
ENOENT, EROFS or EBADF.
**************************************************************************************
chroot
SYNOPSIS
int chroot(const char *path);
PARAMETERS
path: [in] points to the new root.
DESCRIPTION
Changes the root directory for the current task and all its children to the path specified
by path. This operation is privilegied and only the superuser can invoke it successfully.
RETURN VALUE
On success zero is returned. On error, -1 is returned and errno is set to one of the
following values:
EPERM: the effective uid of the task is not equal the the uid of the file and the task does
not have superuser privileges.
ENOTDIR, EACCESS, EFAULT, ENOENT, ENOMEM ENAMETOOLONG, EROFS or ELOOP.
**************************************************************************************
close
SYNOPSIS
int close(int fd);
PARAMETERS
fd: [in] the file descriptor to close.
DESCRIPTION
Closes the file descriptor fd. If fd is the last file descriptor refering to a file, then
the ressources associated with that file are deallocated. The lock held on the file by the
current task are released.
RETURN VALUE
On success zero is returned. On error, -1 is returned and errno is set to EBADF.
**************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -