aboutsummaryrefslogtreecommitdiff
path: root/os-posix.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2011-03-15 13:56:04 +0200
committerBlue Swirl <blauwirbel@gmail.com>2011-03-26 12:54:42 +0000
commitf64622c401d4975a56b8559e16286231a1d2cfb8 (patch)
tree20912e758f2b1a3be545af99215ef8a7276ac466 /os-posix.c
parentbf6b87a883f4067574764acb76024e34abba4aad (diff)
downloadqemu-arm-f64622c401d4975a56b8559e16286231a1d2cfb8.tar.gz
report that QEMU process was killed by a signal
Currently when rogue script kills QEMU process (using TERM/INT/HUP signal) it looks indistinguishable from system shutdown. Lets report that QEMU was killed and leave some clues about the killer identity. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/os-posix.c b/os-posix.c
index 7971f8620b..eb49e2f177 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -62,9 +62,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)
{
- qemu_system_shutdown_request();
+ qemu_system_killed(info->si_signo, info->si_pid);
}
static void sigchld_handler(int signal)
@@ -77,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);