13 * The bug we test for: under strace -f, last two lines are swapped
14 * because wait syscall is suspended by strace and thus can't be interrupted.
17 static const char msg1[] = "Child signals parent\n";
18 static const char msg2[] = "Parent got signal\n";
19 static const char msg3[] = "Child will exit now\n";
21 static void handler(int s)
23 write(1, msg2, sizeof(msg2)-1);
28 /* Note: in Linux, signal() installs handler with SA_RESTART flag,
29 * therefore wait will be restarted.
31 signal(SIGALRM, handler);
36 write(1, msg1, sizeof(msg1)-1);
37 kill(getppid(), SIGALRM);
39 write(1, msg3, sizeof(msg3)-1);
55 printf("Please run me under 'strace -f'\n");
71 fgets(buf1, 80, stdin); printf("%s", buf1);
72 fgets(buf2, 80, stdin); printf("%s", buf2);
73 fgets(buf3, 80, stdin); printf("%s", buf3);
75 if (strcmp(buf1, msg1) != 0
76 || strcmp(buf2, msg2) != 0
77 || strcmp(buf3, msg3) != 0
79 printf("ERROR! Expected order:\n%s%s%s", msg1, msg2, msg3);
82 printf("Good: wait seems to be correctly interrupted by signals\n");