NAME
semgetvalue - get the value of a semaphore SYNOPSIS
#include
int semgetvalue(semt *sem, int *sval); Link with -pthread. DESCRIPTION semgetvalue() places the current value of the semaphore pointed to sem into the integer pointed to by sval. If one or more processes or threads are blocked waiting to lock the
semaphore with semwait(3), POSIX.1-2001 permits two possibilities for the value returned in sval: either 0 is returned; or a negative number whose absolute value is the count of the number of processes and threads currently blocked in semwait(3). Linux adopts the former behavior. RETURN VALUE
semgetvalue() returns 0 on success; on error, -1 is returned and errno is set to indicate the error. ERRORS EINVAL sem is not a valid semaphore. ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌───────────────┬───────────────┬─────────┐ │Interface │ Attribute │ Value │ ├───────────────┼───────────────┼─────────┤
│semgetvalue() │ Thread safety │ MT-Safe │ └───────────────┴───────────────┴─────────┘ CONFORMING TO
POSIX.1-2001. NOTES The value of the semaphore may already have changed by the time semgetvalue() returns. SEE ALSO sempost(3), semwait(3), semoverview(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2012-05-13 SEMGETVALUE(3)