glibc/hurd/hurdmalloc.h
Samuel Thibault e67f54ab1a hurdmalloc: Run fork handler as late as possible [BZ #19431]
This is the hurd-specific follow-up for
29d794863c : hurdmalloc also needs the
same fix

	* hurd/hurdmalloc.c (malloc_fork_prepare): Rename to
	_hurd_malloc_fork_prepare.
	(malloc_fork_parent): Rename to _hurd_malloc_fork_parent.
	(malloc_fork_child): Rename to _hurd_malloc_fork_child.
	(_hurd_fork_prepare_hook): Drop malloc_fork_prepare.
	(_hurd_fork_parent_hook): Drop malloc_fork_parent.
	(_hurd_fork_child_hook): Drop malloc_fork_child.
	* hurd/hurdmalloc.h (_hurd_malloc_fork_prepare,
	_hurd_malloc_fork_parent, _hurd_malloc_fork_child): Add declarations.
	* sysdeps/mach/hurd/fork.c (__fork): Call __malloc_fork_lock_parent
	after locking locks (notably hurd_dtable_lock). Call
	_hurd_malloc_fork_prepare after that. Call _hurd_malloc_fork_parent
	before __malloc_fork_unlock_parent and _hurd_malloc_fork_child before
	__malloc_fork_unlock_child.
2016-09-22 01:45:48 +02:00

22 lines
712 B
C

/* XXX this file is a temporary hack.
All hurd-internal code which uses malloc et al includes this file so it
will use the internal malloc routines _hurd_{malloc,realloc,free}
instead. The "hurd-internal" functions are the cthreads version,
which uses vm_allocate and is thread-safe. The normal user version
of malloc et al is the unixoid one using sbrk.
*/
extern void *_hurd_malloc (size_t);
extern void *_hurd_realloc (void *, size_t);
extern void _hurd_free (void *);
extern void _hurd_malloc_fork_prepare (void);
extern void _hurd_malloc_fork_parent (void);
extern void _hurd_malloc_fork_child (void);
#define malloc _hurd_malloc
#define realloc _hurd_realloc
#define free _hurd_free