X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_atfork.c;h=26d325438cec6ae63cc814766de557cc7a6a89c3;hb=9532ae1318201d66b235a618df16aac0b3386630;hp=a40d7f63287079c2ce538360305b86e7174b06e9;hpb=56fbaa3bbe73f12af2bfbbcf2adb196e6f9fe264;p=musl diff --git a/src/thread/pthread_atfork.c b/src/thread/pthread_atfork.c index a40d7f63..26d32543 100644 --- a/src/thread/pthread_atfork.c +++ b/src/thread/pthread_atfork.c @@ -1,5 +1,12 @@ #include +#include #include "libc.h" +#include "lock.h" + +#define malloc __libc_malloc +#define calloc undef +#define realloc undef +#define free undef static struct atfork_funcs { void (*prepare)(void); @@ -8,7 +15,7 @@ static struct atfork_funcs { struct atfork_funcs *prev, *next; } *funcs; -static volatile int lock[2]; +static volatile int lock[1]; void __fork_handler(int who) { @@ -33,7 +40,7 @@ void __fork_handler(int who) int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) { struct atfork_funcs *new = malloc(sizeof *new); - if (!new) return -1; + if (!new) return ENOMEM; LOCK(lock); new->next = funcs;