unistd.h
Overview
Related Modules:
Description:
Provides functions and data structures related to process operations.
For example, you can use the functions to create and copy a process, and obtain a process ID.
Since:
1.0
Version:
1.0
Summary
Macros
SEEK_SET 0 |
|
SEEK_CUR 1 |
Relocation starts from the position of the currently accessed file. |
SEEK_END 2 |
|
NULL ((void*)0) |
|
F_OK 0 |
|
R_OK 4 |
|
W_OK 2 |
|
X_OK 1 |
Functions
pipe (int pipefd[2]) |
|
close (int fd) |
|
dup (int oldfd) |
|
dup2 (int oldfd, int newfd) |
Copies the descriptor of the target file to a specified descriptor. |
lseek (int fd, off_t offset, int whence) |
|
fsync (int fd) |
Synchronizes a file associated with a specified file descriptor to the storage device. |
read (int fd, void buf, size_t size) |
Reads the file contents and saves them in a specified buffer location. |
write (int fd, const void buf, size_t size) |
|
pread (int fd, void buf, size_t count, off_t offset) |
Reads data whose offset is offset and length is count from fd to the buffer. |
pwrite (int fd, const void buf, size_t count, off_t offset) |
Writes data from the buffer to fd whose offset is offset and length is count. |
unlink (const char path) |
|
unlinkat (int fd, const char path, int flag) |
|
rmdir (const char path) |
|
truncate (const char path, off_t length) |
Truncates a file to a specified size based on the file path. |
ftruncate (int fd, off_t length) |
|
access (const char path, int mode) |
|
chdir (const char path) |
Switches the current working directory to a specified directory. |
getcwd (char buf, size_t size) |
|
alarm (unsigned int seconds) |
Arranges a signal to be sent to the current process after the number of seconds specified by seconds. |
sleep (unsigned seconds) |
|
pause (void) |
|
fork (void) |
Creates a new process that inherits from the user-mode data of its parent process. |
execve (const char path, char const arg[], char const envp[]) |
|
execv (const char path, char const arg[]) |
|
execle (const char path, const char arg,…) |
|
execl (const char path, const char arg,…) |
|
execvp (const char path, char const arg[]) |
|
execlp (const char path, const char arg,…) |
|
_exit (int status) |
Exits the process immediately and closes all opened file descriptors in the process. |
swab (const void from, void to, ssize_t n) |
|
getpid (void) |
|
getppid (void) |
|
getpgrp (void) |
|
getpgid (pid_t pid) |
Obtains the ID of the process group whose process ID is specified by pid. |
setpgid (pid_t pid, pid_t pgid) |
Sets the ID of the process group whose process ID is specified by pid. |
getopt (int argc, char const argv[], const char optstring) |
Parses command-line arguments based on the specified option. |
getuid (void) |
|
geteuid (void) |
|
getgid (void) |
|
getegid (void) |
Obtains the effective group ID (GID) of the calling process. |
getgroups (int size, gid_t list[]) |
Obtains a list of supplementary user group IDs specific to the calling process. |
setuid (uid_t uid) |
|
seteuid (uid_t euid) |
|
setgid (gid_t gid) |
|
setegid (gid_t egid) |
|
pathconf (const char path, int name) |
|
setreuid (uid_t ruid, uid_t euid) |
Sets the real and effective user IDs of the calling process. |
setregid (gid_t rgid, gid_t egid) |
Sets the real and effective user group IDs of the calling process. |
setpgrp (void) |
|
usleep (unsigned useconds) |
|
ualarm (unsigned value, unsigned interval) |
|
setgroups (size_t size, const gid_t list) |
Sets the supplementary user group list of the calling process. |
setresuid (uid_t ruid, uid_t euid, uid_t suid) |
Sets the real, effective, and saved user IDs of the calling process. |
setresgid (gid_t rgid, gid_t egid, gid_t sgid) |
Sets the real, effective, and saved group IDs of the calling process. |
getresuid (uid_t ruid, uid_t euid, uid_t suid) |
Obtains the real, effective, and saved user IDs of the calling process. |
getresgid (gid_t rgid, gid_t egid, gid_t sgid) |
Obtains the real, effective, and saved user group IDs of the calling process. |
get_current_dir_name (void) |
|
sbrk (intptr_t increment) |
|
getpagesize (void) |
|
chown (const char pathname, uid_t owner, gid_t group) |