pipe.c - 9base - revived minimalist port of Plan 9 userland to Unix
 (HTM) git clone git://git.suckless.org/9base
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       pipe.c (320B)
       ---
            1 #include <u.h>
            2 #define NOPLAN9DEFINES
            3 #include <libc.h>
            4 #include <sys/socket.h>
            5 
            6 /*
            7  * We use socketpair to get a two-way pipe.
            8  * The pipe still doesn't preserve message boundaries.
            9  * Worse, it cannot be reopened via /dev/fd/NNN on Linux.
           10  */
           11 int
           12 p9pipe(int fd[2])
           13 {
           14         return socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
           15 }