1SIGQUEUE(2) Linux Programmer's Manual SIGQUEUE(2)
2
3
4
6 sigqueue, rt_sigqueueinfo - queue a signal and data to a process
7
9 #include <signal.h>
10
11 int sigqueue(pid_t pid, int sig, const union sigval value);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 sigqueue(): _POSIX_C_SOURCE >= 199309L
16
18 sigqueue() sends the signal specified in sig to the process whose PID
19 is given in pid. The permissions required to send a signal are the
20 same as for kill(2). As with kill(2), the null signal (0) can be used
21 to check if a process with a given PID exists.
22
23 The value argument is used to specify an accompanying item of data
24 (either an integer or a pointer value) to be sent with the signal, and
25 has the following type:
26
27 union sigval {
28 int sival_int;
29 void *sival_ptr;
30 };
31
32 If the receiving process has installed a handler for this signal using
33 the SA_SIGINFO flag to sigaction(2), then it can obtain this data via
34 the si_value field of the siginfo_t structure passed as the second
35 argument to the handler. Furthermore, the si_code field of that struc‐
36 ture will be set to SI_QUEUE.
37
39 On success, sigqueue() returns 0, indicating that the signal was suc‐
40 cessfully queued to the receiving process. Otherwise -1 is returned
41 and errno is set to indicate the error.
42
44 EAGAIN The limit of signals which may be queued has been reached. (See
45 signal(7) for further information.)
46
47 EINVAL sig was invalid.
48
49 EPERM The process does not have permission to send the signal to the
50 receiving process. For the required permissions, see kill(2).
51
52 ESRCH No process has a PID matching pid.
53
55 This system call first appeared in Linux 2.2.
56
58 POSIX.1-2001.
59
61 If this function results in the sending of a signal to the process that
62 invoked it, and that signal was not blocked by the calling thread, and
63 no other threads were willing to handle this signal (either by having
64 it unblocked, or by waiting for it using sigwait(3)), then at least
65 some signal must be delivered to this thread before this function
66 returns.
67
68 On Linux, the underlying system call is actually named rt_sigqueue‐
69 info(), and differs in its third argument, which is the siginfo_t
70 structure that will be supplied to the receiving process's signal han‐
71 dler or returned by the receiving process's sigtimedwait(2) call.
72 Inside the glibc sigqueue() wrapper, this argument, info, is initial‐
73 ized as follows:
74
75 info.si_signo = sig; /* argument supplied to sigqueue() */
76 info.si_code = SI_QUEUE;
77 info.si_pid = getpid(); /* Process ID of sender */
78 info.si_uid = getuid(); /* Real UID of sender */
79 info.si_value = val; /* argument supplied to sigqueue() */
80
82 kill(2), sigaction(2), signal(2), sigwait(3), signal(7)
83
85 This page is part of release 3.22 of the Linux man-pages project. A
86 description of the project, and information about reporting bugs, can
87 be found at http://www.kernel.org/doc/man-pages/.
88
89
90
91Linux 2007-07-26 SIGQUEUE(2)