]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/tkill.2
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[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 "2004-05-31" "Linux 2.6.6" "Linux Programmer's Manual"
27 .SH NAME
28 tkill, tgkill \- send a signal to a single process
29 .SH SYNOPSIS
30 .nf
31 .B #include <sys/types.h>
32 .br
33 .B #include <linux/unistd.h>
34 .br
35 .B #include <errno.h>
36 .sp
37 .B "_syscall2(int, tkill, int, tid, int, sig)"
38 /* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
39 .sp
40 .B int tkill(int tid, int sig);
41 .sp
42 .B "_syscall3(int, tgkill, int, tgid, int, tid, int, sig)"
43 /* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
44 .sp
45 .B int tgkill(int tgid, int tid, int sig);
46 .fi
47 .SH DESCRIPTION
48 The \fBtkill\fP() system call is analogous to
49 .BR kill (2),
50 except when the specified process is part of a thread group
51 (created by specifying the CLONE_THREAD flag in the call to clone).
52 Since all the processes in a thread group have the same PID,
53 they cannot be individually signalled with \fBkill\fP().
54 With \fBtkill\fP(), however, one can address each process
55 by its unique TID.
56 .PP
57 The \fBtgkill\fP() call improves on \fBtkill\fP() by allowing the caller to
58 specify the thread group ID of the thread to be signalled, protecting
59 against TID reuse.
60 If the tgid is specified as \-1, \fBtgkill\fP() degenerates
61 into \fBtkill\fP().
62 .PP
63 These are the raw system call interfaces, meant for internal
64 thread library use.
65 .SH "RETURN VALUE"
66 On success, zero is returned.
67 On error, \-1 is returned, and \fIerrno\fP
68 is set appropriately.
69 .SH ERRORS
70 .TP
71 .B EINVAL
72 An invalid TID or signal was specified.
73 .TP
74 .B EPERM
75 Permission denied.
76 For the required permissions, see
77 .BR kill (2).
78 .TP
79 .B ESRCH
80 No process with the specified thread ID (and thread group ID) exists.
81 .SH "CONFORMING TO"
82 \fBtkill\fP() and \fBtgkill\fP() are Linux specific and should not be used
83 in programs that are intended to be portable.
84 .SH VERSIONS
85 \fBtkill\fP() is supported since Linux 2.4.19 / 2.5.4.
86 \fBtgkill\fP() was added in Linux 2.5.75.
87 .SH "SEE ALSO"
88 .BR gettid (2),
89 .BR kill (2)