]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sigqueue.3
sigqueue.3: tstamp
[thirdparty/man-pages.git] / man3 / sigqueue.3
CommitLineData
c11b1abf 1.\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
10d76543
MK
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
d9bfdb9c 23.\" added note on self-signaling, aeb, 2002-06-07
fea681da
MK
24.\" added note on CAP_KILL, mtk, 2004-06-16
25.\"
91efc2b9 26.TH SIGQUEUE 3 2012-03-25 "Linux" "Linux Programmer's Manual"
fea681da 27.SH NAME
46d7906b 28sigqueue \- queue a signal and data to a process
fea681da
MK
29.SH SYNOPSIS
30.B #include <signal.h>
31.sp
c10859eb 32.BI "int sigqueue(pid_t " pid ", int " sig ", const union sigval " value );
cc4615cc
MK
33.sp
34.in -4n
35Feature Test Macro Requirements for glibc (see
36.BR feature_test_macros (7)):
37.in
38.sp
39.BR sigqueue ():
40_POSIX_C_SOURCE\ >=\ 199309L
fea681da
MK
41.SH DESCRIPTION
42.BR sigqueue ()
43sends the signal specified in
44.I sig
45to the process whose PID is given in
46.IR pid .
47The permissions required to send a signal are the same as for
48.BR kill (2).
c13182ef 49As with
fea681da
MK
50.BR kill (2),
51the null signal (0) can be used to check if a process with a given
52PID exists.
53.PP
54The
55.I value
56argument is used to specify an accompanying item of data (either an integer
57or a pointer value) to be sent with the signal, and has the following type:
58.sp
088a639b 59.in +4n
fea681da
MK
60.nf
61union sigval {
62 int sival_int;
63 void *sival_ptr;
64};
65.fi
088a639b 66.in
fea681da
MK
67
68If the receiving process has installed a handler for this signal using the
69.B SA_SIGINFO
70flag to
71.BR sigaction (2),
72then it can obtain this data via the
73.I si_value
c13182ef 74field of the
fea681da
MK
75.I siginfo_t
76structure passed as the second argument to the handler.
77Furthermore, the
78.I si_code
79field of that structure will be set to
80.BR SI_QUEUE .
81.SH "RETURN VALUE"
c13182ef 82On success,
fea681da
MK
83.BR sigqueue ()
84returns 0, indicating that the signal was successfully
d301ee6c 85queued to the receiving process.
fea681da
MK
86Otherwise \-1 is returned and
87.I errno
88is set to indicate the error.
89.SH ERRORS
90.TP
91.B EAGAIN
92The limit of signals which may be queued has been reached.
93(See
94.BR signal (7)
95for further information.)
96.TP
97.B EINVAL
98.I sig
99was invalid.
100.TP
101.B EPERM
102The process does not have permission to send the signal
103to the receiving process.
104For the required permissions, see
105.BR kill (2).
106.TP
107.B ESRCH
108No process has a PID matching
109.IR pid .
cdd160d9
MK
110.SH VERSIONS
111This system call first appeared in Linux 2.2.
2dd578fd 112.SH "CONFORMING TO"
44a2c328 113POSIX.1-2001.
fea681da
MK
114.SH NOTES
115If this function results in the sending of a signal to the process
116that invoked it, and that signal was not blocked by the calling thread,
117and no other threads were willing to handle this signal (either by
118having it unblocked, or by waiting for it using
119.BR sigwait (3)),
120then at least some signal must be delivered to this thread before this
121function returns.
cdd160d9 122
5b36ada0
MK
123On Linux, this function is implemented using the
124.BR rt_sigqueueinfo (2)
125system call.
126The system call differs in its third argument, which is the
cdd160d9
MK
127.I siginfo_t
128structure that will be supplied to the receiving process's
129signal handler or returned by the receiving process's
130.BR sigtimedwait (2)
131call.
e0bf9127 132Inside the glibc
cdd160d9
MK
133.BR sigqueue ()
134wrapper, this argument,
5b36ada0 135.IR uinfo ,
cdd160d9 136is initialized as follows:
088a639b 137.in +4n
cdd160d9
MK
138.nf
139
5b36ada0
MK
140uinfo.si_signo = sig; /* argument supplied to sigqueue() */
141uinfo.si_code = SI_QUEUE;
142uinfo.si_pid = getpid(); /* Process ID of sender */
143uinfo.si_uid = getuid(); /* Real UID of sender */
144uinfo.si_value = val; /* argument supplied to sigqueue() */
cdd160d9
MK
145.fi
146.in
fea681da
MK
147.SH "SEE ALSO"
148.BR kill (2),
d4b94904 149.BR rt_sigqueueinfo (2),
fea681da
MK
150.BR sigaction (2),
151.BR signal (2),
36757dc1 152.BR pthread_sigqueue (3),
fea681da
MK
153.BR sigwait (3),
154.BR signal (7)