From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VdzIM-0004Bm-Lk for mharc-qemu-trivial@gnu.org; Wed, 06 Nov 2013 04:21:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdzIG-000438-3e for qemu-trivial@nongnu.org; Wed, 06 Nov 2013 04:21:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdzIA-0002xj-0F for qemu-trivial@nongnu.org; Wed, 06 Nov 2013 04:20:56 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:52175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdzHx-0002w2-EU; Wed, 06 Nov 2013 04:20:37 -0500 Received: from [192.168.88.2] (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id 2E5574085D; Wed, 6 Nov 2013 13:20:36 +0400 (MSK) Message-ID: <527A09E4.7090605@msgid.tls.msk.ru> Date: Wed, 06 Nov 2013 13:20:36 +0400 From: Michael Tokarev Organization: Telecom Service, JSC User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130922 Icedove/17.0.9 MIME-Version: 1.0 To: whitearchey References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, qemu-devel Subject: Re: [Qemu-trivial] [PATCH] qga: Fix shutdown command of guest agent to work with SysV X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Nov 2013 09:21:02 -0000 06.11.2013 05:54, whitearchey wrote: > For now guest agent uses following command to shutdown system: > shutdown -P +0 "blabla" > but this syntax works only with shutdown command from systemd or upstart, > because SysV shutdown requires -h switch. > > Following patch changes the command so it works with systemd, upstart and SysV While the patch is one-liner indeed, it is a bit more than trivial. Because it changes things in a non-obvious way, especially when multiple systems are concerned. Cc'ing qemu-devel@ due to this. > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > - execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0", > + execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", Note that shutdown command is not in POSIX, despite the fact that this is put into commands-posix.c Note also that even shutdown from sysvinit on linux has another option, -P, which mean poweroff, while -h means "halt OR poweroff" (the latter is a bit unclear). Does the same work on other *nixes? *BSD? Solaris? Thanks, /mjt From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdzI3-0003wS-QM for qemu-devel@nongnu.org; Wed, 06 Nov 2013 04:20:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdzHx-0002w8-Qf for qemu-devel@nongnu.org; Wed, 06 Nov 2013 04:20:43 -0500 Message-ID: <527A09E4.7090605@msgid.tls.msk.ru> Date: Wed, 06 Nov 2013 13:20:36 +0400 From: Michael Tokarev MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qga: Fix shutdown command of guest agent to work with SysV List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: whitearchey Cc: qemu-trivial@nongnu.org, qemu-devel 06.11.2013 05:54, whitearchey wrote: > For now guest agent uses following command to shutdown system: > shutdown -P +0 "blabla" > but this syntax works only with shutdown command from systemd or upstart, > because SysV shutdown requires -h switch. > > Following patch changes the command so it works with systemd, upstart and SysV While the patch is one-liner indeed, it is a bit more than trivial. Because it changes things in a non-obvious way, especially when multiple systems are concerned. Cc'ing qemu-devel@ due to this. > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > - execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0", > + execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", Note that shutdown command is not in POSIX, despite the fact that this is put into commands-posix.c Note also that even shutdown from sysvinit on linux has another option, -P, which mean poweroff, while -h means "halt OR poweroff" (the latter is a bit unclear). Does the same work on other *nixes? *BSD? Solaris? Thanks, /mjt