sigqueueのヘルプ・マニュアル
日本語 英語
sigqueue --help
man sigqueue
SIGQUEUE(2) Linux Programmer’s Manual SIGQUEUE(2)
名前
sigqueue, rt_sigqueueinfo - シグナルとデータをプロセスに送る
書式
#include
int sigqueue(pid_t pid, int sig, const union sigval value);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
sigqueue(): _POSIX_C_SOURCE >= 199309L
説明
sigqueue() は sig で指定されたシグナルを、PID が pid であるプロセスに送
る。シグナルを送るのに必要な権限は kill(2) と同じである。 kill(2) と 同
様 に、ヌル・シグナル (0) を使って指定した PID のプロセスが存在するかを
チェックすることができる。
value 引き数はシグナルと一緒に送るデータの付属アイテムを 指 定 す る 。
value は (整数またはポインタの値であり) 以下のような型である。
union sigval {
int sival_int;
void *sival_ptr;
};
受 取 先 の プロセスに、このシグナルに対するハンドラを (sigaction(2) に
SA_SIGINFO を指定して) インストールしておくと、そのハンドラの第 2 引 き
数に渡される siginfo_t 構造体の si_value フィールドによって、このデータ
を取得できる。さらに、この構造体の si_code フィールドは SI_QUEUE に設定
される。
返り値
成功した場合、 sigqueue() は 0 を返す。これは受け取り側プロセスの待ち行
列にシグナルが正しく入れられたことを示す。失敗した場合は -1 が返され 、
errno がエラーを表す値に設定される。
エラー
EAGAIN 待 ち行列に入れられるシグナルの最大数に達した (より詳しい情報は
signal(7) を参照すること)。
EINVAL sig が不正である。
EPERM このプロセスには、受け取り側プロセスにシグナルを送る権限がない。
必要な権限については、 kill(2) を参照すること。
ESRCH pid にマッチする PID のプロセスがない。
バージョン
このシステムコールは Linux 2.2 で初めて登場した。
準拠
POSIX.1-2001.
注意
こ の関数を呼び出したプロセスにこの関数がシグナルを送ったときに、シグナ
ルが呼び出し側スレッドにブロックされず、かつ (シグナルがブロックされ な
か った、または sigwait(3) を使用するのを待っていることにより) このシグ
ナルを扱うスレッドが何もない場合は、この関数がリターンする前に、少な く
ともそのスレッドに対してシグナルが配送されていなければならない。
Linux で は 、 呼 び 出 さ れ る シ ス テ ム コ ー ルの名前は実際には
rt_sigqueueinfo() である。 rt_sigqueueinfo() では 3 番目の引き数に違 い
が あり、 siginfo_t 構造体である。 siginfo_t 構造体は、シグナルを受信す
るプロセスのシグナルハンドラに渡されたり、シグナル受信プロセス の sig-
timedwait(2) システムコールから返されたりする。 glibc の sigqueue() ラ
ッパー関数内部では、この引き数 info は以下のように初期化される。
info.si_signo = sig; /* argument supplied to sigqueue() */
info.si_code = SI_QUEUE;
info.si_pid = getpid(); /* Process ID of sender */
info.si_uid = getuid(); /* Real UID of sender */
info.si_value = val; /* argument supplied to sigqueue() */
関連項目
kill(2), sigaction(2), signal(2), sigwait(3), signal(7)
Linux 2007-07-26 SIGQUEUE(2)
SIGQUEUE(2) Linux Programmer’s Manual SIGQUEUE(2)
NAME
sigqueue, rt_sigqueueinfo - queue a signal and data to a process
SYNOPSIS
#include
int sigqueue(pid_t pid, int sig, const union sigval value);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
sigqueue(): _POSIX_C_SOURCE >= 199309L
DESCRIPTION
sigqueue() sends the signal specified in sig to the process whose PID
is given in pid. The permissions required to send a signal are the
same as for kill(2). As with kill(2), the null signal (0) can be used
to check if a process with a given PID exists.
The value argument is used to specify an accompanying item of data
(either an integer or a pointer value) to be sent with the signal, and
has the following type:
union sigval {
int sival_int;
void *sival_ptr;
};
If the receiving process has installed a handler for this signal using
the SA_SIGINFO flag to sigaction(2), then it can obtain this data via
the si_value field of the siginfo_t structure passed as the second
argument to the handler. Furthermore, the si_code field of that struc-
ture will be set to SI_QUEUE.
RETURN VALUE
On success, sigqueue() returns 0, indicating that the signal was suc-
cessfully queued to the receiving process. Otherwise -1 is returned
and errno is set to indicate the error.
ERRORS
EAGAIN The limit of signals which may be queued has been reached. (See
signal(7) for further information.)
EINVAL sig was invalid.
EPERM The process does not have permission to send the signal to the
receiving process. For the required permissions, see kill(2).
ESRCH No process has a PID matching pid.
VERSIONS
This system call first appeared in Linux 2.2.
CONFORMING TO
POSIX.1-2001.
NOTES
If this function results in the sending of a signal to the process that
invoked it, and that signal was not blocked by the calling thread, and
no other threads were willing to handle this signal (either by having
it unblocked, or by waiting for it using sigwait(3)), then at least
some signal must be delivered to this thread before this function
returns.
On Linux, the underlying system call is actually named rt_sigqueue-
info(), and differs in its third argument, which is the siginfo_t
structure that will be supplied to the receiving process’s signal han-
dler or returned by the receiving process’s sigtimedwait(2) call.
Inside the glibc sigqueue() wrapper, this argument, info, is initial-
ized as follows:
info.si_signo = sig; /* argument supplied to sigqueue() */
info.si_code = SI_QUEUE;
info.si_pid = getpid(); /* Process ID of sender */
info.si_uid = getuid(); /* Real UID of sender */
info.si_value = val; /* argument supplied to sigqueue() */
SEE ALSO
kill(2), sigaction(2), signal(2), sigwait(3), signal(7)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2007-07-26 SIGQUEUE(2)