1sigqueue(3)                Library Functions Manual                sigqueue(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <signal.h>
13
14       int sigqueue(pid_t pid, int sig, const union sigval value);
15
16   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18       sigqueue():
19           _POSIX_C_SOURCE >= 199309L
20

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

VERSIONS

69   C library/kernel differences
70       On Linux, sigqueue() is implemented using the rt_sigqueueinfo(2) system
71       call.  The system call differs in its third argument, which is the sig‐
72       info_t  structure that will be supplied to the receiving process's sig‐
73       nal handler or returned  by  the  receiving  process's  sigtimedwait(2)
74       call.   Inside  the  glibc sigqueue() wrapper, this argument, uinfo, is
75       initialized as follows:
76
77           uinfo.si_signo = sig;      /* Argument supplied to sigqueue() */
78           uinfo.si_code = SI_QUEUE;
79           uinfo.si_pid = getpid();   /* Process ID of sender */
80           uinfo.si_uid = getuid();   /* Real UID of sender */
81           uinfo.si_value = val;      /* Argument supplied to sigqueue() */
82

STANDARDS

84       POSIX.1-2008.
85

HISTORY

87       Linux 2.2.  POSIX.1-2001.
88

NOTES

90       If this function results in the sending of a signal to the process that
91       invoked  it, and that signal was not blocked by the calling thread, and
92       no other threads were willing to handle this signal (either  by  having
93       it  unblocked,  or  by  waiting for it using sigwait(3)), then at least
94       some signal must be delivered to this thread before this  function  re‐
95       turns.
96

SEE ALSO

98       kill(2),       rt_sigqueueinfo(2),       sigaction(2),       signal(2),
99       pthread_sigqueue(3), sigwait(3), signal(7)
100
101
102
103Linux man-pages 6.04              2023-03-30                       sigqueue(3)
Impressum