diff configure.in @ 1622:d22e03714d36 HEAD

index_mmap_invalidate = yes now invalidate memory maps before accessing them. Setting this on should fix some problems with OpenBSD. It should also make it possible to use index files over NFS as long as lock daemon is used. It might be such a good idea however.
author Timo Sirainen <tss@iki.fi>
date Tue, 15 Jul 2003 21:26:42 +0300
parents fcc5d6bb6244
children e31dbc7ca0da
line wrap: on
line diff
--- a/configure.in	Tue Jul 15 15:38:05 2003 +0300
+++ b/configure.in	Tue Jul 15 21:26:42 2003 +0300
@@ -593,6 +593,44 @@
   AC_MSG_RESULT(no)
 ])
 
+dnl * If mmap() plays nicely with write()
+AC_MSG_CHECKING([whether we need to use MS_INVALIDATE with mmaps])
+AC_TRY_RUN([
+  #include <stdio.h>
+  #include <sys/types.h>
+  #include <sys/stat.h>
+  #include <unistd.h>
+  #include <fcntl.h>
+  #include <sys/mman.h>
+  int main() {
+    /* return 0 if we're signed */
+    int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC);
+    void *mem;
+    if (f == -1) {
+      perror("open()");
+      return 1;
+    }
+    write(f, "1", 2);
+    mem = mmap(NULL, 2, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0);
+    if (mem == MAP_FAILED) {
+      perror("mmap()");
+      return 1;
+    }
+    strcpy(mem, "2");
+    msync(mem, 2, MS_SYNC);
+    lseek(f, 0, SEEK_SET);
+    write(f, "3", 2);
+  
+    return strcmp(mem, "3") == 0 ? 0 : 1;
+  }
+],
+  AC_MSG_RESULT(no)
+], [
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(NEED_MS_INVALIDATE,, Define if your mmap() implementation requires use of MS_INVALIDATE to work with write())
+])
+
+
 dnl * Solaris compatible sendfilev()
 AC_CHECK_LIB(sendfile, sendfilev, [
   LIBS="$LIBS -lsendfile"