Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

intro(3)



  intro(2)                            CLIX                            intro(2)



  NAME

    intro - Introduction to system calls and error numbers

  SYNOPSIS

    #include <errno.h>

  DESCRIPTION

    This section describes all system calls (usually called functions in this
    documentation).

    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 or the NULL pointer; the individual descriptions specify the
    details.  An error number is also available in the external variable
    errno.  The variable errno is not cleared on successful calls, so it
    should be tested only after an error is 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>.

    1 EPERM  Not owner
           This error typically indicates an attempt to modify a file
           forbidden except to its owner or the superuser.  It is also
           returned if an ordinary user attempts an action allowed only to the
           superuser.

    2 ENOENT  No such file or directory
           This error occurs when a filename is specified and the file should
           exist but does not, or when one of the directories in a pathname
           does not exist.

    3 ESRCH  No such process
           No process can be found that corresponds to the process specified
           by pid in the kill() or ptrace() functions.

    4 EINTR  Interrupted system call
           An asynchronous signal (such as interrupt or quit), that the user
           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.  This error may 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 that does not exist or



  2/94 - Intergraph Corporation                                              1






  intro(2)                            CLIX                            intro(2)



           is beyond the limits of the device.  It may also occur when a tape
           drive is not online or no disk pack is loaded on a drive.

    7 E2BIG  Arg list too long
           An argument list longer than 5,120 bytes is presented to a member
           of the exec() function family.

    8 ENOEXEC  Exec format error
           Execution of a file that, although it has the appropriate
           permissions, does not start with a valid magic number (see the
           a.out() file format) is requested.

    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 that is open only
           for writing (respectively, reading).

    10 ECHILD  No child processes
           A wait() function call was executed by a process that had no
           existing or unwaited-for child processes.

    11 EAGAIN  No more processes
           A fork() function call failed because the system process table is
           full or the user is not allowed to create any more processes; or a
           system call failed because of insufficient memory or swap space.

    12 ENOMEM  Not enough space
           During an exec(), brk(), or sbrk(), a program asks for more space
           than the system is able to supply.  This may not be 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 fork().  This error occurring on a resource
           associated with Remote File Sharing (RFS) indicates a memory
           depletion that may be temporary, depending on system activity at
           the time the call was invoked.

    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 nonblock file was mentioned where a block device was required (as
           in the mount() function).

    16 EBUSY Device or resource busy
           The device or resource is currently unavailable.  An attempt was



  2                                              Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



           made to mount a device already mounted or to dismount a device that
           has an active file (open file, current directory, mounted-on file,
           active text segment).  This error 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 (see the
           link() function).

    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 (such as reading a write-only device).

    20 ENOTDIR  Not a directory
           A nondirectory was specified where a directory is required (such as
           in a path prefix or as an argument to the chdir() function).

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

    22 EINVAL  Invalid argument
           An invalid argument (such as dismounting a nonmounted device;
           mentioning an undefined signal in the signal() or kill() functions;
           or reading or writing a file for which lseek() has generated a
           negative pointer).  The error is also set by the math functions
           described in this manual.

    23 ENFILE  File table overflow
           The system file table is temporarily full, and no more opens can be
           accepted.

    24 EMFILE  Too many open files
           No process may have more than NOFILES (default 128) descriptors
           open at a time.

    25 ENOTTY  Not a character device (or) Not a typewriter
           An attempt was made to execute the ioctl() function on a file that
           is not a special character device.

    26 ETXTBSY  Text file busy
           An attempt was made to execute a pure-procedure program currently
           open for writing.  Also, an attempt to open for writing or to
           remove a pure-procedure program being run.

    27 EFBIG  File too large
           The size of a file exceeded the maximum file size or ULIMIT (see
           the ulimit() function).




  2/94 - Intergraph Corporation                                              3






  intro(2)                            CLIX                            intro(2)



    28 ENOSPC  No space left on device
           During a write() to an ordinary file, no free space is left on the
           device.  In the fcntl() function, the setting or removing of record
           locks on a file cannot be accomplished because no more record
           entries remain on the system.

    29 ESPPE  Illegal seek
           An attempt to perform an illegal seek by the lseek() function was
           issued to a pipe.

    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 was made to make more than the maximum number of links
           (1000) to a file.

    32 EPPE  Broken pipe
           An attempt was made to write on a pipe for which no process to read
           the data exists.  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 is out of the
           function's domain.

    34 ERANGE  Result too large
           The value of a function in the math package 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 the msgop() function).

    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
           the msgctl(), semctl(), and shmctl() functions).

    37-44 Reserved numbers

    45 EDEADLK  Deadlock
           A deadlock situation was detected and avoided.  This error pertains
           to file and record locking.

    46 ENOLCK  No lock
           In fcntl(), setting or removing record locks on a file cannot be
           accomplished because no more record entries remain on the system.

    47 ENOSYS Function not implemented



  4                                              Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



           An attempt was made to use a function that is not available in this
           implementation.

    60 ENOSTR  Not a stream
           A putmsg() or getmsg() system call was attempted on a file
           descriptor that is not a STREAMS device.

    62 ETIME  Stream ioctl timeout
           The timer set for a STREAMS ioctl() call expired.  The cause of
           this error is device specific and could indicate a hardware or
           software failure or a timeout value that is too short for the
           specific operation.  The status of the ioctl() operation is
           indeterminate.

    63 ENOSR  No stream resources
           During a STREAMS open(), either no STREAMS queues or no STREAMS
           head data structures were available.

    64 ENONET  Machine is not on the network
           This error is Remote File Sharing (RFS) specific.  It occurs when
           users try to advertise, unadvertise, mount, or unmount remote
           resources when the machine did not do the proper startup to connect
           to the network.

    65 ENOPKG  No package
           This error occurs when users attempt to use a system call from a
           package that is not installed.

    66 EREMOTE  Resource is remote
           This error is RFS-specific.  It occurs when users try to advertise
           a resource that is not on the local machine, or try to
           mount/unmount a device (or pathname) that is on a remote machine.

    67 ENOLINK  Virtual circuit is gone
           This error is RFS-specific.  It occurs when the link (virtual
           circuit) connecting to a remote machine is gone.

    68 EADV  Advertise error
           This error is RFS-specific.  It occurs when users try to advertise
           a resource that has been advertised, try to stop the RFS while
           resources are still advertised, or try to force an unmount on a
           resource when it is still advertised.

    69 ESRMNT  Srmount error
           This error is RFS-specific.  It occurs when users try to stop RFS
           while resources are still mounted by remote machines.

    70 ECOMM  Communication error
           This error is RFS-specific.  It occurs when users try to send
           messages to remote machines, but no virtual circuit can be found.




  2/94 - Intergraph Corporation                                              5






  intro(2)                            CLIX                            intro(2)



    71 EPROTO  Protocol error
           Some protocol error occurred.  This error is device specific, but
           is generally not related to a hardware failure.

    74 EMULTIHOP  Multihop attempted
           This error is RFS-specific.  It occurs when users try to access
           remote resources that are not directly accessible.

    77 EBADMSG  Bad message
           During a read(), getmsg(), or ioctl() I_RECVFD system call to a
           STREAMS device, something that cannot be processed has come to the
           head of the queue.  What it is depends on the system call:

           read()     Control information or a passed file descriptor.

           getmsg()   Passed file descriptor.

           ioctl()    Control or data information.

    83 ELIBACC  Cannot access a needed shared library
           Tried to run the exec() function on an a.out file that requires a
           shared library (to be linked in) and the shared library does not
           exist or the user does not have permission to use it.

    84 ELIBBAD  Accessing a corrupted shared library
           Tried to run the exec() function on an a.out file that requires a
           shared library (to be linked in) and exec() could not load the
           shared library.  The shared library is probably corrupted.

    85 ELIBSCN  .lib section in a.out corrupted
           Tried to run the exec() function on an a.out file that requires a
           shared library (to be linked in) and erroneous data was in the .lib
           section of the a.out file.  The .lib section tells exec() the
           shared libraries needed.  The a.out file is probably corrupted.

    86 ELIBMAX  Attempting to link in more shared libraries than system limit
           Tried to run the exec() function on an a.out file that requires
           more shared libraries (to be linked in) than allowed on the current
           system configuration.

    87 ELIBEXEC  Cannot exec a shared library directly
           Tried to run the exec() function on a shared library directly.
           This is not allowed.

    88 ENAMETOOLONG  Filename too long
           The size of a pathname string exceeded PATH_MAX, or a pathname
           component was longer than NAME_MAX and _POSIX_NO_TRUNC (see the
           <unistd.h> header file) was in effect for that file.

    89 ENOTEMPTY  Directory not empty
           A directory with entries other than ``.'' and ``..'' was supplied



  6                                              Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



           when an empty directory was expected.

    90 EWOULDBLOCK  Operation would block
           An operation that would cause a process to block was attempted on
           an object in nonblocking mode (see the fcntl() function).

    91 EINPROGRESS  Operation now in progress
           An operation that takes a long time to complete (such as a
           connect() function) was attempted on a nonblocking object (see
           fcntl()).

    92 EALREADY  Operation already in progress
           An operation was attempted on a nonblocking object that had an
           operation in progress.

    93 ENOTSOCK  Socket operation on nonsocket
           Self-explanatory.

    94 EDESTADDRREQ  Destination address required
           A required address was omitted from an operation on a socket.

    95 EMSGSIZE  Message too long
           A message sent on a socket was larger than the internal message
           buffer or some other network limit.

    96 EPROTOTYPE  Protocol wrong type for socket
           A protocol was specified that does not support the semantics of the
           socket type requested.

    97 EPROTONOSUPPORT  Protocol not supported
           The protocol was not configured in the system, or no implementation
           exists for it.

    98 ESOCKTNOSUPPORT  Socket type not supported
           The support for the socket type was not configured in the system,
           or no implementation exists for it.

    99 EOPNOTSUPP  Operation not supported on socket
           Self-explanatory.

    100 EPFNOSUPPORT  Protocol family not supported
           The protocol family was not configured in the system, or no
           implementation exists for it.

    101 EAFNOSUPPORT  Address family not supported by protocol family
           An address was used that is incompatible with the requested
           protocol.

    102 EADDRINUSE  Address already in use
           Only one use of each address is normally permitted.




  2/94 - Intergraph Corporation                                              7






  intro(2)                            CLIX                            intro(2)



    103 EADDRNOTAVAIL  Can't assign requested address
           This normally results from an attempt to create a socket with an
           address that is not on this machine.

    104 ENETDOWN  Network is down
           A socket operation encountered a dead network.

    105 ENETUNREACH  Network is unreachable
           A socket operation attempted to an unreachable network.

    106 ENETRESET  Network dropped connection on reset
           The host that was connected to crashed and rebooted.

    107 ECONNABORTED  Software caused connection abort
           A connection abort occurred and was caused the host machine
           software.

    108 ECONNRESET  Connection reset be peer
           A connection was forcibly closed by a peer.  This normally results
           from a loss of the connection on the remote socket due to a timeout
           or a reboot.

    109 ENOBUFS  No buffer space available
           An operation on a socket was not performed because the system
           lacked sufficient buffer space, or because a queue was full.

    110 EISCONN  Socket is already connected
           A connect() request was made on an already connected socket.  This
           also occurs if a sendto() request on a connected socket specified a
           destination when it was already connected.

    111 ENOTCONN  Socket is not connected
           An request to send or receive data was disallowed because the
           socket is not connected and (when sending on a datagram socket) no
           address was supplied.

    112 ESHUTDOWN  Can't send after socket shutdown
           A request to send data was disallowed because the socket was
           shutdown with a previous shutdown() call.

    114 ETIMEDOUT  Connection timed out
           A socket operation timed out.  The timeout period depends on the
           communication protocol.

    115 ECONNREFUSED  Connection refused
           No connection could be made because the target machine actively
           refused it.  This usually results from trying to connect to a
           service that is inactive on the foreign host.

    116 EHOSTDOWN  Host is down
           A socket operation failed because the destination host was down.



  8                                              Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



    117 EHOSTUNREACH  No route to host
           A socket operation was attempted to an unreachable host.

    118 ENOPROTOOPT  Protocol not available
           A bad option or level was specified in a getsockopt() call.

  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()
           ).  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 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 kill() ).

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

    Real User ID and Real Group ID
           Each user allowed on the system is identified by a positive integer
           (0 to 65535) 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 process creation.

    Effective User ID and Effective Group ID
           An active process has an effective user ID and an effective group
           ID used to determine file access permissions.  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 exec() ).

    Superuser
           A process is recognized as a superuser process and is granted



  2/94 - Intergraph Corporation                                              9






  intro(2)                            CLIX                            intro(2)



           special privileges, such as immunity from file permissions, if its
           effective user ID is 0.

    Special Processes
           The processes with a process ID of 0 and a process ID of 1 are
           special processes and are referred to as proc0 and proc1.

           Proc0 is the scheduler.  Proc1 is the initialization process
           (init).  Proc1 is the ancestor of every other process in the system
           and is used to control the process structure.

    File Descriptor
           A file descriptor is a small integer used to perform I/O on a file.
           The value of a file descriptor is from 0 to (NOFILE - 1).  A
           process may have no more than NOFILE (defined in master.d) file
           descriptors open simultaneously.  A file descriptor is returned by
           system calls such as open() or pipe().  The file descriptor is used
           as an argument by calls such as read(), write(), ioctl(), and
           close().

    Filename
           Names consisting of 1 to 14 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).

           It is generally unwise to use *, ?, [, or ] as part of filenames
           because of the special meaning attached to these characters by the
           shell.  (See the command sh().)  Although permitted, using
           unprintable characters in filenames should be avoided.

    Pathname and Path Prefix
           A pathname is a null-terminated character string starting with an
           optional slash (/), followed by zero or more directory names
           separated by slashes, and optionally followed by a filename.

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

           A slash by itself names the root directory.

           Unless specifically stated otherwise, the null pathname is treated
           as if it named a nonexistent file.

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



  10                                             Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



    Root Directory and Current Working Directory
           Each process has associated with it a concept of a root directory
           and a current working directory for resolving pathname searches.
           The root directory of a process 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 is true:

           ⊕  The effective user ID of the process is superuser.

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

           ⊕  The effective user ID of the process does not match the user ID
              of the file owner, the effective group ID of the process does
              not match the group ID of the file, and the appropriate access
              bit of the file mode ``other'' portion (0007) 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() system call.  Each msqid has an associated
           message queue and data structure.  The data structure is referred
           to as msqid_ds and contains the following members:

           struct  ipc_perm msg_perm;
           struct  msg *msg_first;
           struct  msg *msg_last;
           ushort  msg_cbytes;
           ushort  msg_qnum;
           ushort  msg_qbytes;
           ushort  msg_lspid;
           ushort  msg_lrpid;
           time_t  msg_stime;
           time_t  msg_rtime;
           time_t  msg_ctime;


           msg_perm
                  An ipc_perm structure that specifies the message operation
                  permission (see below).  This structure includes the
                  following members:



  2/94 - Intergraph Corporation                                             11






  intro(2)                            CLIX                            intro(2)



                  ushort  cuid;   /* creator user ID */
                  ushort  cgid;   /* creator group ID */
                  ushort  uid;    /* user ID */
                  ushort  gid;    /* group ID */
                  ushort  mode;   /* r/w permission */
                  ushort  seq;    /* slot usage sequence # */
                  key_t   key;    /* key */


           msg *msg_first
                  A pointer to the first message on the queue.

           msg *msg_last
                  A pointer to the last message on the queue.

           msg_cbytes
                  The current number of bytes on the queue.

           msg_qnum
                  The number of messages currently on the queue.

           msg_qbytes
                  The maximum number of bytes allowed on the queue.

           msg_lspid
                  The process ID of the last process that performed a msgsnd
                  (message send) operation.

           msg_lrpid
                  The process ID of the last process that performed a msgrcv
                  (message receive) operation.

           msg_stime
                  The time of the last msgsnd operation.

           msg_rtime
                  The time of the last msgrcv operation.

           msg_ctime
                  The time of the last msgctl() operation that changed a
                  member of the above structure.

    Message Operation Permissions
           In the msgop() and msgctl() 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




  12                                             Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



           00040   Read by group

           00020   Write by group

           00004   Read by others

           00002   Write by others

           Read and write permissions on a msqid are granted to a process if
           one or more of the following is true:

           ⊕  The effective user ID of the process is superuser.

           ⊕  The effective user ID of the process matches msg_perm.cuid or
              msg_perm.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 group ID of the process matches msg_perm.cgid or
              msg_perm.gid and the appropriate bit of the ``group'' portion
              (060) of msg_perm.mode is set.

           ⊕  The appropriate bit of the ``other'' portion (006) 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() 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 */
           struct sem *sem_base;     /* ptr to first semaphore in set */
           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 */


           sem_perm
                  An ipc_perm structure that specifies the semaphore operation
                  permission.  This structure includes the following members:

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



  2/94 - Intergraph Corporation                                             13






  intro(2)                            CLIX                            intro(2)



                  ushort  seq;    /* slot usage sequence number */
                  key_t   key;    /* key */


           sem_nsems
                  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.  Values for sem_num run
                  sequentially from 0 to the value of sem_nsems minus 1.

           sem_otime
                  The time of the last semop() operation.

           sem_ctime
                  The time of the last semctl() operation that changed a
                  member of the above structure.

                  A semaphore is a data structure called sem 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 A non-negative integer that is the actual value of the
                  semaphore.

           sempid Equal to the process ID of the last process that performed a
                  semaphore operation on this semaphore.

           semncnt
                  A count of the number of processes currently suspended and
                  awaiting this semaphore's semval to become greater than its
                  current value.

           semzcnt
                  A count of the number of processes currently suspended and
                  awaiting this semaphore's semval to become 0.

    Semaphore Operation Permissions
           In the semop() and semctl() 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

           00040   Read by group



  14                                             Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



           00020   Alter by group

           00004   Read by others

           00002   Alter by others

           Read and alter permissions on a semid are granted to a process if
           one or more of the following is true:

           ⊕  The effective user ID of the process is superuser.

           ⊕  The effective user ID of the process matches sem_perm.cuid or
              sem_perm.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 group ID of the process matches sem_perm.cgid or
              sem_perm.gid and the appropriate bit of the ``group'' portion
              (060) of sem_perm.mode is set.

           ⊕  The appropriate bit of the ``other'' portion (006) 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() system call.  Each shmid has a segment of
           memory (referred to as a shared memory segment) and an associated
           data structure.  (These shared memory segments must be explicitly
           removed by the user after the last reference to them is removed.)
           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 */
           struct region *shm_reg;   /* ptr to region structure */
           char   pad[4];            /* for swap compatibility */
           ushort shm_lpid;          /* pid of last operation */
           ushort shm_cpid;          /* creator pid */
           ushort shm_nattch;        /* number of current attaches */
           ushort shm_cnattch;       /* used only for shminfo */
           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     An ipc_perm structure that specifies the shared memory
                        operation permission.  This structure includes the



  2/94 - Intergraph Corporation                                             15






  intro(2)                            CLIX                            intro(2)



                        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 */
                        ushort  seq;   /* slot usage sequence # */
                        key_t   key;   /* key */


           shm_segsz    The size of the shared memory segment in bytes.

           shm_cpid     The process ID of the process that created the shared
                        memory identifier.

           shm_lpid     The process ID of the last process that performed a
                        shmop() operation.

           shm_nattch   The number of processes that currently have this
                        segment attached.

           shm_atime    The time of the last shmat() operation.

           shm_dtime    The time of the last shmdt() operation.

           shm_ctime    The time of the last shmctl() operation that changed a
                        member of the above structure.

    Shared Memory Operation Permissions
           In the shmop() and shmctl() 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

           00040   Read by group

           00020   Write by group

           00004   Read by others

           00002   Write by others

           Read and write permissions on a shmid are granted to a process if
           one or more of the following is true:

           ⊕  The effective user ID of the process is superuser.




  16                                             Intergraph Corporation - 2/94






  intro(2)                            CLIX                            intro(2)



           ⊕  The effective user ID of the process matches shm_perm.cuid or
              shm_perm.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 group ID of the process matches shm_perm.cgid or
              shm_perm.gid and the appropriate bit of the ``group'' portion
              (060) of shm_perm.mode is set.

           ⊕  The appropriate bit of the ``other'' portion (06) of
              shm_perm.mode is set.

           Otherwise, the corresponding permissions are denied.

    STREAMS
           A set of kernel mechanisms that support the development of network
           services and data communication drivers.  It defines interface
           standards for character input/output within the kernel and between
           the kernel and user-level processes.  The STREAMS mechanism is
           composed of utility routines, kernel facilities, and a set of data
           structures.

    Stream A full-duplex data path within the kernel between a user process
           and driver routines.  The primary components are a stream head, a
           driver, and zero or more modules between the stream head and
           driver.  A stream is analogous to a shell pipeline except that data
           flow and processing are bidirectional.

    Stream Head
           The end of the stream that provides the interface between the
           stream and a user process.  The principle functions of the stream
           head are processing STREAMS-related system calls and passing data
           and information between a user process and the stream.

    Driver The interface between peripheral hardware and the stream.  A driver
           can also be a pseudo-driver, such as a multiplexor or log driver
           (see the log() file), that is not associated with a hardware
           device.

    Module An entity containing processing routines for input and output data.
           It always exists in the middle of a stream between the stream's
           head and a driver.  A module is the STREAMS' counterpart to the
           commands in a shell pipeline except that a module contains a pair
           of functions that allow independent bidirectional (downstream and
           upstream) data flow and processing.

    Downstream
           The direction from stream head to driver.

    Upstream
           The direction from driver to stream head.



  2/94 - Intergraph Corporation                                             17






  intro(2)                            CLIX                            intro(2)



    Message
           One or more blocks of data or information with associated STREAMS
           control structures.  Messages can be of several defined types, that
           identify the message contents.  Messages are the only means of
           transferring data and communicating within a stream.

    Message Queue
           A linked list of messages awaiting processing by a module or
           driver.

    Read Queue
           The message queue in a module or driver containing messages moving
           upstream.

    Write Queue
           The message queue in a module or driver containing messages moving
           downstream.

    Multiplexor
           A driver that allows streams associated with several user processes
           to be connected to a single driver or several drivers to be
           connected to a single user process.  STREAMS does not provide a
           general multiplexing driver, but provides the facilities for
           constructing them and for connecting multiplexed streams
           configurations.

    Sockets and Address Families
           A socket is an endpoint for communication between processes.  Each
           socket has queues for sending and receiving data.

           Sockets are typed according to their communications properties.
           These properties include whether messages sent and received at a
           socket require the name of the partner, whether communication is
           reliable, the format used in naming message recipients, and so on.

           Each instance of the system supports some collection of socket
           types; consult socket() for more information about the types
           available and their properties.

           Each instance of the system supports some number of sets of
           communications protocols.  Each protocol set supports addresses of
           a certain format.  An Address Family is the set of addresses for a
           specific group of protocols.  Each socket has an address chosen
           from the address family in which the socket was created.

  RELATED INFORMATION

    Functions:  intro(3)






  18                                             Intergraph Corporation - 2/94




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