From patchwork Thu Dec 10 11:33:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Psota X-Patchwork-Id: 40799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4ED59B6F0D for ; Thu, 10 Dec 2009 22:34:38 +1100 (EST) Received: from localhost ([127.0.0.1]:42657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIhI3-0006w4-7Q for incoming@patchwork.ozlabs.org; Thu, 10 Dec 2009 06:34:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIhHL-0006uJ-RD for qemu-devel@nongnu.org; Thu, 10 Dec 2009 06:33:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIhHH-0006rg-3C for qemu-devel@nongnu.org; Thu, 10 Dec 2009 06:33:51 -0500 Received: from [199.232.76.173] (port=33059 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIhHG-0006rW-Rw for qemu-devel@nongnu.org; Thu, 10 Dec 2009 06:33:46 -0500 Received: from mail-px0-f189.google.com ([209.85.216.189]:43573) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIhHG-0007Dw-KH for qemu-devel@nongnu.org; Thu, 10 Dec 2009 06:33:46 -0500 Received: by pxi27 with SMTP id 27so2046804pxi.4 for ; Thu, 10 Dec 2009 03:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=00xbFMvOnewaH/7TQQ7qH04Tiwr+vt2GmtBnbagGYn4=; b=udBq9hAHgd28M4r+uvv1PF7/5aC2ci+BB+z+YgGyWUNFa3WWayNcHHMS9hwt1q/Ydt Cj2UPrZxYGZuhHf4tzuEmDyEeUelPtX037F84lBVIerB4Dzo/Q4HDZeTfx9zRQ98vbUA Y2cFttulF1dFyQYIZBN+luRSORHhyNgI0D+nU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=TlK02KtgQGCFZ7Pv32GjkxEqS8hHPMT+Eg37XRFUfgWE5x4EidVo8DFcNYKVg3EAhZ B85sBMqjvZJwc07VaY9r5lgiRC6wDY5esCy4fV2idM3SKwU3fVmb085S99x3Vogfsh4t G11w75lr6JySVcCbTJLMTgQYHueZL/86Ejk24= MIME-Version: 1.0 Received: by 10.114.189.8 with SMTP id m8mr19410892waf.180.1260444825050; Thu, 10 Dec 2009 03:33:45 -0800 (PST) Date: Thu, 10 Dec 2009 12:33:44 +0100 Message-ID: <233e0fa20912100333s38992cb0w2f956016049b5b3@mail.gmail.com> From: Jan Psota To: qemu-devel@nongnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] qemu-kvm guest shutdown on signal -- patch X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It would be useful if you include this addition to qemu code. I often use Windows on virtual qemu machines and I think that there is no more elegant way to shut them down (any other OS too!), than by killing qemu with signal it does not use for other purposes. // termsig_handler() is not consistent with other _handler names, // it would look better as sigterm_handler() --- Jan Psota --- vl.c.orig 2009-09-23 09:30:02.000000000 +0200 +++ vl.c 2009-12-08 21:31:57.275033029 +0100 @@ -4742,6 +4742,11 @@ qemu_system_shutdown_request(); } +static void sigquit_handler(int signal) +{ + qemu_system_powerdown_request(); +} + static void sigchld_handler(int signal) { waitpid(-1, NULL, WNOHANG); @@ -4757,6 +4762,9 @@ sigaction(SIGHUP, &act, NULL); sigaction(SIGTERM, &act, NULL); + act.sa_handler = sigquit_handler; + sigaction(SIGQUIT, &act, NULL); + act.sa_handler = sigchld_handler; act.sa_flags = SA_NOCLDSTOP; sigaction(SIGCHLD, &act, NULL);