From owner-freebsd-current Thu Dec 27 15:24:43 2001 Delivered-To: freebsd-current@freebsd.org Received: from melchior.cuivre.fr.eu.org (melchior.enst.fr [137.194.161.6]) by hub.freebsd.org (Postfix) with ESMTP id EDA5737B405 for ; Thu, 27 Dec 2001 15:24:37 -0800 (PST) Received: from melusine.cuivre.fr.eu.org (melusine.enst.fr [137.194.160.34]) by melchior.cuivre.fr.eu.org (Postfix) with ESMTP id C36277F57; Fri, 28 Dec 2001 00:24:35 +0100 (CET) Received: by melusine.cuivre.fr.eu.org (Postfix, from userid 1000) id 28F4469; Fri, 28 Dec 2001 00:24:34 +0100 (CET) Date: Fri, 28 Dec 2001 00:24:34 +0100 From: Thomas Quinot To: Garance A Drosihn Cc: freebsd-current@FreeBSD.ORG Subject: Re: reboot -p Message-ID: <20011228002434.A10135@melusine.cuivre.fr.eu.org> Reply-To: thomas@cuivre.fr.eu.org References: <47197.1009447811@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: ; from drosih@rpi.edu on Thu, Dec 27, 2001 at 12:43:01PM -0500 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Le 2001-12-27, Garance A Drosihn écrivait : > If I understand your request, you would want > shutdown -p now > to behave the same as > shutdown -r now > if the operating system does not know how to power down the hardware. > Is that what you want? Actually what I want would be more like support for a combination like: shutdown -r -p now (which is currently unsupported because we have assigned one signal that says init 'shutdown -r' and another for 'shutdown -p', but that's not the issue here.) More precisely, right now if you do reboot -p then you have exactly the same behaviour as halt -p I.e. try to power down the system, and if the power down fails, then halt. What I would like to have is a means to try to powerdown the system, and if the powerdown fails, then reboot. This comes in handy in the following scenario: 1. UPS signals impending low battery condition; 2. UPS monitoring daemon starts shutdown; 3. kernel syncs buffers and umounts file systems; 4. using an ad hoc event handler registered in shutdown_final, we then signal the UPS that it can stop outputting AC from the battery backup (this is the powerdown action); If the UPS is still on battery power at stage 4, then it will actually power down the machine. On the other hand, if power was restored after stage 2 (eg while the kernel was flushing its buffers), then the signalling at stage 4 will have no effect and the machine needs to reboot. An alternative solution is to make a special-purpose binary that calls shutdown(2) with RB_POWER set and RB_HALT cleared, or to use a different method altogether for starting that emergency powerdown/reboot sequence. On the other hand, it seems to me that RB_POWER should be the proper way of requesting a powerdown action from the kernel. Thomas. -- Thomas.Quinot@Cuivre.FR.EU.ORG To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message