1SIGQUEUE(3P)               POSIX Programmer's Manual              SIGQUEUE(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sigqueue — queue a signal to a process
13

SYNOPSIS

15       #include <signal.h>
16
17       int sigqueue(pid_t pid, int signo, union sigval value);
18

DESCRIPTION

20       The sigqueue() function shall cause the signal specified by signo to be
21       sent with the value specified by value to the process specified by pid.
22       If signo is zero (the null signal), error checking is performed but  no
23       signal  is  actually  sent.  The  null  signal can be used to check the
24       validity of pid.
25
26       The conditions required for a process to have  permission  to  queue  a
27       signal to another process are the same as for the kill() function.
28
29       The  sigqueue() function shall return immediately. If SA_SIGINFO is set
30       for signo and if the resources were available to queue the signal,  the
31       signal shall be queued and sent to the receiving process. If SA_SIGINFO
32       is not set for signo, then signo shall be sent at  least  once  to  the
33       receiving process; it is unspecified whether value shall be sent to the
34       receiving process as a result of this call.
35
36       If the value of pid causes  signo  to  be  generated  for  the  sending
37       process,  and  if signo is not blocked for the calling thread and if no
38       other thread has signo unblocked or is waiting in a sigwait()  function
39       for signo, either signo or at least the pending, unblocked signal shall
40       be delivered to the  calling  thread  before  the  sigqueue()  function
41       returns.  Should  any multiple pending signals in the range SIGRTMIN to
42       SIGRTMAX be selected for delivery, it shall be the lowest numbered one.
43       The  selection  order  between  realtime  and  non-realtime signals, or
44       between multiple pending non-realtime signals, is unspecified.
45

RETURN VALUE

47       Upon successful  completion,  the  specified  signal  shall  have  been
48       queued,  and the sigqueue() function shall return a value of zero. Oth‐
49       erwise, the function shall return a value of -1 and set errno to  indi‐
50       cate the error.
51

ERRORS

53       The sigqueue() function shall fail if:
54
55       EAGAIN No  resources are available to queue the signal. The process has
56              already queued {SIGQUEUE_MAX} signals that are still pending  at
57              the  receiver(s),  or  a  system-wide  resource  limit  has been
58              exceeded.
59
60       EINVAL The value of the signo argument is  an  invalid  or  unsupported
61              signal number.
62
63       EPERM  The  process  does  not  have appropriate privileges to send the
64              signal to the receiving process.
65
66       ESRCH  The process pid does not exist.
67
68       The following sections are informative.
69

EXAMPLES

71       None.
72

APPLICATION USAGE

74       None.
75

RATIONALE

77       The sigqueue() function allows an application to queue a realtime  sig‐
78       nal to itself or to another process, specifying the application-defined
79       value. This is common practice in  realtime  applications  on  existing
80       realtime  systems.  It was felt that specifying another function in the
81       sig...  name space already carved out for  signals  was  preferable  to
82       extending the interface to kill().
83
84       Such a function became necessary when the put/get event function of the
85       message queues was removed. It should  be  noted  that  the  sigqueue()
86       function  implies reduced performance in a security-conscious implemen‐
87       tation as the access permissions between the sender and  receiver  have
88       to  be  checked  on  each  send  when the pid is resolved into a target
89       process. Such access checks were necessary only at message  queue  open
90       in the previous interface.
91
92       The  standard  developers required that sigqueue() have the same seman‐
93       tics with respect to the null signal as kill(), and that the same  per‐
94       mission checking be used. But because of the difficulty of implementing
95       the ``broadcast'' semantic of kill() (for example, to  process  groups)
96       and  the  interaction  with  resource allocation, this semantic was not
97       adopted. The sigqueue() function queues a signal to  a  single  process
98       specified by the pid argument.
99
100       The  sigqueue()  function  can  fail  if  the  system  has insufficient
101       resources to queue the signal. An  explicit  limit  on  the  number  of
102       queued  signals  that  a  process  could send was introduced. While the
103       limit is ``per-sender'', this volume of POSIX.1‐2017 does  not  specify
104       that  the  resources  be  part  of  the state of the sender. This would
105       require either that the sender be maintained after exit until all  sig‐
106       nals  that it had sent to other processes were handled or that all such
107       signals that had not yet been acted upon be removed from  the  queue(s)
108       of  the  receivers.  This volume of POSIX.1‐2017 does not preclude this
109       behavior, but an implementation that allocated queuing resources from a
110       system-wide  pool  (with per-sender limits) and that leaves queued sig‐
111       nals pending after the sender exits is also permitted.
112

FUTURE DIRECTIONS

114       None.
115

SEE ALSO

117       Section 2.8.1, Realtime Signals
118
119       The Base Definitions volume of POSIX.1‐2017, <signal.h>
120
122       Portions of this text are reprinted and reproduced in  electronic  form
123       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
124       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
125       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
126       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
127       event of any discrepancy between this version and the original IEEE and
128       The Open Group Standard, the original IEEE and The Open Group  Standard
129       is  the  referee document. The original Standard can be obtained online
130       at http://www.opengroup.org/unix/online.html .
131
132       Any typographical or formatting errors that appear  in  this  page  are
133       most likely to have been introduced during the conversion of the source
134       files to man page format. To report such errors,  see  https://www.ker
135       nel.org/doc/man-pages/reporting_bugs.html .
136
137
138
139IEEE/The Open Group                  2017                         SIGQUEUE(3P)
Impressum