6 #include <sys/socket.h>
9 static const struct sockaddr sa;
11 int main(int argc, char *argv[])
18 "Please run me under 'strace -f -oLOG', and examine LOG file for incorrect\n"
19 "decoding of interrupted syscalls: grep for 'sendto', '??" /* anti-trigraph gap */ "?', 'unavailable'.\n"
20 "Pass number of iterations in argv[1] (default: 999).\n"
25 sigaddset(&set, SIGCHLD);
26 sigprocmask(SIG_BLOCK, &set, NULL);
30 loops = atoi(argv[1]);
32 while (--loops >= 0) {
50 /* grandchild: kill child */
55 /* Add various syscalls you want to test here.
56 * strace will decode them and suddenly find
57 * process disappearing.
58 * But leave at least one case "empty", so that
59 * "kill grandchild" happens quicker.
60 * This produces cases when strace can't even
61 * decode syscall number before process dies.
65 break; /* intentionally empty */
67 sendto(-1, "Hello cruel world", 17, 0, &sa, sizeof(sa));