#include <u.h>
#include <libc.h>
#include "../syscall/syscall.h"
/*
* SOCK_SEQSTREAM preserves message boundaries (Plan 9 pipe)
* but if you read the first 5 bytes of a 10 byte message,
* throws the rest of the message away.
*
* SOCK_STREAM does not preserve message boundaries (Unix pipe).
*
* Let's try SOCK_SEQPACKET for now.
*/
int
pipe(int *fd)
{
ulong arg[4];
arg[0] = PF_UNIX;
arg[1] = SOCK_SEQPACKET;
arg[2] = 0;
arg[3] = (ulong)fd;
return linuxsocketcall(SOCKOP_SOCKETPAIR, arg);
}
|