[Pm-utils] [patch commit] POSIXification of pm-utils
victor.lowther at gmail.com
Sat Jan 26 12:47:53 PST 2008
Attached patch against mainline GIT to posixify pm-utils.
Rewrote scripts to make them POSIX compliant.
Changed locking to use directories as locking primitives, because
atomicity of directory creation is enforced by the kernel and mkdir
will fail if a directory already exists. I investigated using
noclobber, but POSIX says to die on redirection failure instead of
returning an error.
Changed location of the main lock to reside in /tmp, so that it will
be automatically cleaned on boot if suspend/resume fails.
Genericised the hook-running infrastructure, modified pm-powersave
to use it instead of implementing its own.
Changed run_hooks to handle going forwards and backwards in one call
When running hooks backwards, run_hooks automatically skips ones that
failed running forwards. This allows hooks to signal that they do
not need to run on resume by returning a non-zero exit status.
Modified module load/unload, service stop/start, and save/restore
state functions to avoid environment variable hackery and (more
important) use of eval where not required.
Simplified get_power_status -- on_ac_power never returns 255, so do
not bother testing for it.
In pm_main, moved unlocking into a trap 0 function so that it will be
called no matter how the script exits. Also modified pm_main to use
the new auto-reversing run_hooks infrastructure.
In modunload, got rid of gratuitous use of seq as well as numerous
Added LC_COLLATE=c so that our sort order will always be stable.
Moved LC_COLLATE=c to pm/functions
Replaced calls to basename with parameter expansion.
Got rid of duplicate hook-running infrastructure
New file that actually does the suspend/hibernate.
Don't save any state if we are not in a system where this applies.
Don't use nonexistent RESUME_MODULES environment variable, just call
the modreload function.
Use new locking infrastructure.
Replace parsing of output of ls with globbing.
Change fallback governor from "userspace" to "performance"
Get rid of redundant tests
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 28894 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/pm-utils/attachments/20080126/aaa1ca05/attachment-0001.bin
More information about the Pm-utils