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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

VERSIONS

55       This system call first appeared in Linux 2.2.
56

CONFORMING TO

58       POSIX.1-2001.
59

NOTES

61       If this function results in the sending of a signal to the process that
62       invoked  it, and that signal was not blocked by the calling thread, and
63       no other threads were willing to handle this signal (either  by  having
64       it  unblocked,  or  by  waiting for it using sigwait(3)), then at least
65       some signal must be delivered  to  this  thread  before  this  function
66       returns.
67
68       On  Linux,  this  function  is implemented using the rt_sigqueueinfo(2)
69       system call.  The system call differs in its third argument,  which  is
70       the  siginfo_t  structure  that  will  be  supplied  to  the  receiving
71       process's signal handler or returned by the  receiving  process's  sig‐
72       timedwait(2) call.  Inside the glibc sigqueue() wrapper, this argument,
73       uinfo, is initialized as follows:
74
75           uinfo.si_signo = sig;      /* argument supplied to sigqueue() */
76           uinfo.si_code = SI_QUEUE;
77           uinfo.si_pid = getpid();   /* Process ID of sender */
78           uinfo.si_uid = getuid();   /* Real UID of sender */
79           uinfo.si_value = val;      /* argument supplied to sigqueue() */
80

SEE ALSO

82       kill(2),       rt_sigqueueinfo(2),       sigaction(2),       signal(2),
83       pthread_sigqueue(3), sigwait(3), signal(7)
84

COLOPHON

86       This  page  is  part of release 3.53 of the Linux man-pages project.  A
87       description of the project, and information about reporting  bugs,  can
88       be found at http://www.kernel.org/doc/man-pages/.
89
90
91
92Linux                             2012-03-25                       SIGQUEUE(3)
Impressum