2006-07-16 17:36:31 +02:00
|
|
|
#include "user.h"
|
|
|
|
|
2006-06-27 16:35:53 +02:00
|
|
|
char buf[32];
|
2006-06-26 17:11:19 +02:00
|
|
|
|
2006-07-16 17:36:31 +02:00
|
|
|
int
|
2006-07-17 03:25:22 +02:00
|
|
|
main(void)
|
2006-06-22 22:47:23 +02:00
|
|
|
{
|
2006-06-27 16:35:53 +02:00
|
|
|
int pid, fds[2], n;
|
|
|
|
|
|
|
|
pipe(fds);
|
2006-06-26 22:31:52 +02:00
|
|
|
pid = fork();
|
2006-06-27 16:35:53 +02:00
|
|
|
if(pid > 0){
|
|
|
|
write(fds[1], "xyz", 4);
|
|
|
|
puts("w");
|
2006-06-26 22:31:52 +02:00
|
|
|
} else {
|
2006-06-27 16:35:53 +02:00
|
|
|
n = read(fds[0], buf, sizeof(buf));
|
|
|
|
puts("r: ");
|
|
|
|
puts(buf);
|
|
|
|
puts("\n");
|
2006-06-26 22:31:52 +02:00
|
|
|
}
|
2006-07-16 17:36:31 +02:00
|
|
|
for(;;);
|
2006-06-22 22:47:23 +02:00
|
|
|
}
|