tailfsrv.c 258 B

1234567891011121314151617
  1. #include <u.h>
  2. #include <libc.h>
  3. void
  4. main(void)
  5. {
  6. int fd, p[2];
  7. char buf[8192], n;
  8. pipe(p);
  9. fd = create("/srv/log", OWRITE, 0666);
  10. fprint(fd, "%d", p[0]);
  11. close(fd);
  12. close(p[0]);
  13. while((n = read(p[1], buf, sizeof buf)) >= 0)
  14. write(1, buf, n);
  15. }