From owner-svn-src-all@FreeBSD.ORG Sat Jan 1 22:31:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 564C2106566B; Sat, 1 Jan 2011 22:31:31 +0000 (UTC) (envelope-from yar.tikhiy@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8E0AA8FC08; Sat, 1 Jan 2011 22:31:30 +0000 (UTC) Received: by wyf19 with SMTP id 19so12353114wyf.13 for ; Sat, 01 Jan 2011 14:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=c5MPbsAqIHzEZLTuzX+nJ9IZvC2BG4huBvDGwFn3Y18=; b=GAfCqz/pZII0KGeUd7QW0HESJJqc/o+zmM+5x6Q/m2h5lhP8PsvwhBUH3Ux70nqNqD Md4AXkLgClvJv6IYDgw6C+sb+/Ayc3jbwWBRQ5g2NnHMWhcF3GJtSg7CDadePAJM2sWr oEcdf2rmTDXXyf7bLOClAy/c/rTAlikyQvco0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=n1J+JQXbMqosAgO4JuHUwKECJ8ZEzCyj5sZmIwtlEl4D/JeGciuK618S4Qox0vIh0n f3KYZGdD/5M8Dnpe5d8UEzG6u9X9hYo8LSwwGosBJMtSuSPZnPhQcT2Z5YTybHx/NS2O pgdYtKN8DXVhDZzNn4NqgY3mlNF8MAe5zYViM= MIME-Version: 1.0 Received: by 10.227.129.7 with SMTP id m7mr10908037wbs.59.1293919763969; Sat, 01 Jan 2011 14:09:23 -0800 (PST) Sender: yar.tikhiy@gmail.com Received: by 10.227.143.134 with HTTP; Sat, 1 Jan 2011 14:09:23 -0800 (PST) In-Reply-To: <20110101145734.GA72435@stack.nl> References: <201012301806.oBUI6VcW046731@svn.freebsd.org> <20101231144308.GA55052@stack.nl> <4D1E51BD.8090707@bsdimp.com> <20110101145734.GA72435@stack.nl> Date: Sun, 2 Jan 2011 09:09:23 +1100 X-Google-Sender-Auth: wX00s9Q7yOH5NWZURjE5ls5_A1M Message-ID: From: Yar Tikhiy To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , Warner Losh Subject: Re: svn commit: r216823 - head/sbin/shutdown X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jan 2011 22:31:31 -0000 On Sun, Jan 2, 2011 at 1:57 AM, Jilles Tjoelker wrote: > On Fri, Dec 31, 2010 at 02:57:17PM -0700, Warner Losh wrote: >> On 12/31/2010 07:43, Jilles Tjoelker wrote: >> > On Thu, Dec 30, 2010 at 06:06:31PM +0000, Pawel Jakub Dawidek wrote: >> >> Author: pjd >> >> Date: Thu Dec 30 18:06:31 2010 >> >> New Revision: 216823 >> >> URL: http://svn.freebsd.org/changeset/base/216823 >> >> Log: >> >> =A0 =A0For compatibility with Linux and Solaris add poweroff(8). >> >> =A0 =A0It is implemented as a hard link to shutdown(8) and it is equi= valent of: >> >> =A0 =A0 =A0 =A0 =A0 =A0# shutdown -p now >> > If we go that way, then for consistency reboot(8) and halt(8) should >> > also be equivalent to calling shutdown -r now and shutdown -h now >> > respectively, unless conflicting options are given. Linux has a -f >> > option for what's currently reboot's and halt's default action, and >> > fastboot(8)/fasthalt(8) could also retain the current behaviour. > >> > I would be in favour of this change. >> I'm not sure I'd go this far. =A0I really *LIKE* that halt/reboot is the >> low-level interface that shutdown -r now calls. =A0I'm not sure that >> moving away from this would be a good idea. =A0It cuts out many levels o= f >> indirection that can be useful in many instances. > > But that's not how it works. After printing all the warnings, > shutdown(8) signals init. Ctrl+Alt+Del also signals init (and that's > nontrivial to change, because it's in the kernel). > > Only if the strange -o option is used does shutdown execute reboot(8) or > halt(8). > > I think the canonical low-level interface should be sending signals to > init. reboot(8) and halt(8) doing things on their own should be banished > to non-default options. (Something should be fixed first so that > /etc/rc.d/mixer doesn't destroy the user's settings from single-user > mode.) I'd say we've got two different, if related, issues here. One is how to prevent people from foot-shooting and the system from doing unforeseen harm to itself when the multi-user shutdown procedure is triggered while in single-user mode. Init(8) should know which mode the system is currently in, so it can a) refrain from running /etc/rc.shutdown unless /etc/rc ran, and b) expose the current mode via a sysctl writeable by PID 1 only for the benefit of other system components. The other issue is whether it is OK to change the traditional BSD semantics of reboot(8) and halt(8). At first glance, this doesn't seem to be a good idea. However, it might be that, as soon as issue 1 is fixed, the residual difference between shutdown and reboot/halt won't be that important. Moreover, I dare guess that BSD beginners can be confused by the current reboot/halt semantics and so they can be prone to foot-shooting by leaving no chance to a big and slow daemon to stop properly when in multi-user mode. What seems obvious to us old Unix fogeys isn't necessarily intuitive, natural or optimal. See . :-) Yar