1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .TH SET_TID_ADDRESS 2 2012-07-19 "Linux" "Linux Programmer's Manual"
25 set_tid_address \- set pointer to thread ID
28 .B #include <linux/unistd.h>
30 .BI "long set_tid_address(int *" tidptr );
33 For each process, the kernel maintains two attributes (addresses) called
37 These two attributes contain the value NULL by default.
40 If a process is started using
46 is set to the value passed in the
48 argument of that system call.
52 is set, the very first thing the new process does
53 is writing its PID at this address.
56 If a process is started using
59 .B CLONE_CHILD_CLEARTID
62 is set to the value passed in the
64 argument of that system call.
67 .BR set_tid_address ()
70 value for the calling process to
75 is not NULL terminates, then,
76 if the process is sharing memory with other processes or threads,
77 then 0 is written at the address specified in
79 and the kernel performs the following operation:
81 futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);
83 The effect of this operation is to wake a single process that
84 is performing a futex wait on the memory location.
85 Errors from the futex wake operation are ignored.
87 .BR set_tid_address ()
88 always returns the PID of the calling process.
90 .BR set_tid_address ()
93 This call is present since Linux 2.5.48.
94 Details as given here are valid since Linux 2.5.49.
96 This system call is Linux-specific.