]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/set_tid_address.2
Updated CONFOMRING TOs and/or standards references.
[thirdparty/man-pages.git] / man2 / set_tid_address.2
1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH SET_TID_ADDRESS 2 2004-09-10 "Linux 2.6" "Linux Programmer's Manual"
24 .SH NAME
25 set_tid_address \- set pointer to thread ID
26 .SH SYNOPSIS
27 .nf
28 .B #include <linux/unistd.h>
29 .sp
30 .BI "long set_tid_address(int *" tidptr );
31 .SH DESCRIPTION
32 The kernel keeps for each process two values called
33 .I set_child_tid
34 and
35 .I clear_child_tid
36 that are NULL by default.
37
38 .SS set_child_tid
39 If a process is started using
40 .BR clone (2)
41 with the
42 .B CLONE_CHILD_SETTID
43 flag,
44 .I set_child_tid
45 is set to
46 .IR child_tidptr ,
47 the fifth parameter of that system call.
48 .LP
49 When
50 .I set_child_tid
51 is set, the very first thing the new process does
52 is writing its PID at this address.
53
54 .SS clear_child_tid
55 If a process is started using
56 .BR clone (2)
57 with the
58 .B CLONE_CHILD_CLEARTID
59 flag,
60 .I clear_child_tid
61 is set to
62 .IR child_tidptr ,
63 the fifth parameter of that system call.
64 .LP
65 The system call
66 .BR set_tid_address ()
67 sets the
68 .I clear_child_tid
69 value for the calling process to
70 .IR tidptr .
71 .LP
72 When
73 .I clear_child_tid
74 is set, and the process exits, and the process was sharing memory
75 with other processes or threads, then 0 is written at this address,
76 and a
77 .I futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
78 call is done. (That is, wake a single process waiting on this futex.)
79 Errors are ignored.
80 .SH "RETURN VALUE"
81 .BR set_tid_address ()
82 returns the PID of the current process.
83 .SH HISTORY
84 This call is present since Linux 2.5.48.
85 Details as given here are valid since Linux 2.5.49.
86 .SH "CONFORMING TO"
87 This system call is Linux specific.
88 .SH "SEE ALSO"
89 .BR clone (2),
90 .BR futex (2)