r834 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Aug 19 21:46:32 CEST 2006


Author: phk
Date: 2006-08-19 21:46:32 +0200 (Sat, 19 Aug 2006)
New Revision: 834

Modified:
   trunk/varnish-cache/bin/varnishd/shmlog.c
Log:
Don't re-mmap the shmlog in the child, we already did it in the management
process and the inherited copy is perfectly fine to use.



Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c	2006-08-18 20:07:37 UTC (rev 833)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c	2006-08-19 19:46:32 UTC (rev 834)
@@ -124,19 +124,12 @@
 VSL_Init(void)
 {
 
-	loghead = mmap(NULL, heritage.vsl_size,
-	    PROT_READ|PROT_WRITE,
-	    MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED,
-	    heritage.vsl_fd, 0);
-	assert(loghead != MAP_FAILED);
-
 	assert(loghead->magic == SHMLOGHEAD_MAGIC);
 	assert(loghead->hdrsize == sizeof *loghead);
-	/* XXX check sanity of loghead */
+	/* XXX more check sanity of loghead  ? */
 	logstart = (unsigned char *)loghead + loghead->start;
 	AZ(pthread_mutex_init(&vsl_mutex, NULL));
 	loghead->starttime = time(NULL);
-	VSL_stats = &loghead->stats;
 	memset(VSL_stats, 0, sizeof *VSL_stats);
 }
 
@@ -181,9 +174,10 @@
 	}
 	heritage.vsl_size = slh.size + slh.start;
 
-	/*
-	 * Call VSL_Init so that we get a VSL_stats pointer in the
-	 * management process as well.
-	 */
-	VSL_Init();
+	loghead = mmap(NULL, heritage.vsl_size,
+	    PROT_READ|PROT_WRITE,
+	    MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED,
+	    heritage.vsl_fd, 0);
+	assert(loghead != MAP_FAILED);
+	VSL_stats = &loghead->stats;
 }




More information about the varnish-commit mailing list