]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/unit_tests/test_wq_exit_race_panic_10970548.c
xnu-2422.1.72.tar.gz
[apple/xnu.git] / tools / tests / unit_tests / test_wq_exit_race_panic_10970548.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <dispatch/dispatch.h>
4
5 int main(int argc, char *argv[])
6 {
7 char **envp = { NULL };
8 char *mycount = "1";
9 char *nargvp[] = { argv[0], mycount , NULL};
10 char *progpath = argv[0];
11 char buf[50];
12 char oldcount[30];
13 int envcount=0;
14 if (argc >= 2){
15 envcount = atoi(argv[1]);
16 printf("count = %d \n", envcount);
17 sprintf(buf, "%d", envcount+1);
18 nargvp[1] = buf;
19 }
20 char **nargvpp = nargvp;
21 if (envcount < 8 )
22 fork();
23 if (envcount > 320)
24 exit(0);
25 dispatch_apply(32,
26 dispatch_get_global_queue(0,0),
27 ^(size_t i __attribute__((unused))) {
28 execve(progpath,nargvpp,envp);
29 });
30
31 return 0;
32 }