misc/70476: sbin/reboot change, -p behavior default for halt

Dmitri Nikulin setagllib at optusnet.com.au
Sun Aug 15 03:50:13 PDT 2004


>Number:         70476
>Category:       misc
>Synopsis:       sbin/reboot change, -p behavior default for halt
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 15 10:50:13 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Dmitri Nikulin
>Release:        5.2-CURRENT
>Organization:
>Environment:
>Description:
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).
>How-To-Repeat:
halt without -p
>Fix:
diff -ruN reboot/reboot.8 reboot.new/reboot.8
--- reboot/reboot.8    2004-07-31 22:11:35.000000000 +1000
+++ reboot.new/reboot.8    2004-08-15 22:47:20.349003304 +1000
@@ -112,6 +112,7 @@
or
.Nm
was called.
+(If called as halt, this is the default)
.El
.Pp
The
diff -ruN reboot/reboot.c reboot.new/reboot.c
--- reboot/reboot.c    2004-07-31 22:11:35.000000000 +1000
+++ reboot.new/reboot.c    2004-08-15 22:41:12.656901000 +1000
@@ -72,10 +72,10 @@

    if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) {
        dohalt = 1;
-        howto = RB_HALT;
+        howto = RB_HALT|RB_POWEROFF;
    } else
        howto = 0;
-    kflag = lflag = nflag = qflag = 0;
+    kflag = lflag = nflag = qflag = pflag = 0;
    while ((ch = getopt(argc, argv, "dk:lnpq")) != -1)
        switch(ch) {
        case 'd': 

(Unbroken copy at http://members.optusnet.com.au/setagllib/reboot.patch)
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list