Added and implemented atfork() - note, this function is not part of POSIX

and should go away over time.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9308 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-10-12 16:37:39 +00:00
parent 10031c3053
commit 81d4f788a2
2 changed files with 32 additions and 0 deletions
+3
View File
@@ -1,7 +1,10 @@
SubDir OBOS_TOP src kernel libroot posix stdlib ;
UsePrivateHeaders libroot ;
KernelMergeObject posix_stdlib.o :
abs.c
atfork.c
atof.c
atoi.c
bsearch.c
+29
View File
@@ -0,0 +1,29 @@
/*
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
#include <fork.h>
#include <stdlib.h>
#include <errno.h>
/** This is the BeOS compatible atfork() function; since it's not part of POSIX,
* it should probably go away over time.
* Use pthread_atfork() instead.
*/
int
atfork(void (*function)(void))
{
status_t status = __register_atfork(NULL, NULL, function);
if (status < B_OK) {
errno = status;
return -1;
}
return 0;
}