SIGQUEUE(3)                POSIX Programmer's Manual               SIGQUEUE(3)



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

NNAAMMEE
       sigqueue -- queue a signal to a process

SSYYNNOOPPSSIISS
       #include <signal.h>

       int sigqueue(pid_t _p_i_d, int _s_i_g_n_o, union sigval _v_a_l_u_e);

DDEESSCCRRIIPPTTIIOONN
       The _s_i_g_q_u_e_u_e() function shall cause the signal specified by _s_i_g_n_o to be
       sent with the value specified by _v_a_l_u_e to the process specified by _p_i_d.
       If _s_i_g_n_o is zero (the null signal), error checking is performed but no
       signal is actually sent. The null signal can be used to check the
       validity of _p_i_d.

       The conditions required for a process to have permission to queue a
       signal to another process are the same as for the _k_i_l_l() function.

       The _s_i_g_q_u_e_u_e() function shall return immediately. If SA_SIGINFO is set
       for _s_i_g_n_o and if the resources were available to queue the signal, the
       signal shall be queued and sent to the receiving process. If SA_SIGINFO
       is not set for _s_i_g_n_o, then _s_i_g_n_o shall be sent at least once to the
       receiving process; it is unspecified whether _v_a_l_u_e shall be sent to the
       receiving process as a result of this call.

       If the value of _p_i_d causes _s_i_g_n_o to be generated for the sending
       process, and if _s_i_g_n_o is not blocked for the calling thread and if no
       other thread has _s_i_g_n_o unblocked or is waiting in a _s_i_g_w_a_i_t() function
       for _s_i_g_n_o, either _s_i_g_n_o or at least the pending, unblocked signal shall
       be delivered to the calling thread before the _s_i_g_q_u_e_u_e() function
       returns. Should any multiple pending signals in the range SIGRTMIN to
       SIGRTMAX be selected for delivery, it shall be the lowest numbered one.
       The selection order between realtime and non-realtime signals, or
       between multiple pending non-realtime signals, is unspecified.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, the specified signal shall have been
       queued, and the _s_i_g_q_u_e_u_e() function shall return a value of zero.
       Otherwise, the function shall return a value of -1 and set _e_r_r_n_o to
       indicate the error.

EERRRROORRSS
       The _s_i_g_q_u_e_u_e() function shall fail if:

       EEAAGGAAIINN No resources are available to queue the signal. The process has
              already queued {SIGQUEUE_MAX} signals that are still pending at
              the receiver(s), or a system-wide resource limit has been
              exceeded.

       EEIINNVVAALL The value of the _s_i_g_n_o argument is an invalid or unsupported
              signal number.

       EEPPEERRMM  The process does not have appropriate privileges to send the
              signal to the receiving process.

       EESSRRCCHH  The process _p_i_d does not exist.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       The _s_i_g_q_u_e_u_e() function allows an application to queue a realtime
       signal to itself or to another process, specifying the application-
       defined value. This is common practice in realtime applications on
       existing realtime systems.  It was felt that specifying another
       function in the _s_i_g...  name space already carved out for signals was
       preferable to extending the interface to _k_i_l_l().

       Such a function became necessary when the put/get event function of the
       message queues was removed. It should be noted that the _s_i_g_q_u_e_u_e()
       function implies reduced performance in a security-conscious
       implementation as the access permissions between the sender and
       receiver have to be checked on each send when the _p_i_d is resolved into
       a target process. Such access checks were necessary only at message
       queue open in the previous interface.

       The standard developers required that _s_i_g_q_u_e_u_e() have the same
       semantics with respect to the null signal as _k_i_l_l(), and that the same
       permission checking be used. But because of the difficulty of
       implementing the ``broadcast'' semantic of _k_i_l_l() (for example, to
       process groups) and the interaction with resource allocation, this
       semantic was not adopted. The _s_i_g_q_u_e_u_e() function queues a signal to a
       single process specified by the _p_i_d argument.

       The _s_i_g_q_u_e_u_e() function can fail if the system has insufficient
       resources to queue the signal. An explicit limit on the number of
       queued signals that a process could send was introduced. While the
       limit is ``per-sender'', this volume of POSIX.1-2017 does not specify
       that the resources be part of the state of the sender. This would
       require either that the sender be maintained after exit until all
       signals that it had sent to other processes were handled or that all
       such signals that had not yet been acted upon be removed from the
       queue(s) of the receivers. This volume of POSIX.1-2017 does not
       preclude this behavior, but an implementation that allocated queuing
       resources from a system-wide pool (with per-sender limits) and that
       leaves queued signals pending after the sender exits is also permitted.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _S_e_c_t_i_o_n _2_._8_._1, _R_e_a_l_t_i_m_e _S_i_g_n_a_l_s

       The Base Definitions volume of POSIX.1-2017, <<ssiiggnnaall..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                          SIGQUEUE(3)
