1SEM_GETVALUE(P) POSIX Programmer's Manual SEM_GETVALUE(P)
2
3
4
6 sem_getvalue - get the value of a semaphore (REALTIME)
7
9 #include <semaphore.h>
10
11 int sem_getvalue(sem_t *restrict sem, int *restrict sval);
12
13
15 The sem_getvalue() function shall update the location referenced by the
16 sval argument to have the value of the semaphore referenced by sem
17 without affecting the state of the semaphore. The updated value repre‐
18 sents an actual semaphore value that occurred at some unspecified time
19 during the call, but it need not be the actual value of the semaphore
20 when it is returned to the calling process.
21
22 If sem is locked, then the object to which sval points shall either be
23 set to zero or to a negative number whose absolute value represents the
24 number of processes waiting for the semaphore at some unspecified time
25 during the call.
26
28 Upon successful completion, the sem_getvalue() function shall return a
29 value of zero. Otherwise, it shall return a value of -1 and set errno
30 to indicate the error.
31
33 The sem_getvalue() function shall fail if:
34
35 EINVAL The sem argument does not refer to a valid semaphore.
36
37
38 The following sections are informative.
39
41 None.
42
44 The sem_getvalue() function is part of the Semaphores option and need
45 not be available on all implementations.
46
48 None.
49
51 None.
52
54 semctl() , semget() , semop() , sem_post() , sem_timedwait() , sem_try‐
55 wait() , sem_wait() , the Base Definitions volume of
56 IEEE Std 1003.1-2001, <semaphore.h>
57
59 Portions of this text are reprinted and reproduced in electronic form
60 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
61 -- Portable Operating System Interface (POSIX), The Open Group Base
62 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
63 Electrical and Electronics Engineers, Inc and The Open Group. In the
64 event of any discrepancy between this version and the original IEEE and
65 The Open Group Standard, the original IEEE and The Open Group Standard
66 is the referee document. The original Standard can be obtained online
67 at http://www.opengroup.org/unix/online.html .
68
69
70
71IEEE/The Open Group 2003 SEM_GETVALUE(P)