On 09/23/12 22:24, Ted Unangst wrote:
> On Sat, Sep 22, 2012 at 14:01, Theo de Raadt wrote:
>>> 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).
>>
>> it is a bad idea to pull machine/ header files.
> 
> I was going to agree, but that's how sbin/sysctl gets at these
> defines.  So it's that or sys/sysctl.h needs to pull it in itself.

So, if the consensus indeed is that this is the right way to do this,
I'd like to see this tested on various archs to make sure there is
nothing funky going on.

So please test this whether you have a lid to suspend with or not.

OK?

/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) {

Reply via email to