(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / mach / hurd / tls.h
blobbc15b4dab674883f1871b8febf5f636ce7368a4e
1 /* Definitions for thread-local data handling. Hurd version.
2 Copyright (C) 2003 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _TLS_H
21 #define _TLS_H
23 #if defined HAVE_TLS_SUPPORT && !defined ASSEMBLER
25 # include <stddef.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 void *pointer;
35 } dtv_t;
38 /* Type of the TCB. */
39 typedef struct
41 void *tcb; /* Points to this structure. */
42 dtv_t *dtv; /* Vector of pointers to TLS data. */
43 thread_t self; /* This thread's control port. */
44 } tcbhead_t;
47 /* This is the size of the initial TCB. */
48 # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
50 /* Alignment requirements for the initial TCB. */
51 # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
53 /* This is the size of the TCB. */
54 # define TLS_TCB_SIZE TLS_INIT_TCB_SIZE /* XXX */
56 /* Alignment requirements for the TCB. */
57 # define TLS_TCB_ALIGN TLS_INIT_TCB_ALIGN /* XXX */
60 /* Install the dtv pointer. The pointer passed is to the element with
61 index -1 which contain the length. */
62 # define INSTALL_DTV(descr, dtvp) \
63 ((tcbhead_t *) (descr))->dtv = (dtvp) + 1
65 /* Return dtv of given thread descriptor. */
66 # define GET_DTV(descr) \
67 (((tcbhead_t *) (descr))->dtv)
69 #endif /* HAVE_TLS_SUPPORT */
72 #endif /* tls.h */