
There is no reason to use a single message for nonoverlapping requests and replies combined, and in fact splitting them out allows reuse of messages and avoids various problems with field layouts. Since the upcoming socketpair(2) system call will be using the same reply as pipe2(2), split up the single message used for the latter. In order to keep the used parts of messages at the front, start a transitional phase to move the pipe(2) flags field to the front of its request. Change-Id: If3f1c3d348ec7e27b7f5b7147ce1b9ef490dfab9
32 lines
524 B
C
32 lines
524 B
C
#include <sys/cdefs.h>
|
|
#include "namespace.h"
|
|
#include <lib.h>
|
|
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
#ifdef __weak_alias
|
|
__weak_alias(pipe, _pipe)
|
|
#endif
|
|
|
|
int
|
|
pipe2(int fild[2], int flags)
|
|
{
|
|
message m;
|
|
|
|
memset(&m, 0, sizeof(m));
|
|
m.m_lc_vfs_pipe2.flags = flags;
|
|
m.m_lc_vfs_pipe2.oflags = flags; /* backward compatibility */
|
|
|
|
if (_syscall(VFS_PROC_NR, VFS_PIPE2, &m) < 0) return(-1);
|
|
fild[0] = m.m_vfs_lc_fdpair.fd0;
|
|
fild[1] = m.m_vfs_lc_fdpair.fd1;
|
|
return(0);
|
|
}
|
|
|
|
int
|
|
pipe(int fild[2])
|
|
{
|
|
return pipe2(fild, 0);
|
|
}
|