openbsd-ports/mail/dovecot/patches/patch-src_lib-index_mail-index_c
jolan a07ffc1aaa incorporate megadiff from the author which allows mmaping of index data
on openbsd, related to pr/3291.  bump PKGNAME
2003-07-23 06:03:00 +00:00

37 lines
1.2 KiB
Plaintext

$OpenBSD: patch-src_lib-index_mail-index_c,v 1.1 2003/07/23 06:03:01 jolan Exp $
--- src/lib-index/mail-index.c.orig Sun May 18 07:26:28 2003
+++ src/lib-index/mail-index.c Tue Jul 15 15:17:29 2003
@@ -89,6 +89,15 @@ int mail_index_mmap_update(struct mail_i
if (index->mmap_base != NULL) {
index->header = (struct mail_index_header *) index->mmap_base;
+ if (index->mmap_invalidate) {
+ if (msync(index->mmap_base,
+ index->mmap_used_length,
+ MS_SYNC | MS_INVALIDATE) < 0) {
+ index_set_syscall_error(index, "msync()");
+ return FALSE;
+ }
+ }
+
/* make sure file size hasn't changed */
if (index->header->sync_id == index->sync_id) {
index->mmap_used_length = index->header->used_file_size;
@@ -99,9 +108,13 @@ int mail_index_mmap_update(struct mail_i
return TRUE;
}
- if (msync(index->mmap_base,
- index->mmap_used_length, MS_SYNC) < 0)
- return index_set_syscall_error(index, "msync()");
+ if (!index->mmap_invalidate) {
+ if (msync(index->mmap_base,
+ index->mmap_used_length, MS_SYNC) < 0) {
+ index_set_syscall_error(index, "msync()");
+ return FALSE;
+ }
+ }
if (munmap(index->mmap_base, index->mmap_full_length) < 0)
return index_set_syscall_error(index, "munmap()");