1/* 2** Copyright 2004, Axel D��rfler, axeld@pinc-software.de. All rights reserved. 3** Distributed under the terms of the Haiku License. 4*/ 5 6 7#include <fork.h> 8 9#include <stdlib.h> 10#include <errno.h> 11 12#include <errno_private.h> 13 14 15/** This is the BeOS compatible atfork() function; since it's not part of POSIX, 16 * it should probably go away over time. 17 * Use pthread_atfork() instead. 18 */ 19 20int 21atfork(void (*function)(void)) 22{ 23 status_t status = __register_atfork(NULL, NULL, function); 24 if (status < B_OK) { 25 __set_errno(status); 26 return -1; 27 } 28 29 return 0; 30} 31 32