[experimental-ims] cc710d5 Explicitly sync the header of the VSM so other processes can read(2) it on kernels without coherent VM/buf (OpenBSD, still ?, really ?)

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:53 CET 2014


commit cc710d56021a4d1927ceedf426cebfff48ef1860
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Aug 9 08:22:24 2012 +0000

    Explicitly sync the header of the VSM so other processes can read(2) it
    on kernels without coherent VM/buf (OpenBSD, still ?, really ?)
    
    Submitted by:	Federico G. Schwindt

diff --git a/bin/varnishd/mgt/mgt_shmem.c b/bin/varnishd/mgt/mgt_shmem.c
index 79f8c41..bc59194 100644
--- a/bin/varnishd/mgt/mgt_shmem.c
+++ b/bin/varnishd/mgt/mgt_shmem.c
@@ -187,8 +187,7 @@ mgt_shm_size(void)
 
 	size = mgt_param.vsl_space + mgt_param.vsm_space;
 	ps = getpagesize();
-	size += ps - 1;
-	size &= ~(ps - 1U);
+	size = RUP2(size, ps);
 	return (size);
 }
 
@@ -247,6 +246,9 @@ mgt_SHM_Create(void)
 		(void)unlink(fnbuf);
 		exit (-1);
 	}
+
+	/* Commit changes, for OS's without coherent VM/buf */
+	AZ(msync(p, getpagesize(), MS_SYNC));
 }
 
 /*--------------------------------------------------------------------



More information about the varnish-commit mailing list