sem_getvalue(2) DG/UX R4.11MU05 sem_getvalue(2)
NAME
sem_getvalue - get the current value of a semaphore
SYNOPSIS
#include <semaphore.h>
int semgetvalue (*sem, *semaphorevalue)
semt *sem;
int *semaphorevalue;
DESCRIPTION
Use semgetvalue(2) to get the current value of a semaphore:
sem is a valid semaphore address returned by a prior seminit(2)
or semopen(2) call.
semaphorevalue
is the location to update with the value of the semaphore.
semgetvalue updates the location referenced by the semaphorevalue
argument to have the value of the semaphore referenced by sem,
without affecting the state of the semaphore.
The semaphorevalue returned is an actual semaphore value which
occurred at some unspecified time during the call, but may not be the
actual value of the semaphore when it is returned to the calling
process.
If sem is locked and unavailable to other processes, then the
semaphorevalue returned by semgetvalue is zero. If the semaphore
is unlocked and available to other processes (semtrywait(2) will
successfully return), then the semaphorevalue returned by
semgetvalue is positive, and represents the number of successful
semtrywait(2) calls that can be done on the semaphore.
Note
* This routine is based on POSIX realtime extension document P1003.4
draft 14. It is therefore subject to change.
* Compilation of a source file using this routine requires that
feature macro _POSIX4_DRAFT_SOURCE be defined. This feature macro
is not enabled by any other feature macro, nor does it enable any
other feature macro.
* The compiled routine must be linked to library librte.a.
RETURN VALUE
If successful, semgetvalue returns 0. If unsuccessful, it returns -1
and sets ERRNO to one of the following:
EINVAL sem is invalid.
SEE ALSO
semdestroy(2), semclose(2), seminit(2), semopen(2),
semtrywait(2), semwait(2), semunlink(2), sempost(2).
Licensed material--property of copyright holder(s)