From: phessler Date: Sat, 7 Aug 2010 10:22:28 +0000 (+0000) Subject: disable lidsuspend when we are powering down X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d51453aac061168bb373ffd26101e9ab47f5ee6c;p=openbsd disable lidsuspend when we are powering down "I like this" marco@, "Sure" deraadt@ --- 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;