OSDN Git Service

2811633ad4e1fc120a4eece60db941423755f38f
[linuxjm/LDP_man-pages.git] / draft / man2 / semctl.2
1 .\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
2 .\" and Copyright 2004, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" Modified Tue Oct 22 17:53:56 1996 by Eric S. Raymond <esr@thyrsus.com>
25 .\" Modified Fri Jun 19 10:59:15 1998 by Andries Brouwer <aeb@cwi.nl>
26 .\" Modified Sun Feb 18 01:59:29 2001 by Andries Brouwer <aeb@cwi.nl>
27 .\" Modified 20 Dec 2001, Michael Kerrisk <mtk.manpages@gmail.com>
28 .\" Modified 21 Dec 2001, aeb
29 .\" Modified 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"     Added notes on CAP_IPC_OWNER requirement
31 .\" Modified 17 Jun 2004, Michael Kerrisk <mtk.manpages@gmail.com>
32 .\"     Added notes on CAP_SYS_ADMIN requirement for IPC_SET and IPC_RMID
33 .\" Modified, 11 Nov 2004, Michael Kerrisk <mtk.manpages@gmail.com>
34 .\"     Language and formatting clean-ups
35 .\"     Rewrote semun text
36 .\"     Added semid_ds and ipc_perm structure definitions
37 .\" 2005-08-02, mtk: Added IPC_INFO, SEM_INFO, SEM_STAT descriptions.
38 .\"
39 .\" Japanese Version Copyright (c) 1997,1998 HANATAKA Shinya
40 .\"         all rights reserved.
41 .\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
42 .\" Modified 1998-09-10, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
43 .\" Updated & Modified 2001-06-03, Yuichi SATO <ysato@h4.dion.ne.jp>
44 .\" Updated & Modified 2002-01-02, Yuichi SATO
45 .\" Updated & Modified 2005-01-03, Yuichi SATO <ysato444@yahoo.co.jp>
46 .\" Updated & Modified 2005-10-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
47 .\"
48 .\"WORD:        semaphore               セマフォ
49 .\"WORD:        semaphore set           セマフォ集合
50 .\"WORD:        union                   共用体
51 .\"WORD:        buffer                  バッファ
52 .\"WORD:        member                  メンバー
53 .\"WORD:        superuser               スーパー・ユーザ
54 .\"WORD:        effective uid           実効ユーザ ID
55 .\"WORD:        creator                 作成者
56 .\"WORD:        owner                   所有者
57 .\"WORD:        entry                   エントリ
58 .\"WORD:        undo                    アンドゥ
59 .\"WORD:        implement               実装
60 .\"WORD:        feature test macro      機能検査マクロ
61 .\"
62 .TH SEMCTL 2 2009-09-27 "Linux" "Linux Programmer's Manual"
63 .\"O .SH NAME
64 .SH 名前
65 .\"O semctl \- semaphore control operations
66 semctl \- セマフォの制御操作を行なう
67 .\"O .SH SYNOPSIS
68 .SH 書式
69 .nf
70 .B #include <sys/types.h>
71 .B #include <sys/ipc.h>
72 .B #include <sys/sem.h>
73 .sp
74 .BI "int semctl(int " semid ", int " semnum ", int " cmd ", ...);"
75 .fi
76 .\"O .SH DESCRIPTION
77 .SH 説明
78 .\"O .BR semctl ()
79 .\"O performs the control operation specified by
80 .\"O .I cmd
81 .\"O on the semaphore set identified by
82 .\"O .IR semid ,
83 .\"O or on the
84 .\"O .IR semnum -th
85 .\"O semaphore of that set.
86 .\"O (The semaphores in a set are numbered starting at 0.)
87 .BR semctl ()
88 は、
89 .I semid
90 で指定されたセマフォ集合 (semaphore set)
91 またはセマフォ集合の
92 .I semnun
93 番目のセマフォに対して、
94 .I cmd
95 で指定された制御操作を行なう
96 (集合内のセマフォの番号は 0 から始まる)。
97 .PP
98 .\"O This function has three or four arguments, depending on
99 .\"O .IR cmd .
100 .\"O When there are four, the fourth has the type
101 .\"O .IR "union semun" .
102 .\"O The \fIcalling program\fP must define this union as follows:
103 この関数は、
104 .I cmd
105 の値に依存して、3 個または 4 個の引き数を持つ。
106 引き数が 4 個の場合、第 4 引き数の型は
107 .I "union semun"
108 である。
109 \fI呼び出し元プログラム\fPは、
110 この共用体 (union) を以下のように定義しなければならない。
111
112 .nf
113 .in +4n
114 union semun {
115 .\"O     int              val;    /* Value for SETVAL */
116     int              val;    /* SETVAL の値 */
117 .\"O     struct semid_ds *buf;    /* Buffer for IPC_STAT, IPC_SET */
118     struct semid_ds *buf;    /* IPC_STAT, IPC_SET 用のバッファ */
119 .\"O     unsigned short  *array;  /* Array for GETALL, SETALL */
120     unsigned short  *array;  /* GETALL, SETALL 用の配列 */
121 .\"O     struct seminfo  *__buf;  /* Buffer for IPC_INFO
122 .\"O                                 (Linux-specific) */
123     struct seminfo  *__buf;  /* IPC_INFO 用のバッファ
124                                 (Linux 固有) */
125 };
126 .in
127 .fi
128 .PP
129 .\"O The
130 .\"O .I semid_ds
131 .\"O data structure is defined in \fI<sys/sem.h>\fP as follows:
132 .I semid_ds
133 データ構造体は \fI<sys/sem.h>\fP で以下のように定義されている:
134 .nf
135 .in +4n
136
137 struct semid_ds {
138 .\"O     struct ipc_perm sem_perm;  /* Ownership and permissions */
139     struct ipc_perm sem_perm;  /* 所有権と許可 */
140 .\"O     time_t          sem_otime; /* Last semop time */
141     time_t          sem_otime; /* 最後の semop の時刻 */
142 .\"O     time_t          sem_ctime; /* Last change time */
143     time_t          sem_ctime; /* 最後に変更が行われた時刻 */
144 .\"O     unsigned short  sem_nsems; /* No. of semaphores in set */
145     unsigned short  sem_nsems; /* 集合内のセマフォの数 */
146 };
147 .fi
148 .PP
149 .in
150 .fi
151 .PP
152 .\"O The
153 .\"O .I ipc_perm
154 .\"O structure is defined in \fI<sys/ipc.h>\fP as follows
155 .\"O (the highlighted fields are settable using
156 .\"O .BR IPC_SET ):
157 .I ipc_perm
158 構造体は \fI<sys/ipc.h>\fP で以下のように定義されている
159 (強調されたフィールドは
160 .B IPC_SET
161 を使って設定可能である):
162 .PP
163 .nf
164 .in +4n
165 struct ipc_perm {
166 .\"O     key_t          __key; /* Key supplied to semget(2) */
167 .\"O     uid_t          \fBuid\fP;   /* Effective UID of owner */
168 .\"O     gid_t          \fBgid\fP;   /* Effective GID of owner */
169 .\"O     uid_t          cuid;  /* Effective UID of creator */
170 .\"O     gid_t          cgid;  /* Effective GID of creator */
171     key_t          __key; /* semget(2) に与えられるキー */
172     uid_t          \fBuid\fP;   /* 所有者 (owner) の実効 UID */
173     gid_t          \fBgid\fP;   /* 所有者の実効 GID */
174     uid_t          cuid;  /* 作成者 (creator) の実効 UID */
175     gid_t          cgid;  /* 作成者の実効 GID */
176 .\"O     unsigned short \fBmode\fP;  /* Permissions */
177     unsigned short \fBmode\fP;  /* 許可 */
178 .\"O     unsigned short __seq; /* Sequence number */
179     unsigned short __seq; /* シーケンス番号 */
180 };
181 .in
182 .fi
183 .PP
184 .\"O Valid values for
185 .\"O .I cmd
186 .\"O are:
187 .I cmd
188 として有効な値は
189 .TP 10
190 .B IPC_STAT
191 .\"O Copy information from the kernel data structure associated with
192 .\"O .I semid
193 .\"O into the
194 .\"O .I semid_ds
195 .\"O structure pointed to by
196 .\"O .IR arg.buf .
197 .I semid
198 に関連づけられたカーネルデータ構造体の情報を
199 .I arg.buf
200 で指された
201 .I semid_ds
202 構造体へコピーする。
203 .\"O The argument
204 .\"O .I semnum
205 .\"O is ignored.
206 .\"O The calling process must have read permission on the semaphore set.
207 .I semnum
208 引き数は無視される。
209 呼び出したプロセスはそのセマフォ集合に対する
210 読み込み許可を持たなければならない。
211 .TP
212 .B IPC_SET
213 .\"O Write the values of some members of the
214 .\"O .I semid_ds
215 .\"O structure pointed to by
216 .\"O .I arg.buf
217 .\"O to the kernel data structure associated with this semaphore set,
218 .\"O updating also its
219 .\"O .I sem_ctime
220 .I arg.buf
221 で指定された
222 .I semid_ds
223 構造体のメンバーのいくつかの値を、
224 このセマフォに関連づけられたカーネルデータ構造体に書き込み、
225 .I sem_ctime
226 メンバーの値も更新する。
227 .\"O The following members of the structure are updated:
228 .\"O .IR sem_perm.uid ,
229 .\"O .IR sem_perm.gid ,
230 .\"O and (the least significant 9 bits of)
231 .\"O .IR sem_perm.mode .
232 構造体の以下のメンバーが更新される:
233 .IR sem_perm.uid ,
234 .IR sem_perm.gid ,
235 .I sem_perm.mode
236 (の最下位 9 ビット)。
237 .\"O The effective UID of the calling process must match the owner
238 .\"O .RI ( sem_perm.uid )
239 .\"O or creator
240 .\"O .RI ( sem_perm.cuid )
241 .\"O of the semaphore set, or the caller must be privileged.
242 呼び出したプロセスの実効 UID が所有者
243 .RI ( sem_perm.uid )
244 または作成者
245 .RI ( sem_perm.cuid )
246 と一致するか、呼び出した人が特権を持たなければならない。
247 .\"O The argument
248 .\"O .I semnum
249 .\"O is ignored.
250 .I semnum
251 引き数は無視される。
252 .TP
253 .B IPC_RMID
254 .\"O Immediately remove the semaphore set,
255 .\"O awakening all processes blocked in
256 .\"O .BR semop (2)
257 .\"O calls on the set (with an error return and
258 .\"O .I errno
259 .\"O set to
260 .\"O .BR EIDRM ).
261 セマフォ集合をただちに削除し、その集合上の
262 .BR semop (2)
263 コールでブロックされている全てのプロセスを目覚めさせる
264 (エラー値が返されて、
265 .I errno
266
267 .B EIDRM
268 が設定される)。
269 .\"O The effective user ID of the calling process must
270 .\"O match the creator or owner of the semaphore set,
271 .\"O or the caller must be privileged.
272 .\"O The argument
273 .\"O .I semnum
274 .\"O is ignored.
275 呼び出したプロセスの実効ユーザ ID が
276 そのセマフォ集合の作成者または所有者と一致するか、
277 呼び出した人が特権を持たなければならない。
278 .I semnum
279 引き数は無視される。
280 .TP
281 .\"O .BR IPC_INFO " (Linux-specific)"
282 .BR IPC_INFO " (Linux 固有)"
283 .\"O Returns information about system-wide semaphore limits and
284 .\"O parameters in the structure pointed to by
285 .\"O .IR arg.__buf .
286 システム全体でのセマフォの制限とパラメータに関する情報を、
287 .I arg.__buf
288 が指す構造体に入れて返す。
289 .\"O This structure is of type
290 .\"O .IR seminfo ,
291 .\"O defined in
292 .\"O .I <sys/sem.h>
293 .\"O if the
294 .\"O .B _GNU_SOURCE
295 .\"O feature test macro is defined:
296 この構造体は
297 .I seminfo
298 型である。
299 .I seminfo
300
301 .B _GNU_SOURCE
302 機能検査マクロが定義された場合に
303 .I <sys/sem.h>
304 で以下のように定義される:
305 .nf
306 .in +4n
307
308 struct  seminfo {
309 .\"O     int semmap;  /* Number of entries in semaphore
310 .\"O                     map; unused within kernel */
311 .\"O     int semmni;  /* Maximum number of semaphore sets */
312 .\"O     int semmns;  /* Maximum number of semaphores in all
313 .\"O                     semaphore sets */
314 .\"O     int semmnu;  /* System-wide maximum number of undo
315 .\"O                     structures; unused within kernel */
316 .\"O     int semmsl;  /* Maximum number of semaphores in a
317 .\"O                     set */
318 .\"O     int semopm;  /* Maximum number of operations for
319 .\"O                     semop(2) */
320 .\"O     int semume;  /* Maximum number of undo entries per
321 .\"O                     process; unused within kernel */
322 .\"O     int semusz;  /* Size of struct sem_undo */
323 .\"O     int semvmx;  /* Maximum semaphore value */
324 .\"O     int semaem;  /* Max. value that can be recorded for
325 .\"O                     semaphore adjustment (SEM_UNDO) */
326     int semmap;  /* セマフォ・マップの最大エントリ数;
327                     カーネル内では未使用 */
328     int semmni;  /* セマフォ集合の最大数 */
329     int semmns;  /* 全セマフォ集合中のセマフォの
330                     最大数 */
331     int semmnu;  /* アンドゥ構造体のシステム全体での
332                     最大数; カーネル内では未使用 */
333     int semmsl;  /* 一つのセマフォ集合の最大セマフォ数 */
334     int semopm;  /* semop(2) に渡す操作の最大数 */
335     int semume;  /* プロセスあたりのアンドゥ・エントリ
336                     の最大数; カーネル内では未使用 */
337     int semusz;  /* 構造体 sem_undo のサイズ */
338     int semvmx;  /* セマフォの最大値 */
339     int semaem;  /* セマフォの調整 (semaphore adjustment;
340                      SEM_UNDO) のために記録される最大値 */
341 };
342
343 .in
344 .fi
345 .\"O The
346 .\"O .IR semmsl ,
347 .\"O .IR semmns ,
348 .\"O .IR semopm ,
349 .\"O and
350 .\"O .I semmni
351 .\"O settings can be changed via
352 .\"O .IR /proc/sys/kernel/sem ;
353 .\"O see
354 .\"O .BR proc (5)
355 .\"O for details.
356 設定
357 .IR semmsl ,
358 .IR semmns ,
359 .IR semopm ,
360 .I semmni
361
362 .I /proc/sys/kernel/sem
363 経由で変更可能である。
364 詳しくは
365 .BR proc (5)
366 を参照。
367 .TP
368 .\"O .BR SEM_INFO " (Linux-specific)"
369 .BR SEM_INFO " (Linux 固有)"
370 .\"O Returns a
371 .\"O .I seminfo
372 .\"O structure containing the same information as for
373 .\"O .BR IPC_INFO ,
374 .\"O except that the following fields are returned with information
375 .\"O about system resources consumed by semaphores: the
376 .\"O .I semusz
377 .\"O field returns the number of semaphore sets that currently exist
378 .\"O on the system; and the
379 .\"O .I semaem
380 .\"O field returns the total number of semaphores in all semaphore sets
381 .\"O on the system.
382 .B IPC_INFO
383 のときと同じ情報を格納した
384 .I seminfo
385 構造体を返す。
386 但し、以下のフィールドにはセマフォが消費しているシステム資源に
387 関する情報が格納される点が異なる。
388 .I semusz
389 フィールドは現在システム上に存在するセマフォ集合の数を返す。
390 .I semaem
391 フィールドはシステム上の全てのセマフォ集合に含まれる
392 セマフォの総数を返す。
393 .TP
394 .\"O .BR SEM_STAT " (Linux-specific)"
395 .BR SEM_STAT " (Linux 固有)"
396 .\"O Returns a
397 .\"O .I semid_ds
398 .\"O structure as for
399 .\"O .BR IPC_STAT .
400 .B IPC_STAT
401 と同じく
402 .I semid_ds
403 構造体を返す。
404 .\"O However, the
405 .\"O .I semid
406 .\"O argument is not a semaphore identifier, but instead an index into
407 .\"O the kernel's internal array that maintains information about
408 .\"O all semaphore sets on the system.
409 但し、
410 .I semid
411 引き数は、セマフォ識別子ではなく、システム上の全てのセマフォ集合
412 に関する情報を管理するカーネルの内部配列へのインデックスである。
413 .TP
414 .B GETALL
415 .\"O Return
416 .\"O .B semval
417 .\"O (i.e., the current value)
418 .\"O for all semaphores of the set into
419 .\"O .IR arg.array .
420 .\"O The argument
421 .\"O .I semnum
422 .\"O is ignored.
423 .\"O The calling process must have read permission on the semaphore set.
424 集合の全てのセマフォの
425 .B semval
426 の値 (現在の値) を
427 .I arg.array
428 に返す。
429 .I semnum
430 引き数は無視される。
431 呼び出したプロセスはそのセマフォ集合に読み込み許可を持たなければならない。
432 .TP
433 .B GETNCNT
434 .\"O The system call returns the value of
435 .\"O .B semncnt
436 .\"O for the
437 .\"O .IR semnum \-th
438 .\"O semaphore of the set
439 .\"O (i.e., the number of processes waiting for an increase of
440 .\"O .B semval
441 .\"O for the
442 .\"O .IR semnum \-th
443 .\"O semaphore of the set).
444 .\"O The calling process must have read permission on the semaphore set.
445 システムコールは集合の
446 .I semnum
447 番目のセマフォの
448 .B semncnt
449 の値を返す (集合の
450 .I semnum
451 番目のセマフォの
452 .B semval
453 の増加を待っているプロセスの数を返す)。
454 呼び出したプロセスはそのセマフォ集合に読み込み許可を持たなければならない。
455 .TP
456 .B GETPID
457 .\"O The system call returns the value of
458 .\"O .B sempid
459 .\"O for the
460 .\"O .IR semnum \-th
461 .\"O semaphore of the set
462 .\"O (i.e., the PID of the process that executed the last
463 .\"O .BR semop (2)
464 .\"O call for the
465 .\"O .IR semnum \-th
466 .\"O semaphore of the set).
467 .\"O The calling process must have read permission on the semaphore set.
468 システムコールは集合の
469 .I semnum
470 番目のセマフォの
471 .B sempid
472 の値 (集合の
473 .I semnum
474 番目のセマフォに最後に
475 .BR semop (2)
476 コールを実行したプロセスの PID) を返す。
477 呼び出したプロセスはそのセマフォ集合に読み込み許可を持たなければならない。
478 .TP
479 .B GETVAL
480 .\"O The system call returns the value of
481 .\"O .B semval
482 .\"O for the
483 .\"O .IR semnum \-th
484 .\"O semaphore of the set.
485 .\"O The calling process must have read permission on the semaphore set.
486 システムコールは集合の
487 .I semnum
488 番目のセマフォの
489 .B semval
490 の値を返す。
491 呼び出したプロセスはそのセマフォ集合に読み込み許可を持たなければならない。
492 .TP
493 .B GETZCNT
494 .\"O The system call returns the value of
495 .\"O .B semzcnt
496 .\"O for the
497 .\"O .IR semnum \-th
498 .\"O semaphore of the set
499 .\"O (i.e., the number of processes waiting for
500 .\"O .B semval
501 .\"O of the
502 .\"O .IR semnum \-th
503 .\"O semaphore of the set to become 0).
504 .\"O The calling process must have read permission on the semaphore set.
505 システムコールは集合の
506 .I semnum
507 番目のセマフォの
508 .B semzcnt
509 の値を返す (集合の
510 .I semnum
511 番目のセマフォの
512 .B semval
513 の値が 0 になるのを待っているプロセスの数を返す)。
514 呼び出したプロセスはそのセマフォ集合に読み込み許可を持たなければならない。
515 .TP
516 .B SETALL
517 .\"O Set
518 .\"O .B semval
519 .\"O for all semaphores of the set using
520 .\"O .IR arg.array ,
521 .\"O updating also the
522 .\"O .I sem_ctime
523 .\"O member of the
524 .\"O .I semid_ds
525 .\"O structure associated with the set.
526 集合の全てのセマフォの
527 .B semval
528
529 .I arg.array
530 で指定された値を設定する。
531 その集合に関連する
532 .I semid_ds
533 構造体の
534 .I sem_ctime
535 メンバーの値も更新する。
536 .\"O Undo entries (see
537 .\"O .BR semop (2))
538 .\"O are cleared for altered semaphores in all processes.
539 .\"O If the changes to semaphore values would permit blocked
540 .\"O .BR semop (2)
541 .\"O calls in other processes to proceed, then those processes are woken up.
542 全てのプロセスのセマフォの変更についてのアンドゥ・エントリ
543 .RB ( semop (2)
544 を参照) は消去 (clear) される。
545 セマフォの値の変更により、他のプロセス内でブロックされている
546 .BR semop (2)
547 コールの続行が許可されると、それらのプロセスは起こされる (wake up)。
548 .\"O The argument
549 .\"O .I semnum
550 .\"O is ignored.
551 .\"O The calling process must have alter (write) permission on
552 .\"O the semaphore set.
553 .I semnum
554 引き数は無視される。
555 呼び出したプロセスはそのセマフォ集合に
556 変更 (書き込み) 許可を持たなければならない。
557 .TP
558 .B SETVAL
559 .\"O Set the value of
560 .\"O .B semval
561 .\"O to
562 .\"O .I arg.val
563 .\"O for the
564 .\"O .IR semnum \-th
565 .\"O semaphore of the set, updating also the
566 .\"O .I sem_ctime
567 .\"O member of the
568 .\"O .I semid_ds
569 .\"O structure associated with the set.
570 集合の
571 .I semnum
572 番目のセマフォの
573 .B semval
574
575 .I arg.val
576 の値を設定する。その集合に関連する
577 .I semid_ds
578 構造体の
579 .I sem_ctime
580 メンバーの値も更新する。
581 .\"O Undo entries are cleared for altered semaphores in all processes.
582 .\"O If the changes to semaphore values would permit blocked
583 .\"O .BR semop (2)
584 .\"O calls in other processes to proceed, then those processes are woken up.
585 .\"O The calling process must have alter permission on the semaphore set.
586 全てのプロセスのセマフォの変更についてのアンドゥ・エントリは消去される。
587 セマフォの値の変更により、他のプロセス内でブロックされている
588 .BR semop (2)
589 コールの続行が許可されると、それらのプロセスは起こされる (wake up)。
590 呼び出したプロセスはそのセマフォ集合に
591 変更 (書き込み) 許可を持たなければならない。
592 .\"O .SH "RETURN VALUE"
593 .SH 返り値
594 .\"O On failure
595 .\"O .BR semctl ()
596 .\"O returns \-1
597 .\"O with
598 .\"O .I errno
599 .\"O indicating the error.
600 失敗した場合、
601 .BR semctl ()
602 は \-1 を返し、
603 .I errno
604 にそのエラーを示す。
605
606 .\"O Otherwise the system call returns a nonnegative value depending on
607 .\"O .I cmd
608 .\"O as follows:
609 そうでなければシステムコールは
610 .I cmd
611 によって以下の負でない値を返す:
612 .TP 12
613 .B GETNCNT
614 .\"O the value of
615 .\"O .BR semncnt .
616 .B semncnt
617 の値
618 .TP
619 .B GETPID
620 .\"O the value of
621 .\"O .BR sempid .
622 .B sempid
623 の値
624 .TP
625 .B GETVAL
626 .\"O the value of
627 .\"O .BR semval .
628 .B semval
629 の値
630 .TP
631 .B GETZCNT
632 .\"O the value of
633 .\"O .BR semzcnt .
634 .B semzcnt
635 の値
636 .TP
637 .B IPC_INFO
638 .\"O the index of the highest used entry in the
639 .\"O kernel's internal array recording information about all
640 .\"O semaphore sets.
641 .\"O (This information can be used with repeated
642 .\"O .B SEM_STAT
643 .\"O operations to obtain information about all semaphore sets on the system.)
644 全てのセマフォ集合に関する情報を管理しているカーネルの内部配列の使用中
645 エントリのインデックスの最大値
646 (この情報は、システムの全てのセマフォ集合に関する情報を取得するために
647 .B SEM_STAT
648 操作を繰り返し実行する際に使用できる)
649 .TP
650 .B SEM_INFO
651 .\"O As for
652 .\"O .BR IPC_INFO .
653 .B IPC_INFO
654 と同じ
655 .TP
656 .B SEM_STAT
657 .\"O the identifier of the semaphore set whose index was given in
658 .\"O .IR semid .
659 .I semid
660 で指定されたインデックスを持つセマフォ集合の識別子
661 .LP
662 .\"O All other
663 .\"O .I cmd
664 .\"O values return 0 on success.
665 .I cmd
666 の値がそれ以外の場合、成功すると 0 が返される。
667 .\"O .SH ERRORS
668 .SH エラー
669 .\"O On failure,
670 .\"O .I errno
671 .\"O will be set to one of the following:
672 失敗した場合は
673 .I errno
674 には以下の値のどれかが設定される:
675 .TP
676 .B EACCES
677 .\"O The argument
678 .\"O .I cmd
679 .\"O has one of the values
680 .\"O .BR GETALL ,
681 .\"O .BR GETPID ,
682 .\"O .BR GETVAL ,
683 .\"O .BR GETNCNT ,
684 .\"O .BR GETZCNT ,
685 .\"O .BR IPC_STAT ,
686 .\"O .BR SEM_STAT ,
687 .\"O .BR SETALL ,
688 .\"O or
689 .\"O .B SETVAL
690 .\"O and the calling process does not have the required
691 .\"O permissions on the semaphore set and does not have the
692 .\"O .B CAP_IPC_OWNER
693 .\"O capability.
694 .I cmd
695 引き数が
696 .BR GETALL ,
697 .BR GETPID ,
698 .BR GETVAL ,
699 .BR GETNCNT ,
700 .BR GETZCNT ,
701 .BR IPC_STAT ,
702 .BR SEM_STAT ,
703 .BR SETALL ,
704 .B SETVAL
705 のうちの何れかの値を持ち、
706 呼び出したプロセスがセマフォに対して必要とされる許可と
707 .B CAP_IPC_OWNER
708 ケーパビリティ (capability) を持っていない。
709 .TP
710 .B EFAULT
711 .\"O The address pointed to by
712 .\"O .I arg.buf
713 .\"O or
714 .\"O .I arg.array
715 .\"O isn't accessible.
716 .I arg.buf
717 または
718 .I arg.array
719 で指されているアドレスにアクセスすることができない。
720 .TP
721 .B EIDRM
722 .\"O The semaphore set was removed.
723 セマフォ集合が削除された。
724 .TP
725 .B EINVAL
726 .\"O Invalid value for
727 .\"O .I cmd
728 .\"O or
729 .\"O .IR semid .
730 .\"O Or: for a
731 .\"O .B SEM_STAT
732 .\"O operation, the index value specified in
733 .\"O .I semid
734 .\"O referred to an array slot that is currently unused.
735 .I cmd
736 または
737 .I semid
738 に無効な値が指定された。
739 もしくは、
740 .B SEM_STAT
741 操作の場合に、
742 .I semid
743 で指定されたインデックス値が現在未使用の配列のスロットを参照いていた。
744 .TP
745 .B EPERM
746 .\"O The argument
747 .\"O .I cmd
748 .\"O has the value
749 .\"O .B IPC_SET
750 .\"O or
751 .\"O .B IPC_RMID
752 .\"O but the effective user ID of the calling process is not the creator
753 .\"O (as found in
754 .\"O .IR sem_perm.cuid )
755 .\"O or the owner
756 .\"O (as found in
757 .\"O .IR sem_perm.uid )
758 .\"O of the semaphore set,
759 .\"O and the process does not have the
760 .\"O .B CAP_SYS_ADMIN
761 .\"O capability.
762 .I cmd
763 引き数に
764 .B IPC_SET
765 または
766 .B IPC_RMID
767 が指定され、呼び出したプロセスの実効ユーザ ID がセマフォの
768 .RI ( sem_perm.cuid
769 で見つかる) 作成者または
770 .RI ( sem_perm.uid
771 で見つかる) 所有者でもなく、
772 プロセスが
773 .B CAP_SYS_ADMIN
774 ケーパビリティを持たない。
775 .TP
776 .B ERANGE
777 .\"O The argument
778 .\"O .I cmd
779 .\"O has the value
780 .\"O .B SETALL
781 .\"O or
782 .\"O .B SETVAL
783 .\"O and the value to which
784 .\"O .B semval
785 .\"O is to be set (for some semaphore of the set) is less than 0
786 .\"O or greater than the implementation limit
787 .\"O .BR SEMVMX .
788 .I cmd
789 引き数に
790 .B SETALL
791 または
792 .B SETVAL
793 が指定され、(集合のセマフォのどれかの)
794 .B semval
795 に設定される値が 0 より小さいか、実装の制限
796 .B SEMVMX
797 よりも大きい。
798 .\"O .SH "CONFORMING TO"
799 .SH 準拠
800 SVr4, POSIX.1-2001.
801 .\"O .\" SVr4 documents more error conditions EINVAL and EOVERFLOW.
802 .\" SVr4 には、他に EINVAL, EOVERFLOW エラーについての記述がある。
803 .\"O .SH NOTES
804 .SH 注意
805 .\"O The
806 .\"O .BR IPC_INFO ,
807 .\"O .B SEM_STAT
808 .\"O and
809 .\"O .B SEM_INFO
810 .\"O operations are used by the
811 .\"O .BR ipcs (1)
812 .\"O program to provide information on allocated resources.
813 .\"O In the future these may modified or moved to a /proc file system
814 .\"O interface.
815 .BR IPC_INFO ,
816 .BR SEM_STAT ,
817 .B SEM_INFO
818 操作は
819 .BR ipcs (1)
820 プログラムによって割当られた資源について情報を提供するために使用される。
821 将来的にはこれらは変更されるか、
822 /proc ファイル・システム・インタフェースに移動されるかもしれない。
823 .LP
824 .\"O Various fields in a \fIstruct semid_ds\fP were typed as
825 .\"O .I short
826 .\"O under Linux 2.2
827 .\"O and have become
828 .\"O .I long
829 .\"O under Linux 2.4.
830 .\"O To take advantage of this,
831 .\"O a recompilation under glibc-2.1.91 or later should suffice.
832 .\"O (The kernel distinguishes old and new calls by an
833 .\"O .B IPC_64
834 .\"O flag in
835 .\"O .IR cmd .)
836 \fI構造体 semid_ds\fP 内の多くのフィールドは、
837 Linux 2.2 では
838 .I short
839 型だったが、Linux 2.4 では
840 .I long
841 型になった。
842 この利点を生かすには、glibc-2.1.91 以降の環境下で
843 再コンパイルすれば十分である。
844 カーネルは新しい形式の呼び出しと古い形式の呼び出しを
845 .I cmd
846 内の
847 .B IPC_64
848 フラグで区別する。
849 .PP
850 .\"O In some earlier versions of glibc, the
851 .\"O .I semun
852 .\"O union was defined in \fI<sys/sem.h>\fP, but POSIX.1-2001 requires
853 .\"O that the caller define this union.
854 初期のバージョンの glibc では、
855 .I semun
856 共用体は \fI<sys/sem.h>\fP で定義されていたが、
857 POSIX.1-2001 では呼び出し側がこの共用体を定義する必要がある。
858 .\"O On versions of glibc where this union is \fInot\fP defined,
859 .\"O the macro
860 .\"O .B _SEM_SEMUN_UNDEFINED
861 .\"O is defined in \fI<sys/sem.h>\fP.
862 この共用体が定義されて\fIいない\fP glibc のバージョンでは、
863 マクロ
864 .B _SEM_SEMUN_UNDEFINED
865 が \fI<sys/sem.h>\fP で定義されている。
866 .PP
867 .\"O The following system limit on semaphore sets affects a
868 .\"O .BR semctl ()
869 .\"O call:
870 以下は
871 .BR semctl ()
872 コールに影響するセマフォ集合のシステム制限:
873 .TP
874 .B SEMVMX
875 .\"O Maximum value for
876 .\"O .BR semval :
877 .\"O implementation dependent (32767).
878 .B semval
879 の最大値 : 実装依存 (32767)。
880 .LP
881 .\"O For greater portability it is best to always call
882 .\"O .BR semctl ()
883 .\"O with four arguments.
884 移植性を高めるための一番良い方法は、常に 4 個の引き数で
885 .BR semctl ()
886 を呼び出すことである。
887 .\"O .SH "SEE ALSO"
888 .SH 関連項目
889 .BR ipc (2),
890 .BR semget (2),
891 .BR semop (2),
892 .BR capabilities (7),
893 .BR sem_overview (7),
894 .BR svipc (7)