операции управления семафором System V (System V semaphore control operations)
Возвращаемое значение (Return value)
On success, semctl
() returns a nonnegative value depending on cmd
as follows:
GETNCNT
the value of semncnt
.
GETPID
the value of sempid
.
GETVAL
the value of semval
.
GETZCNT
the value of semzcnt
.
IPC_INFO
the index of the highest used entry in the kernel's
internal array recording information about all semaphore
sets. (This information can be used with repeated
SEM_STAT
or SEM_STAT_ANY
operations to obtain information
about all semaphore sets on the system.)
SEM_INFO
as for IPC_INFO
.
SEM_STAT
the identifier of the semaphore set whose index was given
in semid.
SEM_STAT_ANY
as for SEM_STAT
.
All other cmd values return 0 on success.
On failure, semctl
() returns -1 and sets errno to indicate the
error.