disabling sleep when shutting down
Colin Percival
cperciva at freebsd.org
Sat Sep 26 18:56:34 UTC 2015
On 09/26/15 10:59, Ian Smith wrote:
> On Sat, 26 Sep 2015 00:26:31 -0700, Colin Percival wrote:
> > Points without consensus:
> > * jkim thinks we should prevent suspend when we're dropping to single-user
> > mode; I'm not sure I see the point, but I don't think there's any harm in
> > doing that too.
>
> We should prevent suspending _during_ shutdown to SU, of course. Once
> happily in SU, is there any reason to disallow suspend? I've done it.
I think the question here was about suspending during the shutdown to
single-user mode. This seemed a bit different to me since it's not a
"walk away from your laptop" sort of situation. But I've included it
(or rather, not *excluded* it) anyway.
> > * Ian Smith would like to have suspend blocked for the last 5 minutes before
> > shutdown(8) signals init to shut the system down. I don't think anyone else
> > has expressed a desire for this, and some people have raised concerns about
> > blocking suspend for too long in case a system is running out of battery; so
> > I'm inclined to leave this out at this point. (It would be easy enough to
> > add the sysctl-frobbing to shutdown(8) if desired later.)
>
> Sorry, but that rather misrepresents my position; I was trying to deal
> specifically with the LID foot-shooting potential, in the case of user-
> initiated shutdown, so looking at possible mechanisms. Not to worry, I
> clearly didn't express myself clearly :^\
Ok, so you're satisfied with having the suspend-disabling triggered by
init (i.e., not happening until shutdown(8) reaches "now")?
> +static void
> +block_suspend(int block)
> +{
> +
> + sysctlbyname("kern.suspend_blocked", NULL, NULL, &block,
> sizeof(block));
> +}
>
> This doesn't appear to get called?
Err, yes. I wrote a helper function, then decided that since it was
just one line I really didn't need to make it a helper function.
Pretend it isn't there. ;-)
> Any idea if any of this may not be straightforward to MFC, to 9 maybe?
Should be trivial to MFC.
--
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
More information about the freebsd-acpi
mailing list