Loading...
--- Libc/Libc-997.90.3/sys/fork.c
+++ Libc/Libc-825.26/sys/fork.c
@@ -23,22 +23,17 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#include <TargetConditionals.h>
-#if TARGET_IPHONE_SIMULATOR
-extern pid_t (*_host_fork)(void);
-#else
extern pid_t __fork(void);
-#endif
+extern void _cthread_fork_prepare();
+extern void _cthread_fork_parent();
+extern void _cthread_fork_child();
static void (*_libSystem_atfork_prepare)(void) = 0;
static void (*_libSystem_atfork_parent)(void) = 0;
static void (*_libSystem_atfork_child)(void) = 0;
-#if !TARGET_IPHONE_SIMULATOR
-__private_extern__
-#endif
-void _libc_fork_init(void (*prepare)(void), void (*parent)(void), void (*child)(void))
+__private_extern__ void _libc_fork_init(void (*prepare)(void), void (*parent)(void), void (*child)(void))
{
_libSystem_atfork_prepare = prepare;
_libSystem_atfork_parent = parent;
@@ -57,12 +52,7 @@
// Reader beware: this __fork() call is yet another wrapper around the actual syscall
// and lives inside libsyscall. The fork syscall needs some cuddling by asm before it's
// allowed to see the big wide C world.
-#if TARGET_IPHONE_SIMULATOR
- // _host_fork is yet another layer of wrapping that lives in the simulator's libSystem
- ret = _host_fork();
-#else
ret = __fork();
-#endif
if (-1 == ret)
{
// __fork already set errno for us