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