[tip:tools/kvm] kvm tools: Provide instance name when running 'kvm debug'

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

 



Commit-ID:  789f255667a413a71c761f1e50ec956d14033d81
Gitweb:     http://git.kernel.org/tip/789f255667a413a71c761f1e50ec956d14033d81
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Sat, 2 Jul 2011 19:52:06 -0400
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Sat, 2 Jul 2011 13:07:44 +0300

kvm tools: Provide instance name when running 'kvm debug'

Instead of sending a signal to the first instance found, send it
to a specific instance.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/kvm-debug.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/tools/kvm/kvm-debug.c b/tools/kvm/kvm-debug.c
index 58782dd..432ae84 100644
--- a/tools/kvm/kvm-debug.c
+++ b/tools/kvm/kvm-debug.c
@@ -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);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux