bjh 01/03/05 06:52:07
Modified: network_io/os2 sendrecv.c
Log:
OS/2: Limit data passed to writev() to 64k as that's all it can handle.
Revision Changes Path
1.19 +9 -3 apr/network_io/os2/sendrecv.c
Index: sendrecv.c
===================================================================
RCS file: /home/cvs/apr/network_io/os2/sendrecv.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- sendrecv.c 2001/02/16 04:16:01 1.18
+++ sendrecv.c 2001/03/05 14:51:59 1.19
@@ -142,10 +142,16 @@
apr_status_t rv;
struct iovec *tmpvec;
int fds, err = 0;
+ int nv_tosend, total = 0;
- tmpvec = alloca(sizeof(struct iovec) * nvec);
- memcpy(tmpvec, vec, sizeof(struct iovec) * nvec);
+ /* Make sure writev() only gets fed 64k at a time */
+ for ( nv_tosend = 0; total + vec[nv_tosend].iov_len < 65536; nv_tosend++
) {
+ total += vec[nv_tosend].iov_len;
+ }
+ tmpvec = alloca(sizeof(struct iovec) * nv_tosend);
+ memcpy(tmpvec, vec, sizeof(struct iovec) * nv_tosend);
+
do {
if (!sock->nonblock || err == SOCEWOULDBLOCK) {
fds = sock->socketdes;
@@ -165,7 +171,7 @@
}
}
- rv = writev(sock->socketdes, tmpvec, nvec);
+ rv = writev(sock->socketdes, tmpvec, nv_tosend);
err = rv < 0 ? sock_errno() : 0;
} while (err == SOCEINTR || err == SOCEWOULDBLOCK);