4
0
Эх сурвалжийг харах

main: Don't ask libqb to handle segv, it doesn't work

segv should be handled by corosync, libqb is not the
place to be handling emergency signals.

This currently requires the head of libqb git tree to
generate a blackbox & coredump in the event of a segfault,
but it's better than the write() spin that currently happens.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 9 жил өмнө
parent
commit
30771a39a8
1 өөрчлөгдсөн 3 нэмэгдсэн , 37 устгасан
  1. 3 37
      exec/main.c

+ 3 - 37
exec/main.c

@@ -251,40 +251,10 @@ static int32_t sig_exit_handler (int num, void *data)
 
 
 static void sigsegv_handler (int num)
 static void sigsegv_handler (int num)
 {
 {
-	(void)signal (SIGSEGV, SIG_DFL);
+	(void)signal (num, SIG_DFL);
 	corosync_blackbox_write_to_file ();
 	corosync_blackbox_write_to_file ();
 	qb_log_fini();
 	qb_log_fini();
-	raise (SIGSEGV);
-}
-
-/*
- * QB wrapper for real signal handler
- */
-static int32_t sig_segv_handler (int num, void *data)
-{
-
-	sigsegv_handler(num);
-
-	return 0;
-}
-
-static void sigabrt_handler (int num)
-{
-	(void)signal (SIGABRT, SIG_DFL);
-	corosync_blackbox_write_to_file ();
-	qb_log_fini();
-	raise (SIGABRT);
-}
-
-/*
- * QB wrapper for real signal handler
- */
-static int32_t sig_abrt_handler (int num, void *data)
-{
-
-	sigabrt_handler(num);
-
-	return 0;
+	raise (num);
 }
 }
 
 
 #define LOCALHOST_IP inet_addr("127.0.0.1")
 #define LOCALHOST_IP inet_addr("127.0.0.1")
@@ -1207,7 +1177,7 @@ int main (int argc, char **argv, char **envp)
 	 * Other signals are registered later via qb_loop_signal_add
 	 * Other signals are registered later via qb_loop_signal_add
 	 */
 	 */
 	(void)signal (SIGSEGV, sigsegv_handler);
 	(void)signal (SIGSEGV, sigsegv_handler);
-	(void)signal (SIGABRT, sigabrt_handler);
+	(void)signal (SIGABRT, sigsegv_handler);
 #if MSG_NOSIGNAL != 0
 #if MSG_NOSIGNAL != 0
 	(void)signal (SIGPIPE, SIG_IGN);
 	(void)signal (SIGPIPE, SIG_IGN);
 #endif
 #endif
@@ -1340,10 +1310,6 @@ int main (int argc, char **argv, char **envp)
 		SIGUSR2, NULL, sig_diag_handler, NULL);
 		SIGUSR2, NULL, sig_diag_handler, NULL);
 	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
 	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
 		SIGINT, NULL, sig_exit_handler, NULL);
 		SIGINT, NULL, sig_exit_handler, NULL);
-	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
-		SIGSEGV, NULL, sig_segv_handler, NULL);
-	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
-		SIGABRT, NULL, sig_abrt_handler, NULL);
 	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
 	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
 		SIGQUIT, NULL, sig_exit_handler, NULL);
 		SIGQUIT, NULL, sig_exit_handler, NULL);
 	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,
 	qb_loop_signal_add(corosync_poll_handle, QB_LOOP_HIGH,