freebsd-ports/devel/ORBit2/files/patch-configure.in
Maxim Sobolev 441ede378e Huh, finally implement writev(2) wrapper that actually works. Boys, never ever
try to use writev(2) in a non-blocking mode, especially on sockets. Not only
this makes handling of EAGAIN rather weird, but in the case of sockets makes
your code subject of a ENOBUFS, which is absolutely unclear how to handle
properly. *sigh*

Bump PORTREVISION.
2001-10-29 17:05:04 +00:00

57 lines
1.2 KiB
Text

$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 #