1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 #
|