summaryrefslogtreecommitdiff
path: root/devel/ORBit2
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-10-29 08:19:24 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-10-29 08:19:24 +0000
commit128ab3ea692fd95d9f843bb4158cb7a5a865dff1 (patch)
tree5d47b869b3289261f8bcfc911abad5e0b6efab9c /devel/ORBit2
parentUpdate 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')
-rw-r--r--devel/ORBit2/Makefile5
-rw-r--r--devel/ORBit2/files/patch-ae102
-rw-r--r--devel/ORBit2/files/patch-configure.in57
-rw-r--r--devel/ORBit2/files/patch-src::IIOP::giop-msg-buffer.c38
-rw-r--r--devel/ORBit2/files/patch-src::ORBitutil::compat.c41
-rw-r--r--devel/ORBit2/files/patch-src::ORBitutil::orbit-os-config.h.in12
6 files changed, 235 insertions, 20 deletions
diff --git a/devel/ORBit2/Makefile b/devel/ORBit2/Makefile
index 8426c47c1730..e052ed590230 100644
--- a/devel/ORBit2/Makefile
+++ b/devel/ORBit2/Makefile
@@ -7,7 +7,7 @@
PORTNAME= ORBit
PORTVERSION= 0.5.10
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= stable/sources/ORBit
@@ -26,6 +26,9 @@ CONFIGURE_ARGS= --disable-indent
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LIBS="-L${LOCALBASE}/lib"
+post-patch:
+ @${TOUCH} ${WRKSRC}/configure
+
post-install:
@${ECHO} "ORBIIOPIPv4=0" > ${PREFIX}/etc/orbitrc.default
@${ECHO} "ORBIIOPIPv6=0" >> ${PREFIX}/etc/orbitrc.default
diff --git a/devel/ORBit2/files/patch-ae b/devel/ORBit2/files/patch-ae
index 7ba0a489c38b..7e43d15302c9 100644
--- a/devel/ORBit2/files/patch-ae
+++ b/devel/ORBit2/files/patch-ae
@@ -1,9 +1,12 @@
---- configure.orig Fri Feb 19 00:50:06 1999
-+++ configure Fri Feb 19 00:50:21 1999
-@@ -2499,9 +2499,9 @@
-
+
+$FreeBSD$
+
+--- configure 2001/10/27 12:43:19 1.1
++++ configure 2001/10/27 12:43:58
+@@ -5747,9 +5747,9 @@
rm -f conf.glibtest
+
-GMODULE_CFLAGS=`glib-config --cflags gmodule`
+GMODULE_CFLAGS=`$GLIB_CONFIG --cflags gmodule`
@@ -12,7 +15,96 @@
for ac_prog in 'bison -y' byacc
-@@ -5288,10 +5288,6 @@
+@@ -7273,57 +7273,47 @@
+ fi
+
+
++echo $ac_n "checking how many vectors writev is capable to handle""... $ac_c" 1>&6
++echo "configure:7278: checking how many vectors writev is capable to handle" >&5
+ if test "$cross_compiling" = yes; then
+- cat >> confdefs.h <<\EOF
+-#define HAVE_LIMITED_WRITEV 1
+-EOF
+-
++ MAXIOV=16
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 7284 "configure"
++#line 7283 "configure"
+ #include "confdefs.h"
+
+-#include <fcntl.h>
++#include <sys/types.h>
+ #include <sys/uio.h>
+-#define NIOVECS 50
+-int main(int argc, char *argv[])
++#include <fcntl.h>
++#include <stdio.h>
++int main()
+ {
+- char dumbuf[20] = "\n";
+- struct iovec iovecs[NIOVECS];
+- int i,fd;
+-
+- for(i = 0; i < NIOVECS; i++) {
+- iovecs[i].iov_base = dumbuf;
+- iovecs[i].iov_len = 1;
+- }
+-
+- fd=open("/dev/null", O_WRONLY);
+- if(fd==-1)
+- return(1);
+-
+- if(writev(fd, iovecs, NIOVECS) < 0)
+- return 1;
+-
++ FILE *f;
++ int fd, i;
++ static struct iovec iovecs[4097];
++ if ((f = fopen("conftestval", "w")) == NULL || \
++ (fd = open("/dev/null", O_WRONLY)) < 0)
++ exit(1);
++ for (i = 1; i < 4098 && writev(fd, iovecs, i) >= 0; i++);
++ fprintf(f, "%d\n", i - 1);
++ fclose(f);
+ close(fd);
+- return 0;
++ exit(0);
+ }
+
+ EOF
+-if { (eval echo configure:7313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
++if { (eval echo configure:7306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+- :
++ MAXIOV=`cat conftestval`
+ else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+- cat >> confdefs.h <<\EOF
+-#define HAVE_LIMITED_WRITEV 1
+-EOF
+-
++ MAXIOV=16
+ fi
+ rm -fr conftest*
+ fi
+-
++echo "$ac_t""$MAXIOV" 1>&6
+
+
+ #######################
+@@ -8260,7 +8250,7 @@
+ s%@LIB_WRAP@%$LIB_WRAP%g
+ s%@HAVE_HOSTS_ACCESS_TRUE@%$HAVE_HOSTS_ACCESS_TRUE%g
+ s%@HAVE_HOSTS_ACCESS_FALSE@%$HAVE_HOSTS_ACCESS_FALSE%g
+-s%@HAVE_LIMITED_WRITEV@%$HAVE_LIMITED_WRITEV%g
++s%@MAXIOV@%$MAXIOV%g
+ s%@subdirs@%$subdirs%g
+ s%@pkglibdir@%$pkglibdir%g
+
+@@ -8584,10 +8574,6 @@
*) # Relative path.
ac_sub_cache_file="$ac_dots$cache_file" ;;
esac
diff --git a/devel/ORBit2/files/patch-configure.in b/devel/ORBit2/files/patch-configure.in
new file mode 100644
index 000000000000..abd947f9dfe7
--- /dev/null
+++ b/devel/ORBit2/files/patch-configure.in
@@ -0,0 +1,57 @@
+
+$FreeBSD$
+
+--- configure.in 2001/10/27 12:08:05 1.1
++++ configure.in 2001/10/27 12:33:26
+@@ -241,33 +241,29 @@
+ dnl This generates warnings from autoconf...
+ AC_C_BIGENDIAN
+
++AC_MSG_CHECKING(how many vectors writev is capable to handle)
+ AC_TRY_RUN([
+-#include <fcntl.h>
++#include <sys/types.h>
+ #include <sys/uio.h>
+-#define NIOVECS 50
+-int main(int argc, char *argv[])
++#include <fcntl.h>
++#include <stdio.h>
++int main()
+ {
+- char dumbuf[20] = "\n";
+- struct iovec iovecs[NIOVECS];
+- int i,fd;
+-
+- for(i = 0; i < NIOVECS; i++) {
+- iovecs[i].iov_base = dumbuf;
+- iovecs[i].iov_len = 1;
+- }
+-
+- fd=open("/dev/null", O_WRONLY);
+- if(fd==-1)
+- return(1);
+-
+- if(writev(fd, iovecs, NIOVECS) < 0)
+- return 1;
+-
++ FILE *f;
++ int fd, i;
++ static struct iovec iovecs[4097];
++ if ((f = fopen("conftestval", "w")) == NULL || \
++ (fd = open("/dev/null", O_WRONLY)) < 0)
++ exit(1);
++ for (i = 1; i < 4098 && writev(fd, iovecs, i) >= 0; i++);
++ fprintf(f, "%d\n", i - 1);
++ fclose(f);
+ close(fd);
+- return 0;
++ exit(0);
+ }
+-], , AC_DEFINE(HAVE_LIMITED_WRITEV), AC_DEFINE(HAVE_LIMITED_WRITEV))
+-AC_SUBST(HAVE_LIMITED_WRITEV)
++], MAXIOV=`cat conftestval`, MAXIOV=16, MAXIOV=16)dnl
++AC_MSG_RESULT($MAXIOV)
++AC_SUBST(MAXIOV)
+
+ #######################
+ # type alignment test #
diff --git a/devel/ORBit2/files/patch-src::IIOP::giop-msg-buffer.c b/devel/ORBit2/files/patch-src::IIOP::giop-msg-buffer.c
index a42320410527..d6184df8952a 100644
--- a/devel/ORBit2/files/patch-src::IIOP::giop-msg-buffer.c
+++ b/devel/ORBit2/files/patch-src::IIOP::giop-msg-buffer.c
@@ -1,24 +1,34 @@
$FreeBSD$
---- src/IIOP/giop-msg-buffer.c 2001/10/26 12:42:42 1.1
-+++ src/IIOP/giop-msg-buffer.c 2001/10/26 12:42:53
-@@ -197,7 +197,17 @@
+--- src/IIOP/giop-msg-buffer.c.orig Wed Oct 3 09:51:21 2001
++++ src/IIOP/giop-msg-buffer.c Sat Oct 27 15:52:11 2001
+@@ -34,10 +34,6 @@
+ #include "IIOP.h"
+ #include "IIOP-private.h"
+
+-#ifdef HAVE_LIMITED_WRITEV
+-#define writev g_writev
+-#endif
+-
+ /* type defs */
+
+ #ifdef __GNUC__
+@@ -197,7 +193,7 @@
sum);
}
#endif
- res = writev(fd, curvec, nvecs);
-+ for(sum = 0, t = 0; t < nvecs; t++) {
-+ do {
-+ res = write(fd, curvec[t].iov_base, curvec[t].iov_len);
-+ } while (res < 0 && errno == EAGAIN);
-+ if (res < 0) {
-+ break;
-+ } else
-+ sum += res;
-+ }
-+ if (res >= 0)
-+ res = sum;
++ res = g_writev(fd, curvec, nvecs);
sum = (GIOP_MESSAGE_BUFFER(send_buffer)->message_header.message_size + sizeof(GIOPMessageHeader));
if(res < sum) {
+@@ -227,7 +223,7 @@
+
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK);
+
+- t = writev(fd, curvec, nvecs);
++ t = g_writev(fd, curvec, nvecs);
+
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+
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
diff --git a/devel/ORBit2/files/patch-src::ORBitutil::orbit-os-config.h.in b/devel/ORBit2/files/patch-src::ORBitutil::orbit-os-config.h.in
new file mode 100644
index 000000000000..35697338049f
--- /dev/null
+++ b/devel/ORBit2/files/patch-src::ORBitutil::orbit-os-config.h.in
@@ -0,0 +1,12 @@
+
+$FreeBSD$
+
+--- src/ORBitutil/orbit-os-config.h.in 2001/10/27 12:25:39 1.1
++++ src/ORBitutil/orbit-os-config.h.in 2001/10/27 12:26:13
+@@ -2,5 +2,6 @@
+ #define OS_CONFIG_H 1
+
+ #define ORBIT_HAVE_ALLOCA_H @ORBIT_HAVE_ALLOCA_H@
++#define MAXIOV @MAXIOV@
+
+ #endif