From 770403be47fb93816066c33271d029b14d7fa92c Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 11 Jan 2011 23:26:07 +0100 Subject: [PATCH] Make win32 tests pass --- include/parrot/io.h | 2 +- include/parrot/platform_interface.h | 3 ++- src/platform/generic/io.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/parrot/io.h b/include/parrot/io.h index 7bdc328c51..0fa39fe220 100644 --- a/include/parrot/io.h +++ b/include/parrot/io.h @@ -45,7 +45,7 @@ Parrot_io_open((interp), (file), (flags)) #define PIO_OPEN_PIPE(interp, file, flags, pid) \ Parrot_io_open_pipe((interp), (file), (flags), (pid)) -#define PIO_DUP(interp, handle) (PIOHANDLE)dup((int)(handle)) +#define PIO_DUP(interp, handle) Parrot_io_dup((interp), (handle)) #define PIO_CLOSE(interp, handle) Parrot_io_close((interp), (handle)) #define PIO_CLOSE_PIOHANDLE(interp, handle) Parrot_io_close_piohandle((interp), (handle)) #define PIO_PIPE_WAIT(interp, pid) Parrot_io_waitpid((interp), (pid)) diff --git a/include/parrot/platform_interface.h b/include/parrot/platform_interface.h index 4b623ca9da..50db42e840 100644 --- a/include/parrot/platform_interface.h +++ b/include/parrot/platform_interface.h @@ -62,7 +62,8 @@ typedef off_t PIOOFF_T; PIOHANDLE Parrot_io_std_os_handle(PARROT_INTERP, INTVAL fileno); PIOHANDLE Parrot_io_open(PARROT_INTERP, ARGIN(STRING *path), INTVAL flags); -INTVAL Parrot_io_close(PARROT_INTERP, PIOHANDLE file_descriptor); +PIOHANDLE Parrot_io_dup(PARROT_INTERP, PIOHANDLE handle); +INTVAL Parrot_io_close(PARROT_INTERP, PIOHANDLE handle); INTVAL Parrot_io_close_piohandle(PARROT_INTERP, PIOHANDLE handle); INTVAL Parrot_io_waitpid(PARROT_INTERP, INTVAL pid); INTVAL Parrot_io_is_tty(PARROT_INTERP, PIOHANDLE fd); diff --git a/src/platform/generic/io.c b/src/platform/generic/io.c index 951bb4bc78..6b262053b1 100644 --- a/src/platform/generic/io.c +++ b/src/platform/generic/io.c @@ -175,6 +175,23 @@ Parrot_io_open(PARROT_INTERP, ARGIN(STRING *path), INTVAL flags) return fd; } +/* + +=item C + +Duplicates file handle C. + +=cut + +*/ + +PARROT_WARN_UNUSED_RESULT +PIOHANDLE +Parrot_io_dup(PARROT_INTERP, PIOHANDLE handle) +{ + return dup(handle); +} + #if PARROT_ASYNC_DEVEL /*