Date: Wed, 23 Sep 2015 13:17:01 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: Colin Percival <cperciva@freebsd.org>, Anthony Jenkins <Scoobi_doo@yahoo.com>, "freebsd-acpi@freebsd.org" <freebsd-acpi@freebsd.org> Subject: Re: disabling sleep when shutting down Message-ID: <5602DE8D.3020102@FreeBSD.org> In-Reply-To: <560262BF.7090107@freebsd.org> References: <55FA3848.7090802@freebsd.org> <55FB233D.2080000@FreeBSD.org> <55FB48E3.20401@freebsd.org> <55FC4F13.3090603@FreeBSD.org> <55FC57F9.3050702@yahoo.com> <55FE5D54.1030806@freebsd.org> <5601A863.5070406@FreeBSD.org> <560262BF.7090107@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
-----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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5602DE8D.3020102>
