From 128ab3ea692fd95d9f843bb4158cb7a5a865dff1 Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Mon, 29 Oct 2001 08:19:24 +0000 Subject: Reimplement fix for an imcompatibility between ORBit and FreeBSD properly. Instead of replacing writev(2) with loop based on write(2), test system limit on the number of vectors writev(2) accepts and split call to writev(2) to several calls in such a way that number of vectors in each call doesn't exceed this limit (aka UIO_MAXIOV). Bump PORTREVISION. --- devel/ORBit2/files/patch-src::ORBitutil::compat.c | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 devel/ORBit2/files/patch-src::ORBitutil::compat.c (limited to 'devel/ORBit2/files/patch-src::ORBitutil::compat.c') diff --git a/devel/ORBit2/files/patch-src::ORBitutil::compat.c b/devel/ORBit2/files/patch-src::ORBitutil::compat.c new file mode 100644 index 000000000000..823471b2b622 --- /dev/null +++ b/devel/ORBit2/files/patch-src::ORBitutil::compat.c @@ -0,0 +1,41 @@ + +$FreeBSD$ + +--- src/ORBitutil/compat.c.orig Wed Sep 9 07:08:14 1998 ++++ src/ORBitutil/compat.c Sat Oct 27 15:49:13 2001 +@@ -1,18 +1,28 @@ ++#include ++ + #include "config.h" + #include "util.h" + +-#define MAX_IOVS 16 +- + int g_writev(int fd, const struct iovec * vector, size_t count) + { +- int retval = 0; ++ int retval, wcur; ++ int sum = 0; + +- while(count > MAX_IOVS) { +- retval += writev(fd, vector, MAX_IOVS); +- vector += MAX_IOVS; count -= MAX_IOVS; ++ for (wcur = MAXIOV; wcur == MAXIOV && count != 0; count -= MAXIOV) { ++ if (wcur > count) ++ wcur = count; ++ do { ++ retval = writev(fd, vector, wcur); ++ } while (retval < 0 && errno == EAGAIN); ++ if (retval < 0) { ++ sum = retval; ++ break; ++ } ++ vector = &(vector[wcur]); ++ sum += retval; + } + +- return writev(fd, vector, count) + retval; ++ return sum; + } + + #ifndef HAVE_INET_ATON -- cgit v1.2.3