1SIGQUEUE(3) Linux Programmer's Manual SIGQUEUE(3)
2
3
4
6 sigqueue - 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 sigqueue() and the underlying rt_sigqueueinfo() system call first
56 appeared in Linux 2.2.
57
59 For an explanation of the terms used in this section, see
60 attributes(7).
61
62 ┌───────────┬───────────────┬─────────┐
63 │Interface │ Attribute │ Value │
64 ├───────────┼───────────────┼─────────┤
65 │sigqueue() │ Thread safety │ MT-Safe │
66 └───────────┴───────────────┴─────────┘
68 POSIX.1-2001, POSIX.1-2008.
69
71 If this function results in the sending of a signal to the process that
72 invoked it, and that signal was not blocked by the calling thread, and
73 no other threads were willing to handle this signal (either by having
74 it unblocked, or by waiting for it using sigwait(3)), then at least
75 some signal must be delivered to this thread before this function
76 returns.
77
78 C library/kernel differences
79 On Linux, sigqueue() is implemented using the rt_sigqueueinfo(2) system
80 call. The system call differs in its third argument, which is the sig‐
81 info_t structure that will be supplied to the receiving process's sig‐
82 nal handler or returned by the receiving process's sigtimedwait(2)
83 call. Inside the glibc sigqueue() wrapper, this argument, uinfo, is
84 initialized as follows:
85
86 uinfo.si_signo = sig; /* Argument supplied to sigqueue() */
87 uinfo.si_code = SI_QUEUE;
88 uinfo.si_pid = getpid(); /* Process ID of sender */
89 uinfo.si_uid = getuid(); /* Real UID of sender */
90 uinfo.si_value = val; /* Argument supplied to sigqueue() */
91
93 kill(2), rt_sigqueueinfo(2), sigaction(2), signal(2),
94 pthread_sigqueue(3), sigwait(3), signal(7)
95
97 This page is part of release 4.16 of the Linux man-pages project. A
98 description of the project, information about reporting bugs, and the
99 latest version of this page, can be found at
100 https://www.kernel.org/doc/man-pages/.
101
102
103
104Linux 2017-09-15 SIGQUEUE(3)