[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1110231212480.5199-100000@netrider.rowland.org>
Date: Sun, 23 Oct 2011 12:17:42 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: NeilBrown <neilb@...e.de>
cc: John Stultz <john.stultz@...aro.org>,
"Rafael J. Wysocki" <rjw@...k.pl>,
mark gross <markgross@...gnar.org>,
Linux PM list <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: lsusd - The Linux SUSpend Daemon
On Sun, 23 Oct 2011, NeilBrown wrote:
> > There shouldn't be any trouble about making wakeup_count pollable. It
> > also would need to respect nonblocking reads, which it currently does
> > not do.
>
> Hmm.. you are correct. I wonder why I thought it did support non-blocking
> reads...
> I guess it was the code for handling an interrupted system call.
>
> I feel a bit uncomfortable with the idea of sysfs files that block but I
> don't think I can convincingly argue against it.
> A non-blocking flag could be passed in, but it would be a very messy change -
> lots of function call signatures changing needlessly: we would need a flag
> to the 'show' method ... or add a 'show_nonblock' method which would also be
> ugly.
Right. Sysfs is pretty inflexible.
> But I think there is a need to block - if there is an in-progress event then
> it must be possible to wait for it to complete as it may not be visible to
> userspace until then.
> We could easily enable 'poll' for wakeup_count and then make it always
> non-blocking, but I'm not really sure I want to require programs to use poll,
> only to allow them. And without using poll there is no way to wait.
>
> As wakeup_count really has to be single-access we could possibly fudge
> something by remembering the last value read (like we remember the last value
> written).
A simpler approach would be to add a nonblocking variant:
/sys/power/wakeup_count_nb. It would make sense to support poll for
this file; poll isn't very useful for the wakeup_count file.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists