[master] 66d72f358 Keep vext .so files with -p debug=+vmod_so_keep

Nils Goroll nils.goroll at uplex.de
Tue Aug 2 10:49:06 UTC 2022


commit 66d72f3583ab224de1f1ccd62509a1db95b2b765
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Aug 2 12:45:15 2022 +0200

    Keep vext .so files with -p debug=+vmod_so_keep
    
    Required for seamless debugging.
    
    Alternatives considered:
    - add vext_so_keep debug flag -> overkill
    
    To decide:
    - rename to libso_keep / "Keep copied VMOD/VEXT libraries" ?
      (libso to disambiguate from so for socket option)

diff --git a/bin/varnishd/common/common_vext.c b/bin/varnishd/common/common_vext.c
index 3a4523cc3..fba153627 100644
--- a/bin/varnishd/common/common_vext.c
+++ b/bin/varnishd/common/common_vext.c
@@ -158,14 +158,15 @@ vext_load(void)
 }
 
 void
-vext_cleanup(void)
+vext_cleanup(int do_unlink)
 {
 	struct vext *vp;
 
 	VTAILQ_FOREACH(vp, &vext_list, list) {
 		fprintf(stderr, "ee3 %s\n", VSB_data(vp->vsb));
 		if (vp->vsb != NULL && VSB_len(vp->vsb) > 0) {
-			XXXAZ(unlink(VSB_data(vp->vsb)));
+			if (do_unlink)
+				XXXAZ(unlink(VSB_data(vp->vsb)));
 			VSB_clear(vp->vsb);
 		}
 	}
diff --git a/bin/varnishd/common/heritage.h b/bin/varnishd/common/heritage.h
index 48b0e243d..06dbe177d 100644
--- a/bin/varnishd/common/heritage.h
+++ b/bin/varnishd/common/heritage.h
@@ -133,6 +133,6 @@ extern vsm_lock_f *vsmw_unlock;
 void vext_argument(const char *);
 void vext_copyin(struct vsb *);
 void vext_load(void);
-void vext_cleanup(void);
+void vext_cleanup(int);
 typedef void vext_iter_f(const char *, void *);
 void vext_iter(vext_iter_f *func, void *);
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index a335ce645..6cc52a124 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -285,7 +285,7 @@ mgt_Cflag_atexit(void)
 	/* Only master process */
 	if (getpid() != heritage.mgt_pid)
 		return;
-	vext_cleanup();
+	vext_cleanup(1);
 	VJ_rmdir("vmod_cache");
 	VJ_rmdir("vext_cache");
 	(void)chdir("/");
@@ -986,7 +986,7 @@ main(int argc, char * const *argv)
 	mgt_cli_close_all();
 	VEV_Destroy(&mgt_evb);
 	VJ_master(JAIL_MASTER_SYSTEM);
-	vext_cleanup();
+	vext_cleanup(! MGT_DO_DEBUG(DBG_VMOD_SO_KEEP));
 	(void)rmdir("vext_cache");
 	VJ_master(JAIL_MASTER_LOW);
 	VTAILQ_FOREACH(alp, &arglist, list) {


More information about the varnish-commit mailing list