[dovecot-cvs] dovecot configure.in,1.135,1.136 dovecot-example.conf,1.68,1.69

cras at procontrol.fi cras at procontrol.fi
Tue Jul 15 22:26:44 EEST 2003


Update of /home/cvs/dovecot
In directory danu:/tmp/cvs-serv10641

Modified Files:
	configure.in dovecot-example.conf 
Log Message:
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.



Index: configure.in
===================================================================
RCS file: /home/cvs/dovecot/configure.in,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- configure.in	10 Jul 2003 14:45:58 -0000	1.135
+++ configure.in	15 Jul 2003 18:26:42 -0000	1.136
@@ -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"

Index: dovecot-example.conf
===================================================================
RCS file: /home/cvs/dovecot/dovecot-example.conf,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- dovecot-example.conf	11 Jul 2003 22:36:05 -0000	1.68
+++ dovecot-example.conf	15 Jul 2003 18:26:42 -0000	1.69
@@ -234,6 +234,7 @@
 
 # Use mmap() instead of read() to read mail files. read() seems to be a bit
 # faster with my Linux/x86 and it's better with NFS, so that's the default.
+# Note that OpenBSD 3.3 and older don't work right with mail_read_mmaped = yes.
 #mail_read_mmaped = no
 
 # Copy mail to another folders using hard links. This is much faster than
@@ -285,6 +286,11 @@
 # might not work. It could also be a small security risk if you use single UID
 # for multiple users, as the users could ptrace() each others processes then.
 #mail_drop_priv_before_exec = no
+
+# Call mmap() with MS_INVALIDATE flag each time before accessing message
+# indexes. This is currently required with OpenBSD 3.3 and older versions.
+# It's also required if you insist on saving index files over NFS.
+#index_mmap_invalidate = no
 
 # Set max. process size in megabytes. Most of the memory goes to mmap()ing
 # files, so it shouldn't harm much even if this limit is set pretty high.



More information about the dovecot-cvs mailing list