1SET_TID_ADDRESS(2)         Linux Programmer's Manual        SET_TID_ADDRESS(2)
2
3
4

NAME

6       set_tid_address - set pointer to thread ID
7

SYNOPSIS

9       #include <linux/unistd.h>
10
11       long set_tid_address(int *tidptr);
12

DESCRIPTION

14       The  kernel  keeps for each process two values called set_child_tid and
15       clear_child_tid that are NULL by default.
16
17   set_child_tid
18       If a process is started  using  clone(2)  with  the  CLONE_CHILD_SETTID
19       flag,  set_child_tid is set to child_tidptr, the fifth argument of that
20       system call.
21
22       When set_child_tid is set, the very first thing the new process does is
23       writing its PID at this address.
24
25   clear_child_tid
26       If  a  process  is started using clone(2) with the CLONE_CHILD_CLEARTID
27       flag, clear_child_tid is set to child_tidptr,  the  fifth  argument  of
28       that system call.
29
30       The  system  call  set_tid_address() sets the clear_child_tid value for
31       the calling process to tidptr.
32
33       When clear_child_tid is set, and the process exits, and the process was
34       sharing  memory  with  other processes or threads, then 0 is written at
35       this address, and a futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL,  0);
36       call  is done.  (That is, wake a single process waiting on this futex.)
37       Errors are ignored.
38

RETURN VALUE

40       set_tid_address() always returns the PID of the calling process.
41

ERRORS

43       set_tid_address() always succeeds.
44

VERSIONS

46       This call is present since Linux 2.5.48.  Details  as  given  here  are
47       valid since Linux 2.5.49.
48

CONFORMING TO

50       This system call is Linux-specific.
51

SEE ALSO

53       clone(2), futex(2)
54

COLOPHON

56       This  page  is  part of release 3.22 of the Linux man-pages project.  A
57       description of the project, and information about reporting  bugs,  can
58       be found at http://www.kernel.org/doc/man-pages/.
59
60
61
62Linux                             2004-09-10                SET_TID_ADDRESS(2)
Impressum