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 2004-09-10 "Linux 2.6" "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 );
32 The kernel keeps for each process two values called
36 that are NULL by default.
39 If a process is started using
47 the fifth parameter of that system call.
51 is set, the very first thing the new process does
52 is writing its PID at this address.
55 If a process is started using
58 .B CLONE_CHILD_CLEARTID
63 the fifth parameter of that system call.
66 .BR set_tid_address ()
69 value for the calling process to
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,
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.)
81 .BR set_tid_address ()
82 returns the PID of the current process.
84 This call is present since Linux 2.5.48.
85 Details as given here are valid since Linux 2.5.49.
87 This system call is Linux specific.