[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] report that QEMU process was killed by a signal

From: Gleb Natapov
Subject: [Qemu-devel] [PATCH] report that QEMU process was killed by a signal
Date: Mon, 14 Mar 2011 14:58:55 +0200

Currently when rogue script kills QEMU process (using TERM/INT/HUP
signal) it looks indistinguishable from system shutdown. Lets report
that QMEU was killed and leave some clues about the killed identity.

Signed-off-by: Gleb Natapov <address@hidden>
diff --git a/os-posix.c b/os-posix.c
index 38c29d1..7e175e8 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -61,8 +61,9 @@ void os_setup_early_signal_handling(void)
     sigaction(SIGPIPE, &act, NULL);
-static void termsig_handler(int signal)
+static void termsig_handler(int signal, siginfo_t *info, void *c)
+    fprintf(stderr, "Got signal %d from pid %d\n", info->si_signo, 
@@ -76,7 +77,8 @@ void os_setup_signal_handling(void)
     struct sigaction act;
     memset(&act, 0, sizeof(act));
-    act.sa_handler = termsig_handler;
+    act.sa_sigaction = termsig_handler;
+    act.sa_flags = SA_SIGINFO;
     sigaction(SIGINT,  &act, NULL);
     sigaction(SIGHUP,  &act, NULL);
     sigaction(SIGTERM, &act, NULL);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]