xv6-cs450/user1.c
rsc 9b37d1bfaa Add user.h for prototypes.
Add cons_puts for cleaner output.
2006-07-16 15:36:31 +00:00

23 lines
274 B
C

#include "user.h"
char buf[32];
int
main()
{
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(;;);
}