From patchwork Sat Jul 2 23:52:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 939652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p61NrW99021161 for ; Fri, 1 Jul 2011 23:53:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752046Ab1GAXx1 (ORCPT ); Fri, 1 Jul 2011 19:53:27 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:37668 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750788Ab1GAXx0 (ORCPT ); Fri, 1 Jul 2011 19:53:26 -0400 Received: by mail-ww0-f44.google.com with SMTP id 5so3645497wwe.1 for ; Fri, 01 Jul 2011 16:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=FOhtd/86Jv03QhVa0Ghjbo5VXZ7nyJ0gy+7Q3UcE6Hk=; b=aqZXM8RaET+KLPGROtEwVuoyzDGK78SKt8euAOF1VH0FHHU+8QyNJBOMnVWAmihupq y2nonvsZ8UeZa82HLtbpiJumB1wzaAoUdIxG59ugLCJQdkYd+D8Jc8gnXWraWMcVpI6h 7Wgx3iPROPld0sMjiDVZUar/cPMpy3ns6vJko= Received: by 10.217.2.202 with SMTP id p52mr3329709wes.28.1309564405919; Fri, 01 Jul 2011 16:53:25 -0700 (PDT) Received: from localhost.localdomain ([31.210.184.221]) by mx.google.com with ESMTPS id l53sm1858198weq.23.2011.07.01.16.53.20 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Jul 2011 16:53:25 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, Sasha Levin Subject: [PATCH v2 5/8] kvm tools: Provide instance name when running 'kvm pause' Date: Sat, 2 Jul 2011 19:52:07 -0400 Message-Id: <1309650731-5796-5-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1309650731-5796-1-git-send-email-levinsasha928@gmail.com> References: <1309650731-5796-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 01 Jul 2011 23:53:32 +0000 (UTC) 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); }