summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2010-08-07 10:22:29 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2010-08-07 10:22:29 +0000
commit59e893327bf0336669aa222abe0e15581aea0f69 (patch)
tree6bcaf75e1c15e17fdd8de1565fbae7c8d0c8cd8a /sbin
parenta45e7b2fe4ffe9a726c02cfd85b7deec69030efc (diff)
disable lidsuspend when we are powering down
"I like this" marco@, "Sure" deraadt@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/init/init.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 670a37744d4..9065589fb6f 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.41 2009/10/27 23:59:33 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.42 2010/08/07 10:22:28 phessler Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -1298,6 +1298,17 @@ nice_death(void)
static const int death_sigs[3] = { SIGHUP, SIGTERM, SIGKILL };
int status;
+#if CPU_LIDSUSPEND
+ int lidsuspend_mib[] = {CTL_MACHDEP, CPU_LIDSUSPEND};
+ int dontsuspend = 0;
+
+ if ((death_howto & RB_POWERDOWN) &&
+ (sysctl(lidsuspend_mib, 2, NULL, NULL, &dontsuspend,
+ sizeof(dontsuspend)) < 0))
+ warning("cannot disable lid suspend");
+ }
+#endif
+
for (sp = sessions; sp; sp = sp->se_next) {
sp->se_flags &= ~SE_PRESENT;
sp->se_flags |= SE_SHUTDOWN;