]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Provide instance name when running 'kvm debug'
authorSasha Levin <levinsasha928@gmail.com>
Sat, 2 Jul 2011 23:52:06 +0000 (19:52 -0400)
committerPekka Enberg <penberg@kernel.org>
Sat, 2 Jul 2011 10:07:44 +0000 (13:07 +0300)
Instead of sending a signal to the first instance found, send it
to a specific instance.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/kvm-debug.c

index 58782ddb6d6f9d28f68f243f81ad1600df6f1c6e..432ae84c51db27e2b4dd16a5934cd699b1966b4e 100644 (file)
@@ -1,11 +1,22 @@
-#include <stdio.h>
-#include <string.h>
-
 #include <kvm/util.h>
 #include <kvm/kvm-cmd.h>
 #include <kvm/kvm-debug.h>
+#include <kvm/kvm.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
 
 int kvm_cmd_debug(int argc, const char **argv, const char *prefix)
 {
-       return system("kill -3 $(pidof kvm)");
+       int pid;
+
+       if (argc != 1)
+               die("Usage: kvm debug [instance name]\n");
+
+       pid = kvm__get_pid_by_instance(argv[0]);
+       if (pid < 0)
+               die("Failed locating instance name");
+
+       return kill(pid, SIGQUIT);
 }