[master] 88557be start generalizing the signal handler

Nils Goroll nils.goroll at uplex.de
Mon Aug 28 14:05:11 CEST 2017


commit 88557be05d4fcd632e5779f7432706e15660f6d6
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Aug 23 08:37:21 2017 +0200

    start generalizing the signal handler
    
    it was already used for more than SIGSEGV, so we should output the actual
    signal description.

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 183cc5b..d3dcbf0 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -254,18 +254,18 @@ child_poker(const struct vev *e, int what)
 }
 
 /*=====================================================================
- * SIGSEGV handler for child process
+ * signal handler for child process
  */
 
 static void __match_proto__()
-child_sigsegv_handler(int s, siginfo_t *si, void *c)
+child_signal_handler(int s, siginfo_t *si, void *c)
 {
 	char buf[1024];
 
-	(void)s;
 	(void)c;
 
-	bprintf(buf, "Segmentation fault by instruction at %p", si->si_addr);
+	bprintf(buf, "Signal %d (%s) received at %p si_code %d",
+		s, strsignal(s), si->si_addr, si->si_code);
 	VAS_Fail(__func__,
 		 __FILE__,
 		 __LINE__,
@@ -350,7 +350,7 @@ mgt_launch_child(struct cli *cli)
 		mgt_ProcTitle("Child");
 		if (mgt_param.sigsegv_handler) {
 			memset(&sa, 0, sizeof sa);
-			sa.sa_sigaction = child_sigsegv_handler;
+			sa.sa_sigaction = child_signal_handler;
 			sa.sa_flags = SA_SIGINFO;
 			(void)sigaction(SIGSEGV, &sa, NULL);
 			(void)sigaction(SIGBUS, &sa, NULL);



More information about the varnish-commit mailing list