]> git.neil.brown.name Git - susman.git/log
susman.git
11 years agowakealarmd: cope with delta between system time and RTC time. master
NeilBrown [Sun, 8 Jul 2012 09:47:31 +0000 (19:47 +1000)]
wakealarmd: cope with delta between system time and RTC time.

If system time is different from RTC time, we need to allow for that
difference when setting an alarm for a wakeup call.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoREADME update
NeilBrown [Sun, 22 Apr 2012 04:38:15 +0000 (14:38 +1000)]
README update

 - new 'susman' daemon
 - suspend_abort() interface
 - other minor details

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoConvert from /var/run to /run
NeilBrown [Sun, 22 Apr 2012 04:23:21 +0000 (14:23 +1000)]
Convert from /var/run to /run

New code should be using /run.  So pretend to be new.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agocycle_watchers: don't write the 'all done' signal until after the rename.
NeilBrown [Sun, 22 Apr 2012 04:23:15 +0000 (14:23 +1000)]
cycle_watchers: don't write the 'all done' signal until after the rename.

When a suspend cycle is finished we move the new 'watching-next' into
place and we write to the old one to make sure any process watching
will notice something has happened.

It is best to write to the file *After* the rename else a process that
notices the file change might make wrong assumptions about the
then-current 'watching' file.

i.e. close a small and probably unimportant race.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agowakealarmd: move timer event from connection to global state.
NeilBrown [Sun, 22 Apr 2012 04:23:04 +0000 (14:23 +1000)]
wakealarmd: move timer event from connection to global state.

Rather than having a separate timer event for each active
connection, we now have a single timer event for all connections.

As we keep a sorted list of connections, this is just as easy to work
with.

And it allows us to re-establish the timer after a suspend/resume.
This is needed as the timer might be made more slack by suspend.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agowakealarmd: missing close()
NeilBrown [Sun, 22 Apr 2012 04:22:56 +0000 (14:22 +1000)]
wakealarmd: missing close()

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosuspend.py: make a 'blocker' class.
NeilBrown [Sun, 22 Apr 2012 04:22:53 +0000 (14:22 +1000)]
suspend.py: make a 'blocker' class.

Rather than using a global variable to hold the file handle on the
'disabled' file, create a class so a class-object can hold it.

12 years agowakealarmd fixes
NeilBrown [Sun, 22 Apr 2012 04:21:41 +0000 (14:21 +1000)]
wakealarmd fixes

1/ make sure to reset the wakealarm before
   write to write a new value.

2/ We need to block suspend if it is *not* already disabled,
   not if it is.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agolsusd: allow clients to abort this suspend cycle.
NeilBrown [Sun, 22 Apr 2012 04:19:19 +0000 (14:19 +1000)]
lsusd: allow clients to abort this suspend cycle.

When an event happens in the kernel, it increments the
wakeup_count which aborts the current suspend cycle.
We need something similar for user-space.

So use the atime of the 'disabled' file.  Any process that
triggers an event for another process to read can simply
read from this file and thus abort the current suspend (if there
is one).

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosuspend.py: we need to updated the watcher when we get a new file to watch.
NeilBrown [Sun, 22 Apr 2012 04:18:15 +0000 (14:18 +1000)]
suspend.py: we need to updated the watcher when we get a new file to watch.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agolsusd: create the initial 'watchers' file.
NeilBrown [Sun, 22 Apr 2012 04:18:03 +0000 (14:18 +1000)]
lsusd: create the initial 'watchers' file.

I wonder how I managed not to have that already.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMakefile: add simple 'install' target
NeilBrown [Sun, 22 Apr 2012 04:17:18 +0000 (14:17 +1000)]
Makefile: add simple 'install' target

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosuspend.py: add function to create/lock the 'immediate' file
NeilBrown [Fri, 16 Mar 2012 02:12:18 +0000 (13:12 +1100)]
suspend.py: add function to create/lock the 'immediate' file

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoRequire process requesting immediate suspend to remain active.
NeilBrown [Fri, 16 Mar 2012 01:49:52 +0000 (12:49 +1100)]
Require process requesting immediate suspend to remain active.

The process that creates 'immediate' must do so while disabling
suspend and must take a lock on the file.
If the process dies, this lock will disappear and auto-suspension
will stop.
This is a good fail-safe for development.

Might be good to make it configurable later.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosuspend.py: add block/unblock support
NeilBrown [Fri, 16 Mar 2012 01:10:07 +0000 (12:10 +1100)]
suspend.py: add block/unblock support

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAdd "susman" daemon
NeilBrown [Fri, 16 Mar 2012 00:36:32 +0000 (11:36 +1100)]
Add "susman" daemon

susman runs all three daemons
 lsusd
 lsused
 wakealarmd

We wait for each to get started before starting the next.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agolsused: exit if cannot bind socket.
NeilBrown [Thu, 15 Mar 2012 20:52:33 +0000 (07:52 +1100)]
lsused: exit if cannot bind socket.

Same for wakealarmd

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agolsusd: add missing unlock of disable file.
NeilBrown [Thu, 15 Mar 2012 20:40:02 +0000 (07:40 +1100)]
lsusd: add missing unlock of disable file.

We shouldn't hold the disable file locked while
alerting watchers.  The comment said that we didn't,
but we did.
So unlock it.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agorequest_suspend: change check for suspend-is-disabled.
NeilBrown [Thu, 15 Mar 2012 20:40:00 +0000 (07:40 +1100)]
request_suspend: change check for suspend-is-disabled.

Both request_suspend and lsusd try to abort the request if suspend is
disabled.  However as they use the same mechanism they can trip over
each other and produce the wrong result.

So leave the primary checking to lsusd.  It will remove  the 'request'
file if needed, so request_suspend will notice.  It can then check
if a suspend actually happened by examining the 'watching' file.

Also: change request_suspend to exit(2) on strange error, and exit(1)
only if suspend was blocked.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agolsusd - a Linux SUSpend Daemon
NeilBrown [Fri, 21 Oct 2011 04:49:17 +0000 (15:49 +1100)]
lsusd - a Linux SUSpend Daemon

Initial commit.

Signed-off-by: NeilBrown <neilb@suse.de>