sbin/reboot change, -p behavior default for halt

Dmitri Nikulin setagllib at optusnet.com.au
Sat Aug 14 19:59:08 PDT 2004


Category: misc
Severity: non-critical
Priority: low
Class: update
Release: 5.2-CURRENT

Full 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':

(Thunderbird breaks tabbing; actual patch available on 
http://members.optusnet.com.au/setagllib/reboot.patch)


More information about the freebsd-bugbusters mailing list