xref: /openbsd-src/lib/libc/sys/intro.2 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\"	$OpenBSD: intro.2,v 1.20 2001/03/27 22:41:44 aaron Exp $
2.\"	$NetBSD: intro.2,v 1.6 1995/02/27 12:33:41 cgd Exp $
3.\"
4.\" Copyright (c) 1980, 1983, 1986, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)intro.2	8.3 (Berkeley) 12/11/93
36.\"
37.Dd December 11, 1993
38.Dt INTRO 2
39.Os
40.Sh NAME
41.Nm intro
42.Nd introduction to system calls and error numbers
43.Sh SYNOPSIS
44.Fd #include <errno.h>
45.Sh DESCRIPTION
46This section provides an overview of the system calls,
47their error returns, and other common definitions and concepts.
48.\".Pp
49.\".Sy System call restart
50.\".Pp
51.\"<more later...>
52.Sh DIAGNOSTICS
53Nearly all of the system calls provide an error number in the external
54variable
55.Va errno ,
56which is defined as:
57.Pp
58.Dl extern int errno;
59.Pp
60When a system call detects an error, it returns an integer value
61indicating failure (usually \-1) and sets the variable
62.Va errno
63accordingly.
64(This allows interpretation of the failure on receiving
65a \-1 and to take action accordingly.)
66Successful calls never set
67.Va errno ;
68once set, it remains until another error occurs.
69It should only be examined after an error.
70Note that a number of system calls overload the meanings of these
71error numbers, and that the meanings must be interpreted according
72to the type and circumstances of the call.
73.Pp
74The following is a complete list of the errors and their
75names as given in
76.Aq Pa sys/errno.h .
77.Bl -hang -width Ds
78.It Er 0 Em "Error 0" .
79Not used.
80.It Er 1 EPERM Em "Operation not permitted" .
81An attempt was made to perform an operation limited to processes
82with appropriate privileges or to the owner of a file or other
83resources.
84.It Er 2 ENOENT Em "No such file or directory" .
85A component of a specified pathname did not exist, or the
86pathname was an empty string.
87.It Er 3 ESRCH Em "No such process" .
88No process could be found corresponding to that specified by the given
89process ID.
90.It Er 4 EINTR Em "Interrupted function call" .
91An asynchronous signal (such as
92.Dv SIGINT
93or
94.Dv SIGQUIT )
95was caught by the process during the execution of an interruptible
96function.
97If the signal handler performs a normal return, the
98interrupted function call will seem to have returned the error condition.
99.It Er 5 EIO Em "Input/output error" .
100Some physical input or output error occurred.
101This error will not be reported until a subsequent operation on the same file
102descriptor and may be lost (over written) by any subsequent errors.
103.It Er 6 ENXIO Em "\&No such device or address" .
104Input or output on a special file referred to a device that did not
105exist, or made a request beyond the limits of the device.
106This error may also occur when, for example, a tape drive is not online or
107no disk pack is loaded on a drive.
108.It Er 7 E2BIG Em "Arg list too long" .
109The number of bytes used for the argument and environment
110list of the new process exceeded the limit
111.Dv NCARGS
112(specified in
113.Aq Pa sys/param.h ) .
114.It Er 8 ENOEXEC Em "Exec format error" .
115A request was made to execute a file that, although it has the appropriate
116permissions, was not in the format required for an executable file.
117.It Er 9 EBADF Em "Bad file descriptor" .
118A file descriptor argument was out of range, referred to no open file,
119or a read (write) request was made to a file that was only open for
120writing (reading).
121.It Er 10 ECHILD Em "\&No child processes" .
122A
123.Xr wait 2
124or
125.Xr waitpid 2
126function was executed by a process that had no existing or unwaited-for
127child processes.
128.It Er 11 EDEADLK Em "Resource deadlock avoided" .
129An attempt was made to lock a system resource that
130would have resulted in a deadlock situation.
131.It Er 12 ENOMEM Em "Cannot allocate memory" .
132The new process image required more memory than was allowed by the hardware
133or by system-imposed memory management constraints.
134A lack of swap space is normally temporary; however, a lack of core is not.
135Soft limits may be increased to their corresponding hard limits.
136.It Er 13 EACCES Em "Permission denied" .
137An attempt was made to access a file in a way forbidden
138by its file access permissions.
139.It Er 14 EFAULT Em "Bad address" .
140The system detected an invalid address in attempting to
141use an argument of a call.
142.It Er 15 ENOTBLK Em "Not a block device" .
143A block device operation was attempted on a non-block device or file.
144.It Er 16 EBUSY Em "Resource busy" .
145An attempt to use a system resource which was in use at the time
146in a manner which would have conflicted with the request.
147.It Er 17 EEXIST Em "File exists" .
148An existing file was mentioned in an inappropriate context,
149for instance, as the new link name in a
150.Xr link 2
151function.
152.It Er 18 EXDEV Em "Improper link" .
153A hard link to a file on another file system was attempted.
154.It Er 19 ENODEV Em "Operation not supported by device" .
155An attempt was made to apply an inappropriate function to a device,
156for example, trying to read a write-only device such as a printer.
157.It Er 20 ENOTDIR Em "Not a directory" .
158A component of the specified pathname existed, but it was
159not a directory, when a directory was expected.
160.It Er 21 EISDIR Em "Is a directory" .
161An attempt was made to open a directory with write mode specified.
162.It Er 22 EINVAL Em "Invalid argument" .
163Some invalid argument was supplied.
164(For example, specifying an undefined signal to a
165.Xr signal 3
166or
167.Xr kill 2
168function).
169.It Er 23 ENFILE Em "Too many open files in system" .
170Maximum number of file descriptors allowable on the system
171has been reached and a requests for an open cannot be satisfied
172until at least one has been closed.
173.It Er 24 EMFILE Em "Too many open files" .
174(As released, the limit on the number of
175open files per process is 64.)
176.Xr getdtablesize 3
177will obtain the current limit.
178.It Er 25 ENOTTY Em "Inappropriate ioctl for device" .
179A control function (see
180.Xr ioctl 2 )
181was attempted for a file or
182special device for which the operation was inappropriate.
183.It Er 26 ETXTBSY Em "Text file busy" .
184The new process was a pure procedure (shared text) file
185which was open for writing by another process, or
186while the pure procedure file was being executed an
187.Xr open 2
188call requested write access.
189.It Er 27 EFBIG Em "File too large" .
190The size of a file exceeded the maximum (about 2.1E9 bytes).
191.It Er 28 ENOSPC Em "Device out of space" .
192A
193.Xr write 2
194to an ordinary file, the creation of a directory or symbolic link,
195or the creation of a directory entry failed because no more disk
196blocks were available on the file system, or the allocation of an
197inode for a newly created file failed because no more inodes were
198available on the file system.
199.It Er 29 ESPIPE Em "Illegal seek" .
200An
201.Xr lseek 2
202function was issued on a socket, pipe or
203.Tn FIFO .
204.It Er 30 EROFS Em "Read-only file system" .
205An attempt was made to modify a file or directory was made
206on a file system that was read-only at the time.
207.It Er 31 EMLINK Em "Too many links" .
208Maximum allowable hard links to a single file has been exceeded (limit
209of 32767 hard links per file).
210.It Er 32 EPIPE Em "Broken pipe" .
211A write on a pipe, socket or
212.Tn FIFO
213for which there is no process to read the data.
214.It Er 33 EDOM Em "Numerical argument out of domain" .
215A numerical input argument was outside the defined domain of
216the mathematical function.
217.It Er 34 ERANGE Em "Numerical result out of range" .
218A numerical result of the function was too large to fit in the
219available space (perhaps exceeded precision).
220.It Er 35 EAGAIN Em "Resource temporarily unavailable" .
221This is a temporary condition and later calls to the
222same routine may complete normally.
223.It Er 36 EINPROGRESS Em "Operation now in progress" .
224An operation that takes a long time to complete (such as a
225.Xr connect 2 )
226was attempted on a non-blocking object (see
227.Xr fcntl 2 ) .
228.It Er 37 EALREADY Em "Operation already in progress" .
229An operation was attempted on a non-blocking object that already
230had an operation in progress.
231.It Er 38 ENOTSOCK Em "Socket operation on non-socket" .
232Self-explanatory.
233.It Er 39 EDESTADDRREQ Em "Destination address required" .
234A required address was omitted from an operation on a socket.
235.It Er 40 EMSGSIZE Em "Message too long" .
236A message sent on a socket was larger than the internal message buffer
237or some other network limit.
238.It Er 41 EPROTOTYPE Em "Protocol wrong type for socket" .
239A protocol was specified that does not support the semantics of the
240socket type requested.
241For example, you cannot use the
242.Tn ARPA
243Internet
244.Tn UDP
245protocol with type
246.Dv SOCK_STREAM .
247.It Er 42 ENOPROTOOPT Em "Protocol not available" .
248A bad option or level was specified in a
249.Xr getsockopt 2
250or
251.Xr setsockopt 2
252call.
253.It Er 43 EPROTONOSUPPORT Em "Protocol not supported" .
254The protocol has not been configured into the
255system or no implementation for it exists.
256.It Er 44 ESOCKTNOSUPPORT Em "Socket type not supported" .
257The support for the socket type has not been configured into the
258system or no implementation for it exists.
259.It Er 45 EOPNOTSUPP Em "Operation not supported" .
260The attempted operation is not supported for the type of object referenced.
261Usually this occurs when a file descriptor refers to a file or socket
262that cannot support this operation, for example, trying to
263.Em accept
264a connection on a datagram socket.
265.It Er 46 EPFNOSUPPORT Em "Protocol family not supported" .
266The protocol family has not been configured into the
267system or no implementation for it exists.
268.It Er 47 EAFNOSUPPORT Em "Address family not supported by protocol family" .
269An address incompatible with the requested protocol was used.
270For example, you shouldn't necessarily expect to be able to use
271.Tn NS
272addresses with
273.Tn ARPA
274Internet protocols.
275.It Er 48 EADDRINUSE Em "Address already in use" .
276Only one usage of each address is normally permitted.
277.It Er 49 EADDRNOTAVAIL Em "Cannot assign requested address" .
278Normally results from an attempt to create a socket with an
279address not on this machine.
280.It Er 50 ENETDOWN Em "Network is down" .
281A socket operation encountered a dead network.
282.It Er 51 ENETUNREACH Em "Network is unreachable" .
283A socket operation was attempted to an unreachable network.
284.It Er 52 ENETRESET Em "Network dropped connection on reset" .
285The host you were connected to crashed and rebooted.
286.It Er 53 ECONNABORTED Em "Software caused connection abort" .
287A connection abort was caused internal to your host machine.
288.It Er 54 ECONNRESET Em "Connection reset by peer" .
289A connection was forcibly closed by a peer.
290This normally results from a loss of the connection on the remote socket
291due to a timeout or a reboot.
292.It Er 55 ENOBUFS Em "\&No buffer space available" .
293An operation on a socket or pipe was not performed because
294the system lacked sufficient buffer space or because a queue was full.
295.It Er 56 EISCONN Em "Socket is already connected" .
296A
297.Xr connect 2
298request was made on an already connected socket; or, a
299.Xr sendto 2
300or
301.Xr sendmsg 2
302request on a connected socket specified a destination
303when already connected.
304.It Er 57 ENOTCONN Em "Socket is not connected" .
305An request to send or receive data was disallowed because
306the socket was not connected and (when sending on a datagram socket)
307no address was supplied.
308.It Er 58 ESHUTDOWN Em "Cannot send after socket shutdown" .
309A request to send data was disallowed because the socket
310had already been shut down with a previous
311.Xr shutdown 2
312call.
313.It Er 59 ETOOMANYREFS Em "Too many references: can't splice" .
314Not used in
315.Ox .
316.It Er 60 ETIMEDOUT Em "Operation timed out" .
317A
318.Xr connect 2
319or
320.Xr send 2
321request failed because the connected party did not
322properly respond after a period of time.
323(The timeout period is dependent on the communication protocol.)
324.It Er 61 ECONNREFUSED Em "Connection refused" .
325No connection could be made because the target machine actively
326refused it.
327This usually results from trying to connect to a service that is
328inactive on the foreign host.
329.It Er 62 ELOOP Em "Too many levels of symbolic links" .
330A path name lookup involved more than 8 symbolic links.
331.It Er 63 ENAMETOOLONG Em "File name too long" .
332A component of a path name exceeded 255
333.Pq Dv MAXNAMELEN
334characters, or an entire path name exceeded 1023
335.Pq Dv MAXPATHLEN Ns -1
336characters.
337.It Er 64 EHOSTDOWN Em "Host is down" .
338A socket operation failed because the destination host was down.
339.It Er 65 EHOSTUNREACH Em "No route to host" .
340A socket operation was attempted to an unreachable host.
341.It Er 66 ENOTEMPTY Em "Directory not empty" .
342A directory with entries other than
343.Ql \&.
344and
345.Ql \&..
346was supplied to a remove directory or rename call.
347.It Er 67 EPROCLIM Em "Too many processes" .
348.It Er 68 EUSERS Em "Too many users" .
349The quota system ran out of table entries.
350.It Er 69 EDQUOT Em "Disc quota exceeded" .
351A
352.Xr write 2
353to an ordinary file, the creation of a directory or symbolic link,
354or the creation of a directory entry failed because the user's quota
355of disk blocks was exhausted, or the allocation of an inode for a newly
356created file failed because the user's quota of inodes was exhausted.
357.It Er 70 ESTALE Em "Stale NFS file handle" .
358An attempt was made to access an open file (on an
359.Tn NFS
360filesystem) which is now unavailable as referenced by the file descriptor.
361This may indicate the file was deleted on the
362.Tn NFS
363server or some
364other catastrophic event occurred.
365.It Er 72 EBADRPC Em "RPC struct is bad" .
366Exchange of
367.Tn RPC
368information was unsuccessful.
369.It Er 73 ERPCMISMATCH Em "RPC version wrong" .
370The version of
371.Tn RPC
372on the remote peer is not compatible with the local version.
373.It Er 74 EPROGUNAVAIL Em "RPC prog. not avail" .
374The requested program is not registered on the remote host.
375.It Er 75 EPROGMISMATCH Em "Program version wrong" .
376The requested version of the program is not available on the remote host
377.Pq Tn RPC .
378.It Er 76 EPROCUNAVAIL Em "Bad procedure for program" .
379An
380.Tn RPC
381call was attempted for a procedure which doesn't exist
382in the remote program.
383.It Er 77 ENOLCK Em "No locks available" .
384A system-imposed limit on the number of simultaneous file
385locks was reached.
386.It Er 78 ENOSYS Em "Function not implemented" .
387Attempted a system call that is not available on this
388system.
389.It Er 79 EFTYPE Em "Inappropriate file type or format" .
390The file contains invalid data or set to invalid modes.
391.It Er 80 EAUTH Em "Authentication error" .
392Attempted to use an invalid authentication ticket to mount a
393.Tn NFS
394filesystem.
395.It Er 81 ENEEDAUTH Em "Need authenticator" .
396An authentication ticket must be obtained before the given
397.Tn NFS
398filesystem may be mounted.
399.El
400.Sh DEFINITIONS
401.Bl -tag -width Ds
402.It Process ID
403Each active process in the system is uniquely identified by a non-negative
404integer called a process ID.
405The range of this ID is from 1 to 32766.
406.It Parent Process ID
407A new process is created by a currently active process; (see
408.Xr fork 2 ) .
409The parent process ID of a process is initially the process ID of its creator.
410If the creating process exits,
411the parent process ID of each child is set to the ID of a system process,
412.Xr init 8 .
413.It Process Group
414Each active process is a member of a process group that is identified by
415a non-negative integer called the process group ID.
416This is the process ID of the group leader.
417This grouping permits the signaling of related processes (see
418.Xr termios 4 )
419and the job control mechanisms of
420.Xr csh 1 .
421.It Session
422A session is a set of one or more process groups.
423A session is created by a successful call to
424.Xr setsid 2 ,
425which causes the caller to become the only member of the only process
426group in the new session.
427.It Session Leader
428A process that has created a new session by a successful call to
429.Xr setsid 2 ,
430is known as a session leader.
431Only a session leader may acquire a terminal as its controlling terminal (see
432.Xr termios 4 ) .
433.It Controlling Process
434A session leader with a controlling terminal is a controlling process.
435.It Controlling Terminal
436A terminal that is associated with a session is known as the controlling
437terminal for that session and its members.
438.It Terminal Process Group ID
439A terminal may be acquired by a session leader as its controlling terminal.
440Once a terminal is associated with a session, any of the process groups
441within the session may be placed into the foreground by setting
442the terminal process group ID to the ID of the process group.
443This facility is used
444to arbitrate between multiple jobs contending for the same terminal;
445(see
446.Xr csh 1
447and
448.Xr tty 4 ) .
449.It Orphaned Process Group
450A process group is considered to be
451.Em orphaned
452if it is not under the control of a job control shell.
453More precisely, a process group is orphaned
454when none of its members has a parent process that is in the same session
455as the group,
456but is in a different process group.
457Note that when a process exits, the parent process for its children
458is changed to be
459.Xr init 8 ,
460which is in a separate session.
461Not all members of an orphaned process group are necessarily orphaned
462processes (those whose creating process has exited).
463The process group of a session leader is orphaned by definition.
464.It Real User ID and Real Group ID
465Each user on the system is identified by a positive integer
466termed the real user ID.
467.Pp
468Each user is also a member of one or more groups.
469One of these groups is distinguished from others and
470used in implementing accounting facilities.
471The positive integer corresponding to this distinguished group is termed
472the real group ID.
473.Pp
474All processes have a real user ID and real group ID.
475These are initialized from the equivalent attributes
476of the process that created it.
477.It "Effective User ID, Effective Group ID, and Group Access List"
478Access to system resources is governed by two values:
479the effective user ID, and the group access list.
480The first member of the group access list is also known as the
481effective group ID.
482(In POSIX.1, the group access list is known as the set of supplementary
483group IDs, and it is unspecified whether the effective group ID is
484a member of the list.)
485.Pp
486The effective user ID and effective group ID are initially the
487process's real user ID and real group ID respectively.
488Either may be modified through execution of a set-user-ID or set-group-ID
489file (possibly by one its ancestors) (see
490.Xr execve 2 ) .
491By convention, the effective group ID (the first member of the group access
492list) is duplicated, so that the execution of a set-group-ID program
493does not result in the loss of the original (real) group ID.
494.Pp
495The group access list is a set of group IDs
496used only in determining resource accessibility.
497Access checks are performed as described below in ``File Access Permissions''.
498.It Saved Set User ID and Saved Set Group ID
499When a process executes a new file, the effective user ID is set
500to the owner of the file if the file is set-user-ID, and the effective
501group ID (first element of the group access list) is set to the group
502of the file if the file is set-group-ID.
503The effective user ID of the process is then recorded as the saved set-user-ID,
504and the effective group ID of the process is recorded as the saved set-group-ID.
505These values may be used to regain those values as the effective user
506or group ID after reverting to the real ID (see
507.Xr setuid 2 ) .
508(In POSIX.1, the saved set-user-ID and saved set-group-ID are optional,
509and are used in setuid and setgid, but this does not work as desired
510for the superuser.)
511.It Superuser
512A process is recognized as a
513.Em superuser
514process and is granted special privileges if its effective user ID is 0.
515.It Special Processes
516The processes with process IDs of 0, 1, and 2 are special.
517Process 0 is the scheduler.
518Process 1 is the initialization process
519.Xr init 8 ,
520and is the ancestor of every other process in the system.
521It is used to control the process structure.
522Process 2 is the paging daemon.
523.It Descriptor
524An integer assigned by the system when a file is referenced
525by
526.Xr open 2
527or
528.Xr dup 2 ,
529or when a socket is created by
530.Xr pipe 2 ,
531.Xr socket 2
532or
533.Xr socketpair 2 ,
534which uniquely identifies an access path to that file or socket from
535a given process or any of its children.
536.It File Name
537Names consisting of up to 255
538.Pq Dv MAXNAMELEN
539characters may be used to name
540an ordinary file, special file, or directory.
541.Pp
542These characters may be selected from the set of all
543.Tn ASCII
544character
545excluding 0 (NUL) and the
546.Tn ASCII
547code for
548.Ql \&/
549(slash).
550.Pp
551Note that it is generally unwise to use
552.Ql \&* ,
553.Ql \&? ,
554.Ql \&[
555or
556.Ql \&]
557as part of
558file names because of the special meaning attached to these characters
559by the shell.
560.Pp
561Note also that
562.Pq Dv MAXNAMELEN
563is an upper limit fixed by the kernel, meant to be used for sizing buffers.
564Some filesystems may have additional restrictions.
565These can be queried using
566.Xr pathconf 2
567and
568.Xr fpathconf 2 .
569.It Path Name
570A path name is a
571.Tn NUL Ns -terminated
572character string starting with an
573optional slash
574.Ql \&/ ,
575followed by zero or more directory names separated
576by slashes, optionally followed by a file name.
577The total length of a path name must be less than 1024
578.Pq Dv MAXPATHLEN
579characters.
580Additional restrictions may apply, depending upon the filesystem, to be
581queried with
582.Xr pathconf 2
583or
584.Xr fpathconf 2
585if needed.
586.Pp
587If a path name begins with a slash, the path search begins at the
588.Em root
589directory.
590Otherwise, the search begins from the current working directory.
591A slash by itself names the root directory.
592An empty pathname refers to the current directory.
593.It Directory
594A directory is a special type of file that contains entries
595that are references to other files.
596Directory entries are called links.
597By convention, a directory contains at least two links,
598.Ql \&.
599and
600.Ql \&.. ,
601referred to as
602.Em dot
603and
604.Em dot-dot
605respectively.
606Dot refers to the directory itself and dot-dot refers to its
607parent directory.
608.It "Root Directory and Current Working Directory"
609Each process has associated with it a concept of a root directory
610and a current working directory for the purpose of resolving path
611name searches.
612A process's root directory need not be the root directory of
613the root file system.
614.It File Access Permissions
615Every file in the file system has a set of access permissions.
616These permissions are used in determining whether a process
617may perform a requested operation on the file (such as opening
618a file for writing).
619Access permissions are established at the time a file is created.
620They may be changed at some later time through the
621.Xr chmod 2
622call.
623.Pp
624File access is broken down according to whether a file may be: read,
625written, or executed.
626Directory files use the execute permission to control if the directory
627may be searched.
628.Pp
629File access permissions are interpreted by the system as
630they apply to three different classes of users: the owner
631of the file, those users in the file's group, anyone else.
632Every file has an independent set of access permissions for
633each of these classes.
634When an access check is made, the system decides if permission should be
635granted by checking the access information applicable to the caller.
636.Pp
637Read, write, and execute/search permissions on
638a file are granted to a process if:
639.Pp
640The process's effective user ID is that of the superuser.
641(Note: even the superuser cannot execute a non-executable file.)
642.Pp
643The process's effective user ID matches the user ID of the owner
644of the file and the owner permissions allow the access.
645.Pp
646The process's effective user ID does not match the user ID of the
647owner of the file, and either the process's effective
648group ID matches the group ID
649of the file, or the group ID of the file is in
650the process's group access list,
651and the group permissions allow the access.
652.Pp
653Neither the effective user ID nor effective group ID
654and group access list of the process
655match the corresponding user ID and group ID of the file,
656but the permissions for ``other users'' allow access.
657.Pp
658Otherwise, permission is denied.
659.It Sockets and Address Families
660.Pp
661A socket is an endpoint for communication between processes.
662Each socket has queues for sending and receiving data.
663.Pp
664Sockets are typed according to their communications properties.
665These properties include whether messages sent and received
666at a socket require the name of the partner, whether communication
667is reliable, the format used in naming message recipients, etc.
668.Pp
669Each instance of the system supports some
670collection of socket types; consult
671.Xr socket 2
672for more information about the types available and
673their properties.
674.Pp
675Each instance of the system supports some number of sets of
676communications protocols.
677Each protocol set supports addresses of a certain format.
678An Address Family is the set of addresses for a specific group of protocols.
679Each socket has an address chosen from the address family in which the
680socket was created.
681.El
682.Sh SEE ALSO
683.Xr intro 3 ,
684.Xr perror 3
685.Sh HISTORY
686An
687.Nm
688manual page appeared in
689.At v6 .
690