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 13 /** This is the BeOS compatible atfork() function; since it's not part of POSIX, 14 * it should probably go away over time. 15 * Use pthread_atfork() instead. 16 */ 17 18 int 19 atfork(void (*function)(void)) 20 { 21 status_t status = __register_atfork(NULL, NULL, function); 22 if (status < B_OK) { 23 errno = status; 24 return -1; 25 } 26 27 return 0; 28 } 29 30