man-pages/man2/rt_sigqueueinfo.2.html
2021-03-31 01:06:50 +01:00

325 lines
7.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of RT_SIGQUEUEINFO</TITLE>
</HEAD><BODY>
<H1>RT_SIGQUEUEINFO</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-10-10<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
rt_sigqueueinfo, rt_tgsigqueueinfo - queue a signal and data
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>int rt_sigqueueinfo(pid_t </B><I>tgid</I><B>, int </B><I>sig</I><B>, siginfo_t *</B><I>info</I><B>);</B>
<B>int rt_tgsigqueueinfo(pid_t </B><I>tgid</I><B>, pid_t </B><I>tid</I><B>, int </B><I>sig</I><B>,</B>
<B> siginfo_t *</B><I>info</I><B>);</B>
</PRE>
<P>
<I>Note</I>:
There are no glibc wrappers for these system calls; see NOTES.
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>rt_sigqueueinfo</B>()
and
<B>rt_tgsigqueueinfo</B>()
system calls are the low-level interfaces used to send a signal plus data
to a process or thread.
The receiver of the signal can obtain the accompanying data
by establishing a signal handler with the
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2)
<B>SA_SIGINFO</B>
flag.
<P>
These system calls are not intended for direct application use;
they are provided to allow the implementation of
<B><A HREF="/cgi-bin/man/man2html?3+sigqueue">sigqueue</A></B>(3)
and
<B><A HREF="/cgi-bin/man/man2html?3+pthread_sigqueue">pthread_sigqueue</A></B>(3).
<P>
The
<B>rt_sigqueueinfo</B>()
system call sends the signal
<I>sig</I>
to the thread group with the ID
<I>tgid</I>.
(The term &quot;thread group&quot; is synonymous with &quot;process&quot;, and
<I>tid</I>
corresponds to the traditional UNIX process ID.)
The signal will be delivered to an arbitrary member of the thread group
(i.e., one of the threads that is not currently blocking the signal).
<P>
The
<I>info</I>
argument specifies the data to accompany the signal.
This argument is a pointer to a structure of type
<I>siginfo_t</I>,
described in
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2)
(and defined by including
<I>&lt;<A HREF="file:///usr/include/sigaction.h">sigaction.h</A>&gt;</I>).
The caller should set the following fields in this structure:
<DL COMPACT>
<DT id="1"><I>si_code</I>
<DD>
This should be one of the
<B>SI_*</B>
codes in the Linux kernel source file
<I>include/asm-generic/siginfo.h</I>.
If the signal is being sent to any process other than the caller itself,
the following restrictions apply:
<DL COMPACT><DT id="2"><DD>
<DL COMPACT>
<DT id="3">*<DD>
The code can't be a value greater than or equal to zero.
In particular, it can't be
<B>SI_USER</B>,
which is used by the kernel to indicate a signal sent by
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2),
and nor can it be
<B>SI_KERNEL</B>,
which is used to indicate a signal generated by the kernel.
<DT id="4">*<DD>
The code can't (since Linux 2.6.39) be
<B>SI_TKILL</B>,
which is used by the kernel to indicate a signal sent using
<B><A HREF="/cgi-bin/man/man2html?2+tgkill">tgkill</A></B>(2).
</DL>
</DL>
<DT id="5"><I>si_pid</I>
<DD>
This should be set to a process ID,
typically the process ID of the sender.
<DT id="6"><I>si_uid</I>
<DD>
This should be set to a user ID,
typically the real user ID of the sender.
<DT id="7"><I>si_value</I>
<DD>
This field contains the user data to accompany the signal.
For more information, see the description of the last
(<I>union sigval</I>)
argument of
<B><A HREF="/cgi-bin/man/man2html?3+sigqueue">sigqueue</A></B>(3).
</DL>
<P>
Internally, the kernel sets the
<I>si_signo</I>
field to the value specified in
<I>sig</I>,
so that the receiver of the signal can also obtain
the signal number via that field.
<P>
The
<B>rt_tgsigqueueinfo</B>()
system call is like
<B>rt_sigqueueinfo</B>(),
but sends the signal and data to the single thread
specified by the combination of
<I>tgid</I>,
a thread group ID,
and
<I>tid</I>,
a thread in that thread group.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, these system calls return 0.
On error, they return -1 and
<I>errno</I>
is set to indicate the error.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="8"><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="9"><B>EINVAL</B>
<DD>
<I>sig</I>,
<I>tgid</I>,
or
<I>tid</I>
was invalid.
<DT id="10"><B>EPERM</B>
<DD>
The caller does not have permission to send the signal to the target.
For the required permissions, see
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2).
<DT id="11"><B>EPERM</B>
<DD>
<I>tgid</I>
specifies a process other than the caller and
<I>info-&gt;si_code</I>
is invalid.
<DT id="12"><B>ESRCH</B>
<DD>
<B>rt_sigqueueinfo</B>():
No thread group matching
<I>tgid</I>
was found.
</DL>
<P>
<B>rt_tgsigqueinfo</B>():
No thread matching
<I>tgid</I>
and
<I>tid</I>
was found.
<A NAME="lbAG">&nbsp;</A>
<H2>VERSIONS</H2>
The
<B>rt_sigqueueinfo</B>()
system call was added to Linux in version 2.2.
The
<B>rt_tgsigqueueinfo</B>()
system call was added to Linux in version 2.6.31.
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
These system calls are Linux-specific.
<A NAME="lbAI">&nbsp;</A>
<H2>NOTES</H2>
Since these system calls are not intended for application use,
there are no glibc wrapper functions; use
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2)
in the unlikely case that you want to call them directly.
<P>
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 the specified process
or thread exists.
<A NAME="lbAJ">&nbsp;</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+pidfd_send_signal">pidfd_send_signal</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+tgkill">tgkill</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+sigqueue">sigqueue</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7)
<A NAME="lbAK">&nbsp;</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">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="13"><A HREF="#lbAB">NAME</A><DD>
<DT id="14"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="15"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="16"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="17"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="18"><A HREF="#lbAG">VERSIONS</A><DD>
<DT id="19"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="20"><A HREF="#lbAI">NOTES</A><DD>
<DT id="21"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="22"><A HREF="#lbAK">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:34 GMT, March 31, 2021
</BODY>
</HTML>