Date: Mon, 16 Aug 2004 12:30:30 GMT From: Giorgos Keramidas <keramida@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/70476: sbin/reboot change, -p behavior default for halt Message-ID: <200408161230.i7GCUUBo033848@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/70476; it has been noted by GNATS. From: Giorgos Keramidas <keramida@freebsd.org> To: Dmitri Nikulin <setagllib@optusnet.com.au> Cc: bug-followup@freebsd.org Subject: Re: misc/70476: sbin/reboot change, -p behavior default for halt Date: Mon, 16 Aug 2004 15:22:09 +0300 (EEST) On 2004-08-15 12:58, Dmitri Nikulin wrote: > Power-off functionality is usually expected from systems which support ACPI > even half as well as FreeBSD does, yet the default behavior of halt is a > completely soft shutdown. Environments that use halt (e.g. display managers) > need messy reconfiguration, and users that aren't aware of the -p flag might > never learn about it. Using acpiconf properly achieves the same result but > with even more divergence from what people expect to have to type. > > Applied from src/sbin, this patch makes -p functionality the default for halt > (much like on typical GNU/Linux systems). On Debian GNU/Linux this is not the default behavior. The halt command is equivalent to a power off only when called as "poweroff". The manpage of halt includes: -p When halting the system, do a poweroff. This is the default when halt is called as poweroff. It might also be worth noting that the patch you attached removes the ability to "halt" without powering off completely. If you do change the behavior of halt, then please do it by introducing a new hard-link of reboot called "poweroff". Then the -p option would be easy to set by default for "poweroff" without changing the current behavior of "halt". What do you think of using the following patch instead? %%% Index: Makefile =================================================================== RCS file: /home/ncvs/src/sbin/reboot/Makefile,v retrieving revision 1.13 diff -u -r1.13 Makefile --- Makefile 22 Mar 2004 00:52:27 -0000 1.13 +++ Makefile 16 Aug 2004 12:13:04 -0000 @@ -15,7 +15,8 @@ .endif LINKS= ${BINDIR}/reboot ${BINDIR}/halt ${BINDIR}/reboot ${BINDIR}/fastboot \ - ${BINDIR}/reboot ${BINDIR}/fasthalt + ${BINDIR}/reboot ${BINDIR}/fasthalt \ + ${BINDIR}/reboot ${BINDIR}/poweroff SCRIPTS= nextboot.sh Index: reboot.c =================================================================== RCS file: /home/ncvs/src/sbin/reboot/reboot.c,v retrieving revision 1.20 diff -u -r1.20 reboot.c --- reboot.c 9 Apr 2004 19:58:35 -0000 1.20 +++ reboot.c 16 Aug 2004 12:18:27 -0000 @@ -70,9 +70,13 @@ char *kernel, *p; const char *user; - if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { + p = rindex(argv[0], '/') ? p + 1 : argv[0]; + if (strcmp(p, "halt") == 0) { dohalt = 1; howto = RB_HALT; + } else if (strcmp(p, "poweroff") == 0) { + dohalt = 1; + howto = RB_POWEROFF; } else howto = 0; kflag = lflag = nflag = qflag = 0; %%%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408161230.i7GCUUBo033848>