>Then, if the /sys/power/wakeup_count interface is used correctly, the resulting kernel will be able to abort suspend in progress in reaction to wakeup events in the same circumstances in which the original Android kernel would do that. Yet, user space cannot access wakeup source objects, so the part of the wakelocks framework allowing user space to manipulate them has to be replaced with a different mechanics implemented entirely in user space, involving a power manager process and a suitable IPC interface for the processes that would use wakelocks on Android.
Why can't we just create a '/dev/wakelock' device, which calls wakeup_source_create() when it is opened? And add a few ioctl()s to allow userspace to set descriptive names for wakelocks.
Additional userspace IPC framework looks almost exactly like the kernel API.