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