Update copyright notices with scripts/update-copyrights.
[external/glibc.git] / sysdeps / generic / tls.h
1 /* Definition for thread-local data handling.  Generic version.
2    Copyright (C) 2002-2013 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18
19 /* An architecture-specific version of this file has to defined a
20    number of symbols:
21
22      TLS_TCB_AT_TP  or  TLS_DTV_AT_TP
23
24      The presence of one of these symbols signals which variant of
25      the TLS ABI is used.  There are in the moment two variants
26      available:
27
28      * the thread pointer points to a thread control block
29
30      * the thread pointer points to the dynamic thread vector
31
32
33      TLS_TCB_SIZE
34
35      This is the size of the thread control block structure.  How
36      this is actually defined depends on the ABI.  The thread control
37      block could be internal descriptor of the thread library or
38      just a data structure which allows finding the DTV.
39
40      TLS_INIT_TCB_SIZE
41
42      Similarly, but this value is only used at startup and in the
43      dynamic linker itself.  There are no threads in use at that time.
44
45
46      TLS_TCB_ALIGN
47
48      Alignment requirements for the TCB structure.
49
50      TLS_INIT_TCB_ALIGN
51
52      Similarly, but for the structure used at startup time.
53
54
55      INSTALL_DTV(tcb, init_dtv)
56
57      This macro must install the given initial DTV into the thread control
58      block TCB.  The normal runtime functionality must then be able to
59      use the value.
60
61
62      TLS_INIT_TP(tcb, firstcall)
63
64      This macro must initialize the thread pointer to enable normal TLS
65      operation.  The first parameter is a pointer to the thread control
66      block.  The second parameter specifies whether this is the first
67      call for the TCB.  ld.so calls this macro more than once.
68
69
70      THREAD_DTV()
71
72      This macro returns the address of the DTV of the current thread.
73      This normally is done using the thread register which points
74      to the dtv or the TCB (from which the DTV can found).
75   */