3 char buf
[512], buf2
[512];
10 if ((fd
= open("motd", O_RDONLY
)) < 0)
11 panic("open motd: %e", fd
);
13 if ((n
= readn(fd
, buf
, sizeof buf
)) <= 0)
14 panic("readn: %e", n
);
20 cprintf("going to read in child (might page fault if your sharing is buggy)\n");
21 if ((n2
= readn(fd
, buf2
, sizeof buf2
)) != n2
)
22 panic("read in parent got %d, read in child got %d", n
, n2
);
23 if (memcmp(buf
, buf2
, n
) != 0)
24 panic("read in parent got different bytes from read in child");
25 cprintf("read in child succeeded\n");
31 if ((n2
= readn(fd
, buf2
, sizeof buf2
)) != n
)
32 panic("read in parent got %d, then got %d", n
, n2
);
33 cprintf("read in parent succeeded\n");