2 .\" Hey Emacs! This file is -*- nroff -*- source.
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-04-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
29 .TH SEM_GETVALUE 3 2006-03-25 "Linux" "Linux Programmer's Manual"
32 .\"O sem_getvalue \- get the value of a semaphore
33 sem_getvalue \- セマフォの値を取得する
37 .B #include <semaphore.h>
39 .BI "int sem_getvalue(sem_t *" sem ", int *" sval );
42 .\"O Link with \fI\-lrt\fP or \fI\-pthread\fP.
43 \fI\-lrt\fP または \fI\-pthread\fP でリンクする。
46 .\"O .BR sem_getvalue ()
47 .\"O places the current value of the semaphore pointed to
49 .\"O into the integer pointed to by
58 .\"O If one or more processes or threads are blocked
59 .\"O waiting to lock the semaphore with
60 .\"O .BR sem_wait (3),
61 .\"O POSIX.1-2001 permits two possibilities for the value returned in
63 .\"O either 0 is returned;
64 .\"O or a negative number whose absolute value is the count
65 .\"O of the number of processes and threads currently blocked in
66 .\"O .BR sem_wait (3).
67 .\"O Linux adopts the former behavior.
73 で返される値は 0 もしくは負の値のいずれかとなる。
76 で現在停止しているプロセスかスレッドの合計数に等しい。
77 Linux は前者の動作 (0 を返す動作) を採用している。
80 .\"O .BR sem_getvalue ()
81 .\"O returns 0 on success;
82 .\"O on error, \-1 is returned and
84 .\"O is set to indicate the error.
87 は 0 を返す。エラーの場合、\-1 を返し、
95 .\"O is not a valid semaphore.
98 .\"O .SH CONFORMING TO
103 .\"O The value of the semaphore may already have changed by the time
104 .\"O .BR sem_getvalue ()
107 が返るときには、すでにセマフォの値は変化している可能性がある。