disabling sleep when shutting down
Jung-uk Kim
jkim at FreeBSD.org
Wed Sep 23 17:17:02 UTC 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 09/23/2015 04:28, Colin Percival wrote:
> On 09/22/15 12:13, Jung-uk Kim wrote:
>>> I didn't want to pollute init with arch-dependent hacks.
>>> Anyway, the attached patch should do what you want (not
>>> tested).
>>
>> Or a simpler hack with sysctl(3) instead of ioctl(2).
>
> Right, this is more like what I was thinking. (I can write patches
> myself btw -- I was asking for help with figuring out the right
> solution, not with the coding itself!)
I don't doubt that. In fact, I wanted to save some electrons because
you can read/write patches and "the code speaks for itself". :-)
> A couple things I'm not sure about though:
>> + /* Temporarily block any suspend requests. */ + len =
>> sizeof(blocked); + block = 1; + if
>> (sysctlbyname("debug.acpi.sleep_blocked", &blocked, &len, +
>> &block, sizeof(block)) == -1) + blocked = 0;
>
> Wouldn't it make sense to wrap this in "if (Reboot)"? That way it
> would block suspend for poweroff / halt / reboot, but not for
> dropping to single-user mode.
I think dropping to single user should be protected, too.
Jung-uk Kim
>> +#if defined(__amd64__) || defined(__i386__) + /* Unblock suspend
>> requests. */ + if (!blocked) +
>> sysctlbyname("debug.acpi.sleep_blocked", NULL, NULL, +
>> &blocked, sizeof(blocked)); +#endif +
>
> And if we restrict the blocking to only happen if (Reboot), is
> there any point unblocking suspend when we're about to call
> reboot(2)?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJWAt6IAAoJEHyflib82/FGoT4H/3eoM/O/Zj80VqT1qBmYiSoa
VFJM/RQ3c0Nvu+a+D0GHoD4G98QFclmqmeQiaSBl6LchgqTPllN3o5l8WTKVisM7
12iFzx5WrfVpdoB8u6l2wMp9YcIvsqPwEAbz+nvaZOHZWpSgjxcjImCoI1nKhHpz
SPF2jkjdTwvPvpDHgfT1GALfDXFPtFGyDZeEin5ntkTm9mJOyxd0v3Jj4iFSRzgc
D1KsTRfIjsygiNHnTvTfuKSOspU4yhlWr+NS3b3hnXpPgOmBhdS8UYjOjVCt03eE
SRfZ9FPqMI8rX8l8AXchxKHpRSkngqGTpUpMdNooqqyNfqGoHwvqQ2nI4NStHsc=
=wzTq
-----END PGP SIGNATURE-----
More information about the freebsd-acpi
mailing list