xref: /csrg-svn/lib/libc/sys/intro.2 (revision 48433)
147208Scael.\" Copyright (c) 1980,1983,1986,1991 Regents of the University of California.
247208Scael.\" All rights reserved.
320110Smckusick.\"
447208Scael.\" %sccs.include.redist.man%
520110Smckusick.\"
6*48433Skarels.\"     @(#)intro.2	6.12 (Berkeley) 04/20/91
747208Scael.\"
847208Scael.Dd
947208Scael.Dt INTRO 2
1047208Scael.Os BSD 4
1147208Scael.Sh NAME
1247208Scael.Nm intro
1347208Scael.Nd introduction to system calls and error numbers
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <sys/errno.h>
1647208Scael.Sh DESCRIPTION
1744667SkarelsThis section provides an overview of the system calls,
1844667Skarelstheir error returns, and other common definitions and concepts.
1947208Scael.\".Pp
2047208Scael.\".Sy System call restart
2147208Scael.\".Pp
2244667Skarels.\"<more later...>
2347208Scael.Sh DIAGNOSTICS
2447208ScaelNearly all of the system calls provide an error number in the external
2547208Scaelvariable
2647208Scael.Va errno ,
2747208Scaelwhich is defined as:
2847208Scael.Pp
2947208Scael.Dl extern int errno
3047208Scael.Pp
3147208ScaelWhen a system call detects an error,
3247208Scaelit returns an integer value
3347208Scaelindicating failure (usually -1)
3447208Scaeland sets the variable
3547208Scael.Va errno
3647208Scaelaccordingly.
3747208Scael<This allows interpretation of the failure on receiving
3847208Scaela -1 and to take action accordingly.>
3947208ScaelSuccessful calls never set
4047208Scael.Va errno ;
4147208Scaelonce set, it remains until another error occurs.
4247208ScaelIt should only be examined after an error.
4328185SkarelsNote that a number of system calls overload the meanings of these
4428185Skarelserror numbers, and that the meanings must be interpreted according
4528185Skarelsto the type and circumstances of the call.
4647208Scael.Pp
4720111SmckusickThe following is a complete list of the errors and their
4820111Smckusicknames as given in
4947208Scael.Aq Pa sys/errno.h .
5047208Scael.Bl -hang -width Ds
5147208Scael.It Er 0 Em "Error 0" .
5247208ScaelNot used.
5347208Scael.It Er 1 EPERM Em "Operation not permitted .
5447208ScaelAn attempt was made to perform an operation limited to processes
5547208Scaelwith appropriate privileges or to the owner of a file or other
5647208Scaelresources.
5747208Scael.It Er 2 ENOENT Em "No such file or directory" .
5847208ScaelA component of a specified pathname did not exist, or the
5947208Scaelpathname was an empty string.
6047208Scael.It Er 3 ESRCH Em "No such process" .
6147208ScaelNo process could be found corresponding to that specified by the given
6247208Scaelprocess ID.
6347208Scael.It Er 4 EINTR Em "Interrupted function call" .
6447208ScaelAn asynchronous signal (such as
6547208Scael.Dv SIGINT
6620110Smckusickor
6747208Scael.Dv SIGQUIT )
6847208Scaelwas caught by the process during the execution of an interruptible
6947208Scaelfunction. If the signal handler performs a normal return, the
7047208Scaelinterupted function call will seem to have returned the error condition.
7147208Scael.It Er 5 EIO Em "Input/output error" .
7247208ScaelSome physical input or output error occurred.
7347208ScaelThis error not be reported until a subsequent operation on the same file
7447208Scaeldescriptor and may be lost (over written) by any subsequent errors.
7547208Scael.It Er 6 ENXIO Em "\&No such device or address" .
7647208ScaelInput or output on a special file referred to a device that did not
7747208Scaelexist, or
7847208Scaelmade a request beyond the limits of the device.
7947208ScaelThis error may also occur when, for example,
8047208Scaela tape drive is not online or no disk pack is
8147208Scaelis loaded on a drive.
8247208Scael.It Er 7 E2BIG Em "Arg list too long" .
8347208ScaelThe number of bytes used for the argument and environment
8447208Scaellist of the new process exceeded the current limit
8547208Scaelof 20480 bytes
8647208Scael.Pf ( Dv NCARGS
8747208Scaelin
8847208Scael.Aq Pa sys/param.h ) .
8947208Scael.It Er 8 ENOEXEC Em "Exec format error" .
9047208ScaelA request was made to execute a file
9123809Ssechrestthat, although it has the appropriate permissions,
9247208Scaelwas not in the format required for an
9347208Scaelexecutable file.
9447208Scael.It Er 9 EBADF Em "Bad file descriptor" .
9547208ScaelA file descriptor argument was out of range, referred to no open file,
9647208Scaelor a read (write) request was made to a file that was only open for
9747208Scaelwriting (reading).
9847208Scael.It Er 10 ECHILD Em "\&No child processes" .
9947208ScaelA
10047208Scael.Xr wait
10147208Scaelor
10247208Scael.Xr waitpid
10347208Scaelfunction was executed by a process that had no existing or unwaited-for
10447208Scaelchild processes.
10547208Scael.It Er 11 EDEADLK Em "Resource deadlock avoided" .
10644763StrentAn attempt was made to lock a system resource that
10744763Strentwould have resulted in a deadlock situation.
10847208Scael.It Er 12 ENOMEM Em "Cannnot allocate memory" .
10947208ScaelThe new process image required more memory than was allowed by the hardware
11047208Scaelor by system-imposed memory management constraints.
11147208ScaelA lack of swap space is normally temporary; however,
11247208Scaela lack of core is not.
11328185SkarelsSoft limits may be increased to their corresponding hard limits.
11447208Scael.It Er 13 EACCES Em "Permission denied" .
11520110SmckusickAn attempt was made to access a file in a way forbidden
11647208Scaelby its file access permissions.
11747208Scael.It Er 14 EFAULT Em "Bad address" .
11847208ScaelThe system detected an invalid address in attempting to
11947208Scaeluse an argument of a call.
12047208Scael.It Er 15 ENOTBLK Em "Not a block device" .
12147208ScaelA block device operation was attempted on a non-block device or file.
12247208Scael.It Er 16 EBUSY Em "Resource busy" .
12347208ScaelAn attempt to use a system resource which was in use at the time
12447208Scaelin a manner which would have conflicted with the request.
12547208Scael.It Er 17 EEXIST Em "File exists" .
12620110SmckusickAn existing file was mentioned in an inappropriate context,
12747208Scaelfor instance, as the new link name in a
12847208Scael.Xr link
12947208Scaelfunction.
13047208Scael.It Er 18 EXDEV Em "Improper link" .
13147208ScaelA hard link to a file on another file system
13220110Smckusickwas attempted.
13347208Scael.It Er 19 ENODEV Em "Operation not supported by device" .
13420110SmckusickAn attempt was made to apply an inappropriate
13547208Scaelfunction to a device,
13647208Scaelfor example,
13747208Scaeltrying to read a write-only device such as a printer.
13847208Scael.It Er 20 ENOTDIR Em "Not a directory" .
13947208ScaelA component of the specified pathname existed, but it was
14047208Scaelnot a directory, when a directory was expected.
14147208Scael.It Er 21 EISDIR Em "Is a directory" .
14247208ScaelAn attempt was made to open a directory with write mode specified.
14347208Scael.It Er 22 EINVAL Em "Invalid argument" .
14447208ScaelSome invalid argument was supplied. (For example,
14547208Scaelspecifying an undefined signal to a
14647208Scael.Xr signal
14747208Scaelor
14847208Scael.Xr kill
14947208Scaelfunction).
15047208Scael.It Er 23 ENFILE Em "Too many open files in system" .
15147208ScaelMaximum number of file descriptors allowable on the system
15247208Scaelhas been reached and a requests for an open cannot be satisfied
15347208Scaeluntil at least one has been closed.
15447208Scael.It Er 24 EMFILE Em "Too many open files" .
15547208Scael<As released, the limit on the number of
15647208Scaelopen files per process is 64.>
15747208Scael.Xr Getdtablesize 2
15828185Skarelswill obtain the current limit.
15947208Scael.It Er 25 ENOTTY Em "Inappropriate ioctl for device" .
16047208ScaelA control function (see
16147208Scael.Xr ioctl 2 )
16247208Scaelwas attempted for a file or
16347208Scaelspecial device for which the operation was inappropriate.
16447208Scael.It Er 26 ETXTBSY Em "Text file busy" .
16547208ScaelThe new process was a pure procedure (shared text) file
16647208Scaelwhich was open for writing by another process, or
16747208Scaelthe pure procedure file was being executed an
16847208Scael.Xr open
16947208Scaelcall requested write access.
17047208Scael.It Er 27 EFBIG Em "File too large" .
17120110SmckusickThe size of a file exceeded the maximum (about
17228185Skarels.if t 2\u\s-231\s+2\d
17328185Skarels.if n 2.1E9
17420110Smckusickbytes).
17547208Scael.It Er 28 ENOSPC Em "Device out of space" .
17624439SmckusickA
17747208Scael.Xr write
17824439Smckusickto an ordinary file, the creation of a
17924439Smckusickdirectory or symbolic link, or the creation of a directory
18024439Smckusickentry failed because no more disk blocks are available
18124439Smckusickon the file system, or the allocation of an inode for a newly
18224439Smckusickcreated file failed because no more inodes are available
18324439Smckusickon the file system.
18447208Scael.It Er 29 ESPIPE Em "Illegal seek" .
18520110SmckusickAn
18647208Scael.Xr lseek
18747208Scaelfunction was issued on a socket, pipe or
18847208Scael.Tn FIFO .
18947208Scael.It Er 30 EROFS Em "Read-only file system" .
19047208ScaelAn attempt was made to modify a file or directory
19120110Smckusickwas made
19247208Scaelon a file system that was read-only at the time.
19347208Scael.It Er 31 EMLINK Em "Too many links" .
19447208ScaelMaximum allowable hard links to a single file has been exceeded (limit
19547208Scaelof 32767 hard links per file).
19647208Scael.It Er 32 EPIPE Em "Broken pipe" .
19747208ScaelA write on a pipe, socket or
19847208Scael.Tn FIFO
19947208Scaelfor which there is no process
20020110Smckusickto read the data.
20147208Scael.It Er 33 EDOM Em "Numerical argument out of domain" .
20247208ScaelA numerical input argument was outside the defined domain of the mathematical
20347208Scaelfunction.
20447208Scael.It Er 34 ERANGE Em "Numerical result out of range" .
20547208ScaelA numerical result of the function was to large to fit in the
20647208Scaelavailable space (perhaps exceeded precision).
20747208Scael.It Er 35 EAGAIN Em "Resource temporarily unavailable" .
20844763StrentThis is a temporary condition and later calls to the
20944763Strentsame routine may complete normally.
21047208Scael.It Er 36 EINPROGRESS Em "Operation now in progress" .
21123809SsechrestAn operation that takes a long time to complete (such as
21247208Scaela
21347208Scael.Xr connect 2 )
21447208Scaelwas attempted on a non-blocking object (see
21547208Scael.Xr fcntl 2 ) .
21647208Scael.It Er 37 EALREADY Em "Operation already in progress" .
21723809SsechrestAn operation was attempted on a non-blocking object that already
21820111Smckusickhad an operation in progress.
21947208Scael.It Er 38 ENOTSOCK Em "Socket operation on non-socket" .
22020111SmckusickSelf-explanatory.
22147208Scael.It Er 39 EDESTADDRREQ Em "Destination address required" .
22220111SmckusickA required address was omitted from an operation on a socket.
22347208Scael.It Er 40 EMSGSIZE Em "Message too long" .
22428185SkarelsA message sent on a socket was larger than the internal message buffer
22528185Skarelsor some other network limit.
22647208Scael.It Er 41 EPROTOTYPE Em "Protocol wrong type for socket" .
22723809SsechrestA protocol was specified that does not support the semantics of the
22847208Scaelsocket type requested. For example, you cannot use the
22947208Scael.Tn ARPA
23047208ScaelInternet
23147208Scael.Tn UDP
23247208Scaelprotocol with type
23347208Scael.Dv SOCK_STREAM .
23447208Scael.It Er 42 ENOPROTOOPT Em "Protocol not available" .
23528185SkarelsA bad option or level was specified in a
23647208Scael.Xr getsockopt 2
23720111Smckusickor
23847208Scael.Xr setsockopt 2
23920111Smckusickcall.
24047208Scael.It Er 43 EPROTONOSUPPORT Em "Protocol not supported" .
24120111SmckusickThe protocol has not been configured into the
24220111Smckusicksystem or no implementation for it exists.
24347208Scael.It Er 44 ESOCKTNOSUPPORT Em "Socket type not supported" .
24420111SmckusickThe support for the socket type has not been configured into the
24520111Smckusicksystem or no implementation for it exists.
246*48433Skarels.It Er 45 EOPNOTSUPP Em "Operation not supported" .
247*48433SkarelsThe attempted operation is not supported for the type of object referenced.
248*48433SkarelsUsually this occurs when a file descriptor refers to a file or socket
249*48433Skarelsthat cannot support this operation,
250*48433Skarelsfor example, trying to
25147208Scael.Em accept
25247208Scaela connection on a datagram socket.
25347208Scael.It Er 46 EPFNOSUPPORT Em "Protocol family not supported" .
25420111SmckusickThe protocol family has not been configured into the
25520111Smckusicksystem or no implementation for it exists.
25647208Scael.It Er 47 EAFNOSUPPORT Em "Address family not supported by protocol family" .
25720111SmckusickAn address incompatible with the requested protocol was used.
25847208ScaelFor example, you shouldn't necessarily expect to be able to use
25947208Scael.Tn NS
26047208Scaeladdresses with
26147208Scael.Tn ARPA
26247208ScaelInternet protocols.
26347208Scael.It Er 48 EADDRINUSE Em "Address already in use" .
26420111SmckusickOnly one usage of each address is normally permitted.
26547208Scael.It Er 49 EADDRNOTAVAIL Em "Cannot assign requested address" .
26620111SmckusickNormally results from an attempt to create a socket with an
26720111Smckusickaddress not on this machine.
26847208Scael.It Er 50 ENETDOWN Em "Network is down" .
26920111SmckusickA socket operation encountered a dead network.
27047208Scael.It Er 51 ENETUNREACH Em "Network is unreachable" .
27120111SmckusickA socket operation was attempted to an unreachable network.
27247208Scael.It Er 52 ENETRESET Em "Network dropped connection on reset" .
27320111SmckusickThe host you were connected to crashed and rebooted.
27447208Scael.It Er 53 ECONNABORTED Em "Software caused connection abort" .
27520111SmckusickA connection abort was caused internal to your host machine.
27647208Scael.It Er 54 ECONNRESET Em "Connection reset by peer" .
27720111SmckusickA connection was forcibly closed by a peer.  This normally
27828185Skarelsresults from a loss of the connection on the remote socket
27928185Skarelsdue to a timeout or a reboot.
28047208Scael.It Er 55 ENOBUFS Em "\&No buffer space available" .
28120111SmckusickAn operation on a socket or pipe was not performed because
28228185Skarelsthe system lacked sufficient buffer space or because a queue was full.
28347208Scael.It Er 56 EISCONN Em "Socket is already connected" .
28420111SmckusickA
28547208Scael.Xr connect
28620111Smckusickrequest was made on an already connected socket; or,
28720111Smckusicka
28847208Scael.Xr sendto
28920111Smckusickor
29047208Scael.Xr sendmsg
29120111Smckusickrequest on a connected socket specified a destination
29228185Skarelswhen already connected.
29347208Scael.It Er 57 ENOTCONN Em "Socket is not connected" .
29420111SmckusickAn request to send or receive data was disallowed because
29528185Skarelsthe socket is not connected and (when sending on a  datagram socket)
29628185Skarelsno address was supplied.
29747208Scael.It Er 58 ESHUTDOWN Em "Cannot send after socket shutdown" .
29820111SmckusickA request to send data was disallowed because the socket
29920111Smckusickhad already been shut down with a previous
30047208Scael.Xr shutdown 2
30120111Smckusickcall.
30247208Scael.It Er 60 ETIMEDOUT Em "Connection timed out" .
30320111SmckusickA
30447208Scael.Xr connect
30528185Skarelsor
30647208Scael.Xr send
30720111Smckusickrequest failed because the connected party did not
30820111Smckusickproperly respond after a period of time.  (The timeout
30920111Smckusickperiod is dependent on the communication protocol.)
31047208Scael.It Er 61 ECONNREFUSED Em "Connection refused" .
31120111SmckusickNo connection could be made because the target machine actively
31220111Smckusickrefused it.  This usually results from trying to connect
31323809Ssechrestto a service that is inactive on the foreign host.
31447208Scael.It Er 62 ELOOP Em "Too many levels of symbolic links" .
31520111SmckusickA path name lookup involved more than 8 symbolic links.
31647208Scael.It Er 63 ENAMETOOLONG Em "File name too long" .
31747208ScaelA component of a path name exceeded 255
31847208Scael.Pq Dv MAXNAMELEN
31947208Scaelcharacters, or an entire
32047208Scaelpath name exceeded 1023
32147208Scael.Pq Dv MAXPATHLEN Ns -1
32247208Scaelcharacters.
32347208Scael.It Er 64 EHOSTDOWN Em "Host is down" .
32420112SmckusickA socket operation failed because the destination host was down.
32547208Scael.It Er 65 EHOSTUNREACH Em "No route to host" .
32620112SmckusickA socket operation was attempted to an unreachable host.
32747208Scael.It Er 66 ENOTEMPTY Em "Directory not empty" .
32847208ScaelA directory with entries other than
32947208Scael.Ql \&.
33047208Scaeland
33147208Scael.Ql \&..
33220111Smckusickwas supplied to a remove directory or rename call.
33347208Scael.It Er 67 EPROCLIM Em "Too many processes" .
33447208Scael.It Er 68 EUSERS Em "Too many users" .
33535335SbosticThe quota system ran out of table entries.
33647208Scael.It Er 69 EDQUOT Em "Disc quota exceeded" .
33724439SmckusickA
33847208Scael.Xr write
33924439Smckusickto an ordinary file, the creation of a
34024439Smckusickdirectory or symbolic link, or the creation of a directory
34124439Smckusickentry failed because the user's quota of disk blocks was
34224439Smckusickexhausted, or the allocation of an inode for a newly
34324439Smckusickcreated file failed because the user's quota of inodes
34424439Smckusickwas exhausted.
34547208Scael.It Er 70 ESTALE Em "Stale NFS file handle" .
34647208ScaelAn attempt was made to access an open file (on an
34747208Scael.Tn NFS
34847208Scaelfilesystem)
34944763Strentwhich is now unavailable as referenced by the file descriptor.
35047208ScaelThis may indicate the file was deleted on the
35147208Scael.Tn NFS
35247208Scaelserver or some
35344763Strentother catastrophic event occured.
35447208Scael.It Er 72 EBADRPC Em "RPC struct is bad" .
35547208ScaelExchange of
35647208Scael.Tn RPC
35747208Scaelinformation was unsuccessful.
35847208Scael.It Er 73 ERPCMISMATCH Em "RPC version wrong" .
35947208ScaelThe version of
36047208Scael.Tn RPC
36147208Scaelon the remote peer is not compatible with
36244763Strentthe local version.
36347208Scael.It Er 74 EPROGUNAVAIL Em "RPC prog. not avail" .
36444763StrentThe requested program is not registered on the remote host.
36547208Scael.It Er 75 EPROGMISMATCH Em "Program version wrong" .
36644763StrentThe requested version of the program is not available
36747208Scaelon the remote host
36847208Scael.Pq Tn RPC .
36947208Scael.It Er 76 EPROCUNAVAIL Em "Bad procedure for program" .
37047208ScaelAn
37147208Scael.Tn RPC
37247208Scaelcall was attempted for a procedure which doesn't exist
37344763Strentin the remote program.
37447208Scael.It Er 77 ENOLCK Em "No locks available" .
37544763StrentA system-imposed limit on the number of simultaneous file
37644763Strentlocks was reached.
37747208Scael.It Er 78 ENOSYS Em "Function not implemented" .
37844763StrentAttempted a system call that is not available on this
37944763Strentsystem.
38047208Scael.Sh DEFINITIONS
38147208Scael.Bl -tag -width Ds
38247208Scael.It  Process ID .
38347208ScaelEach active process in the system is uniquely identified by a non-negative
38428185Skarelsinteger called a process ID.  The range of this ID is from 0 to 30000.
38547208Scael.It  Parent process ID
38628635SkjdA new process is created by a currently active process; (see
38747208Scael.Xr fork 2 ) .
38820111SmckusickThe parent process ID of a process is the process ID of its creator.
38947208Scael.It  Process Group ID
39020111SmckusickEach active process is a member of a process group that is identified by
39147208Scaela non-negative integer called the process group ID.  This is the process
39228185SkarelsID of the group leader.  This grouping permits the signaling of related
39320111Smckusickprocesses (see
39447208Scael.Xr killpg 2 )
39520111Smckusickand the job control mechanisms of
39647208Scael.Xr csh 1 .
39747208Scael.It  Tty Group ID
39820111SmckusickEach active process can be a member of a terminal group that is identified
39947208Scaelby a non-negative integer called the tty group ID.  This grouping is used
40020111Smckusickto arbitrate between multiple jobs contending for the same terminal;
40128635Skjd(see
40247208Scael.Xr csh 1
40320110Smckusickand
40447208Scael.Xr tty 4 ) .
40547208Scael.It  Real User ID and Real Group ID
40620111SmckusickEach user on the system is identified by a positive integer
40720111Smckusicktermed the real user ID.
40847208Scael.Pp
40920111SmckusickEach user is also a member of one or more groups.
41020111SmckusickOne of these groups is distinguished from others and
41120111Smckusickused in implementing accounting facilities.  The positive
41220111Smckusickinteger corresponding to this distinguished group is termed
41320111Smckusickthe real group ID.
41447208Scael.Pp
41520111SmckusickAll processes have a real user ID and real group ID.
41620111SmckusickThese are initialized from the equivalent attributes
41723809Ssechrestof the process that created it.
41847208Scael.It  Effective User Id, Effective Group Id, and Access Groups
41920111SmckusickAccess to system resources is governed by three values:
42020111Smckusickthe effective user ID, the effective group ID, and the
42120111Smckusickgroup access list.
42247208Scael.Pp
42320111SmckusickThe effective user ID and effective group ID are initially the
42420111Smckusickprocess's real user ID and real group ID respectively.  Either
42520111Smckusickmay be modified through execution of a set-user-ID or set-group-ID
42628635Skjdfile (possibly by one its ancestors) (see
42747208Scael.Xr execve 2 ) .
42847208Scael.Pp
42920111SmckusickThe group access list is an additional set of group ID's
43020111Smckusickused only in determining resource accessibility.  Access checks
43120111Smckusickare performed as described below in ``File Access Permissions''.
43247208Scael.It  Super-user
43320111SmckusickA process is recognized as a
43447208Scael.Em super-user
43520111Smckusickprocess and is granted special privileges if its effective user ID is 0.
43647208Scael.It  Special Processes
43720111SmckusickThe processes with a process ID's of 0, 1, and 2 are special.
43820111SmckusickProcess 0 is the scheduler.  Process 1 is the initialization process
43947208Scael.Xr init ,
44020111Smckusickand is the ancestor of every other process in the system.
44120111SmckusickIt is used to control the process structure.
44220111SmckusickProcess 2 is the paging daemon.
44347208Scael.It  Descriptor
44420111SmckusickAn integer assigned by the system when a file is referenced
44520111Smckusickby
44647208Scael.Xr open 2
44728185Skarelsor
44847208Scael.Xr dup 2 ,
44928185Skarelsor when a socket is created by
45047208Scael.Xr pipe 2 ,
45147208Scael.Xr socket 2
45220111Smckusickor
45347208Scael.Xr socketpair 2 ,
45420111Smckusickwhich uniquely identifies an access path to that file or socket from
45520111Smckusicka given process or any of its children.
45647208Scael.It  File Name
45747208ScaelNames consisting of up to 255
45847208Scael.Pq Dv MAXNAMELEN
45947208Scaelcharacters may be used to name
46020111Smckusickan ordinary file, special file, or directory.
46147208Scael.Pp
46247208ScaelThese characters may be selected from the set of all
46347208Scael.Tn ASCII
46447208Scaelcharacter
46547208Scaelexcluding 0 (NUL) and the
46647208Scael.Tn ASCII
46747208Scaelcode for
46847208Scael.Ql \&/
46947208Scael(slash).  (The parity bit,
47047208Scaelbit 7, must be 0.)
47147208Scael.Pp
47247208ScaelNote that it is generally unwise to use
47347208Scael.Ql \&* ,
47447208Scael.Ql \&? ,
47547208Scael.Ql \&[
47647208Scaelor
47747208Scael.Ql \&]
47847208Scaelas part of
47920111Smckusickfile names because of the special meaning attached to these characters
48020111Smckusickby the shell.
48147208Scael.It  Path Name
48247208ScaelA path name is a NUL-terminated character string starting with an
48347208Scaeloptional slash
48447208Scael.Ql \&/ ,
48547208Scaelfollowed by zero or more directory names separated
48620111Smckusickby slashes, optionally followed by a file name.
48747208ScaelThe total length of a path name must be less than 1024
48847208Scael.Pq Dv MAXPATHLEN
48947208Scaelcharacters.
49047208Scael.Pp
49120111SmckusickIf a path name begins with a slash, the path search begins at the
49247208Scael.Em root
49320111Smckusickdirectory.
49420111SmckusickOtherwise, the search begins from the current working directory.
49547208ScaelA slash by itself names the root directory.  An empty
49620111Smckusickpathname refers to the current directory.
49747208Scael.It  Directory
49823809SsechrestA directory is a special type of file that contains entries
49923809Ssechrestthat are references to other files.
50020111SmckusickDirectory entries are called links.  By convention, a directory
50147208Scaelcontains at least two links,
50247208Scael.Ql \&.
50320110Smckusickand
50447208Scael.Ql \&.. ,
50547208Scaelreferred to as
50647208Scael.Em dot
50747208Scaeland
50847208Scael.Em dot-dot
50920111Smckusickrespectively.  Dot refers to the directory itself and
51020111Smckusickdot-dot refers to its parent directory.
51147208Scael.It  Root Directory and Current Working Directory
51220111SmckusickEach process has associated with it a concept of a root directory
51320111Smckusickand a current working directory for the purpose of resolving path
51420111Smckusickname searches.  A process's root directory need not be the root
51520111Smckusickdirectory of the root file system.
51647208Scael.It  File Access Permissions
51720111SmckusickEvery file in the file system has a set of access permissions.
51820111SmckusickThese permissions are used in determining whether a process
51920111Smckusickmay perform a requested operation on the file (such as opening
52020111Smckusicka file for writing).  Access permissions are established at the
52120111Smckusicktime a file is created.  They may be changed at some later time
52220111Smckusickthrough the
52347208Scael.Xr chmod 2
52420111Smckusickcall.
52547208Scael.Pp
52620111SmckusickFile access is broken down according to whether a file may be: read,
52720111Smckusickwritten, or executed.  Directory files use the execute
52820111Smckusickpermission to control if the directory may be searched.
52947208Scael.Pp
53020111SmckusickFile access permissions are interpreted by the system as
53120111Smckusickthey apply to three different classes of users: the owner
53220111Smckusickof the file, those users in the file's group, anyone else.
53320111SmckusickEvery file has an independent set of access permissions for
53420111Smckusickeach of these classes.  When an access check is made, the system
53520111Smckusickdecides if permission should be granted by checking the access
53620111Smckusickinformation applicable to the caller.
53747208Scael.Pp
53820111SmckusickRead, write, and execute/search permissions on
53920111Smckusicka file are granted to a process if:
54047208Scael.Pp
54147208ScaelThe process's effective user ID is that of the super-user. (Note:
54247208Scaeleven the super-user cannot execute a non-executable file.)
54347208Scael.Pp
54420111SmckusickThe process's effective user ID matches the user ID of the owner
54520111Smckusickof the file and the owner permissions allow the access.
54647208Scael.Pp
54720111SmckusickThe process's effective user ID does not match the user ID of the
54820111Smckusickowner of the file, and either the process's effective
54920111Smckusickgroup ID matches the group ID
55020111Smckusickof the file, or the group ID of the file is in
55120111Smckusickthe process's group access list,
55220111Smckusickand the group permissions allow the access.
55347208Scael.Pp
55420111SmckusickNeither the effective user ID nor effective group ID
55520111Smckusickand group access list of the process
55620111Smckusickmatch the corresponding user ID and group ID of the file,
55720111Smckusickbut the permissions for ``other users'' allow access.
55847208Scael.Pp
55920111SmckusickOtherwise, permission is denied.
56047208Scael.It  Sockets and Address Families
56147208Scael.Pp
56220111SmckusickA socket is an endpoint for communication between processes.
56320111SmckusickEach socket has queues for sending and receiving data.
56447208Scael.Pp
56520111SmckusickSockets are typed according to their communications properties.
56620111SmckusickThese properties include whether messages sent and received
56720111Smckusickat a socket require the name of the partner, whether communication
56820111Smckusickis reliable, the format used in naming message recipients, etc.
56947208Scael.Pp
57020111SmckusickEach instance of the system supports some
57120111Smckusickcollection of socket types; consult
57247208Scael.Xr socket 2
57320111Smckusickfor more information about the types available and
57420111Smckusicktheir properties.
57547208Scael.Pp
57620111SmckusickEach instance of the system supports some number of sets of
57720111Smckusickcommunications protocols.  Each protocol set supports addresses
57820111Smckusickof a certain format.  An Address Family is the set of addresses
57920111Smckusickfor a specific group of protocols.  Each socket has an address
58020111Smckusickchosen from the address family in which the socket was created.
58147208Scael.Tp
58247208Scael.Sh SEE ALSO
58320111Smckusickintro(3), perror(3)
58447208Scael.Sh HISTORY
58547208ScaelAn
58647208Scael.Nm
58747208Scaelappeared in Version 6 AT&T UNIX.
588