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.
|
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
|
|
|
.\" 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
|
|
|
|
.\"
|
|
|
|
.TH TKILL 2 "2004-05-31" "Linux 2.6.6" "Linux Programmer's Manual"
|
|
|
|
.SH NAME
|
|
|
|
tkill, tgkill \- send a signal to a single process
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <sys/types.h>
|
|
|
|
.br
|
|
|
|
.B #include <linux/unistd.h>
|
2004-12-10 09:03:08 +00:00
|
|
|
.br
|
|
|
|
.B #include <errno.h>
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
.B "_syscall2(int, tkill, int, tid, int, sig)"
|
2006-03-16 00:50:08 +00:00
|
|
|
/* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
.B int tkill(int tid, int sig);
|
|
|
|
.sp
|
2004-12-10 09:03:08 +00:00
|
|
|
.B "_syscall3(int, tgkill, int, tgid, int, tid, int, sig)"
|
2006-03-16 00:50:08 +00:00
|
|
|
/* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
.B int tgkill(int tgid, int tid, int sig);
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2005-10-19 06:54:38 +00:00
|
|
|
The \fBtkill\fP() 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,
|
2005-10-19 08:35:30 +00:00
|
|
|
they cannot be individually signalled with \fBkill\fP().
|
2005-10-19 06:54:38 +00:00
|
|
|
With \fBtkill\fP(), however, one can address each process
|
2004-11-03 13:51:07 +00:00
|
|
|
by its unique TID.
|
|
|
|
.PP
|
2005-10-19 06:54:38 +00:00
|
|
|
The \fBtgkill\fP() call improves on \fBtkill\fP() 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
|
2005-10-19 06:54:38 +00:00
|
|
|
against TID reuse. If the tgid is specified as \-1, \fBtgkill\fP() degenerates
|
|
|
|
into \fBtkill\fP().
|
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"
|
|
|
|
On success, zero is returned. On error, \-1 is returned, and \fIerrno\fP
|
|
|
|
is set appropriately.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
An invalid TID or signal was specified.
|
|
|
|
.TP
|
|
|
|
.B EPERM
|
|
|
|
Permission denied. For the required permissions, see
|
|
|
|
.BR kill (2).
|
|
|
|
.TP
|
|
|
|
.B ESRCH
|
|
|
|
No process with the specified thread ID (and thread group ID) exists.
|
|
|
|
.SH "CONFORMING TO"
|
2005-10-19 06:54:38 +00:00
|
|
|
\fBtkill\fP() and \fBtgkill\fP() are Linux specific and should not be used
|
2004-11-03 13:51:07 +00:00
|
|
|
in programs that are intended to be portable.
|
2006-08-03 13:57:17 +00:00
|
|
|
.SH VERSIONS
|
2005-10-19 06:54:38 +00:00
|
|
|
\fBtkill\fP() is supported since Linux 2.4.19 / 2.5.4.
|
|
|
|
\fBtgkill\fP() was added in Linux 2.5.75.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR gettid (2),
|
|
|
|
.BR kill (2)
|