xv6/user1.c
2006-07-17 01:25:22 +00:00

22 lines
278 B
C

#include "user.h"
char buf[32];
int
main(void)
{
int pid, fds[2], n;
pipe(fds);
pid = fork();
if(pid > 0){
write(fds[1], "xyz", 4);
puts("w");
} else {
n = read(fds[0], buf, sizeof(buf));
puts("r: ");
puts(buf);
puts("\n");
}
for(;;);
}