.\" Copyright (c) 2002 Michael Kerrisk .\" .\" 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. .\" .\" added note on self-signaling, aeb, 2002-06-07 .\" added note on CAP_KILL, mtk, 2004-06-16 .\" .\" Japanese Version Copyright (c) 2002, 2005 Yuichi SATO .\" all rights reserved. .\" Translated 2002-08-06, Yuichi SATO .\" Updated & Modified 2005-01-08, Yuichi SATO .\" Updated 2007-09-08, Akihiro MOTOKI , LDP v2.64 .\" .TH SIGQUEUE 3 2011-09-18 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O sigqueue, rt_sigqueueinfo \- queue a signal and data to a process sigqueue, rt_sigqueueinfo \- シグナルとデータをプロセスに送る .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "int sigqueue(pid_t " pid ", int " sig ", const union sigval " value ); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR sigqueue (): _POSIX_C_SOURCE\ >=\ 199309L .\"O .SH DESCRIPTION .SH 説明 .\"O .BR sigqueue () .\"O sends the signal specified in .\"O .I sig .\"O to the process whose PID is given in .\"O .IR pid . .BR sigqueue () は .I sig で指定されたシグナルを、PID が .I pid であるプロセスに送る。 .\"O The permissions required to send a signal are the same as for .\"O .BR kill (2). シグナルを送るのに必要な権限は .BR kill (2) と同じである。 .\"O As with .\"O .BR kill (2), .\"O the null signal (0) can be used to check if a process with a given .\"O PID exists. .BR kill (2) と同様に、ヌル・シグナル (0) を使って 指定した PID のプロセスが存在するかをチェックすることができる。 .PP .\"O The .\"O .I value .\"O argument is used to specify an accompanying item of data (either an integer .\"O or a pointer value) to be sent with the signal, and has the following type: .I value 引き数はシグナルと一緒に送るデータの付属アイテムを指定する。 .I value は (整数またはポインタの値であり) 以下のような型である。 .sp .in +4n .nf union sigval { int sival_int; void *sival_ptr; }; .fi .in .\"O If the receiving process has installed a handler for this signal using the .\"O .B SA_SIGINFO .\"O flag to .\"O .BR sigaction (2), .\"O then it can obtain this data via the .\"O .I si_value .\"O field of the .\"O .I siginfo_t .\"O structure passed as the second argument to the handler. 受取先のプロセスに、このシグナルに対するハンドラを .RB ( sigaction (2) に .B SA_SIGINFO を指定して) インストールしておくと、 そのハンドラの第 2 引き数に渡される .I siginfo_t 構造体の .I si_value フィールドによって、このデータを取得できる。 .\"O Furthermore, the .\"O .I si_code .\"O field of that structure will be set to .\"O .BR SI_QUEUE . さらに、この構造体の .I si_code フィールドは .B SI_QUEUE に設定される。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, .\"O .BR sigqueue () .\"O returns 0, indicating that the signal was successfully .\"O queued to the receiving process. 成功した場合、 .BR sigqueue () は 0 を返す。 これは受け取り側プロセスの待ち行列に シグナルが正しく入れられたことを示す。 .\"O Otherwise \-1 is returned and .\"O .I errno .\"O is set to indicate the error. 失敗した場合は \-1 が返され、 .I errno がエラーを表す値に設定される。 .\"O .SH ERRORS .SH エラー .TP .B EAGAIN .\"O The limit of signals which may be queued has been reached. 待ち行列に入れられるシグナルの最大数に達した .\"O (See .\"O .BR signal (7) .\"O for further information.) (より詳しい情報は .BR signal (7) を参照すること)。 .TP .B EINVAL .\"O .I sig .\"O was invalid. .I sig が不正である。 .TP .B EPERM .\"O The process does not have permission to send the signal .\"O to the receiving process. このプロセスには、受け取り側プロセスにシグナルを送る権限がない。 .\"O For the required permissions, see .\"O .BR kill (2). 必要な権限については、 .BR kill (2) を参照すること。 .TP .B ESRCH .\"O No process has a PID matching .\"O .IR pid . .I pid にマッチする PID のプロセスがない。 .\"O .SH VERSIONS .SH バージョン .\"O This system call first appeared in Linux 2.2. このシステムコールは Linux 2.2 で初めて登場した。 .\"O .SH "CONFORMING TO" .SH 準拠 POSIX.1-2001. .\"O .SH NOTES .SH 注意 .\"O If this function results in the sending of a signal to the process .\"O that invoked it, and that signal was not blocked by the calling thread, .\"O and no other threads were willing to handle this signal (either by .\"O having it unblocked, or by waiting for it using .\"O .BR sigwait (3)), .\"O then at least some signal must be delivered to this thread before this .\"O function returns. .\"Osato: .\"Osato: この文章は長すぎるのと it が多すぎるために良く分かりません。 .\"Osato: that invoked it ( = this function) .\"Osato: by having it ( = that signal) unblocked .\"Osato: by waiting for it ( = that signal) using sigwait(3) .\"Osato: として訳してみました。 .\"Osato: 詳しい方からの御指摘をお待ちします。 .\"Osato: この関数を呼び出したプロセスにこの関数がシグナルを送ったときに、 シグナルが呼び出し側スレッドにブロックされず、 かつ (シグナルがブロックされなかった、または .BR sigwait (3) を使用するのを待っていることにより) このシグナルを扱うスレッドが何もない場合は、 この関数がリターンする前に、少なくとも そのスレッドに対してシグナルが配送されていなければならない。 .\"O On Linux, this function is implemented using the .\"O .BR rt_sigqueueinfo (2) .\"O system call. .\"O The system call differs in its third argument, which is the .\"O .I siginfo_t .\"O structure that will be supplied to the receiving process's .\"O signal handler or returned by the receiving process's .\"O .BR sigtimedwait (2) .\"O call. .\"O Inside the glibc .\"O .BR sigqueue () .\"O wrapper, this argument, .\"O .IR uinfo , .\"O is initialized as follows: Linux では、この関数は .BR rt_sigqueueinfo (2) システムコールを使って実装されている。 両者には 3 番目の引き数に違いがあり、 .BR rt_sigqueueinfo (2) では 3 番目の引き数は .I siginfo_t 構造体である。 .I siginfo_t 構造体は、シグナルを受信するプロセスのシグナルハンドラに渡されたり、 シグナル受信プロセスの .BR sigtimedwait (2) システムコールから返されたりする。 glibc の .BR sigqueue () ラッパー関数内部では、 この引き数 .I uinfo は以下のように初期化される。 .in +4n .nf uinfo.si_signo = sig; /* argument supplied to sigqueue() */ uinfo.si_code = SI_QUEUE; uinfo.si_pid = getpid(); /* Process ID of sender */ uinfo.si_uid = getuid(); /* Real UID of sender */ uinfo.si_value = val; /* argument supplied to sigqueue() */ .fi .in .\"O .SH "SEE ALSO" .SH 関連項目 .BR kill (2), .BR rt_sigqueueinfo (2), .BR sigaction (2), .BR signal (2), .BR pthread_sigqueue (3), .BR sigwait (3), .BR signal (7)