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