summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2003-09-25 05:09:11 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-10-21 05:42:50 +0000
commit2b3899d4782d6cd9fd447b3a3d396a213c356e32 (patch)
tree2de60bb359b1d21717118493de70144e576d3d0e
parent9a33a11b365124410552534ac16eb54196c61f4d (diff)
downloadperl-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.c4
-rw-r--r--os2/os2ish.h2
-rw-r--r--perl.h8
-rw-r--r--perlio.c2
-rw-r--r--pp_sys.c20
5 files changed, 23 insertions, 13 deletions
diff --git a/doio.c b/doio.c
index 3bad8f343b..e2dcad87cb 100644
--- a/doio.c
+++ b/doio.c
@@ -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
diff --git a/perl.h b/perl.h
index 7730f45211..16198df214 100644
--- a/perl.h
+++ b/perl.h
@@ -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
diff --git a/perlio.c b/perlio.c
index c4a81afd7c..cda36f86ad 100644
--- a/perlio.c
+++ b/perlio.c
@@ -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);
/*
diff --git a/pp_sys.c b/pp_sys.c
index 10d052943c..259c926dc3 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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));