text
stringlengths 0
234
|
---|
.so man2/rename.2 |
.\" copyright (c) 2006 michael kerrisk <[email protected]> |
.\" |
.\" %%%license_start(verbatim) |
.\" permission is granted to make and distribute verbatim copies of this |
.\" manual provided the copyright notice and this permission notice are |
.\" preserved on all copies. |
.\" |
.\" permission is granted to copy and distribute modified versions of this |
.\" manual under the conditions for verbatim copying, provided that the |
.\" entire resulting derived work is distributed under the terms of a |
.\" permission notice identical to this one. |
.\" |
.\" since the linux kernel and libraries are constantly changing, this |
.\" manual page may be incorrect or out-of-date. the author(s) assume no |
.\" responsibility for errors or omissions, or for damages resulting from |
.\" the use of the information contained herein. the author(s) may not |
.\" have taken the same level of care in the production of this manual, |
.\" which is licensed free of charge, as they might when working |
.\" professionally. |
.\" |
.\" formatted or processed versions of this manual, if unaccompanied by |
.\" the source, must acknowledge the copyright and authors of this work. |
.\" %%%license_end |
.\" |
.th sem_getvalue 3 2021-03-22 "linux" "linux programmer's manual" |
.sh name |
sem_getvalue \- get the value of a semaphore |
.sh synopsis |
.nf |
.b #include <semaphore.h> |
.pp |
.bi "int sem_getvalue(sem_t *restrict " sem ", int *restrict " sval ); |
.fi |
.pp |
link with \fi\-pthread\fp. |
.sh description |
.br sem_getvalue () |
places the current value of the semaphore pointed to |
.i sem |
into the integer pointed to by |
.ir sval . |
.pp |
if one or more processes or threads are blocked |
waiting to lock the semaphore with |
.br sem_wait (3), |
posix.1 permits two possibilities for the value returned in |
.ir 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 |
.br sem_wait (3). |
linux adopts the former behavior. |
.sh return value |
.br sem_getvalue () |
returns 0 on success; |
on error, \-1 is returned and |
.i errno |
is set to indicate the error. |
.sh errors |
.tp |
.b einval |
.i sem |
is not a valid semaphore. |
(the glibc implementation currently does not check whether |
.i sem |
is valid.) |
.sh attributes |
for an explanation of the terms used in this section, see |
.br attributes (7). |
.ad l |
.nh |
.ts |
allbox; |
lbx lb lb |
l l l. |
interface attribute value |
t{ |
.br sem_getvalue () |
t} thread safety mt-safe |
.te |
.hy |
.ad |
.sp 1 |
.sh conforming to |
posix.1-2001, posix.1-2008. |
.sh notes |
the value of the semaphore may already have changed by the time |
.br sem_getvalue () |
returns. |
.sh see also |
.br sem_post (3), |
.br sem_wait (3), |
.br sem_overview (7) |
.sh colophon |
this page is part of release 5.13 of the linux |
.i man-pages |
project. |
a description of the project, |
Subsets and Splits