sem_getvalue(S-osr5)
sem_getvalue --
get the value of a semaphore
Syntax
cc . . . -lsuds
#include <semaphore.h>
int sem_getvalue (sem_t *sem, int *sval):
Description
The sem_getvalue function updates the location referenced
by the sval argument to have the value of the semaphore
referenced by sem without affecting the state of the
semaphore. The updated value represents an actual semaphore value
that occurred at some unspecified time during the call, but may not
be the actual value of the semaphore when returned to the
calling process.
If sem is locked, the value returned by
sem_getvalue is either zero or a negative number. In the
latter case, the absolute value represents the number of processes
waiting for the semaphore at some unspecified time during the call.
Return values
Upon successful completion, the function returns a value of
zero. Otherwise, the function returns a value of -l and sets
errno to indicate the error.
Diagnostics
If the following condition occurs, the sem_getvalue
function returns -1 and sets errno to the corresponding
value:
[EINVAL]-
The sem argument does not refer to a valid semaphore.
See also
semaphore(FP),
sem_post(S-osr5),
sem_trywait(S-osr5),
sem_wait(S-osr5)
Standards conformance
Text reprinted and/or adapted from IEEE Std 1003.1b-1993,
IEEE Standard for Information Technology, POSIX
Part 1: System Application Program Interface (API)
Amendment 1: Realtime Extensions [C Language], copyright © 1993
by the Institute of Electrical and Electronics Engineers, Inc. The
IEEE takes no responsibility for and will assume no
liability for damages resulting from the reader's misinterpretation
of said information resulting from the placement and context in this
publication. Information is reproduced with the permission of the
IEEE.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005