summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-11-21 08:45:06 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-11-21 08:45:06 +0000
commita7092146033201511b749e3a5ff31247e203604d (patch)
tree14f0599808ecedb698a5049d6b16390848911e68 /pp_sys.c
parente4449fe1872a24e805fcc129361ea26a406317d8 (diff)
downloadperl-a7092146033201511b749e3a5ff31247e203604d.tar.gz
another win32 portability fix: make sysread() and syswrite()
work on sockets p4raw-id: //depot/perl@2255
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 8fa38f2860..b3de2f8ef4 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1422,7 +1422,17 @@ PP(pp_sysread)
Zero(buffer+bufsize, offset-bufsize, char);
}
if (PL_op->op_type == OP_SYSREAD) {
- length = PerlLIO_read(PerlIO_fileno(IoIFP(io)), buffer+offset, length);
+#ifdef PERL_SOCK_SYSREAD_IS_RECV
+ if (IoTYPE(io) == 's') {
+ length = PerlSock_recv(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length, 0);
+ }
+ else
+#endif
+ {
+ length = PerlLIO_read(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length);
+ }
}
else
#ifdef HAS_SOCKET__bad_code_maybe
@@ -1534,7 +1544,17 @@ PP(pp_send)
offset = 0;
if (length > blen - offset)
length = blen - offset;
- length = PerlLIO_write(PerlIO_fileno(IoIFP(io)), buffer+offset, length);
+#ifdef PERL_SOCK_SYSWRITE_IS_SEND
+ if (IoTYPE(io) == 's') {
+ length = PerlSock_send(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length, 0);
+ }
+ else
+#endif
+ {
+ length = PerlLIO_write(PerlIO_fileno(IoIFP(io)),
+ buffer+offset, length);
+ }
}
#ifdef HAS_SOCKET
else if (SP > MARK) {