1SIGQUEUE(P) POSIX Programmer's Manual SIGQUEUE(P)
2
3
4
6 sigqueue - queue a signal to a process (REALTIME)
7
9 #include <signal.h>
10
11 int sigqueue(pid_t pid, int signo, const union sigval value);
12
13
15 The sigqueue() function shall cause the signal specified by signo to be
16 sent with the value specified by value to the process specified by pid.
17 If signo is zero (the null signal), error checking is performed but no
18 signal is actually sent. The null signal can be used to check the
19 validity of pid.
20
21 The conditions required for a process to have permission to queue a
22 signal to another process are the same as for the kill() function.
23
24 The sigqueue() function shall return immediately. If SA_SIGINFO is set
25 for signo and if the resources were available to queue the signal, the
26 signal shall be queued and sent to the receiving process. If SA_SIGINFO
27 is not set for signo, then signo shall be sent at least once to the
28 receiving process; it is unspecified whether value shall be sent to the
29 receiving process as a result of this call.
30
31 If the value of pid causes signo to be generated for the sending
32 process, and if signo is not blocked for the calling thread and if no
33 other thread has signo unblocked or is waiting in a sigwait() function
34 for signo, either signo or at least the pending, unblocked signal shall
35 be delivered to the calling thread before the sigqueue() function
36 returns. Should any multiple pending signals in the range SIGRTMIN to
37 SIGRTMAX be selected for delivery, it shall be the lowest numbered one.
38 The selection order between realtime and non-realtime signals, or
39 between multiple pending non-realtime signals, is unspecified.
40
42 Upon successful completion, the specified signal shall have been
43 queued, and the sigqueue() function shall return a value of zero. Oth‐
44 erwise, the function shall return a value of -1 and set errno to indi‐
45 cate the error.
46
48 The sigqueue() function shall fail if:
49
50 EAGAIN No resources are available to queue the signal. The process has
51 already queued {SIGQUEUE_MAX} signals that are still pending at
52 the receiver(s), or a system-wide resource limit has been
53 exceeded.
54
55 EINVAL The value of the signo argument is an invalid or unsupported
56 signal number.
57
58 EPERM The process does not have the appropriate privilege to send the
59 signal to the receiving process.
60
61 ESRCH The process pid does not exist.
62
63
64 The following sections are informative.
65
67 None.
68
70 None.
71
73 The sigqueue() function allows an application to queue a realtime sig‐
74 nal to itself or to another process, specifying the application-defined
75 value. This is common practice in realtime applications on existing
76 realtime systems. It was felt that specifying another function in the
77 sig... name space already carved out for signals was preferable to
78 extending the interface to kill().
79
80 Such a function became necessary when the put/get event function of the
81 message queues was removed. It should be noted that the sigqueue()
82 function implies reduced performance in a security-conscious implemen‐
83 tation as the access permissions between the sender and receiver have
84 to be checked on each send when the pid is resolved into a target
85 process. Such access checks were necessary only at message queue open
86 in the previous interface.
87
88 The standard developers required that sigqueue() have the same seman‐
89 tics with respect to the null signal as kill(), and that the same per‐
90 mission checking be used. But because of the difficulty of implementing
91 the "broadcast" semantic of kill() (for example, to process groups) and
92 the interaction with resource allocation, this semantic was not
93 adopted. The sigqueue() function queues a signal to a single process
94 specified by the pid argument.
95
96 The sigqueue() function can fail if the system has insufficient
97 resources to queue the signal. An explicit limit on the number of
98 queued signals that a process could send was introduced. While the
99 limit is "per-sender", this volume of IEEE Std 1003.1-2001 does not
100 specify that the resources be part of the state of the sender. This
101 would require either that the sender be maintained after exit until all
102 signals that it had sent to other processes were handled or that all
103 such signals that had not yet been acted upon be removed from the
104 queue(s) of the receivers. This volume of IEEE Std 1003.1-2001 does not
105 preclude this behavior, but an implementation that allocated queuing
106 resources from a system-wide pool (with per-sender limits) and that
107 leaves queued signals pending after the sender exits is also permitted.
108
110 None.
111
113 Realtime Signals , the Base Definitions volume of IEEE Std 1003.1-2001,
114 <signal.h>
115
117 Portions of this text are reprinted and reproduced in electronic form
118 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
119 -- Portable Operating System Interface (POSIX), The Open Group Base
120 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
121 Electrical and Electronics Engineers, Inc and The Open Group. In the
122 event of any discrepancy between this version and the original IEEE and
123 The Open Group Standard, the original IEEE and The Open Group Standard
124 is the referee document. The original Standard can be obtained online
125 at http://www.opengroup.org/unix/online.html .
126
127
128
129IEEE/The Open Group 2003 SIGQUEUE(P)