Cygwin: rename pipe.cc to fhandler_pipe.cc

move pipe syscalls to syscalls.cc

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-01-07 12:31:28 +01:00
parent 9db7f4d1dd
commit 91ca95ae4a
3 changed files with 71 additions and 71 deletions

View File

@ -287,6 +287,7 @@ DLL_OFILES:= \
fhandler_floppy.o \
fhandler_netdrive.o \
fhandler_nodevice.o \
fhandler_pipe.o \
fhandler_proc.o \
fhandler_process.o \
fhandler_process_fd.o \
@ -349,7 +350,6 @@ DLL_OFILES:= \
passwd.o \
path.o \
pinfo.o \
pipe.o \
poll.o \
posix_ipc.o \
pseudo-reloc.o \

View File

@ -436,73 +436,3 @@ fhandler_pipe::fstatvfs (struct statvfs *sfs)
set_errno (EBADF);
return -1;
}
static int __reg3
pipe_worker (int filedes[2], unsigned int psize, int mode)
{
fhandler_pipe *fhs[2];
int res = fhandler_pipe::create (fhs, psize, mode);
if (!res)
{
cygheap_fdnew fdin;
cygheap_fdnew fdout (fdin, false);
char buf[sizeof ("/proc/self/fd/pipe:[9223372036854775807]")];
__small_sprintf (buf, "/proc/self/fd/pipe:[%D]", fhs[0]->get_plain_ino ());
fhs[0]->pc.set_posix (buf);
__small_sprintf (buf, "pipe:[%D]", fhs[1]->get_plain_ino ());
fhs[1]->pc.set_posix (buf);
fdin = fhs[0];
fdout = fhs[1];
filedes[0] = fdin;
filedes[1] = fdout;
}
return res;
}
extern "C" int
_pipe (int filedes[2], unsigned int psize, int mode)
{
int res = pipe_worker (filedes, psize, mode);
int read, write;
if (res != 0)
read = write = -1;
else
{
read = filedes[0];
write = filedes[1];
}
syscall_printf ("%R = _pipe([%d, %d], %u, %y)", res, read, write, psize, mode);
return res;
}
extern "C" int
pipe (int filedes[2])
{
int res = pipe_worker (filedes, DEFAULT_PIPEBUFSIZE, O_BINARY);
int read, write;
if (res != 0)
read = write = -1;
else
{
read = filedes[0];
write = filedes[1];
}
syscall_printf ("%R = pipe([%d, %d])", res, read, write);
return res;
}
extern "C" int
pipe2 (int filedes[2], int mode)
{
int res = pipe_worker (filedes, DEFAULT_PIPEBUFSIZE, mode);
int read, write;
if (res != 0)
read = write = -1;
else
{
read = filedes[0];
write = filedes[1];
}
syscall_printf ("%R = pipe2([%d, %d], %y)", res, read, write, mode);
return res;
}

View File

@ -4959,3 +4959,73 @@ unlinkat (int dirfd, const char *pathname, int flags)
__endtry
return -1;
}
static int __reg3
pipe_worker (int filedes[2], unsigned int psize, int mode)
{
fhandler_pipe *fhs[2];
int res = fhandler_pipe::create (fhs, psize, mode);
if (!res)
{
cygheap_fdnew fdin;
cygheap_fdnew fdout (fdin, false);
char buf[sizeof ("/proc/self/fd/pipe:[9223372036854775807]")];
__small_sprintf (buf, "/proc/self/fd/pipe:[%D]", fhs[0]->get_plain_ino ());
fhs[0]->pc.set_posix (buf);
__small_sprintf (buf, "pipe:[%D]", fhs[1]->get_plain_ino ());
fhs[1]->pc.set_posix (buf);
fdin = fhs[0];
fdout = fhs[1];
filedes[0] = fdin;
filedes[1] = fdout;
}
return res;
}
extern "C" int
_pipe (int filedes[2], unsigned int psize, int mode)
{
int res = pipe_worker (filedes, psize, mode);
int read, write;
if (res != 0)
read = write = -1;
else
{
read = filedes[0];
write = filedes[1];
}
syscall_printf ("%R = _pipe([%d, %d], %u, %y)", res, read, write, psize, mode);
return res;
}
extern "C" int
pipe (int filedes[2])
{
int res = pipe_worker (filedes, DEFAULT_PIPEBUFSIZE, O_BINARY);
int read, write;
if (res != 0)
read = write = -1;
else
{
read = filedes[0];
write = filedes[1];
}
syscall_printf ("%R = pipe([%d, %d])", res, read, write);
return res;
}
extern "C" int
pipe2 (int filedes[2], int mode)
{
int res = pipe_worker (filedes, DEFAULT_PIPEBUFSIZE, mode);
int read, write;
if (res != 0)
read = write = -1;
else
{
read = filedes[0];
write = filedes[1];
}
syscall_printf ("%R = pipe2([%d, %d], %y)", res, read, write, mode);
return res;
}