[newlib-cygwin] Cygwin: rename pipe.cc to fhandler_pipe.cc
Corinna Vinschen
corinna@sourceware.org
Mon Jan 7 12:03:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=91ca95ae4a7ee353fb913d31da6c183b9b4a1656
commit 91ca95ae4a7ee353fb913d31da6c183b9b4a1656
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Mon Jan 7 12:31:28 2019 +0100
Cygwin: rename pipe.cc to fhandler_pipe.cc
move pipe syscalls to syscalls.cc
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/Makefile.in | 2 +-
winsup/cygwin/{pipe.cc => fhandler_pipe.cc} | 70 -----------------------------
winsup/cygwin/syscalls.cc | 70 +++++++++++++++++++++++++++++
3 files changed, 71 insertions(+), 71 deletions(-)
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 733678e..e4ce31f 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -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 \
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/fhandler_pipe.cc
similarity index 87%
rename from winsup/cygwin/pipe.cc
rename to winsup/cygwin/fhandler_pipe.cc
index a75275d..eafaa88 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/fhandler_pipe.cc
@@ -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;
-}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 5bb33bf..b99a21e 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -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;
+}
More information about the Cygwin-cvs
mailing list