Annotation of coherent/a/usr/man/COHERENT/semop, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: semop()                COHERENT System Call               semop()
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Perform semaphore operations
                      9: 
                     10: #include <sys/sem.h>
                     11: sseemmoopp(_s_e_m_i_d, _s_o_p_s, _n_s_o_p_s)
                     12: iinntt _s_e_m_i_d, _n_s_o_p_s; ssttrruucctt sseemmbbuuff(_s_o_p_s)[];
                     13: 
                     14: semop can atomically perform a number of operations on the set of
                     15: semaphores associated with  the semaphore identifier semid.  sops
                     16: pointer to the array of semaphore-operation structures.  nsops is
                     17: the number  of such structures in the  array.  Each structure in-
                     18: cludes the following members:
                     19: 
                     20: 
                     21: short   sem_num;    /* semaphore number */
                     22: short   sem_op;     /* semaphore operation */
                     23: short   sem_flg;    /* operation flags */
                     24: 
                     25: 
                     26: Each semaphore operation  specified by sem_op is performed on the
                     27: semaphore specified by semid and sem_num.
                     28: 
                     29: sem_op specifies one of three semaphore operations, as follows:
                     30: 
                     31: *  If sem_op is negative, one of the following occurs:
                     32: 
                     33: 11. If  semval is greater than  or equal to the  absolute value of
                     34:    sem_op, the  absolute value of sem_op  is subtracted from sem-
                     35:    val.
                     36: 
                     37: 22.  If semval  is  less than  the  absolute value  of sem_op  and
                     38:    (_s_e_m__f_l_g & IIPPCC_NNOOWWAAIITT) is  true, semop sets errno to EGAIN and
                     39:    returns -1.
                     40: 
                     41: 33.  If semval  is  less than  the  absolute value  of sem_op  and
                     42:    (_s_e_m__f_l_g & IIPPCC_NNOOWWAAIITT)  is false, semop increments the semncnt
                     43:    associated with the  specified semaphore and suspend execution
                     44:    of the calling process until one of the following occurs:
                     45: 
                     46: aa. semval becomes greater than  or equal to the absolute value of
                     47:    _s_e_m__o_p.   When this  occurs, the  value of  semncnt associated
                     48:    with the specified  semaphore is decremented, and the absolute
                     49:    value of sem_op is subtracted from semval.
                     50: 
                     51: bb. The semid for which  the calling process is awaiting action is
                     52:    removed from the system.
                     53: 
                     54: cc. The calling process  receives a signal.  When this occurs, the
                     55:    value of  semncnt associated  with the specified  semaphore is
                     56:    decremented, and the  calling process resumes execution in the
                     57:    manner prescribed in signal.
                     58: 
                     59: *  If sem_op is positive, the value of sem_op is added to semval.
                     60: 
                     61: 
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: semop()                COHERENT System Call               semop()
                     70: 
                     71: 
                     72: 
                     73: *  If sem_op is zero, one of the following occurs:
                     74: 
                     75: 11. If semval is zero, semop returns immediately.
                     76: 
                     77: 22. If  semval does not  equal zero and (_s_e_m__f_l_g  & IIPPCC_NNOOWWAAIITT) is
                     78:    true, semop immediately returns -1, with eerrrrnnoo set to EGAIN.
                     79: 
                     80: 33. If semval  is not equal to zero and  (_s_e_m__f_l_g & IIPPCC_NNOOWWAAIITT) is
                     81:    false,  semop  increments  the  semzcnt  associated  with  the
                     82:    specified  semaphore  and suspends  execution  of the  calling
                     83:    process until one of the following occurs:
                     84: 
                     85: aa. semval  becomes zero, at  which time the value  of semzcnt as-
                     86:    sociated with the specified semaphore is decremented.
                     87: 
                     88: bb. The semid for which  the calling process is awaiting action is
                     89:    removed from the system.
                     90: 
                     91: cc. The calling process  receives a signal.  When this occurs, the
                     92:    value of  semzcnt associated  with the specified  semaphore is
                     93:    decremented, and the  calling process resumes execution in the
                     94:    manner prescribed in signal.
                     95: 
                     96: semop fails if  one or more of the following  are true for any of
                     97: the semaphore operations specified by sops:
                     98: 
                     99: *  semid  is not a valid semaphore  identifier.  semop sets errno
                    100:    to EINVAL
                    101: 
                    102: *  sem_num is less than zero or greater than or equal to the num-
                    103:    ber of semaphores in the set associated with semid (EEFFBBIIGG).
                    104: 
                    105: *  nsops is greater than the system imposed maximum (EE22BBIIGG).
                    106: 
                    107: *   Operation  permission   is  denied  to  the  calling  process
                    108:    (EEAACCCCEESS).
                    109: 
                    110: *   The  operation  would result  in  suspension  of the  calling
                    111:    process but (_s_e_m__f_l_g & IIPPCC_NNOOWWAAIITT) is true (EEAAGGAAIINN).
                    112: 
                    113: *  An  operation would cause a semval to  overflow the system im-
                    114:    posed limit (EERRAANNGGEE).
                    115: 
                    116: *  sops points to an illegal address (EEFFAAUULLTT).
                    117: 
                    118: Upon  successful  completion,   the  value  of  sempid  for  each
                    119: semaphore specified in the array  pointed to by sops is set equal
                    120: to the process identifier of the calling process.
                    121: 
                    122: ***** Return Value *****
                    123: 
                    124: If semop returns due to the receipt of a signal, it returns -1 to
                    125: the calling  process and sets errno to EINTR.   If it returns due
                    126: to the removal of a semid from the system, it returns -1 and sets
                    127: errno to EDOM.
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 
                    133: 
                    134: 
                    135: semop()                COHERENT System Call               semop()
                    136: 
                    137: 
                    138: 
                    139: 
                    140: Upon successful completion,  semop returns the value of semval at
                    141: the time of the call for  the last operation in the array pointed
                    142: to by  sops.  Otherwise, it returns  -1 and sets errno  to an ap-
                    143: propriate value.
                    144: 
                    145: ***** Files *****
                    146: 
                    147: /usr/include/sys/ipc.h
                    148: /usr/include/sys/sem.h
                    149: /dev/sem
                    150: /drv/sem
                    151: 
                    152: ***** See Also *****
                    153: 
                    154: COHERENT system calls, sem, semctl(), semget()
                    155: 
                    156: ***** Notes *****
                    157: 
                    158: The  flag  SEM_UNDO  is not  supported.   This  flag would  allow
                    159: semaphore  operations to  be undone upon  the termination  of the
                    160: process which performed the operations.
                    161: 
                    162: To improve portability,  the COHERENT system implements semaphore
                    163: operations as  a device  driver rather  than as an  actual system
                    164: call.
                    165: 
                    166: 
                    167: 
                    168: 
                    169: 
                    170: 
                    171: 
                    172: 
                    173: 
                    174: 
                    175: 
                    176: 
                    177: 
                    178: 
                    179: 
                    180: 
                    181: 
                    182: 
                    183: 
                    184: 
                    185: 
                    186: 
                    187: 
                    188: 
                    189: 
                    190: 
                    191: 
                    192: 
                    193: 
                    194: 
                    195: 
                    196: COHERENT Lexicon                                           Page 3
                    197: 
                    198: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.