Define DEFAULT_STACK_PERMS.
[glibc.git] / sysdeps / unix / sysv / linux / hppa / linuxthreads / malloc-machine.h
blob5dc6e6fa716dc94c5908826bd8ef6feb5f3c57af
1 /* HP-PARISC macro definitions for mutexes, thread-specific data
2 and parameters for malloc.
3 Copyright (C) 2003 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Carlos O'Donell <carlos@baldric.uwo.ca>, 2003.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA. */
22 #ifndef _MALLOC_MACHINE_H
23 #define _MALLOC_MACHINE_H
25 #undef thread_atfork_static
27 #include <atomic.h>
28 #include <bits/libc-lock.h>
30 __libc_lock_define (typedef, mutex_t)
32 /* Since our lock structure does not tolerate being initialized to zero, we must
33 modify the standard function calls made by malloc */
34 # define mutex_init(m) \
35 __libc_maybe_call (__pthread_mutex_init, (m, NULL), \
36 (((m)->__m_lock.__spinlock = __LT_SPINLOCK_INIT),(*(int *)(m))) )
37 # define mutex_lock(m) \
38 __libc_maybe_call (__pthread_mutex_lock, (m), \
39 (__load_and_clear(&((m)->__m_lock.__spinlock)), 0))
40 # define mutex_trylock(m) \
41 __libc_maybe_call (__pthread_mutex_trylock, (m), \
42 (*(int *)(m) ? 1 : (__load_and_clear(&((m)->__m_lock.__spinlock)), 0)))
43 # define mutex_unlock(m) \
44 __libc_maybe_call (__pthread_mutex_unlock, (m), \
45 (((m)->__m_lock.__spinlock = __LT_SPINLOCK_INIT), (*(int *)(m))) )
47 /* This is defined by newer gcc version unique for each module. */
48 extern void *__dso_handle __attribute__ ((__weak__));
50 #include <fork.h>
52 #ifdef SHARED
53 # define thread_atfork(prepare, parent, child) \
54 __register_atfork (prepare, parent, child, __dso_handle)
55 #else
56 # define thread_atfork(prepare, parent, child) \
57 __register_atfork (prepare, parent, child, \
58 &__dso_handle == NULL ? NULL : __dso_handle)
59 #endif
61 /* thread specific data for glibc */
63 #include <bits/libc-tsd.h>
65 typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */
66 __libc_tsd_define (static, void *, MALLOC) /* declaration/common definition */
67 #define tsd_key_create(key, destr) ((void) (key))
68 #define tsd_setspecific(key, data) __libc_tsd_set (void *, MALLOC, (data))
69 #define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (void *, MALLOC))
71 #include <sysdeps/generic/malloc-machine.h>
73 #endif /* !defined(_MALLOC_MACHINE_H) */