man-pages/man2/tkill.2

110 lines
3.1 KiB
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 2008 Michael Kerrisk <tmk.manpages@gmail.com>
.\" and Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
.\"
2004-11-03 13:51:07 +00:00
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
2004-11-03 13:51:07 +00:00
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
2004-11-03 13:51:07 +00:00
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" 2004-05-31, added tgkill, ahu, aeb
.\" 2008-01-15 mtk -- rewote DESCRIPTION
2004-11-03 13:51:07 +00:00
.\"
.TH TKILL 2 2011-09-18 "Linux" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
tkill, tgkill \- send a signal to a thread
2004-11-03 13:51:07 +00:00
.SH SYNOPSIS
.nf
.BI "int tkill(int " tid ", int " sig );
2004-11-03 13:51:07 +00:00
.sp
.BI "int tgkill(int " tgid ", int " tid ", int " sig );
2004-11-03 13:51:07 +00:00
.fi
.SH DESCRIPTION
.BR tgkill ()
sends the signal
.I sig
to the thread with the thread ID
.I tid
in the thread group
.IR tgid .
(By contrast,
.BR kill (2)
can only be used to send a signal to a process (i.e., thread group)
as a whole, and the signal will be delivered to an arbitrary
thread within that process.)
.BR tkill ()
is an obsolete predecessor to
.BR tgkill ().
It only allows 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.
If
.I tgid
is specified as \-1,
.BR tgkill ()
is equivalent to
.BR tkill ().
2004-11-03 13:51:07 +00:00
These are the raw system call interfaces, meant for internal
thread library use.
.SH "RETURN VALUE"
On success, zero is returned.
On error, \-1 is returned, and \fIerrno\fP
2004-11-03 13:51:07 +00:00
is set appropriately.
.SH ERRORS
.TP
.B EINVAL
An invalid thread ID, thread group ID, or signal was specified.
2004-11-03 13:51:07 +00:00
.TP
.B EPERM
Permission denied.
For the required permissions, see
2004-11-03 13:51:07 +00:00
.BR kill (2).
.TP
.B ESRCH
No process with the specified thread ID (and thread group ID) exists.
2007-05-18 16:30:46 +00:00
.SH VERSIONS
.BR tkill ()
is supported since Linux 2.4.19 / 2.5.4.
.BR tgkill ()
was added in Linux 2.5.75.
2004-11-03 13:51:07 +00:00
.SH "CONFORMING TO"
.BR tkill ()
and
.BR tgkill ()
2007-12-25 21:28:09 +00:00
are Linux-specific and should not be used
2004-11-03 13:51:07 +00:00
in programs that are intended to be portable.
.SH NOTES
See the description of
.B CLONE_THREAD
in
.BR clone (2)
for an explanation of thread groups.
2008-01-12 16:30:12 +00:00
Glibc does not provide wrappers for these system calls; call them using
.BR syscall (2).
2004-11-03 13:51:07 +00:00
.SH "SEE ALSO"
.BR clone (2),
.BR gettid (2),
.BR kill (2),
.BR rt_sigqueueinfo (2)