Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought



INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



NAME
     intro - introduction to system calls and error numbers

USAGE
     #include <errno.h>

DESCRIPTION
     This section describes all of the system calls.  Most of
     these calls have one or more error returns.  An error condi-
     tion 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 errno.  Errno is not cleared on
     successful calls, so it should be tested only after an error
     has been indicated.

     Each system call description attempts to list all possible
     error numbers.  The following is a complete list of the
     error numbers and their names as defined in <errno.h>.

     Kernel Errors

     0       unused

     1  EPERM  Not owner
          Typically this error indicates an attempt to modify a
          file in some way that is forbidden to anyone but the
          file's owner or the super-user.  It also may indicate
          an attempt by an ordinary user to do something permit-
          ted 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
          The process whose number was given to kill does not
          exist or is already dead.

     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 occurred during a read or
          write.  Occasionally, this error occurs on a call fol-
          lowing the one to which it actually applies.




Printed 8/1/85                                            INTRO-1





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     6  ENXIO  No such device or address
          I/O on a special file refers to a subdevice which does
          not exist, or attempts to read/write beyond the limits
          of the device.  It may also occur when, for example, an
          illegal tape drive unit number is selected.

     7  E2BIG  Arg list too long
          An argument list longer than 10240 bytes is presented
          to execve.

     8  ENOEXEC  Exec format error
          A request is made to execute a file which, although it
          has the appropriate permissions, is not of the correct
          type.

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

     10  ECHILD  No children
          A wait ws executed by a process with no living or
          unwaited-for children.

     11  EAGAIN  No more processes
          A fork was attempted when the system's process table is
          full.

     12  ENOMEM  Not enough memory
          During an exec, break, or sbrk, a program asks for more
          memory than the system is able to supply.

     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 access the arguments of a system call.

     15  ENOTBLK  Block device required
          A non-block file was mentioned where a block device was
          required.

     16  EBUSY  Device busy
          An attempt was made to acquire a device that is already
          acquired or an release a device on which there is an
          active file directory.

     17  EEXIST  File exists
          An existing file was mentioned in an inappropriate con-
          text, e.g. link.



INTRO-2                                            Printed 8/1/85





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     18  EXDEV  Cross-device link
          An attempt was made to create a hard link to a file on
          another device.

     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
          Something that is not a directory was specified where a
          directory is required, for example in a path name or as
          an argument to chdir.

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

     22  EINVAL  Invalid argument
          Some invalid argument: dismounting a non-mounted dev-
          ice, mentioning an unknown signal in signal, reading or
          writing a file for which seek has generated a negative
          pointer.  Also set by math functions, see intro(3).

     23  ENFILE  File table overflow
          The system's table of open files is full.  No more
          opens can succeed unless a currently-open file is first
          closed.

     24  EMFILE  Too many open files
          A process is limited to 20 open file descriptors.

     25  ENOTTY  Not a character device
          The file mentioned in an ioctl is not a terminal or one
          of the other devices to which these calls apply.

     26  ETXTBSY  Text file busy
          An attempt was made to execute a shell script that is
          currently open for writing, or to write to a shell
          script that is being executed.

     27  EFBIG  File too large
          The size of a file exceeded the maximum file size set
          by ulimit(2).

     28  ENOSPC  No space left on device
          A write was attempted to an ordinary file when there
          was no free space left on the device.

     29  ESPIPE  Illegal seek
          An lseek was issued to a pipe.

     30  EROFS  Read-only file system
          An attempt was made to modify a file or directory



Printed 8/1/85                                            INTRO-3





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



          resident on a device mounted read-only.

     31  EMLINK  Too many links
          An attempt was made to establish more than 1000 links
          to a file.

     32  EPIPE  Broken pipe
          A write was attempted on a pipe for which there is no
          process to read the data.  This condition normally gen-
          erates a SIGPIPE signal.  This error is returned only
          if that if the signal is ignored.

     Math Library Errors

     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
          unrepresentable within machine precision.

     65  ENOMSG  No message of desired type
          An attemot was made to receive a message of a type that
          does not exist on ther specified message queue (see
          msgop(2)).

     66  EIDRM  Identifier Removed
          Thie error is returned when a process resumes execution
          because an identifier was removed from the file
          system's name space. See msgctl(2), semctl(2),
          shmctl(2).

     76  ENOTEMPTY  Directory not empty
          An attempt was made to remove a directory that had more
          entries than ``.'' and ``..''.

DEFINITIONS
     Process ID
     Each active process in the system is uniquely identified by
     a positive integer called a process ID.  The range of this
     ID is from 1 to 30,000.

     Parent Process ID
     A new process is created by a currently active process; see
     fork(2).  The parent process ID of a process is the process
     ID of its creator.

     Process Group ID
     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



INTRO-4                                            Printed 8/1/85





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     grouping permits the signaling of related processes; see
     kill(2).

     Tty Group ID
     Each active process can be a member of a terminal group that
     is identified by a positive integer called the tty group ID.
     This grouping is used to terminate a group of related
     processes upon termination of one of the processes in the
     group; see exit(2) and signal(2).

     User ID and Group ID
     Each user on the system is identified by a positive integer
     termed the user ID.

          Each user is also a member of one or more groups. One
          of these groups is distinguished from others and used
          in implementing accounting facilities.  The positive
          integer corresponding to this distinguished group is
          termed the real group ID.

          All processes have a user ID and group ID.  These are
          initialized from the equivalent attributes of the pro-
          cess which created it.

     Effective User ID and Effective Group ID
     An active process has an effective user ID and an effective
     group ID which are used to determine file access permissions
     (see below).  The effective user ID and effective group ID
     are equal to the process' 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 exec(2).

     Super-user
     A process is recognized as a super-user process and is
     granted special privileges if its effective user ID is zero.

     Special Processes
     The processes with process ID's 1-11 are special.  Process 1
     is normally Display Manager (DM) on DOMAIN nodes and the
     Server Process Manager (SPM) on DOMAIN Server Processors.
     It is the ancestor of every other process in the system.  It
     is used to control the process structure.  Other special
     processes include the Null Process (usually process 2), the
     Clock, the Page Purifier, and the network service processes.

     File Descriptor
     A file descriptor is a small integer used to do I/O on a
     file.  The value of a file descriptor is from 0 to 19.  A
     process may have no more than 20 file descriptors (0-19)
     open simultaneously.  A file descriptor is returned by sys-
     tem calls such as open(2), or pipe(2).  The file descriptor



Printed 8/1/85                                            INTRO-5





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     is used as an argument by calls such as read(2), write(2),
     ioctl(2), and close(2).

     Filename
     Names consisting of 1 to 32 characters may be used to name
     an ordinary file, special file or directory.

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

     Note that it is generally unwise to use *, ?, [, or ] as
     part of filenames because of the special meaning attached to
     these characters by the Shell.  See sh(1).  Although permit-
     ted, it is advisable to avoid the use of unprintable charac-
     ters in filenames.

     Pathname and Path Prefix
     A pathname is a null-terminated character string that
     includes zero or more directory names separated by slashes,
     optionally followed by a file name.  The total length of a
     path name must be less than {PATHNAME_MAX} characters.

          If a path name begins with a slash, the path search
          begins at the node's entry (root) directory.  If a path
          name begins with a double slash, the path search begins
          at the network root, a list of all nodes on the net-
          work.  Otherwise, the search begins from the current
          working directory.  A slash by itself names the node's
          entry directory.  A null pathname refers to the current
          directory.

     Directory

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

     Root Directory and Current Working Directory
     Each process has associated with it a concept of a root
     directory and a current working directory for the purpose of
     resolving pathname searches.  The root directory of a pro-
     cess need not be the root directory of the root file system.

     File Access Permissions

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

          The effective user ID of the process is super-user.



INTRO-6                                            Printed 8/1/85





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



          The effective user ID of the process 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 effective user ID of the process does not match the
          user ID of the owner of the file, and the effective
          group ID of the process matches the group of the file
          and the appropriate access bit of the ``group'' portion
          (070) of the file mode is set.

          The effective user ID of the process does not match the
          user ID of the owner of the file, and the effective
          group ID of the process 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.

     Otherwise, the corresponding permissions are denied.

     Message Queue Identifier
     A message queue identifier (msqid) is a unique positive
     integer created by a msgget(2) system call.  Each msqid has
     a message queue and a data structure associated with it.
     The data structure is referred to as msqid_ds and contains
     the following members:

          struct  ipc_perm msg_perm;  /* operation permission struct */
          ushort  msg_qnum;           /* number of msgs on q */
          ushort  msg_qbytes;         /* max number of bytes on q */
          ushort  msg_lspid;          /* pid of last msgsnd operation */
          ushort  msg_lrpid;          /* pid of last msgrcv operation */
          time_t  msg_stime;          /* last msgsnd time */
          time_t  msg_rtime;          /* last msgrcv time */
          time_t  msg_ctime;          /* last change time */
                                      /* Times measured in secs since */
                                      /* 00:00:00 GMT, Jan. 1, 1970 */

     Msg_perm is an ipc_perm structure that specifies the message
     operation permission (see below).  This structure includes
     the following members:

          ushort  cuid;       /* creator user ID */
          ushort  cgid;       /* creator group ID */
          ushort  uid;        /* user ID */
          ushort  gid;        /* group ID */
          ushort  mode;       /* r/w permission */

     Msg_qnum is the number of messages currently on the queue.
     Msg_qbytes is the maximum number of bytes allowed on the
     queue.  Msg_lspid is the process ID of the last process that
     performed a msgsnd operation.  Msg_lrpid is the process ID
     of the last process that performed a msgrcv operation.



Printed 8/1/85                                            INTRO-7





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     Msg_stime is the time of the last msgsnd operation,
     msg_rtime is the time of the last msgrcv operation, and
     msg_ctime is the time of the last msgctl(2) operation that
     changed a member of the above structure.

     Message Operation Permissions
     In the msgop(2) and msgctl(2) system call descriptions, the
     permission required for an operation is given as ``token}",
     where ``token" is the type of permission needed interpreted
     as follows:

            00400          Read by user
            00200          Write by user
            00060          Read, Write by group
            00006          Read, Write by others

     Read and Write permissions on a msqid are granted to a pro-
     cess if one or more of the following are true:

          The effective user ID of the process is super-user.

          The effective user ID of the process matches
          msg_perm.[c]uid in the data structure associated with
          msqid and the appropriate bit of the ``user'' portion
          (0600) of msg_perm.mode is set.

          The effective user ID of the process does not match
          msg_perm.[c]uid and the effective group ID of the pro-
          cess matches msg_perm.[c]gid and the appropriate bit of
          the ``group'' portion (060) of msg_perm.mode is set.

          The effective user ID of the process does not match
          msg_perm.[c]uid and the effective group ID of the pro-
          cess does not match msg_perm.[c]gid and the appropriate
          bit of the ``other'' portion (06) of msg_perm.mode is
          set.

     Otherwise, the corresponding permissions are denied.

     Semaphore Identifier
     A semaphore identifier (semid) is a unique positive integer
     created by a semget(2) system call.  Each semid has a set of
     semaphores and a data structure associated with it.  The
     data structure is referred to as semid_ds and contains the
     following members:

          struct  ipc_perm sem_perm;  /* operation permission struct */
          ushort  sem_nsems;          /* number of sems in set */
          time_t  sem_otime;          /* last operation time */
          time_t  sem_ctime;          /* last change time */
                                      /* Times measured in secs since */
                                      /* 00:00:00 GMT, Jan. 1, 1970 */



INTRO-8                                            Printed 8/1/85





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     Sem_perm is an ipc_perm structure that specifies the sema-
     phore operation permission (see below).  This structure
     includes the following members:

          ushort  cuid;       /* creator user ID */
          ushort  cgid;       /* creator group ID */
          ushort  uid;        /* user ID */
          ushort  gid;        /* group ID */
          ushort  mode;       /* r/a permission */

     The value of sem_nsems is equal to the number of semaphores
     in the set.  Each semaphore in the set is referenced by a
     positive integer referred to as a sem_num.  Sem_num values
     run sequentially from zero to the value of sem_nsems minus
     1.  Sem_otime is the time of the last semop(2) operation,
     and sem_ctime is the time of the last semctl(2) operation
     that changed a member of the above structure.

     A semaphore is a data structure that contains the following
     members:

          ushort  semval;     /* semaphore value */
          short   sempid;     /* pid of last operation  */
          ushort  semncnt;    /* # awaiting semval > cval */
          ushort  semzcnt;    /* # awaiting semval = 0 */

     Semval is a non-negative integer.  Sempid is equal to the
     process ID of the last process that performed a semaphore
     operation on this semaphore.  Semncnt is a count of the
     number of processes that are currently suspended awaiting
     this semaphore's semval to become greater than its current
     value.  Semzcnt is a count of the number of processes that
     are currently suspended awaiting this semaphore's semval to
     become zero.

     Semaphore Operation Permissions
     In the semop(2) and semctl(2) system call descriptions, the
     permission required for an operation is given as ``token}",
     where ``token" is the type of permission needed interpreted
     as follows:

            00400          Read by user
            00200          Alter by user
            00060          Read, Alter by group
            00006          Read, Alter by others

     Read and Alter permissions on a semid are granted to a pro-
     cess if one or more of the following are true:

          The effective user ID of the process is super-user.

          The effective user ID of the process matches



Printed 8/1/85                                            INTRO-9





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



          sem_perm.[c]uid in the data structure associated with
          semid and the appropriate bit of the ``user'' portion
          (0600) of sem_perm.mode is set.

          The effective user ID of the process does not match
          sem_perm.[c]uid and the effective group ID of the pro-
          cess matches sem_perm.[c]gid and the appropriate bit of
          the ``group'' portion (060) of sem_perm.mode is set.

          The effective user ID of the process does not match
          sem_perm.[c]uid and the effective group ID of the pro-
          cess does not match sem_perm.[c]gid and the appropriate
          bit of the ``other'' portion (06) of sem_perm.mode is
          set.

     Otherwise, the corresponding permissions are denied.

     Shared Memory Identifier
     A shared memory identifier (shmid) is a unique positive
     integer created by a shmget(2) system call.  Each shmid has
     a segment of memory (referred to as a shared memory segment)
     and a data structure associated with it.  The data structure
     is referred to as shmid_ds and contains the following
     members:

          struct  ipc_perm shm_perm;  /* operation permission struct */
          int     shm_segsz;          /* size of segment */
          ushort  shm_cpid;           /* creator pid */
          ushort  shm_lpid;           /* pid of last operation */
          short   shm_nattch;         /* number of current attaches */
          time_t  shm_atime;          /* last attach time */
          time_t  shm_dtime;          /* last detach time */
          time_t  shm_ctime;          /* last change time */
                                      /* Times measured in secs since */
                                      /* 00:00:00 GMT, Jan. 1, 1970 */

     Shm_perm is an ipc_perm structure that specifies the shared
     memory operation permission (see below).  This structure
     includes the following members:

          ushort  cuid;       /* creator user ID */
          ushort  cgid;       /* creator group ID */
          ushort  uid;        /* user ID */
          ushort  gid;        /* group ID */
          ushort  mode;       /* r/w permission */

     Shm_segsz specifies the size of the shared memory segment.
     Shm_cpid is the process ID of the process that created the
     shared memory identifier.  Shm_lpid is the process ID of the
     last process that performed a shmop(2) operation.
     Shm_nattch is the number of processes that currently have
     this segment attached.  Shm_atime is the time of the last



INTRO-10                                           Printed 8/1/85





INTRO(2)        DOMAIN/IX Reference Manual (SYS5)        INTRO(2)



     shmat operation, shm_dtime is the time of the last shmdt
     operation, and shm_ctime is the time of the last shmctl(2)
     operation that changed one of the members of the above
     structure.

     Shared Memory Operation Permissions
     In the shmop(2) and shmctl(2) system call descriptions, the
     permission required for an operation is given as ``token}",
     where ``token" is the type of permission needed interpreted
     as follows:

            00400          Read by user
            00200          Write by user
            00060          Read, Write by group
            00006          Read, Write by others

     Read and Write permissions on a shmid are granted to a pro-
     cess if one or more of the following are true:

          The effective user ID of the process is super-user.

          The effective user ID of the process matches
          shm_perm.[c]uid in the data structure associated with
          shmid and the appropriate bit of the ``user'' portion
          (0600) of shm_perm.mode is set.

          The effective user ID of the process does not match
          shm_perm.[c]uid and the effective group ID of the pro-
          cess matches shm_perm.[c]gid and the appropriate bit of
          the ``group'' portion (060) of shm_perm.mode is set.

          The effective user ID of the process does not match
          shm_perm.[c]uid and the effective group ID of the pro-
          cess does not match shm_perm.[c]gid and the appropriate
          bit of the ``other'' portion (06) of shm_perm.mode is
          set.

     Otherwise, the corresponding permissions are denied.

RELATED INFORMATION
     close(2), ioctl(2), open(2), pipe(2), read(2), write(2),
     intro(3).













Printed 8/1/85                                           INTRO-11



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026