266 lines
6.2 KiB
HTML
266 lines
6.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SIGQUEUE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SIGQUEUE</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sigqueue - queue a signal and data to a process
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/signal.h">signal.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int sigqueue(pid_t </B><I>pid</I><B>, int </B><I>sig</I><B>, const union sigval </B><I>value</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
<B>sigqueue</B>():
|
|
|
|
_POSIX_C_SOURCE >= 199309L
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>sigqueue</B>()
|
|
|
|
sends the signal specified in
|
|
<I>sig</I>
|
|
|
|
to the process whose PID is given in
|
|
<I>pid</I>.
|
|
|
|
The permissions required to send a signal are the same as for
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2).
|
|
|
|
As with
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2),
|
|
|
|
the null signal (0) can be used to check if a process with a given
|
|
PID exists.
|
|
<P>
|
|
|
|
The
|
|
<I>value</I>
|
|
|
|
argument is used to specify an accompanying item of data (either an integer
|
|
or a pointer value) to be sent with the signal, and has the following type:
|
|
<P>
|
|
|
|
|
|
|
|
union sigval {
|
|
<BR> int sival_int;
|
|
<BR> void *sival_ptr;
|
|
};
|
|
|
|
|
|
<P>
|
|
|
|
If the receiving process has installed a handler for this signal using the
|
|
<B>SA_SIGINFO</B>
|
|
|
|
flag to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
then it can obtain this data via the
|
|
<I>si_value</I>
|
|
|
|
field of the
|
|
<I>siginfo_t</I>
|
|
|
|
structure passed as the second argument to the handler.
|
|
Furthermore, the
|
|
<I>si_code</I>
|
|
|
|
field of that structure will be set to
|
|
<B>SI_QUEUE</B>.
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>sigqueue</B>()
|
|
|
|
returns 0, indicating that the signal was successfully
|
|
queued to the receiving process.
|
|
Otherwise, -1 is returned and
|
|
<I>errno</I>
|
|
|
|
is set to indicate the error.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EAGAIN</B>
|
|
|
|
<DD>
|
|
The limit of signals which may be queued has been reached.
|
|
(See
|
|
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7)
|
|
|
|
for further information.)
|
|
<DT id="2"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
<I>sig</I>
|
|
|
|
was invalid.
|
|
<DT id="3"><B>EPERM</B>
|
|
|
|
<DD>
|
|
The process does not have permission to send the signal
|
|
to the receiving process.
|
|
For the required permissions, see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2).
|
|
|
|
<DT id="4"><B>ESRCH</B>
|
|
|
|
<DD>
|
|
No process has a PID matching
|
|
<I>pid</I>.
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
<B>sigqueue</B>()
|
|
|
|
and the underlying
|
|
<B>rt_sigqueueinfo</B>()
|
|
|
|
system call first appeared in Linux 2.2.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>sigqueue</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
If this function results in the sending of a signal to the process
|
|
that invoked it, and that signal was not blocked by the calling thread,
|
|
and no other threads were willing to handle this signal (either by
|
|
having it unblocked, or by waiting for it using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigwait">sigwait</A></B>(3)),
|
|
|
|
then at least some signal must be delivered to this thread before this
|
|
function returns.
|
|
<A NAME="lbAK"> </A>
|
|
<H3>C library/kernel differences</H3>
|
|
|
|
On Linux,
|
|
<B>sigqueue</B>()
|
|
|
|
is implemented using the
|
|
<B><A HREF="/cgi-bin/man/man2html?2+rt_sigqueueinfo">rt_sigqueueinfo</A></B>(2)
|
|
|
|
system call.
|
|
The system call differs in its third argument, which is the
|
|
<I>siginfo_t</I>
|
|
|
|
structure that will be supplied to the receiving process's
|
|
signal handler or returned by the receiving process's
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigtimedwait">sigtimedwait</A></B>(2)
|
|
|
|
call.
|
|
Inside the glibc
|
|
<B>sigqueue</B>()
|
|
|
|
wrapper, this argument,
|
|
<I>uinfo</I>,
|
|
|
|
is initialized as follows:
|
|
<P>
|
|
|
|
|
|
|
|
uinfo.si_signo = sig; /* Argument supplied to sigqueue() */
|
|
uinfo.si_code = SI_QUEUE;
|
|
uinfo.si_pid = getpid(); /* Process ID of sender */
|
|
uinfo.si_uid = getuid(); /* Real UID of sender */
|
|
uinfo.si_value = val; /* Argument supplied to sigqueue() */
|
|
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+rt_sigqueueinfo">rt_sigqueueinfo</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signal">signal</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_sigqueue">pthread_sigqueue</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigwait">sigwait</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7)
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">ATTRIBUTES</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">CONFORMING TO</A><DD>
|
|
<DT id="13"><A HREF="#lbAJ">NOTES</A><DD>
|
|
<DL>
|
|
<DT id="14"><A HREF="#lbAK">C library/kernel differences</A><DD>
|
|
</DL>
|
|
<DT id="15"><A HREF="#lbAL">SEE ALSO</A><DD>
|
|
<DT id="16"><A HREF="#lbAM">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:56 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|