~mfisch/ubuntu/saucy/manpages/update_to_3.51

« back to all changes in this revision

Viewing changes to man2/tkill.2

  • Committer: Matthew Fischer
  • Date: 2013-07-20 02:05:17 UTC
  • mfrom: (1.5.5 upstream)
  • Revision ID: matthew.fischer@canonical.com-20130720020517-p6gt5qgstlpv2tfm
Interim commit as I fight through the merge issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.\" Hey Emacs! This file is -*- nroff -*- source.
2
 
.\"
3
1
.\" Copyright (C) 2008 Michael Kerrisk <tmk.manpages@gmail.com>
4
2
.\" and Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
5
3
.\"
 
4
.\" %%%LICENSE_START(VERBATIM)
6
5
.\" Permission is granted to make and distribute verbatim copies of this
7
6
.\" manual provided the copyright notice and this permission notice are
8
7
.\" preserved on all copies.
22
21
.\"
23
22
.\" Formatted or processed versions of this manual, if unaccompanied by
24
23
.\" the source, must acknowledge the copyright and authors of this work.
 
24
.\" %%%LICENSE_END
25
25
.\"
26
26
.\" 2004-05-31, added tgkill, ahu, aeb
27
 
.\" 2008-01-15 mtk -- rewote DESCRIPTION
 
27
.\" 2008-01-15 mtk -- rewrote DESCRIPTION
28
28
.\"
29
29
.TH TKILL 2 2012-07-13 "Linux" "Linux Programmer's Manual"
30
30
.SH NAME
48
48
.IR tgid .
49
49
(By contrast,
50
50
.BR kill (2)
51
 
can only be used to send a signal to a process (i.e., thread group)
 
51
can be used to send a signal only to a process (i.e., thread group)
52
52
as a whole, and the signal will be delivered to an arbitrary
53
53
thread within that process.)
54
54
 
55
55
.BR tkill ()
56
56
is an obsolete predecessor to
57
57
.BR tgkill ().
58
 
It only allows the target thread ID to be specified,
 
58
It allows only the target thread ID to be specified,
59
59
which may result in the wrong thread being signaled if a thread
60
60
terminates and its thread ID is recycled.
61
61
Avoid using this system call.
 
62
.\" FIXME: Maybe say something about the following:
 
63
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=12889
 
64
.\"     Rich Felker <bugdal@aerifal.cx>
 
65
.\"     There is a race condition in pthread_kill: it is possible that,
 
66
.\"     between the time pthread_kill reads the pid/tid from the target
 
67
.\"     thread descriptor and the time it makes the tgkill syscall,
 
68
.\"     the target thread terminates and the same tid gets assigned
 
69
.\"     to a new thread in the same process.
 
70
.\"
 
71
.\"     (The tgkill syscall was designed to eliminate a similar race
 
72
.\"     condition in tkill, but it only succeeded in eliminating races
 
73
.\"     where the tid gets reused in a different process, and does not
 
74
.\"     help if the same tid gets assigned to a new thread in the
 
75
.\"     same process.)
 
76
.\"
 
77
.\"     The only solution I can see is to introduce a mutex that ensures
 
78
.\"     that a thread cannot exit while pthread_kill is being called on it.
 
79
.\"
 
80
.\"     Note that in most real-world situations, like almost all race
 
81
.\"     conditions, this one will be extremely rare. To make it
 
82
.\"     measurable, one could exhaust all but 1-2 available pid values,
 
83
.\"     possibly by lowering the max pid parameter in /proc, forcing
 
84
.\"     the same tid to be reused rapidly.
62
85
 
63
86
If
64
87
.I tgid
69
92
 
70
93
These are the raw system call interfaces, meant for internal
71
94
thread library use.
72
 
.SH "RETURN VALUE"
 
95
.SH RETURN VALUE
73
96
On success, zero is returned.
74
97
On error, \-1 is returned, and \fIerrno\fP
75
98
is set appropriately.
90
113
is supported since Linux 2.4.19 / 2.5.4.
91
114
.BR tgkill ()
92
115
was added in Linux 2.5.75.
93
 
.SH "CONFORMING TO"
 
116
.SH CONFORMING TO
94
117
.BR tkill ()
95
118
and
96
119
.BR tgkill ()
105
128
 
106
129
Glibc does not provide wrappers for these system calls; call them using
107
130
.BR syscall (2).
108
 
.SH "SEE ALSO"
 
131
.SH SEE ALSO
109
132
.BR clone (2),
110
133
.BR gettid (2),
111
134
.BR kill (2),
112
135
.BR rt_sigqueueinfo (2)
113
136
.SH COLOPHON
114
 
This page is part of release 3.44 of the Linux
 
137
This page is part of release 3.51 of the Linux
115
138
.I man-pages
116
139
project.
117
140
A description of the project,