2004-11-03 13:51:07 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
|
|
|
.\" Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
|
|
|
|
.\" 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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
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
|
|
|
|
.\"
|
2007-05-30 05:36:26 +00:00
|
|
|
.TH TKILL 2 2007-06-01 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
tkill, tgkill \- send a signal to a single process
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
2007-05-26 15:22:28 +00:00
|
|
|
.BI "int tkill(int " tid ", int " sig );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2007-05-26 15:22:28 +00:00
|
|
|
.BI "int tgkill(int " tgid ", int " tid ", int " sig );
|
2004-11-03 13:51:07 +00:00
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR tkill ()
|
|
|
|
system call is analogous to
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR kill (2),
|
|
|
|
except when the specified process is part of a thread group
|
|
|
|
(created by specifying the CLONE_THREAD flag in the call to clone).
|
|
|
|
Since all the processes in a thread group have the same PID,
|
2007-05-12 09:06:04 +00:00
|
|
|
they cannot be individually signalled with
|
|
|
|
.BR kill (2).
|
|
|
|
With
|
|
|
|
.BR tkill (),
|
|
|
|
however, one can address each process
|
2004-11-03 13:51:07 +00:00
|
|
|
by its unique TID.
|
|
|
|
.PP
|
2007-05-12 09:06:04 +00:00
|
|
|
The
|
|
|
|
.BR tgkill ()
|
|
|
|
call improves on
|
|
|
|
.BR tkill ()
|
|
|
|
by allowing the caller to
|
2004-11-03 13:51:07 +00:00
|
|
|
specify the thread group ID of the thread to be signalled, protecting
|
2007-04-12 22:42:49 +00:00
|
|
|
against TID reuse.
|
2007-05-12 09:06:04 +00:00
|
|
|
If the tgid is specified as \-1,
|
|
|
|
.BR tgkill ()
|
|
|
|
degenerates
|
|
|
|
into
|
|
|
|
.BR tkill ().
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
|
|
|
These are the raw system call interfaces, meant for internal
|
|
|
|
thread library use.
|
|
|
|
.SH "RETURN VALUE"
|
2007-04-12 22:42:49 +00:00
|
|
|
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 TID or signal was specified.
|
|
|
|
.TP
|
|
|
|
.B EPERM
|
2007-04-12 22:42:49 +00:00
|
|
|
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"
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR tkill ()
|
|
|
|
and
|
|
|
|
.BR tgkill ()
|
|
|
|
are Linux specific and should not be used
|
2004-11-03 13:51:07 +00:00
|
|
|
in programs that are intended to be portable.
|
2007-05-26 15:22:28 +00:00
|
|
|
.SH NOTES
|
|
|
|
Glibc does not provide wrapper for these system calls; call them using
|
|
|
|
.BR syscall (2).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR gettid (2),
|
|
|
|
.BR kill (2)
|