1SIGQUEUE(3)                Linux Programmer's Manual               SIGQUEUE(3)
2
3
4

NAME

6       sigqueue - queue a signal and data to a process
7

SYNOPSIS

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():
16           _POSIX_C_SOURCE >= 199309L
17

DESCRIPTION

19       sigqueue()  sends  the signal specified in sig to the process whose PID
20       is given in pid.  The permissions required to send  a  signal  are  the
21       same  as for kill(2).  As with kill(2), the null signal (0) can be used
22       to check if a process with a given PID exists.
23
24       The value argument is used to specify an accompanying item of data (ei‐
25       ther an integer or a pointer value) to be sent with the signal, and has
26       the following type:
27
28           union sigval {
29               int   sival_int;
30               void *sival_ptr;
31           };
32
33       If the receiving process has installed a handler for this signal  using
34       the  SA_SIGINFO  flag to sigaction(2), then it can obtain this data via
35       the si_value field of the siginfo_t structure passed as the second  ar‐
36       gument  to  the handler.  Furthermore, the si_code field of that struc‐
37       ture will be set to SI_QUEUE.
38

RETURN VALUE

40       On success, sigqueue() returns 0, indicating that the signal  was  suc‐
41       cessfully  queued  to the receiving process.  Otherwise, -1 is returned
42       and errno is set to indicate the error.
43

ERRORS

45       EAGAIN The limit of signals which may be queued has been reached.  (See
46              signal(7) for further information.)
47
48       EINVAL sig was invalid.
49
50       EPERM  The  process  does not have permission to send the signal to the
51              receiving process.  For the required permissions, see kill(2).
52
53       ESRCH  No process has a PID matching pid.
54

VERSIONS

56       sigqueue() and the underlying rt_sigqueueinfo() system call  first  ap‐
57       peared in Linux 2.2.
58

ATTRIBUTES

60       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
61       tributes(7).
62
63       ┌────────────────────────────────────────────┬───────────────┬─────────┐
64Interface                                   Attribute     Value   
65       ├────────────────────────────────────────────┼───────────────┼─────────┤
66sigqueue()                                  │ Thread safety │ MT-Safe │
67       └────────────────────────────────────────────┴───────────────┴─────────┘
68

CONFORMING TO

70       POSIX.1-2001, POSIX.1-2008.
71

NOTES

73       If this function results in the sending of a signal to the process that
74       invoked  it, and that signal was not blocked by the calling thread, and
75       no other threads were willing to handle this signal (either  by  having
76       it  unblocked,  or  by  waiting for it using sigwait(3)), then at least
77       some signal must be delivered to this thread before this  function  re‐
78       turns.
79
80   C library/kernel differences
81       On Linux, sigqueue() is implemented using the rt_sigqueueinfo(2) system
82       call.  The system call differs in its third argument, which is the sig‐
83       info_t  structure that will be supplied to the receiving process's sig‐
84       nal handler or returned  by  the  receiving  process's  sigtimedwait(2)
85       call.   Inside  the  glibc sigqueue() wrapper, this argument, uinfo, is
86       initialized as follows:
87
88           uinfo.si_signo = sig;      /* Argument supplied to sigqueue() */
89           uinfo.si_code = SI_QUEUE;
90           uinfo.si_pid = getpid();   /* Process ID of sender */
91           uinfo.si_uid = getuid();   /* Real UID of sender */
92           uinfo.si_value = val;      /* Argument supplied to sigqueue() */
93

SEE ALSO

95       kill(2),       rt_sigqueueinfo(2),       sigaction(2),       signal(2),
96       pthread_sigqueue(3), sigwait(3), signal(7)
97

COLOPHON

99       This  page  is  part of release 5.12 of the Linux man-pages project.  A
100       description of the project, information about reporting bugs,  and  the
101       latest     version     of     this    page,    can    be    found    at
102       https://www.kernel.org/doc/man-pages/.
103
104
105
106Linux                             2021-03-22                       SIGQUEUE(3)
Impressum