dovecot-2.2: Fixed compiling on systems without MAP_ANONYMOUS

dovecot at dovecot.org dovecot at dovecot.org
Wed May 7 20:26:45 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/b68e9f4e797f
changeset: 17343:b68e9f4e797f
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 07 23:25:50 2014 +0300
description:
Fixed compiling on systems without MAP_ANONYMOUS
For example OSX.

diffstat:

 src/lib/test-hash-method.c |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (28 lines):

diff -r 96660987de96 -r b68e9f4e797f src/lib/test-hash-method.c
--- a/src/lib/test-hash-method.c	Wed May 07 23:22:13 2014 +0300
+++ b/src/lib/test-hash-method.c	Wed May 07 23:25:50 2014 +0300
@@ -4,6 +4,10 @@
 #include "mmap-util.h"
 #include "hash-method.h"
 
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#  define MAP_ANONYMOUS MAP_ANON
+#endif
+
 static unsigned char *buf;
 static unsigned int buf_size;
 
@@ -33,9 +37,13 @@
 	unsigned int i;
 
 	buf_size = mmap_get_page_size();
+#ifdef MAP_ANONYMOUS
 	buf = mmap(NULL, buf_size*2, PROT_READ | PROT_WRITE,
 		   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	mprotect(buf + buf_size, buf_size, PROT_NONE);
+#else
+	buf = i_malloc(buf_size);
+#endif
 	memset(buf, 0, buf_size);
 
 	for (i = 0; hash_methods[i] != NULL; i++)


More information about the dovecot-cvs mailing list