29 int (*pbd_alloc_allowed) () = 0;
35 static pthread_key_t disabled;
37 static pthread_once_t once;
42 (void) pthread_key_create (&disabled, NULL);
46 void* malloc (
size_t s)
48 static void * (*real_malloc) (size_t) = NULL;
51 real_malloc = dlsym (RTLD_NEXT,
"malloc");
54 (void) pthread_once (&once, make_key);
56 if (pthread_getspecific (disabled) == NULL && pbd_alloc_allowed && !pbd_alloc_allowed ()) {
62 return real_malloc (s);
68 (void) pthread_once (&once, make_key);
69 pthread_setspecific (disabled, (
void *) 1);
75 (void) pthread_once (&once, make_key);
76 pthread_setspecific (disabled, (
void *) 0);
#define resume_rt_malloc_checks()
#define suspend_rt_malloc_checks()