|INTRO(2)||System Calls Manual||INTRO(2)|
introduction to system calls and error numbers
The manual pages in section 2 provide an overview of the system calls, their error returns, and other common definitions and concepts.
Nearly all of the system calls provide an error number in the external variable errno, which is currently defined as:
extern int errno;
Portable applications must not depend on this definition, and
should only use errno as defined in
<errno.h>. When a system
call detects an error, it returns an integer value indicating failure
(usually -1) and sets the variable errno accordingly.
(This allows interpretation of the failure on receiving a -1 and to take
action accordingly.) Successful calls never set errno;
once set, it remains until another error occurs. It should only be examined
after an error. Note that a number of system calls overload the meanings of
these error numbers, and that the meanings must be interpreted according to
the type and circumstances of the call.
The following is a complete list of the errors and their names as
1 EPERMOperation not permitted.
2 ENOENTNo such file or directory.
3 ESRCHNo such process.
4 EINTRInterrupted system call.
SIGQUIT) was caught by the thread during the execution of an interruptible function. If the signal handler performs a normal return, the interrupted function call will seem to have returned the error condition.
5 EIOInput/output error.
6 ENXIODevice not configured.
7 E2BIGArgument list too long.
8 ENOEXECExec format error.
9 EBADFBad file descriptor.
10 ECHILDNo child processes.
11 EDEADLKResource deadlock avoided.
12 ENOMEMCannot allocate memory.
13 EACCESPermission denied.
14 EFAULTBad address.
15 ENOTBLKBlock device required.
16 EBUSYDevice busy.
17 EEXISTFile exists.
18 EXDEVCross-device link.
19 ENODEVOperation not supported by device.
20 ENOTDIRNot a directory.
21 EISDIRIs a directory.
22 EINVALInvalid argument.
23 ENFILEToo many open files in system.
24 EMFILEToo many open files.
25 ENOTTYInappropriate ioctl for device.
26 ETXTBSYText file busy.
27 EFBIGFile too large.
28 ENOSPCNo space left on device.
29 ESPIPEIllegal seek.
30 EROFSRead-only file system.
31 EMLINKToo many links.
32 EPIPEBroken pipe.
33 EDOMNumerical argument out of domain.
34 ERANGEResult too large.
35 EAGAINResource temporarily unavailable.
36 EINPROGRESSOperation now in progress.
37 EALREADYOperation already in progress.
38 ENOTSOCKSocket operation on non-socket.
39 EDESTADDRREQDestination address required.
40 EMSGSIZEMessage too long.
41 EPROTOTYPEProtocol wrong type for socket.
42 ENOPROTOOPTProtocol not available.
43 EPROTONOSUPPORTProtocol not supported.
44 ESOCKTNOSUPPORTSocket type not supported.
45 EOPNOTSUPPOperation not supported.
46 EPFNOSUPPORTProtocol family not supported.
47 EAFNOSUPPORTAddress family not supported by protocol family.
48 EADDRINUSEAddress already in use.
49 EADDRNOTAVAILCan't assign requested address.
50 ENETDOWNNetwork is down.
51 ENETUNREACHNetwork is unreachable.
52 ENETRESETNetwork dropped connection on reset.
53 ECONNABORTEDSoftware caused connection abort.
54 ECONNRESETConnection reset by peer.
55 ENOBUFSNo buffer space available.
56 EISCONNSocket is already connected.
57 ENOTCONNSocket is not connected.
58 ESHUTDOWNCan't send after socket shutdown.
59 ETOOMANYREFSToo many references: can't splice.
60 ETIMEDOUTOperation timed out.
61 ECONNREFUSEDConnection refused.
62 ELOOPToo many levels of symbolic links.
SYMLOOP_MAX) symbolic links.
63 ENAMETOOLONGFile name too long.
NAME_MAX) characters, or an entire path name exceeded 1023 (
64 EHOSTDOWNHost is down.
65 EHOSTUNREACHNo route to host.
66 ENOTEMPTYDirectory not empty.
.’ and ‘
..’ was supplied to a remove directory or rename call.
67 EPROCLIMToo many processes.
68 EUSERSToo many users.
69 EDQUOTDisc quota exceeded.
70 ESTALEStale NFS file handle.
72 EBADRPCRPC struct is bad.
73 ERPCMISMATCHRPC version wrong.
74 EPROGUNAVAILRPC prog. not avail.
75 EPROGMISMATCHProgram version wrong.
76 EPROCUNAVAILBad procedure for program.
77 ENOLCKNo locks available.
78 ENOSYSFunction not implemented.
79 EFTYPEInappropriate file type or format.
80 EAUTHAuthentication error.
81 ENEEDAUTHNeed authenticator.
82 EIPSECIPsec processing failure.
83 ENOATTRAttribute not found.
84 EILSEQIllegal byte sequence.
85 ENOMEDIUMNo medium found.
86 EMEDIUMTYPEWrong medium type.
87 EOVERFLOWValue too large to be stored in data type.
88 ECANCELEDOperation canceled.
89 EIDRMIdentifier removed.
90 ENOMSGNo message of desired type.
91 ENOTSUPNot supported.
Each user is also a member of one or more groups. One of these groups is distinguished from others and used in implementing accounting facilities. The positive integer corresponding to this distinguished group is termed the real group ID.
All processes have a real user ID and real group ID. These are initialized from the equivalent attributes of the process that created it.
The effective user ID and effective group ID are initially the process's real user ID and real group ID respectively. Either may be modified through execution of a set-user-ID or set-group-ID file (possibly by one of its ancestors) (see execve(2)). By convention, the effective group ID (the first member of the group access list) is duplicated, so that the execution of a set-group-ID program does not result in the loss of the original (real) group ID.
The group access list is a set of group IDs used only in determining resource accessibility. Access checks are performed as described below in ``File Access Permissions''.
NAME_MAX) characters may be used to name an ordinary file, special file, or directory.
These characters may be selected from the set of all ASCII
character excluding 0 (NUL) and the ASCII code for
Note that it is generally unwise to use
]’ as part of file names because
of the special meaning attached to these characters by the shell.
Note also that (
NAME_MAX) is an upper
limit fixed by the kernel, meant to be used for sizing buffers. Some
filesystems may have additional restrictions. These can be queried using
/’, followed by zero or more directory names separated by slashes, optionally followed by a file name. The total length of a path name must be less than 1024 (
PATH_MAX) characters. Additional restrictions may apply, depending upon the filesystem, to be queried with pathconf(2) or fpathconf(2) if needed.
If a path name begins with a slash, the path search begins at the root directory. Otherwise, the search begins from the current working directory. A slash by itself names the root directory. An empty pathname is invalid.
.’ and ‘
..’, referred to as dot and dot-dot respectively. Dot refers to the directory itself and dot-dot refers to its parent directory.
File access is broken down according to whether a file may be: read, written, or executed. Directory files use the execute permission to control if the directory may be searched.
File access permissions are interpreted by the system as they apply to three different classes of users: the owner of the file, those users in the file's group, anyone else. Every file has an independent set of access permissions for each of these classes. When an access check is made, the system decides if permission should be granted by checking the access information applicable to the caller.
Read, write, and execute/search permissions on a file are granted to a process if:
The process's effective user ID is that of the superuser. (Note: even the superuser cannot execute a non-executable file.)
The process's effective user ID matches the user ID of the owner of the file and the owner permissions allow the access.
The process's effective user ID does not match the user ID of the owner of the file, and either the process's effective group ID matches the group ID of the file, or the group ID of the file is in the process's group access list, and the group permissions allow the access.
Neither the effective user ID nor effective group ID and group access list of the process match the corresponding user ID and group ID of the file, but the permissions for ``other users'' allow access.
Otherwise, permission is denied.
Sockets are typed according to their communications properties. These properties include whether messages sent and received at a socket require the name of the partner, whether communication is reliable, the format used in naming message recipients, etc.
Each instance of the system supports some collection of socket types; consult socket(2) for more information about the types available and their properties.
Each instance of the system supports some number of sets of communications protocols. Each protocol set supports addresses of a certain format. An Address Family is the set of addresses for a specific group of protocols. Each socket has an address chosen from the address family in which the socket was created.
intro manual page appeared in
Version 6 AT&T UNIX.
|May 30, 2014||OpenBSD-5.6|