7 const char test_name[] = "syn-read";
9 static char buf[BUF_SIZE];
16 pid_t children[CHILD_CNT];
20 check (create (filename, sizeof buf), "create \"%s\"", filename);
21 check ((fd = open (filename)) > 1, "open \"%s\"", filename);
22 random_bytes (buf, sizeof buf);
23 check (write (fd, buf, sizeof buf) > 0, "write \"%s\"", filename);
24 msg ("close \"%s\"", filename);
27 for (i = 0; i < CHILD_CNT; i++)
30 snprintf (cmd_line, sizeof cmd_line, "child-syn-read %d", i);
31 check ((children[i] = exec (cmd_line)) != PID_ERROR,
32 "exec child %d of %d: \"%s\"", i + 1, (int) CHILD_CNT, cmd_line);
35 for (i = 0; i < CHILD_CNT; i++)
37 int status = join (children[i]);
38 check (status == i, "join child %d of %d", i + 1, (int) CHILD_CNT);