[master] 8984f5b Integrage the two-stage SHM creation procedure.
Poul-Henning Kamp
phk at FreeBSD.org
Sat Jan 14 19:43:05 CET 2017
commit 8984f5b0d45794ef5dd6df2d0900db2626fad7a5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat Jan 14 18:42:02 2017 +0000
Integrage the two-stage SHM creation procedure.
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index f06d912..f96e997 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -160,7 +160,6 @@ void mgt_SHM_Init(void);
void mgt_SHM_static_alloc(const void *, ssize_t size,
const char *class, const char *type, const char *ident);
void mgt_SHM_Create(void);
-int mgt_SHM_Commit(void);
void mgt_SHM_Destroy(int keep);
void mgt_SHM_Size_Adjust(void);
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index d480456..77b8cb4 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -549,7 +549,6 @@ mgt_reap_child(void)
mgt_SHM_Destroy(MGT_DO_DEBUG(DBG_VSM_KEEP));
}
mgt_SHM_Create();
- mgt_SHM_Commit();
if (child_state == CH_RUNNING)
child_state = CH_DIED;
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index cc36f27..5ec9a3a 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -772,14 +772,8 @@ main(int argc, char * const *argv)
if (T_arg != NULL)
mgt_cli_telnet(T_arg);
- /* Instantiate VSM */
mgt_SHM_Create();
- if (mgt_SHM_Commit()) {
- MGT_Complain(C_ERR, "Could not commit SHM file");
- u = 2;
- } else {
- u = MGT_Run();
- }
+ u = MGT_Run();
if (eric_fd >= 0)
mgt_eric_im_done(eric_fd, u);
diff --git a/bin/varnishd/mgt/mgt_shmem.c b/bin/varnishd/mgt/mgt_shmem.c
index f0849e9..7ddcefc 100644
--- a/bin/varnishd/mgt/mgt_shmem.c
+++ b/bin/varnishd/mgt/mgt_shmem.c
@@ -257,28 +257,14 @@ mgt_SHM_Create(void)
/* Commit changes, for OS's without coherent VM/buf */
AZ(msync(p, getpagesize(), MS_SYNC));
#endif
-}
-
-/*--------------------------------------------------------------------
- * Commit the VSM
- */
-
-int
-mgt_SHM_Commit(void)
-{
- char fnbuf[64];
- int retval = 0;
-
- bprintf(fnbuf, "%s.%jd", VSM_FILENAME, (intmax_t)getpid());
VJ_master(JAIL_MASTER_FILE);
if (rename(fnbuf, VSM_FILENAME)) {
MGT_Complain(C_ERR, "Rename failed %s -> %s: %s",
fnbuf, VSM_FILENAME, strerror(errno));
(void)unlink(fnbuf);
- retval = -1;
+ exit(1);
}
VJ_master(JAIL_MASTER_LOW);
- return (retval);
}
/*--------------------------------------------------------------------
More information about the varnish-commit
mailing list