OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / sigqueue.3
1 .\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
24 .\"
25 .\" added note on self-signaling, aeb, 2002-06-07
26 .\" added note on CAP_KILL, mtk, 2004-06-16
27 .\"
28 .\"*******************************************************************
29 .\"
30 .\" This file was generated with po4a. Translate the source file.
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" Japanese Version Copyright (c) 2002, 2005 Yuichi SATO
35 .\"         all rights reserved.
36 .\" Translated 2002-08-06, Yuichi SATO <ysato@h4.dion.ne.jp>
37 .\" Updated & Modified 2005-01-08, Yuichi SATO <ysato444@yahoo.co.jp>
38 .\" Updated 2007-09-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
39 .\" Updated 2013-05-04, Akihiro MOTOKI <amotoki@gmail.com>
40 .\"
41 .TH SIGQUEUE 3 2012\-03\-25 Linux "Linux Programmer's Manual"
42 .SH 名前
43 sigqueue \- シグナルとデータをプロセスに送る
44 .SH 書式
45 \fB#include <signal.h>\fP
46 .sp
47 \fBint sigqueue(pid_t \fP\fIpid\fP\fB, int \fP\fIsig\fP\fB, const union sigval
48 \fP\fIvalue\fP\fB);\fP
49 .sp
50 .in -4n
51 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
52 .in
53 .sp
54 \fBsigqueue\fP(): _POSIX_C_SOURCE\ >=\ 199309L
55 .SH 説明
56 \fBsigqueue\fP()  は \fIsig\fP で指定されたシグナルを、PID が \fIpid\fP であるプロセスに送る。 シグナルを送るのに必要な権限は
57 \fBkill\fP(2)  と同じである。 \fBkill\fP(2)  と同様に、ヌル・シグナル (0) を使って 指定した PID
58 のプロセスが存在するかをチェックすることができる。
59 .PP
60 \fIvalue\fP 引き数はシグナルと一緒に送るデータの付属アイテムを指定する。 \fIvalue\fP は (整数またはポインタの値であり)
61 以下のような型である。
62 .sp
63 .in +4n
64 .nf
65 union sigval {
66     int   sival_int;
67     void *sival_ptr;
68 };
69 .fi
70 .in
71
72 受取先のプロセスに、このシグナルに対するハンドラを (\fBsigaction\fP(2)  に \fBSA_SIGINFO\fP を指定して)
73 インストールしておくと、 そのハンドラの第 2 引き数に渡される \fIsiginfo_t\fP 構造体の \fIsi_value\fP
74 フィールドによって、このデータを取得できる。 さらに、この構造体の \fIsi_code\fP フィールドは \fBSI_QUEUE\fP に設定される。
75 .SH 返り値
76 成功した場合、 \fBsigqueue\fP()  は 0 を返す。 これは受け取り側プロセスの待ち行列に シグナルが正しく入れられたことを示す。
77 失敗した場合は \-1 が返され、 \fIerrno\fP がエラーを表す値に設定される。
78 .SH エラー
79 .TP 
80 \fBEAGAIN\fP
81 待ち行列に入れられるシグナルの最大数に達した (より詳しい情報は \fBsignal\fP(7)  を参照すること)。
82 .TP 
83 \fBEINVAL\fP
84 \fIsig\fP が不正である。
85 .TP 
86 \fBEPERM\fP
87 このプロセスには、受け取り側プロセスにシグナルを送る権限がない。 必要な権限については、 \fBkill\fP(2)  を参照すること。
88 .TP 
89 \fBESRCH\fP
90 \fIpid\fP にマッチする PID のプロセスがない。
91 .SH バージョン
92 このシステムコールは Linux 2.2 で初めて登場した。
93 .SH 準拠
94 POSIX.1\-2001.
95 .SH 注意
96 この関数を呼び出したプロセスにこの関数がシグナルを送ったときに、 シグナルが呼び出し側スレッドにブロックされず、 かつ
97 (シグナルがブロックされなかった、または \fBsigwait\fP(3)  を使用するのを待っていることにより)
98 このシグナルを扱うスレッドが何もない場合は、 この関数がリターンする前に、少なくとも そのスレッドに対してシグナルが配送されていなければならない。
99
100 Linux では、この関数は \fBrt_sigqueueinfo\fP(2)  システムコールを使って実装されている。 両者には 3
101 番目の引き数に違いがあり、 \fBrt_sigqueueinfo\fP(2)  では 3 番目の引き数は \fIsiginfo_t\fP 構造体である。
102 \fIsiginfo_t\fP 構造体は、シグナルを受信するプロセスのシグナルハンドラに渡されたり、 シグナル受信プロセスの
103 \fBsigtimedwait\fP(2)  システムコールから返されたりする。 glibc の \fBsigqueue\fP()  ラッパー関数内部では、
104 この引き数 \fIuinfo\fP は以下のように初期化される。
105 .in +4n
106 .nf
107
108 uinfo.si_signo = sig;      /* argument supplied to sigqueue() */
109 uinfo.si_code = SI_QUEUE;
110 uinfo.si_pid = getpid();   /* Process ID of sender */
111 uinfo.si_uid = getuid();   /* Real UID of sender */
112 uinfo.si_value = val;      /* argument supplied to sigqueue() */
113 .fi
114 .in
115 .SH 関連項目
116 \fBkill\fP(2), \fBrt_sigqueueinfo\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2),
117 \fBpthread_sigqueue\fP(3), \fBsigwait\fP(3), \fBsignal\fP(7)
118 .SH この文書について
119 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
120 である。プロジェクトの説明とバグ報告に関する情報は
121 http://www.kernel.org/doc/man\-pages/ に書かれている。