[4.1] e44e54d start generalizing the signal handler

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Tue Sep 19 14:18:05 UTC 2017


commit e44e54dcce14d5d8114b22aef574d37b830359e8
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.
    
    Conflicts:
    	bin/varnishd/mgt/mgt_child.c

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 1154de5..80bb861 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -273,18 +273,19 @@ 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;
 
-	sprintf(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__,
@@ -389,7 +390,7 @@ mgt_launch_child(struct cli *cli)
 
 		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