Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / mach / hurd / tls.h
blobdbe73f50355d1f67ac8d09f3b1674ce337e78fe3
1 /* Definitions for thread-local data handling. Hurd version.
2 Copyright (C) 2003-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #ifndef _TLS_H
20 #define _TLS_H
22 #ifndef __ASSEMBLER__
24 # include <stddef.h>
25 # include <stdbool.h>
26 # include <mach/mig_errors.h>
27 # include <mach.h>
30 /* Type for the dtv. */
31 typedef union dtv
33 size_t counter;
34 struct
36 void *val;
37 bool is_static;
38 } pointer;
39 } dtv_t;
42 /* Type of the TCB. */
43 typedef struct
45 void *tcb; /* Points to this structure. */
46 dtv_t *dtv; /* Vector of pointers to TLS data. */
47 thread_t self; /* This thread's control port. */
48 } tcbhead_t;
51 /* This is the size of the initial TCB. */
52 # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
54 /* Alignment requirements for the initial TCB. */
55 # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
57 /* This is the size of the TCB. */
58 # define TLS_TCB_SIZE TLS_INIT_TCB_SIZE /* XXX */
60 /* Alignment requirements for the TCB. */
61 # define TLS_TCB_ALIGN TLS_INIT_TCB_ALIGN /* XXX */
64 /* Install the dtv pointer. The pointer passed is to the element with
65 index -1 which contain the length. */
66 # define INSTALL_DTV(descr, dtvp) \
67 ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
69 /* Return dtv of given thread descriptor. */
70 # define GET_DTV(descr) \
71 (((tcbhead_t *) (descr))->dtv)
73 #endif /* !ASSEMBLER */
76 #endif /* tls.h */