]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl) |
2 | .\" | |
4b72fb64 | 3 | .\" %%%LICENSE_START(verbatim) |
fea681da MK |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da | 24 | .\" |
f5fe5952 | 25 | .TH SET_TID_ADDRESS 2 2012-07-19 "Linux" "Linux Programmer's Manual" |
fea681da MK |
26 | .SH NAME |
27 | set_tid_address \- set pointer to thread ID | |
28 | .SH SYNOPSIS | |
29 | .nf | |
30 | .B #include <linux/unistd.h> | |
31 | .sp | |
32 | .BI "long set_tid_address(int *" tidptr ); | |
c8250206 | 33 | .fi |
fea681da | 34 | .SH DESCRIPTION |
72442c68 | 35 | For each process, the kernel maintains two attributes (addresses) called |
fea681da MK |
36 | .I set_child_tid |
37 | and | |
72442c68 MK |
38 | .IR clear_child_tid . |
39 | These two attributes contain the value NULL by default. | |
568c4c02 MK |
40 | .TP |
41 | .I set_child_tid | |
fea681da MK |
42 | If a process is started using |
43 | .BR clone (2) | |
44 | with the | |
45 | .B CLONE_CHILD_SETTID | |
46 | flag, | |
47 | .I set_child_tid | |
f5fe5952 MK |
48 | is set to the value passed in the |
49 | .I ctid | |
50 | argument of that system call. | |
568c4c02 | 51 | .IP |
fea681da MK |
52 | When |
53 | .I set_child_tid | |
54 | is set, the very first thing the new process does | |
55 | is writing its PID at this address. | |
568c4c02 MK |
56 | .TP |
57 | .I clear_child_tid | |
fea681da MK |
58 | If a process is started using |
59 | .BR clone (2) | |
60 | with the | |
61 | .B CLONE_CHILD_CLEARTID | |
c13182ef | 62 | flag, |
fea681da | 63 | .I clear_child_tid |
f5fe5952 MK |
64 | is set to the value passed in the |
65 | .I ctid | |
66 | argument of that system call. | |
fea681da MK |
67 | .LP |
68 | The system call | |
e511ffb6 | 69 | .BR set_tid_address () |
fea681da MK |
70 | sets the |
71 | .I clear_child_tid | |
72 | value for the calling process to | |
73 | .IR tidptr . | |
74 | .LP | |
4e9ee225 MK |
75 | When a process whose |
76 | .I clear_child_tid | |
77 | is not NULL terminates, then, | |
78 | if the process is sharing memory with other processes or threads, | |
79 | then 0 is written at the address specified in | |
fea681da | 80 | .I clear_child_tid |
4e9ee225 MK |
81 | and the kernel performs the following operation: |
82 | ||
83 | futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0); | |
84 | ||
85 | The effect of this operation is to wake a single process that | |
86 | is performing a futex wait on the memory location. | |
87 | Errors from the futex wake operation are ignored. | |
47297adb | 88 | .SH RETURN VALUE |
e511ffb6 | 89 | .BR set_tid_address () |
08b7e584 | 90 | always returns the PID of the calling process. |
bd0a01ce MK |
91 | .SH ERRORS |
92 | .BR set_tid_address () | |
93 | always succeeds. | |
889829be | 94 | .SH VERSIONS |
fea681da MK |
95 | This call is present since Linux 2.5.48. |
96 | Details as given here are valid since Linux 2.5.49. | |
47297adb | 97 | .SH CONFORMING TO |
8382f16d | 98 | This system call is Linux-specific. |
47297adb | 99 | .SH SEE ALSO |
fea681da MK |
100 | .BR clone (2), |
101 | .BR futex (2) |