Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (s and S) semop(2)
If the sem_op field of the sembuf structure contains 0 (zero) and the calling process has read
access permission, semop() does one of the following:
If the semval field of the sem structure contains 0 (zero), semop() returns immediately.
If semval is not zero and (sem_flg & IPC_NOWAIT) is not zero, semop() returns
immediately.
If semval is not zero and (sem_flg & IPC_NOWAIT) is 0 (zero), semop() increments
the semaphores semzcnt value (in the sem structure) and suspends the calling process.
If the process is suspended, it sleeps until one of the following occurs:
The semval value becomes 0 (zero). When this happens, the semaphore’s
semzcnt value (in the sem structure) is decremented.
The semaphore set ID specified by the semid parameter is removed from the sys-
tem. When this happens, semop() returns immediately with an error.
The calling process catches a signal. When this happens, the semaphores
semzcnt value is decremented and the calling process resumes execution as
directed by the sigaction() function.
The value of the sempid field in the sem structure for each OSS semaphore that is operated upon
is set to the OSS process ID of the calling process.
Use From the Guardian Environment
If called from a Guardian process, the actions of this function are undefined and errno is set to
[ENOTOSS].
RETURN VALUES
Upon successful completion, the semop() function returns the value 0 (zero).
If the semop() function fails, the value -1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the semop() function sets errno to the corresponding
value:
[E2BIG] The value of the nsops parameter is greater than the system-defined maximum.
[EACCES] The calling process does not have the required access permission.
[EAGAIN] The value of (sem_flg && IPC_NOWAIT)isTRUE, but the requested opera-
tion would cause the calling process to be suspended.
[EFAULT] The address used for the sops parameter is invalid.
[EFBIG] The sem_num field of the sembuf structure is less than 0 (zero) or greater than
or equal to the number of semaphores in the set identified by the semid parame-
ter.
[EIDRM] The semaphore set ID specified by the semid parameter was removed from the
system while the process was waiting for it.
[EINTR] The semop() function was interrupted by a signal.
527186-023 Hewlett-Packard Company 725