]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/tkill.2
grfix
[thirdparty/man-pages.git] / man2 / tkill.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" 2004-05-31, added tgkill, ahu, aeb
25 .\"
26 .TH TKILL 2 2007-06-01 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 tkill, tgkill \- send a signal to a single process
29 .SH SYNOPSIS
30 .nf
31 .BI "int tkill(int " tid ", int " sig );
32 .sp
33 .BI "int tgkill(int " tgid ", int " tid ", int " sig );
34 .fi
35 .SH DESCRIPTION
36 The
37 .BR tkill ()
38 system call is analogous to
39 .BR kill (2),
40 except when the specified process is part of a thread group
41 (created by specifying the
42 .B CLONE_THREAD
43 flag in the call to
44 .BR clone (2)).
45 Since all the processes in a thread group have the same PID,
46 they cannot be individually signaled with
47 .BR kill (2).
48 With
49 .BR tkill (),
50 however, one can address each process
51 by its unique TID.
52 .PP
53 The
54 .BR tgkill ()
55 call improves on
56 .BR tkill ()
57 by allowing the caller to
58 specify the thread group ID of the thread to be signaled, protecting
59 against TID reuse.
60 If the tgid is specified as \-1,
61 .BR tgkill ()
62 degenerates
63 into
64 .BR tkill ().
65 .PP
66 These are the raw system call interfaces, meant for internal
67 thread library use.
68 .SH "RETURN VALUE"
69 On success, zero is returned.
70 On error, \-1 is returned, and \fIerrno\fP
71 is set appropriately.
72 .SH ERRORS
73 .TP
74 .B EINVAL
75 An invalid TID or signal was specified.
76 .TP
77 .B EPERM
78 Permission denied.
79 For the required permissions, see
80 .BR kill (2).
81 .TP
82 .B ESRCH
83 No process with the specified thread ID (and thread group ID) exists.
84 .SH VERSIONS
85 .BR tkill ()
86 is supported since Linux 2.4.19 / 2.5.4.
87 .BR tgkill ()
88 was added in Linux 2.5.75.
89 .SH "CONFORMING TO"
90 .BR tkill ()
91 and
92 .BR tgkill ()
93 are Linux-specific and should not be used
94 in programs that are intended to be portable.
95 .SH NOTES
96 Glibc does not provide wrapper for these system calls; call them using
97 .BR syscall (2).
98 .SH "SEE ALSO"
99 .BR gettid (2),
100 .BR kill (2)