diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2001-10-29 08:19:24 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2001-10-29 08:19:24 +0000 |
commit | 128ab3ea692fd95d9f843bb4158cb7a5a865dff1 (patch) | |
tree | 5d47b869b3289261f8bcfc911abad5e0b6efab9c /devel/ORBit2/files/patch-src::ORBitutil::compat.c | |
parent | Update to 0.12.6. (diff) |
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.
Notes
Notes:
svn path=/head/; revision=49315
Diffstat (limited to 'devel/ORBit2/files/patch-src::ORBitutil::compat.c')
-rw-r--r-- | devel/ORBit2/files/patch-src::ORBitutil::compat.c | 41 |
1 files changed, 41 insertions, 0 deletions
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 <errno.h> ++ + #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 |