3 char *msg
= "Now is the time for all good men to come to the aid of their party.";
11 argv0
= "pipereadeof";
13 if ((i
= pipe(p
)) < 0)
16 if ((pid
= fork()) < 0)
20 cprintf("[%08x] pipereadeof close %d\n", env
->env_id
, p
[1]);
22 cprintf("[%08x] pipereadeof readn %d\n", env
->env_id
, p
[0]);
23 i
= readn(p
[0], buf
, sizeof buf
-1);
27 if (strcmp(buf
, msg
) == 0)
28 cprintf("\npipe read closed properly\n");
30 cprintf("\ngot %d bytes: %s\n", i
, buf
);
33 cprintf("[%08x] pipereadeof close %d\n", env
->env_id
, p
[0]);
35 cprintf("[%08x] pipereadeof write %d\n", env
->env_id
, p
[1]);
36 if ((i
= write(p
[1], msg
, strlen(msg
))) != strlen(msg
))
37 panic("write: %e", i
);
42 argv0
= "pipewriteeof";
43 if ((i
= pipe(p
)) < 0)
46 if ((pid
= fork()) < 0)
53 if (write(p
[1], "x", 1) != 1)
56 cprintf("\npipe write closed properly\n");
63 cprintf("pipe tests passed\n");