From patchwork Wed Jun 29 18:02:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 929902 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5TI4f9X001053 for ; Wed, 29 Jun 2011 18:04:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756912Ab1F2SEh (ORCPT ); Wed, 29 Jun 2011 14:04:37 -0400 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) 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=T0H/0bNnqk/xNRjJDF+ZqRWjHBVqmA2r8mZedaBT4uPUE6VnvgSe0Zv7EB/sqT0809 ybIYLcBVErIi6xhIQzqP2WUw4iawxZWTVdydzyTft6J/53iKT7EM2g+F2i4Vr1q/zD8O H5lQgUZbh44NEEvKPCP+XrGitanHXLT+bB3QI= Received: by 10.229.106.134 with SMTP id x6mr815864qco.191.1309370674671; Wed, 29 Jun 2011 11:04:34 -0700 (PDT) Received: from localhost.localdomain (c-71-232-157-243.hsd1.ma.comcast.net [71.232.157.243]) by mx.google.com with ESMTPS id e18sm1067677qcs.29.2011.06.29.11.04.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Jun 2011 11:04:34 -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 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> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1309370538-7947-1-git-send-email-levinsasha928@gmail.com> References: <1309370538-7947-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 (demeter1.kernel.org [140.211.167.41]); Wed, 29 Jun 2011 18:04:41 +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); }