2003-09-30 02:10:33 +00:00
|
|
|
/* Basic platform-independent macro definitions for mutexes,
|
|
|
|
thread-specific data and parameters for malloc.
|
2015-01-02 16:28:19 +00:00
|
|
|
Copyright (C) 2003-2015 Free Software Foundation, Inc.
|
2003-09-30 02:10:33 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2003-09-30 02:10:33 +00:00
|
|
|
|
|
|
|
#ifndef _MALLOC_MACHINE_H
|
|
|
|
#define _MALLOC_MACHINE_H
|
|
|
|
|
|
|
|
#undef thread_atfork_static
|
|
|
|
|
|
|
|
#include <atomic.h>
|
|
|
|
#include <bits/libc-lock.h>
|
|
|
|
|
|
|
|
/* Assume hurd, with cthreads */
|
|
|
|
|
|
|
|
/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the
|
|
|
|
mutex itself. */
|
|
|
|
#undef mutex_t
|
|
|
|
#define mutex_t struct mutex
|
|
|
|
|
|
|
|
#undef mutex_init
|
2015-03-21 03:49:44 +00:00
|
|
|
#define mutex_init(m) ({ __mutex_init(m); 0; })
|
2003-09-30 02:10:33 +00:00
|
|
|
|
|
|
|
#undef mutex_lock
|
2015-03-21 03:49:44 +00:00
|
|
|
#define mutex_lock(m) ({ __mutex_lock(m); 0; })
|
2003-09-30 02:10:33 +00:00
|
|
|
|
|
|
|
#undef mutex_unlock
|
2015-03-21 03:49:44 +00:00
|
|
|
#define mutex_unlock(m) ({ __mutex_unlock(m); 0; })
|
2003-09-30 02:10:33 +00:00
|
|
|
|
|
|
|
#define mutex_trylock(m) (!__mutex_trylock(m))
|
|
|
|
|
|
|
|
#define thread_atfork(prepare, parent, child) do {} while(0)
|
|
|
|
#define thread_atfork_static(prepare, parent, child) \
|
|
|
|
text_set_element(_hurd_fork_prepare_hook, prepare); \
|
|
|
|
text_set_element(_hurd_fork_parent_hook, parent); \
|
|
|
|
text_set_element(_hurd_fork_child_hook, child);
|
|
|
|
|
|
|
|
/* No we're *not* using pthreads. */
|
|
|
|
#define __pthread_initialize ((void (*)(void))0)
|
|
|
|
|
2003-10-02 18:56:20 +00:00
|
|
|
/* thread specific data for glibc */
|
|
|
|
|
2015-09-03 20:33:46 +00:00
|
|
|
#include <libc-tsd.h>
|
2003-10-02 18:56:20 +00:00
|
|
|
|
|
|
|
typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */
|
* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
of the thread variable instead of void *.
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
__libc_tsd_address arguments. Remove union hack.
* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
Adjust __libc_tsd_{set,get} arguments.
* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
arguments.
* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
(LOCALE): Adjust __libc_tsd_define arguments.
* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
arguments.
(LOCALE): Adjust __libc_tsd_define arguments.
* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
arguments.
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
arguments. nptl/
* sysdeps/pthread/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
arguments.
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
arguments.
2008-11-07 Jakub Jelinek <jakub@redhat.com>
* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
of the thread variable instead of void *.
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
__libc_tsd_address arguments. Remove union hack.
* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
Adjust __libc_tsd_{set,get} arguments.
* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
arguments.
* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
(LOCALE): Adjust __libc_tsd_define arguments.
* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
arguments.
(LOCALE): Adjust __libc_tsd_define arguments.
* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
arguments.
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
arguments.
2008-11-07 15:07:10 +00:00
|
|
|
__libc_tsd_define (static, void *, MALLOC) /* declaration/common definition */
|
2003-10-02 18:56:20 +00:00
|
|
|
#define tsd_key_create(key, destr) ((void) (key))
|
* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
of the thread variable instead of void *.
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
__libc_tsd_address arguments. Remove union hack.
* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
Adjust __libc_tsd_{set,get} arguments.
* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
arguments.
* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
(LOCALE): Adjust __libc_tsd_define arguments.
* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
arguments.
(LOCALE): Adjust __libc_tsd_define arguments.
* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
arguments.
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
arguments. nptl/
* sysdeps/pthread/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
arguments.
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
arguments.
2008-11-07 Jakub Jelinek <jakub@redhat.com>
* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
of the thread variable instead of void *.
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
__libc_tsd_address arguments. Remove union hack.
* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
Adjust __libc_tsd_{set,get} arguments.
* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
__libc_tsd_define arguments.
* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
arguments.
* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
(LOCALE): Adjust __libc_tsd_define arguments.
* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
arguments.
(LOCALE): Adjust __libc_tsd_define arguments.
* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
arguments.
(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
arguments.
2008-11-07 15:07:10 +00:00
|
|
|
#define tsd_setspecific(key, data) __libc_tsd_set (void *, MALLOC, (data))
|
|
|
|
#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (void *, MALLOC))
|
2003-10-02 18:56:20 +00:00
|
|
|
|
2012-02-15 22:14:59 +00:00
|
|
|
/* madvise is a stub on Hurd, so don't bother calling it. */
|
2012-02-17 07:46:28 +00:00
|
|
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
2012-10-04 23:31:43 +00:00
|
|
|
#undef __madvise
|
|
|
|
#define __madvise(addr, len, advice) \
|
|
|
|
((void) (addr), (void) (len), (void) (advice))
|
2012-02-15 22:14:59 +00:00
|
|
|
|
2003-09-30 02:10:33 +00:00
|
|
|
#include <sysdeps/generic/malloc-machine.h>
|
|
|
|
|
|
|
|
#endif /* !defined(_MALLOC_MACHINE_H) */
|