man-pages/man2/tkill.2

101 lines
2.8 KiB
Groff

.\" 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 2007-06-01 "Linux" "Linux Programmer's Manual"
.SH NAME
tkill, tgkill \- send a signal to a single process
.SH SYNOPSIS
.nf
.BI "int tkill(int " tid ", int " sig );
.sp
.BI "int tgkill(int " tgid ", int " tid ", int " sig );
.fi
.SH DESCRIPTION
The
.BR tkill ()
system call is analogous to
.BR kill (2),
except when the specified process is part of a thread group
(created by specifying the
.B CLONE_THREAD
flag in the call to
.BR clone (2)).
Since all the processes in a thread group have the same PID,
they cannot be individually signaled with
.BR kill (2).
With
.BR tkill (),
however, one can address each process
by its unique TID.
.PP
The
.BR tgkill ()
call improves on
.BR tkill ()
by allowing the caller to
specify the thread group ID of the thread to be signaled, protecting
against TID reuse.
If the tgid is specified as \-1,
.BR tgkill ()
degenerates
into
.BR tkill ().
.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 VERSIONS
.BR tkill ()
is supported since Linux 2.4.19 / 2.5.4.
.BR tgkill ()
was added in Linux 2.5.75.
.SH "CONFORMING TO"
.BR tkill ()
and
.BR tgkill ()
are Linux specific and should not be used
in programs that are intended to be portable.
.SH NOTES
Glibc does not provide wrapper for these system calls; call them using
.BR syscall (2).
.SH "SEE ALSO"
.BR gettid (2),
.BR kill (2)