1.\" $NetBSD: intro.2,v 1.57 2015/04/22 13:59:54 wiz 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 April 21, 2015 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. 273In this implementation this is the same as 274.Er EWOULDBLOCK , 275but 276.Er EAGAIN 277is the preferred name. 278.It Er 36 EINPROGRESS Em "Operation now in progress" . 279An operation that takes a long time to complete (such as 280a 281.Xr connect 2 ) 282was attempted on a non-blocking object (see 283.Xr fcntl 2 ) . 284.It Er 37 EALREADY Em "Operation already in progress" . 285An operation was attempted on a non-blocking object that already 286had an operation in progress. 287.It Er 38 ENOTSOCK Em "Socket operation on non-socket" . 288Self-explanatory. 289.It Er 39 EDESTADDRREQ Em "Destination address required" . 290A required address was omitted from an operation on a socket. 291.It Er 40 EMSGSIZE Em "Message too long" . 292A message sent on a socket was larger than the internal message buffer 293or some other network limit. 294.It Er 41 EPROTOTYPE Em "Protocol wrong type for socket" . 295A protocol was specified that does not support the semantics of the 296socket type requested. 297For example, you cannot use the 298.Tn ARPA 299Internet 300.Tn UDP 301protocol with type 302.Dv SOCK_STREAM . 303.It Er 42 ENOPROTOOPT Em "Protocol option not available" . 304A bad option or level was specified in a 305.Xr getsockopt 2 306or 307.Xr setsockopt 2 308call. 309.It Er 43 EPROTONOSUPPORT Em "Protocol not supported" . 310The protocol has not been configured into the 311system or no implementation for it exists. 312.It Er 44 ESOCKTNOSUPPORT Em "Socket type not supported" . 313The support for the socket type has not been configured into the 314system or no implementation for it exists. 315.It Er 45 EOPNOTSUPP Em "Operation not supported" . 316The attempted operation is not supported for the type of object referenced. 317Usually this occurs when a file descriptor refers to a file or socket 318that cannot support this operation, 319for example, trying to 320.Em accept 321a connection on a datagram socket. 322.It Er 46 EPFNOSUPPORT Em "Protocol family not supported" . 323The protocol family has not been configured into the 324system or no implementation for it exists. 325.It Er 47 EAFNOSUPPORT Em "Address family not supported by protocol family" . 326An address incompatible with the requested protocol was used. 327For example, you shouldn't necessarily expect to be able to use 328.Tn NS 329addresses with 330.Tn ARPA 331Internet protocols. 332.It Er 48 EADDRINUSE Em "Address already in use" . 333Only one usage of each address is normally permitted. 334.It Er 49 EADDRNOTAVAIL Em "Cannot assign requested address" . 335Normally results from an attempt to create a socket with an 336address not on this machine. 337.It Er 50 ENETDOWN Em "Network is down" . 338A socket operation encountered a dead network. 339.It Er 51 ENETUNREACH Em "Network is unreachable" . 340A socket operation was attempted to an unreachable network. 341.It Er 52 ENETRESET Em "Network dropped connection on reset" . 342The host you were connected to crashed and rebooted. 343.It Er 53 ECONNABORTED Em "Software caused connection abort" . 344A connection abort was caused internal to your host machine. 345.It Er 54 ECONNRESET Em "Connection reset by peer" . 346A connection was forcibly closed by a peer. 347This normally results from a loss of the connection on the remote 348socket due to a timeout or a reboot. 349.It Er 55 ENOBUFS Em "\&No buffer space available" . 350An operation on a socket or pipe was not performed because 351the system lacked sufficient buffer space or because a queue was full. 352.It Er 56 EISCONN Em "Socket is already connected" . 353A 354.Xr connect 2 355request was made on an already connected socket; or, 356a 357.Xr sendto 2 358or 359.Xr sendmsg 2 360request on a connected socket specified a destination 361when already connected. 362.It Er 57 ENOTCONN Em "Socket is not connected" . 363An request to send or receive data was disallowed because 364the socket was not connected and (when sending on a datagram socket) 365no address was supplied. 366.It Er 58 ESHUTDOWN Em "Cannot send after socket shutdown" . 367A request to send data was disallowed because the socket 368had already been shut down with a previous 369.Xr shutdown 2 370call. 371.It Er 59 ETOOMANYREFS Em "Too many references: can't splice" . 372The resource is used up to capacity. 373.It Er 60 ETIMEDOUT Em "Operation timed out" . 374A 375.Xr connect 2 376or 377.Xr send 2 378request failed because the connected party did not 379properly respond after a period of time. 380(The timeout period is dependent on the communication protocol). 381.It Er 61 ECONNREFUSED Em "Connection refused" . 382No connection could be made because the target machine actively 383refused it. 384This usually results from trying to connect 385to a service that is inactive on the foreign host. 386.It Er 62 ELOOP Em "Too many levels of symbolic links" . 387A path name lookup involved more than 32 388.Pq Dv MAXSYMLINKS 389symbolic links. 390.It Er 63 ENAMETOOLONG Em "File name too long" . 391A component of a path name exceeded 255 392.Pq Dv MAXNAMELEN 393characters, or an entire 394path name exceeded 1023 395.Pq Dv MAXPATHLEN Ns \-1 396characters. 397.It Er 64 EHOSTDOWN Em "Host is down" . 398A socket operation failed because the destination host was down. 399.It Er 65 EHOSTUNREACH Em "No route to host" . 400A socket operation was attempted to an unreachable host. 401.It Er 66 ENOTEMPTY Em "Directory not empty" . 402A directory with entries other than 403.Ql \&. 404and 405.Ql \&.. 406was supplied to a remove directory or rename call. 407.It Er 67 EPROCLIM Em "Too many processes" . 408.It Er 68 EUSERS Em "Too many users" . 409The quota system ran out of table entries. 410.It Er 69 EDQUOT Em "Disc quota exceeded" . 411A 412.Xr write 2 413to an ordinary file, the creation of a 414directory or symbolic link, or the creation of a directory 415entry failed because the user's quota of disk blocks was 416exhausted, or the allocation of an inode for a newly 417created file failed because the user's quota of inodes 418was exhausted. 419.It Er 70 ESTALE Em "Stale NFS file handle" . 420An attempt was made to access an open file (on an 421.Tn NFS 422filesystem) 423which is now unavailable as referenced by the file descriptor. 424This may indicate the file was deleted on the 425.Tn NFS 426server or some other catastrophic event occurred. 427.It Er 71 EREMOTE Em "Too many levels of remote in path" . 428.Tn NFS 429version 3 RPC return code 71. 430.It Er 72 EBADRPC Em "RPC struct is bad" . 431Exchange of 432.Tn RPC 433information was unsuccessful. 434.It Er 73 ERPCMISMATCH Em "RPC version wrong" . 435The version of 436.Tn RPC 437on the remote peer is not compatible with 438the local version. 439.It Er 74 EPROGUNAVAIL Em "RPC prog. not avail" . 440The requested program is not registered on the remote host. 441.It Er 75 EPROGMISMATCH Em "Program version wrong" . 442The requested version of the program is not available 443on the remote host 444.Pq Tn RPC . 445.It Er 76 EPROCUNAVAIL Em "Bad procedure for program" . 446An 447.Tn RPC 448call was attempted for a procedure which doesn't exist 449in the remote program. 450.It Er 77 ENOLCK Em "No locks available" . 451A system-imposed limit on the number of simultaneous file 452locks was reached. 453.It Er 78 ENOSYS Em "Function not implemented" . 454Attempted a system call that is not available on this 455system. 456.It Er 79 EFTYPE Em "Inappropriate file type or format" . 457Attempted a file operation on a file of a type for which it was invalid. 458.It Er 80 EAUTH Em "Authentication error" . 459Attempted to use an invalid authentication ticket to mount an 460.Tn NFS 461filesystem. 462.It Er 81 ENEEDAUTH Em "Need authenticator" . 463An authentication ticket must be obtained before the given 464.Tn NFS 465filesystem may be mounted. 466.It Er 82 EIDRM Em "Identifier removed" . 467An IPC identifier was removed while the current process was waiting on it. 468.It Er 83 ENOMSG Em "No message of the desired type" . 469An IPC message queue does not contain a message of the desired type, 470or a message catalog does not contain the requested message. 471.It Er 84 EOVERFLOW Em "Value too large to be stored in data type" . 472A numerical result of the function was too large to be stored in the 473caller-provided space. 474.It Er 85 EILSEQ Em "Illegal byte sequence" . 475A wide character/multibyte character encoding error occurred. 476.It Er 86 ENOTSUP Em "Not supported" . 477An attempt was made to set or change a parameter to an unsupported 478value. 479.It Er 87 ECANCELED Em "Operation canceled" . 480The requested operation was canceled. 481.It Er 88 EBADMSG Em "Bad or corrupt message" . 482A message in the specified message catalog did not satisfy implementation 483defined criteria, or a STREAMS operation encountered an invalid message or 484a file descriptor at the STREAM head. 485.It Er 89 ENODATA Em "No message available" . 486No message is available on the STREAM head read queue 487.It Er 90 ENOSR Em "No STREAM resources" . 488Buffers could not be allocated due to insufficient STREAMs memory resources. 489.It Er 91 ENOSTR Em "Not a STREAM" . 490A STREAM is not associated with the specified file descriptor. 491.It Er 92 ETIME Em "STREAM ioctl timeout" . 492The timer set for a STREAMS 493.Xr ioctl 2 494operation has expired. 495.It Er 93 ENOATTR Em "Attribute not found" . 496The specified extended attribute does not exist. 497.It Er 94 EMULTIHOP Em "Multihop attempted" . 498Components of path require hopping to multiple remote machines and the 499file system does not allow it. 500It occurs when users try to access remote resources which are not directly 501accessible. 502.It Er 95 ENOLINK Em "Link has been severed" . 503Occurs when the link (virtual circuit) connecting to a remote machine is gone. 504.It Er 96 EPROTO Em "Protocol error" . 505Some protocol error occurred. 506This error is device-specific, but is generally not related to a hardware 507failure. 508.El 509.Sh DEFINITIONS 510.Bl -tag -width Ds 511.It Process ID 512Each active process in the system is uniquely identified by a non-negative 513integer called a process ID. 514The range of this ID is from 0 to 30000. 515.It Parent process ID 516A new process is created by a currently active process; (see 517.Xr fork 2 ) . 518The parent process ID of a process is initially the process ID of its creator. 519If the creating process exits, 520the parent process ID of each child is set to the ID of a system process, 521.Xr init 8 . 522.It Process Group 523Each active process is a member of a process group that is identified by 524a non-negative integer called the process group ID. 525This is the process ID of the group leader. 526This grouping permits the signaling of related processes (see 527.Xr termios 4 ) 528and the job control mechanisms of 529.Xr csh 1 . 530.It Session 531A session is a set of one or more process groups. 532A session is created by a successful call to 533.Xr setsid 2 , 534which causes the caller to become the only member of the only process 535group in the new session. 536.It Session leader 537A process that has created a new session by a successful call to 538.Xr setsid 2 , 539is known as a session leader. 540Only a session leader may acquire a terminal as its controlling terminal (see 541.Xr termios 4 ) . 542.It Controlling process 543A session leader with a controlling terminal is a controlling process. 544.It Controlling terminal 545A terminal that is associated with a session is known as the controlling 546terminal for that session and its members. 547.It "Terminal Process Group ID" 548A terminal may be acquired by a session leader as its controlling terminal. 549Once a terminal is associated with a session, any of the process groups 550within the session may be placed into the foreground by setting 551the terminal process group ID to the ID of the process group. 552This facility is used 553to arbitrate between multiple jobs contending for the same terminal. 554(See 555.Xr csh 1 556and 557.Xr tty 4 558for more information on job control.) 559.It "Orphaned Process Group" 560A process group is considered to be 561.Em orphaned 562if it is not under the control of a job control shell. 563More precisely, a process group is orphaned 564when none of its members has a parent process that is in the same session 565as the group, 566but is in a different process group. 567Note that when a process exits, the parent process for its children 568is changed to be 569.Xr init 8 , 570which is in a separate session. 571Not all members of an orphaned process group are necessarily orphaned 572processes (those whose creating process has exited). 573The process group of a session leader is orphaned by definition. 574.It "Real User ID and Real Group ID" 575Each user on the system is identified by a positive integer 576termed the real user ID. 577.Pp 578Each user is also a member of one or more groups. 579One of these groups is distinguished from others and 580used in implementing accounting facilities. 581The positive integer corresponding to this distinguished group is 582termed the real group ID. 583.Pp 584All processes have a real user ID and real group ID. 585These are initialized from the equivalent attributes 586of the process that created it. 587.It "Effective User Id, Effective Group Id, and Group Access List" 588Access to system resources is governed by two values: 589the effective user ID, and the group access list. 590The first member of the group access list is also known as the 591effective group ID. 592(In POSIX.1, the group access list is known as the set of supplementary 593group IDs, and it is unspecified whether the effective group ID is 594a member of the list.) 595.Pp 596The effective user ID and effective group ID are initially the 597process's real user ID and real group ID respectively. 598Either may be modified through execution of a set-user-ID or 599set-group-ID file (possibly by one of its ancestors) (see 600.Xr execve 2 ) . 601By convention, the effective group ID (the first member of the group access 602list) is duplicated, so that the execution of a set-group-ID program 603does not result in the loss of the original (real) group ID. 604.Pp 605The group access list is a set of group IDs 606used only in determining resource accessibility. 607Access checks are performed as described below in 608.Qq File Access Permissions . 609.It "Saved Set User ID and Saved Set Group ID" 610When a process executes a new file, the effective user ID is set 611to the owner of the file if the file is set-user-ID, and the effective 612group ID (first element of the group access list) is set to the group 613of the file if the file is set-group-ID. 614The effective user ID of the process is then recorded as the saved set-user-ID, 615and the effective group ID of the process is recorded as the saved set-group-ID. 616These values may be used to regain those values as the effective user 617or group ID after reverting to the real ID (see 618.Xr setuid 2 ) . 619(In POSIX.1, the saved set-user-ID and saved set-group-ID are optional, 620and are used in setuid and setgid, but this does not work as desired 621for the super-user.) 622.It Super-user 623A process is recognized as a 624.Em super-user 625process and is granted special privileges if its effective user ID is 0. 626.It Special Processes 627The processes with process IDs of 0 and 1 are special. 628Process 0 is the scheduler. 629Process 1 is the initialization process 630.Xr init 8 , 631and is the ancestor (parent) of every other process in the system. 632It is used to control the process structure. 633The kernel will allocate other kernel threads to handle certain 634periodic tasks or device related tasks, such as: 635.Bl -tag -width pagedaemon 636.It Sy acctwatch 637System accounting disk watcher, see 638.Xr acct 2 , 639.Xr acct 5 . 640.It Sy aiodoned 641Asynchronous I/O done handler, see 642.Xr uvm 9 . 643.It Sy atabusX 644ATA bus handler, see 645.Xr ata 4 . 646.It Sy cardslotX 647CardBus slot watcher thread, see 648.Xr cardslot 4 . 649.It Sy cryptoret 650The software crypto daemon. 651.It Sy fssbsX 652File system snapshot thread, see 653.Xr fss 4 . 654.It Sy ioflush 655The in-kernel periodic flush the buffer cache to disk task, 656which replaces the old 657.Sy update 658program. 659.It Sy nfsio , nfskqpoll 660NFS handing daemons. 661.It Sy lfs_writer 662Log filesystem writer. 663.It Sy pagedaemon 664The page daemon. 665.It Sy raidX , raidioX , raid_parity , raid_recon , raid_reconip , raid_copyback 666Raid framework related threads, see 667.Xr raid 4 . 668.It Sy scsibusX 669SCSI bus handler, see 670.Xr scsi 4 . 671.It Sy smbiodX , smbkq 672SMBFS handling daemon, see 673.Xr netsmb 4 . 674.It Sy swdmover 675The software data mover I/O thread, see 676.Xr dmoverio 4 . 677.It Sy sysmon 678The systems monitoring framework daemon. 679.It Sy usbX , usbtask 680USB bus handler, see 681.Xr usb 4 . 682.El 683.Pp 684There are more machine-dependent kernel threads allocated by 685different drivers. 686See the specific driver manual pages for more information. 687.It Descriptor 688An integer assigned by the system when a file is referenced 689by 690.Xr open 2 691or 692.Xr dup 2 , 693or when a socket is created by 694.Xr pipe 2 , 695.Xr socket 2 , 696or 697.Xr socketpair 2 , 698which uniquely identifies an access path to that file or socket from 699a given process or any of its children. 700.It File Name 701Names consisting of up to 255 702.Pq Dv MAXNAMELEN 703characters may be used to name 704an ordinary file, special file, or directory. 705.Pp 706These characters may be selected from the set of all 707.Tn ASCII 708character 709excluding 0 (NUL) and the 710.Tn ASCII 711code for 712.Ql \&/ 713(slash). 714(The parity bit, bit 7, must be 0). 715.Pp 716Note that it is generally unwise to use 717.Ql \&* , 718.Ql \&? , 719.Ql \&[ 720or 721.Ql \&] 722as part of 723file names because of the special meaning attached to these characters 724by the shell. 725.It Pathname 726A path name is a 727.Tn NUL Ns -terminated 728character string starting with an 729optional slash 730.Ql \&/ , 731followed by zero or more directory names separated 732by slashes, optionally followed by a file name. 733The total length of a path name must be less than 1024 734.Pq Dv MAXPATHLEN 735characters. 736.Pp 737If a path name begins with a slash, the path search begins at the 738.Em root 739directory. 740Otherwise, the search begins from the current working directory. 741A slash by itself names the root directory. 742An empty string is not a valid pathname. 743.It Directory 744A directory is a special type of file that contains entries 745that are references to other files. 746Directory entries are called links. 747By convention, a directory contains at least two links, 748.Ql \&. 749and 750.Ql \&.. , 751referred to as 752.Em dot 753and 754.Em dot-dot 755respectively. 756Dot refers to the directory itself and dot-dot refers to its parent directory. 757.It "Root Directory and Current Working Directory" 758Each process has associated with it a concept of a root directory 759and a current working directory for the purpose of resolving path 760name searches. 761A process's root directory need not be the root 762directory of the root file system. 763.It File Access Permissions 764Every file in the file system has a set of access permissions. 765These permissions are used in determining whether a process 766may perform a requested operation on the file (such as opening 767a file for writing). 768Access permissions are established at the time a file is created. 769They may be changed at some later time through the 770.Xr chmod 2 771call. 772.Pp 773File access is broken down according to whether a file may be: read, 774written, or executed. 775Directory files use the execute permission to control if the 776directory may be searched. 777.Pp 778File access permissions are interpreted by the system as 779they apply to three different classes of users: the owner 780of the file, those users in the file's group, anyone else. 781Every file has an independent set of access permissions for 782each of these classes. 783When an access check is made, the system decides if permission should be 784granted by checking the access information applicable to the caller. 785.Pp 786Read, write, and execute/search permissions on 787a file are granted to a process if: 788.Pp 789The process's effective user ID is that of the super-user. 790(Note: even the super-user cannot execute a non-executable file). 791.Pp 792The process's effective user ID matches the user ID of the owner 793of the file and the owner permissions allow the access. 794.Pp 795The process's effective user ID does not match the user ID of the 796owner of the file, and either the process's effective 797group ID matches the group ID 798of the file, or the group ID of the file is in 799the process's group access list, 800and the group permissions allow the access. 801.Pp 802Neither the effective user ID nor effective group ID 803and group access list of the process 804match the corresponding user ID and group ID of the file, 805but the permissions for ``other users'' allow access. 806.Pp 807Otherwise, permission is denied. 808.It Sockets and Address Families 809A socket is an endpoint for communication between processes. 810Each socket has queues for sending and receiving data. 811.Pp 812Sockets are typed according to their communications properties. 813These properties include whether messages sent and received 814at a socket require the name of the partner, whether communication 815is reliable, the format used in naming message recipients, etc. 816.Pp 817Each instance of the system supports some 818collection of socket types; consult 819.Xr socket 2 820for more information about the types available and 821their properties. 822.Pp 823Each instance of the system supports some number of sets of 824communications protocols. 825Each protocol set supports addresses of a certain format. 826An Address Family is the set of addresses for a specific group of protocols. 827Each socket has an address 828chosen from the address family in which the socket was created. 829.El 830.Sh SEE ALSO 831.Xr intro 3 , 832.Xr perror 3 833.Sh HISTORY 834An 835.Nm intro 836manual page appeared in 837.At v6 . 838