


      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



      NNNNAAAAMMMMEEEE
           intro - introduction to system calls and error numbers
           (callable from C)

      SSSSYYYYNNNNTTTTAAAAXXXX
           ####iiiinnnncccclllluuuuddddeeee <<<<eeeerrrrrrrrnnnnoooo....hhhh>>>>

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           This section describes all of the system calls. Most of
           these calls have one or more error returns. An error
           condition is indicated by an otherwise impossible returned
           value. This is almost always -1; the individual descriptions
           specify the details. An error number is also made available
           in the external variable _e_r_r_n_o.  _E_r_r_n_o is not cleared on
           successful calls, so it should be tested only after an error
           has been indicated.

           All of the possible error numbers are not listed in each
           system call description because many errors are possible for
           most of the calls.  The following is a complete list of the
           error numbers and their names as defined in <<<<eeeerrrrrrrrnnnnoooo....hhhh>>>>.

           1  EPERM  Not owner
                Typically this error indicates an attempt to modify a
                file in some way forbidden except to its owner or
                super-user.  It is also returned for attempts by
                ordinary users to do things allowed only to the super-
                user.

           2  ENOENT  No such file or directory
                This error occurs when a file name is specified and the
                file should exist but doesn't, or when one of the
                directories in a path name does not exist.

           3  ESRCH  No such process
                No process can be found corresponding to that specified
                by _p_i_d in _k_i_l_l or _p_t_r_a_c_e.

           4  EINTR  Interrupted system call
                An asynchronous signal (such as interrupt or quit),
                which the user has elected to catch, occurred during a
                system call.  If execution is resumed after processing
                the signal, it will appear as if the interrupted system
                call returned this error condition.

           5  EIO  I/O error
                Some physical I/O error.  This error may in some cases
                occur on a call following the one to which it actually
                applies.

           6  ENXIO  No such device or address
                I/O on a special file refers to a subdevice which does



      Page 1                                                   (9010-E)






      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



                not exist, or beyond the limits of the device.  It may
                also occur when, for example, a tape drive is not on-
                line or no disk pack is loaded on a drive.

           7  E2IG  Arg list too long
                An argument list longer than 5,120 bytes is presented
                to a member of the _e_x_e_c family.

           8  ENOEXEC  Exec format error
                A request is made to execute a file which, although it
                has the appropriate permissions, does not start with a
                valid magic number (see _a._o_u_t(4)).

           9  EBADF  Bad file number
                Either a file descriptor refers to no open file, or a
                read (respectively write) request is made to a file
                which is open only for writing (respectively reading).

           10  ECHILD  No child processes
                A _w_a_i_t, was executed by a process that had no existing
                or unwaited-for child processes.

           11  EAGAIN  No more processes
                A _f_o_r_k, failed because the system's process table is
                full or the user is not allowed to create any more
                processes.

           12  ENOMEM  Not enough space
                During an _e_x_e_c, _b_r_k, or _s_b_r_k, a program asks for more
                space than the system is able to supply.  This is not a
                temporary condition; the maximum space size is a system
                parameter.  The error may also occur if the arrangement
                of text, data, and stack segments requires too many
                segmentation registers, or if there is not enough swap
                space during a _f_o_r_k.

           13  EACCES  Permission denied
                An attempt was made to access a file in a way forbidden
                by the protection system.

           14  EFAULT  Bad address
                The system encountered a hardware fault in attempting
                to use an argument of a system call.

           15  ENOTBLK  Block device required
                A non-block file was mentioned where a block device was
                required, e.g., in _m_o_u_n_t.

           16  EBUSY  Mount device busy
                An attempt to mount a device that was already mounted
                or an attempt was made to dismount a device on which
                there is an active file (open file, current directory,



      Page 2                                                   (9010-E)






      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



                mounted-on file, active text segment).  It will also
                occur if an attempt is made to enable accounting when
                it is already enabled.

           17  EEXIST  File exists
                An existing file was mentioned in an inappropriate
                context, e.g., _l_i_n_k.

           18  EXDEV  Cross-device link
                A link to a file on another device was attempted.

           19  ENODEV  No such device
                An attempt was made to apply an inappropriate system
                call to a device; e.g., read a write-only device.

           20  ENOTDIR  Not a directory
                A non-directory was specified where a directory is
                required, for example in a path prefix or as an
                argument to _c_h_d_i_r(2).

           21  EISDIR  Is a directory
                An attempt to write on a directory.

           22  EINVAL  Invalid argument
                Some invalid argument (e.g., dismounting a non-mounted
                device; mentioning an undefined signal in _s_i_g_n_a_l, or
                _k_i_l_l; reading or writing a file for which _l_s_e_e_k has
                generated a negative pointer).  Also set by the math
                functions described in the (3M) entries of this manual.

           23  ENFILE  File table overflow
                The system's table of open files is full, and
                temporarily no more _o_p_e_n_s can be accepted.

           24  EMFILE  Too many open files
                No process may have more than 64 file descriptors open
                at a time.

           25  ENOTTY  Not a typewriter

           26  ETXTBSY  Text file busy
                An attempt to execute a pure-procedure program which is
                currently open for writing (or reading).  Also an
                attempt to open for writing a pure-procedure program
                that is being executed.

           27  EFBIG  File too large
                The size of a file exceeded the maximum file size
                (1,082,201,088 bytes) or ULIMIT; see _u_l_i_m_i_t(2).

           28  ENOSPC  No space left on device
                During a _w_r_i_t_e to an ordinary file, there is no free



      Page 3                                                   (9010-E)






      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



                space left on the device.

           30  EROFS  Read-only file system
                An attempt to modify a file or directory was made on a
                device mounted read-only.

           31  EMLINK  Too many links
                An attempt to make more than the maximum number of
                links (1000) to a file.  This condition normally
                generates a signal; the error is returned if the signal
                is ignored.

           33  EDOM  Math argument
                The argument of a function in the math package (3M) is
                out of the domain of the function.

           34  ERANGE  Result too large
                The value of a function in the math package (3M) is not
                representable within machine precision.

           35  ENOMSG  No message of desired type
                An attempt was made to receive a message of a type that
                does not exist on the specified message queue; see
                _m_s_g_o_p(2).

           36  EIDRM  Identifier Removed
                This error is returned to processes that resume
                execution due to the removal of an identifier from the
                file system's name space (see _m_s_g_c_t_l(2), _s_e_m_c_t_l(2), and
                _s_h_m_c_t_l(2)).

      DDDDEEEEFFFFIIIINNNNIIIITTTTIIIIOOOONNNNSSSS
         PPPPrrrroooocccceeeessssssss IIIIDDDD
           Each active process in the system is uniquely identified by
           a positive integer called a process ID.  The range of this
           ID is from 0 to 30,000.

         PPPPaaaarrrreeeennnntttt PPPPrrrroooocccceeeessssssss IIIIDDDD
           A new process is created by a currently active process; see
           _f_o_r_k(2).  The parent process ID of a process is the process
           ID of its creator.

         PPPPrrrroooocccceeeessssssss GGGGrrrroooouuuupppp IIIIDDDD
           Each active process is a member of a process group that is
           identified by a positive integer called the process group
           ID.  This ID is the process ID of the group leader.  This
           grouping permits the signaling of related processes; see
           _k_i_l_l(2).

         TTTTttttyyyy GGGGrrrroooouuuupppp IIIIDDDD
           Each active process can be a member of a terminal group that
           is identified by a positive integer called the tty group ID.



      Page 4                                                   (9010-E)






      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



           This grouping is used to terminate a group of related
           process upon termination of one of the processes in the
           group; see _e_x_i_t(2) and _s_i_g_n_a_l(2).

         RRRReeeeaaaallll UUUUsssseeeerrrr IIIIDDDD aaaannnndddd RRRReeeeaaaallll GGGGrrrroooouuuupppp IIIIDDDD
           Each user allowed on the system is identified by a positive
           integer called a real user ID.

           Each user is also a member of a group.  The group is
           identified by a positive integer called the real group ID.

           An active process has a real user ID and real group ID that
           are set to the real user ID and real group ID, respectively,
           of the user responsible for the creation of the process.

         EEEEffffffffeeeeccccttttiiiivvvveeee UUUUsssseeeerrrr IIIIDDDD aaaannnndddd EEEEffffffffeeeeccccttttiiiivvvveeee GGGGrrrroooouuuupppp IIIIDDDD
           An active process has an effective user ID and an effective
           group ID that are used to determine file access permissions
           (see below).  The effective user ID and effective group ID
           are equal to the process's real user ID and real group ID
           respectively, unless the process or one of its ancestors
           evolved from a file that had the set-user-ID bit or set-
           group ID bit set; see _e_x_e_c(2).

         SSSSuuuuppppeeeerrrr----uuuusssseeeerrrr
           A process is recognized as a _s_u_p_e_r-_u_s_e_r process and is
           granted special privileges if its effective user ID is 0.

         FFFFiiiilllleeee NNNNaaaammmmeeee....
           Names consisting of 1 to 16 characters may be used to name
           an ordinary file, special file or directory.

           These characters may be selected from the set of all
           character values excluding \0 (null) and the ASCII code for
           //// (slash).

           Note that it is generally unwise to use ****, ????, [[[[, or ]]]] as
           part of file names because of the special meaning attached
           to these characters by the shell.  See _s_h(1).  Although
           permitted, it is advisable to avoid the use of unprintable
           characters in file names.

         PPPPaaaatttthhhh NNNNaaaammmmeeee aaaannnndddd PPPPaaaatttthhhh PPPPrrrreeeeffffiiiixxxx
           A path name is a null-terminated character string starting
           with an optional slash (////), followed by zero or more
           directory names separated by slashes, optionally followed by
           a file name.

           More precisely, a path name is a null-terminated character
           string constructed as follows:

                <path-name>::=<file-name>|<path-prefix><file-name>|/



      Page 5                                                   (9010-E)






      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



                <path-prefix>::=<rtprefix>|/<rtprefix>
                <rtprefix>::=<dirname>/|<rtprefix><dirname>/

           where <file-name> is a string of 1 to 16 characters other
           than the ASCII slash and null, and <dirname> is a string of
           1 to 16 characters (other than the ASCII slash and null)
           that names a directory.

           If a path name begins with a slash, the path search begins
           at the _r_o_o_t directory.  Otherwise, the search begins from
           the current working directory.

           A slash by itself names the root directory.

           Unless specifically stated otherwise, the null path name is
           treated as if it named a non-existent file.

         DDDDiiiirrrreeeeccccttttoooorrrryyyy....
           Directory entries are called links.  By convention, a
           directory contains at least two links, .... and ........, referred to
           as _d_o_t and _d_o_t-_d_o_t respectively.  Dot refers to the
           directory itself and dot-dot refers to its parent directory.

         RRRRooooooootttt DDDDiiiirrrreeeeccccttttoooorrrryyyy aaaannnndddd CCCCuuuurrrrrrrreeeennnntttt WWWWoooorrrrkkkkiiiinnnngggg DDDDiiiirrrreeeeccccttttoooorrrryyyy....
           Each process has associated with it a concept of a root
           directory and a current working directory for the purpose of
           resolving path name searches.  A process's root directory
           need not be the root directory of the root file system.

         FFFFiiiilllleeee AAAAcccccccceeeessssssss PPPPeeeerrrrmmmmiiiissssssssiiiioooonnnnssss....
           Read, write, and execute/search permissions on a file are
           granted to a process if one or more of the following are
           true:

                The process's effective user ID is super-user.

                The process's effective user ID matches the user ID of
                the owner of the file and the appropriate access bit of
                the ``owner'' portion (0700) of the file mode is set.

                The process's effective user ID does not match the user
                ID of the owner of the file, and the process's
                effective group ID matches the group of the file and
                the appropriate access bit of the ``group'' portion
                (070) of the file mode is set.

                The process's effective user ID does not match the user
                ID of the owner of the file, and the process's
                effective group ID does not match the group ID of the
                file, and the appropriate access bit of the ``other''
                portion (07) of the file mode is set.




      Page 6                                                   (9010-E)






      IIIINNNNTTTTRRRROOOO((((2222))))                                                 IIIINNNNTTTTRRRROOOO((((2222))))



           Otherwise, the corresponding permissions are denied.






















































      Page 7                                                   (9010-E)



