Ping, ping, on this essentially +1 -1 diff?
Only concern I have is whether #include <machine/cpu.h> could have
side-effects on architectures I don't know of (which, admittedly, is
quite a few).
/Alexander
On 09/12/12 00:43, Alexander Hall wrote:
This pulls in machine/cpu.h so we can see CPU_LIDSUSPEND if it's there.
Also fix the resulting compilation errors now that the code is actually
used.
Tested on my X61s/amd64, where shutting down using the power button now
behaves like halt -p in that it won't suspend while shutting down if I
close the lid.
OK?
On a sidenote, why is the shutdown code duplicated between init and
reboot (a.k.a. halt)? Could we just as well make halt() send SIGUSR2
to init, like acpi does?
/Alexander
Index: init.c
===================================================================
RCS file: /data/openbsd/cvs/src/sbin/init/init.c,v
retrieving revision 1.46
diff -u -p -r1.46 init.c
--- init.c 6 Apr 2012 17:25:00 -0000 1.46
+++ init.c 11 Sep 2012 20:43:20 -0000
@@ -37,6 +37,7 @@
#include <sys/sysctl.h>
#include <sys/wait.h>
#include <sys/reboot.h>
+#include <machine/cpu.h>
#include <db.h>
#include <err.h>
@@ -1313,7 +1314,7 @@ nice_death(void)
static const int death_sigs[3] = { SIGHUP, SIGTERM, SIGKILL };
int status;
-#if CPU_LIDSUSPEND
+#ifdef CPU_LIDSUSPEND
int lidsuspend_mib[] = {CTL_MACHDEP, CPU_LIDSUSPEND};
int dontsuspend = 0;
@@ -1321,7 +1322,6 @@ nice_death(void)
(sysctl(lidsuspend_mib, 2, NULL, NULL, &dontsuspend,
sizeof(dontsuspend)) < 0))
warning("cannot disable lid suspend");
- }
#endif
for (sp = sessions; sp; sp = sp->se_next) {