]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dyld_fork-locks.dest/main.c
2 // BUILD: $CC main.c -o $BUILD_DIR/dyld_fork_test.exe
4 // RUN: ./dyld_fork_test.exe
8 #include <mach-o/dyld_priv.h>
12 static void notifyBeforeFork(const struct mach_header
* mh
, intptr_t vmaddr_slide
)
14 static bool sRanNotifier
= false;
19 // fork and exec child
20 pid_t sChildPid
= fork();
21 if ( sChildPid
< 0 ) {
22 printf("[FAIL] dyld_fork_test didn't fork\n");
25 if ( sChildPid
== 0 ) {
31 int main(int argc
, const char* argv
[])
33 printf("[BEGIN] dyld_fork_test\n");
35 _dyld_register_func_for_add_image(¬ifyBeforeFork
);
38 printf("[PASS] dyld_fork_test\n");