]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/tkill.2
tkill.2: SEE ALSO: Add rt_sigqueueinfo (2)
[thirdparty/man-pages.git] / man2 / tkill.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2008 Michael Kerrisk <tmk.manpages@gmail.com>
4 .\" and Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" 2004-05-31, added tgkill, ahu, aeb
27 .\" 2008-01-15 mtk -- rewote DESCRIPTION
28 .\"
29 .TH TKILL 2 2011-09-18 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 tkill, tgkill \- send a signal to a thread
32 .SH SYNOPSIS
33 .nf
34 .BI "int tkill(int " tid ", int " sig );
35 .sp
36 .BI "int tgkill(int " tgid ", int " tid ", int " sig );
37 .fi
38 .SH DESCRIPTION
39 .BR tgkill ()
40 sends the signal
41 .I sig
42 to the thread with the thread ID
43 .I tid
44 in the thread group
45 .IR tgid .
46 (By contrast,
47 .BR kill (2)
48 can only be used to send a signal to a process (i.e., thread group)
49 as a whole, and the signal will be delivered to an arbitrary
50 thread within that process.)
51
52 .BR tkill ()
53 is an obsolete predecessor to
54 .BR tgkill ().
55 It only allows the target thread ID to be specified,
56 which may result in the wrong thread being signaled if a thread
57 terminates and its thread ID is recycled.
58 Avoid using this system call.
59
60 If
61 .I tgid
62 is specified as \-1,
63 .BR tgkill ()
64 is equivalent to
65 .BR tkill ().
66
67 These are the raw system call interfaces, meant for internal
68 thread library use.
69 .SH "RETURN VALUE"
70 On success, zero is returned.
71 On error, \-1 is returned, and \fIerrno\fP
72 is set appropriately.
73 .SH ERRORS
74 .TP
75 .B EINVAL
76 An invalid thread ID, thread group ID, or signal was specified.
77 .TP
78 .B EPERM
79 Permission denied.
80 For the required permissions, see
81 .BR kill (2).
82 .TP
83 .B ESRCH
84 No process with the specified thread ID (and thread group ID) exists.
85 .SH VERSIONS
86 .BR tkill ()
87 is supported since Linux 2.4.19 / 2.5.4.
88 .BR tgkill ()
89 was added in Linux 2.5.75.
90 .SH "CONFORMING TO"
91 .BR tkill ()
92 and
93 .BR tgkill ()
94 are Linux-specific and should not be used
95 in programs that are intended to be portable.
96 .SH NOTES
97 See the description of
98 .B CLONE_THREAD
99 in
100 .BR clone (2)
101 for an explanation of thread groups.
102
103 Glibc does not provide wrappers for these system calls; call them using
104 .BR syscall (2).
105 .SH "SEE ALSO"
106 .BR clone (2),
107 .BR gettid (2),
108 .BR kill (2),
109 .BR rt_sigqueueinfo (2)