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:
@@ -1,7 +1,10 @@
|
|||||||
SubDir OBOS_TOP src kernel libroot posix stdlib ;
|
SubDir OBOS_TOP src kernel libroot posix stdlib ;
|
||||||
|
|
||||||
|
UsePrivateHeaders libroot ;
|
||||||
|
|
||||||
KernelMergeObject posix_stdlib.o :
|
KernelMergeObject posix_stdlib.o :
|
||||||
abs.c
|
abs.c
|
||||||
|
atfork.c
|
||||||
atof.c
|
atof.c
|
||||||
atoi.c
|
atoi.c
|
||||||
bsearch.c
|
bsearch.c
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user