diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 2003-09-25 05:09:11 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-10-21 05:42:50 +0000 |
commit | 2b3899d4782d6cd9fd447b3a3d396a213c356e32 (patch) | |
tree | 2de60bb359b1d21717118493de70144e576d3d0e | |
parent | 9a33a11b365124410552534ac16eb54196c61f4d (diff) | |
download | perl-2b3899d4782d6cd9fd447b3a3d396a213c356e32.tar.gz |
Two OS/2 portability patches from Ilya.
Subject: [PATCH 5.8.1 @21211] sockets broken on OS/2
Date: Thu, 25 Sep 2003 12:09:11 -0700
Message-ID: <20030925190911.GA27028@math.berkeley.edu>
Subject: Re: [PATCH 5.8.1 @21379] tmpfile() broken on OS/2
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Date: Thu, 25 Sep 2003 19:50:45 -0700
Message-ID: <20030926025045.GA27507@math.berkeley.edu>
p4raw-id: //depot/perl@21509
-rw-r--r-- | doio.c | 4 | ||||
-rw-r--r-- | os2/os2ish.h | 2 | ||||
-rw-r--r-- | perl.h | 8 | ||||
-rw-r--r-- | perlio.c | 2 | ||||
-rw-r--r-- | pp_sys.c | 20 |
5 files changed, 23 insertions, 13 deletions
@@ -937,8 +937,8 @@ Perl_do_pipe(pTHX_ SV *sv, GV *rgv, GV *wgv) if (PerlProc_pipe(fd) < 0) goto badexit; - IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE); - IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE); + IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE); + IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE); IoOFP(rstio) = IoIFP(rstio); IoIFP(wstio) = IoOFP(wstio); IoTYPE(rstio) = IoTYPE_RDONLY; diff --git a/os2/os2ish.h b/os2/os2ish.h index 3ff25f2366..a4145eab4a 100644 --- a/os2/os2ish.h +++ b/os2/os2ish.h @@ -49,6 +49,8 @@ */ #undef USEMYBINMODE +#define SOCKET_OPEN_MODE "b" + /* Stat_t: * This symbol holds the type used to declare buffers for information * returned by stat(). It's usually just struct stat. It may be necessary @@ -4294,6 +4294,14 @@ extern void moncontrol(int); # define PIPESOCK_MODE #endif +#ifndef SOCKET_OPEN_MODE +# define SOCKET_OPEN_MODE PIPESOCK_MODE +#endif + +#ifndef PIPE_OPEN_MODE +# define PIPE_OPEN_MODE PIPESOCK_MODE +#endif + #define PERL_MAGIC_UTF8_CACHESIZE 2 #define PERL_UNICODE_STDIN_FLAG 0x0001 @@ -4868,7 +4868,7 @@ PerlIO_tmpfile(void) if (fd >= 0) f = PerlIO_fdopen(fd, "w+b"); #else /* WIN32 */ -# if defined(HAS_MKSTEMP) && ! defined(VMS) +# if defined(HAS_MKSTEMP) && ! defined(VMS) && ! defined(OS2) SV *sv = newSVpv("/tmp/PerlIO_XXXXXX", 0); /* @@ -621,8 +621,8 @@ PP(pp_pipe_op) if (PerlProc_pipe(fd) < 0) goto badexit; - IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE); - IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE); + IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE); + IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE); IoOFP(rstio) = IoIFP(rstio); IoIFP(wstio) = IoOFP(wstio); IoTYPE(rstio) = IoTYPE_RDONLY; @@ -2295,8 +2295,8 @@ PP(pp_socket) fd = PerlSock_socket(domain, type, protocol); if (fd < 0) RETPUSHUNDEF; - IoIFP(io) = PerlIO_fdopen(fd, "r"PIPESOCK_MODE); /* stdio gets confused about sockets */ - IoOFP(io) = PerlIO_fdopen(fd, "w"PIPESOCK_MODE); + IoIFP(io) = PerlIO_fdopen(fd, "r"SOCKET_OPEN_MODE); /* stdio gets confused about sockets */ + IoOFP(io) = PerlIO_fdopen(fd, "w"SOCKET_OPEN_MODE); IoTYPE(io) = IoTYPE_SOCKET; if (!IoIFP(io) || !IoOFP(io)) { if (IoIFP(io)) PerlIO_close(IoIFP(io)); @@ -2357,11 +2357,11 @@ PP(pp_sockpair) TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF; - IoIFP(io1) = PerlIO_fdopen(fd[0], "r"PIPESOCK_MODE); - IoOFP(io1) = PerlIO_fdopen(fd[0], "w"PIPESOCK_MODE); + IoIFP(io1) = PerlIO_fdopen(fd[0], "r"SOCKET_OPEN_MODE); + IoOFP(io1) = PerlIO_fdopen(fd[0], "w"SOCKET_OPEN_MODE); IoTYPE(io1) = IoTYPE_SOCKET; - IoIFP(io2) = PerlIO_fdopen(fd[1], "r"PIPESOCK_MODE); - IoOFP(io2) = PerlIO_fdopen(fd[1], "w"PIPESOCK_MODE); + IoIFP(io2) = PerlIO_fdopen(fd[1], "r"SOCKET_OPEN_MODE); + IoOFP(io2) = PerlIO_fdopen(fd[1], "w"SOCKET_OPEN_MODE); IoTYPE(io2) = IoTYPE_SOCKET; if (!IoIFP(io1) || !IoOFP(io1) || !IoIFP(io2) || !IoOFP(io2)) { if (IoIFP(io1)) PerlIO_close(IoIFP(io1)); @@ -2532,8 +2532,8 @@ PP(pp_accept) goto badexit; if (IoIFP(nstio)) do_close(ngv, FALSE); - IoIFP(nstio) = PerlIO_fdopen(fd, "r"PIPESOCK_MODE); - IoOFP(nstio) = PerlIO_fdopen(fd, "w"PIPESOCK_MODE); + IoIFP(nstio) = PerlIO_fdopen(fd, "r"SOCKET_OPEN_MODE); + IoOFP(nstio) = PerlIO_fdopen(fd, "w"SOCKET_OPEN_MODE); IoTYPE(nstio) = IoTYPE_SOCKET; if (!IoIFP(nstio) || !IoOFP(nstio)) { if (IoIFP(nstio)) PerlIO_close(IoIFP(nstio)); |