summaryrefslogtreecommitdiff
path: root/user1.c
blob: 267320e6f0f684daefff57bbd5b0073d65c85bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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(;;);
}