]> git.saurik.com Git - apple/xnu.git/blob - tests/no32exec_35914211_helper_binprefs.c
xnu-6153.11.26.tar.gz
[apple/xnu.git] / tests / no32exec_35914211_helper_binprefs.c
1 #include <darwintest.h>
2 #include <unistd.h>
3 #include <signal.h>
4
5 int can_signal_parent = 0;
6
7 void
8 signal_handler(int sig)
9 {
10 if (sig == SIGUSR1) {
11 can_signal_parent = 1;
12 }
13 return;
14 }
15
16 T_DECL(no32exec_bootarg_with_spawn_binprefs_helper, "helper for no32exec_bootarg_with_spawn_binprefs test")
17 {
18 unsigned long ptrSize = sizeof(long);
19 int ppid = getppid();
20
21 signal(SIGUSR1, signal_handler);
22 signal(SIGALRM, signal_handler);
23
24 // parent will signal us if they're no32exec_bootarg_with_spawn_binprefs, otherwise timeout
25 alarm(3);
26 pause();
27
28 /* signal to parent process if we are running in 64-bit mode */
29 if (can_signal_parent && ptrSize == 8) {
30 kill(ppid, SIGUSR1);
31 }
32
33 T_SKIP("nothing to see here");
34 }