From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: [PATCH 5/9] kvm tools: Provide instance name when running 'kvm pause' Date: Wed, 29 Jun 2011 14:02:14 -0400 Message-ID: <1309370538-7947-5-git-send-email-levinsasha928@gmail.com> References: <1309370538-7947-1-git-send-email-levinsasha928@gmail.com> Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, Sasha Levin To: penberg@kernel.org Return-path: Received: from mail-qy0-f174.google.com ([209.85.216.174]:39723 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756541Ab1F2SEf (ORCPT ); Wed, 29 Jun 2011 14:04:35 -0400 Received: by mail-qy0-f174.google.com with SMTP id 29so2667320qyk.19 for ; Wed, 29 Jun 2011 11:04:34 -0700 (PDT) In-Reply-To: <1309370538-7947-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Instead of sending a signal to the first instance found, send it to a specific instance. Signed-off-by: Sasha Levin --- tools/kvm/kvm-pause.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) 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 #include #include +#include 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); } -- 1.7.6