pipe.c 320 B

12345678910111213141516
  1. #include <u.h>
  2. #define NOPLAN9DEFINES
  3. #include <libc.h>
  4. #include <sys/socket.h>
  5. /*
  6. * We use socketpair to get a two-way pipe.
  7. * The pipe still doesn't preserve message boundaries.
  8. * Worse, it cannot be reopened via /dev/fd/NNN on Linux.
  9. */
  10. int
  11. p9pipe(int fd[2])
  12. {
  13. return socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
  14. }