Commit 98448938 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Minor polish



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4871 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 4f3efc10
...@@ -167,6 +167,10 @@ vsl_goodold(int fd, unsigned size) ...@@ -167,6 +167,10 @@ vsl_goodold(int fd, unsigned size)
return (1); return (1);
} }
/*--------------------------------------------------------------------
* Build a new shmlog file
*/
static void static void
vsl_buildnew(const char *fn, unsigned size, int fill) vsl_buildnew(const char *fn, unsigned size, int fill)
{ {
...@@ -178,7 +182,7 @@ vsl_buildnew(const char *fn, unsigned size, int fill) ...@@ -178,7 +182,7 @@ vsl_buildnew(const char *fn, unsigned size, int fill)
(void)unlink(fn); (void)unlink(fn);
vsl_fd = open(fn, O_RDWR | O_CREAT | O_EXCL, 0644); vsl_fd = open(fn, O_RDWR | O_CREAT | O_EXCL, 0644);
if (vsl_fd < 0) { if (vsl_fd < 0) {
fprintf(stderr, "Could not open %s: %s\n", fprintf(stderr, "Could not create %s: %s\n",
fn, strerror(errno)); fn, strerror(errno));
exit (1); exit (1);
} }
...@@ -291,15 +295,14 @@ mgt_SHM_Init(const char *fn, const char *l_arg) ...@@ -291,15 +295,14 @@ mgt_SHM_Init(const char *fn, const char *l_arg)
(void)mlock((void*)loghead, size); (void)mlock((void*)loghead, size);
/* Initialize pool */ /* Initialize pool */
loghead->alloc_seq = 0; loghead->alloc_seq = 0; /* Zero means "inconsistent" */
MEMORY_BARRIER(); VWMB();
memset(&loghead->head, 0, sizeof loghead->head); memset(&loghead->head, 0, sizeof loghead->head);
loghead->head.magic = SHMALLOC_MAGIC; loghead->head.magic = SHMALLOC_MAGIC;
loghead->head.len = loghead->head.len =
(uint8_t*)(loghead) + size - (uint8_t*)&loghead->head; (uint8_t*)(loghead) + size - (uint8_t*)&loghead->head;
bprintf(loghead->head.class, "%s", "Free"); bprintf(loghead->head.class, "%s", "Free");
MEMORY_BARRIER();
VSL_stats = mgt_SHM_Alloc(sizeof *VSL_stats, VSL_stats = mgt_SHM_Alloc(sizeof *VSL_stats,
VSL_CLASS_STAT, VSL_TYPE_STAT, ""); VSL_CLASS_STAT, VSL_TYPE_STAT, "");
...@@ -315,12 +318,10 @@ mgt_SHM_Init(const char *fn, const char *l_arg) ...@@ -315,12 +318,10 @@ mgt_SHM_Init(const char *fn, const char *l_arg)
vsl_log_end = vsl_log_start + s1; vsl_log_end = vsl_log_start + s1;
vsl_log_nxt = vsl_log_start + 1; vsl_log_nxt = vsl_log_start + 1;
*vsl_log_nxt = SLT_ENDMARKER; *vsl_log_nxt = SLT_ENDMARKER;
MEMORY_BARRIER();
*vsl_log_start = random(); *vsl_log_start = random();
MEMORY_BARRIER();
VWMB();
loghead->alloc_seq = random(); loghead->alloc_seq = random();
MEMORY_BARRIER();
} }
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment