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

225 lines
4.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of TKILL</TITLE>
</HEAD><BODY>
<H1>TKILL</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-08-02<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>
tkill, tgkill - send a signal to a thread
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>int tkill(int </B><I>tid</I><B>, int </B><I>sig</I><B>);</B>
<B>int tgkill(int </B><I>tgid</I><B>, int </B><I>tid</I><B>, int </B><I>sig</I><B>);</B>
</PRE>
<P>
<I>Note</I>:
There is no glibc wrapper for
<B>tkill</B>();
see NOTES.
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>tgkill</B>()
sends the signal
<I>sig</I>
to the thread with the thread ID
<I>tid</I>
in the thread group
<I>tgid</I>.
(By contrast,
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2)
can be used to send a signal only to a process (i.e., thread group)
as a whole, and the signal will be delivered to an arbitrary
thread within that process.)
<P>
<B>tkill</B>()
is an obsolete predecessor to
<B>tgkill</B>().
It allows only the target thread ID to be specified,
which may result in the wrong thread being signaled if a thread
terminates and its thread ID is recycled.
Avoid using this system call.
<P>
These are the raw system call interfaces, meant for internal
thread library use.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, zero is returned.
On error, -1 is returned, and <I>errno</I>
is set appropriately.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>EAGAIN</B>
<DD>
The
<B>RLIMIT_SIGPENDING</B>
resource limit was reached and
<I>sig</I>
is a real-time signal.
<DT id="2"><B>EAGAIN</B>
<DD>
Insufficient kernel memory was available and
<I>sig</I>
is a real-time signal.
<DT id="3"><B>EINVAL</B>
<DD>
An invalid thread ID, thread group ID, or signal was specified.
<DT id="4"><B>EPERM</B>
<DD>
Permission denied.
For the required permissions, see
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2).
<DT id="5"><B>ESRCH</B>
<DD>
No process with the specified thread ID (and thread group ID) exists.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>VERSIONS</H2>
<B>tkill</B>()
is supported since Linux 2.4.19 / 2.5.4.
<B>tgkill</B>()
was added in Linux 2.5.75.
<P>
Library support for
<B>tgkill</B>()
was added to glibc in version 2.30.
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
<B>tkill</B>()
and
<B>tgkill</B>()
are Linux-specific and should not be used
in programs that are intended to be portable.
<A NAME="lbAI">&nbsp;</A>
<H2>NOTES</H2>
See the description of
<B>CLONE_THREAD</B>
in
<B><A HREF="/cgi-bin/man/man2html?2+clone">clone</A></B>(2)
for an explanation of thread groups.
<P>
Glibc does not provide a wrapper for
<B>tkill</B>();
call it using
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2).
Before glibc 2.30, there was also no wrapper function for
<B>tgkill</B>().
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+clone">clone</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+gettid">gettid</A></B>(2),
<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)
<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="6"><A HREF="#lbAB">NAME</A><DD>
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="9"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="10"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="11"><A HREF="#lbAG">VERSIONS</A><DD>
<DT id="12"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="13"><A HREF="#lbAI">NOTES</A><DD>
<DT id="14"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="15"><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:35 GMT, March 31, 2021
</BODY>
</HTML>