diff mbox

[5/9] kvm tools: Provide instance name when running 'kvm pause'

Message ID 1309370538-7947-5-git-send-email-levinsasha928@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sasha Levin June 29, 2011, 6:02 p.m. UTC
Instead of sending a signal to the first instance found, send it
to a specific instance.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/kvm-pause.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/kvm-pause.c b/tools/kvm/kvm-pause.c
index fdf8714..0cb6f29 100644
--- a/tools/kvm/kvm-pause.c
+++ b/tools/kvm/kvm-pause.c
@@ -5,9 +5,18 @@ 
 #include <kvm/util.h>
 #include <kvm/kvm-cmd.h>
 #include <kvm/kvm-pause.h>
+#include <kvm/kvm.h>
 
 int kvm_cmd_pause(int argc, const char **argv, const char *prefix)
 {
-	signal(SIGUSR2, SIG_IGN);
-	return system("kill -USR2 $(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, SIGUSR2);
 }