unistd.h

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Template:Short description Template:Use American English Script error: No such module "Unsubst". Script error: No such module "Unsubst".

Script error: No such module "Sidebar". In the C and C++ programming languages, unistd.h is the name of the header file that provides access to the POSIX operating system API.[1] It is defined by the POSIX.1 standard, the base of the Single Unix Specification, and should therefore be available in any POSIX-compliant operating system and compiler. For instance, this includes Unix and Unix-like operating systems, such as GNU variants, distributions of Linux and BSD, and macOS, and compilers such as GCC and LLVM.

On Unix-like systems, the interface defined by unistd.h is typically made up largely of system call wrapper functions such as fork, pipe and I/O primitives (read, write, close, etc.).

Unix compatibility layers such as Cygwin and MinGW also provide their own versions of unistd.h. In fact, those systems provide it along with the translation libraries that implement its functions in terms of win32 functions. E.g. In Cygwin, a header file can be found in /usr/include that sub-includes a file of the same name in /usr/include/sys. Not everything is defined in there but some definitions are done by references to the GNU C standard library headers (like stddef.h) which provide the type size_t and many more. Thus, unistd.h is only a generically defined adaptive layer that might be based upon already existing system and compiler specific definitions. This has the general advantage of not having a possibly concurrent set of header file defined, but one that is built upon the same root which, for this reason, will raise much fewer concerns in combined usage cases.

Overview of functions

Function Description
Script error: No such module "anchor".crypt password and data encryption
Script error: No such module "anchor".encrypt encrypt 64-byte messages
Script error: No such module "anchor".gethostid get the unique identifier of the current host
Script error: No such module "anchor".gethostname get hostname
Script error: No such module "anchor".getopt parse command-line options
Script error: No such module "anchor".swab swap adjacent bytes
Script error: No such module "anchor".sysconf get configuration at run time
Signals Script error: No such module "anchor".alarm schedule an alarm signal
Script error: No such module "anchor".pause wait for signal
Filesystem Script error: No such module "anchor".access
Script error: No such module "anchor".faccessat
Script error: No such module "anchor".faccessat2
check user's permissions for a file or whether it exists
Script error: No such module "anchor".chdir
Script error: No such module "anchor".fchdir
change working directory
Script error: No such module "anchor".chown
Script error: No such module "anchor".fchown
Script error: No such module "anchor".lchown
Script error: No such module "anchor".fchownat
change owner and group of a file
Script error: No such module "anchor".close close a file descriptor
Script error: No such module "anchor".dup
Script error: No such module "anchor".dup2
duplicate a file descriptor
Script error: No such module "anchor".fsync
Script error: No such module "anchor".fdatasync
synchronize a file's in-core state with storage device
Script error: No such module "anchor".fpathconf
Script error: No such module "anchor".pathconf
get configuration values for files
Script error: No such module "anchor".ftruncate
Script error: No such module "anchor".truncate
truncate a file to a specified length
Script error: No such module "anchor".getcwd
Script error: No such module "anchor".getwd
Script error: No such module "anchor".get_current_dir_name
get current working directory
Script error: No such module "anchor".isatty test whether a file descriptor refers to a terminal
Script error: No such module "anchor".link
Script error: No such module "anchor".linkat
make a new name for a file
Script error: No such module "anchor".lockf apply, test or remove a POSIX lock on an open file
Script error: No such module "anchor".lseek reposition read/write file offset
Script error: No such module "anchor".pipe
Script error: No such module "anchor".pipe2
create pipe
Script error: No such module "anchor".pread
Script error: No such module "anchor".pwrite
read from or write to a file descriptor at a given offset
Script error: No such module "anchor".read read from a file descriptor
Script error: No such module "anchor".readlink
Script error: No such module "anchor".readlinkat
read value of a symbolic link
Script error: No such module "anchor".rmdir delete a directory
Script error: No such module "anchor".symlink
Script error: No such module "anchor".symlinkat
make a new name for a file
Script error: No such module "anchor".sync
Script error: No such module "anchor".syncfs
commit filesystem caches to disk
Script error: No such module "anchor".ttyname
Script error: No such module "anchor".ttyname_r
return name of a terminal
Script error: No such module "anchor".unlink
Script error: No such module "anchor".unlinkat
delete a name and possibly the file it refers to
Script error: No such module "anchor".write write to a file descriptor
Process Script error: No such module "anchor"._exit terminate the calling process
Script error: No such module "anchor".execl
Script error: No such module "anchor".execlp
Script error: No such module "anchor".execle
Script error: No such module "anchor".execv
Script error: No such module "anchor".execvp
Script error: No such module "anchor".execvpe
execute a file
Script error: No such module "anchor".fexecve execute program specified via file descriptor
Script error: No such module "anchor".fork create a new process
Script error: No such module "anchor".setpgid
Script error: No such module "anchor".getpgid
Script error: No such module "anchor".setpgrp
Script error: No such module "anchor".getpgrp
set/get process group
Script error: No such module "anchor".getpid
Script error: No such module "anchor".getppid
get process identification
Script error: No such module "anchor".getsid get session ID
Script error: No such module "anchor".nice change process priority
Script error: No such module "anchor".setsid creates a session and sets the process group ID
Script error: No such module "anchor".sleep sleep for a specified number of seconds
Script error: No such module "anchor".tcgetpgrp
Script error: No such module "anchor".tcsetpgrp
get and set terminal foreground process group
User/Group Script error: No such module "anchor".getgid
Script error: No such module "anchor".getegid
get group identity
Script error: No such module "anchor".getuid
Script error: No such module "anchor".geteuid
get user identity
Script error: No such module "anchor".getgroups get list of supplementary group IDs
Script error: No such module "anchor".getlogin
Script error: No such module "anchor".getlogin_r
get username
Script error: No such module "anchor".seteuid
Script error: No such module "anchor".setegid
set effective user or group ID
Script error: No such module "anchor".setgid set group identity
Script error: No such module "anchor".setreuid
Script error: No such module "anchor".setregid
set real and/or effective user or group ID
Script error: No such module "anchor".setuid set user identity

References

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

External links