lkml.org 
[lkml]   [2012]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] epoll: Add a flag, EPOLLWAKEUP, to prevent suspend while epoll events are ready
On Tue, Jul 17, 2012 at 9:22 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:

[...]

> I'm going to push your patch for v3.5,

Thanks.

> but then I'm considering the following
> one for v3.6. I wouldn't like to make more changes in v3.5-rc at this point,

Acked-by: Michael Kerrisk <mtk.man-pages@gmail.com>

Thanks,

Michael

> ---
> From: Rafael J. Wysocki <rjw@sisk.pl>
> Subject: PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
>
> Require processes wanting to use the wake_lock/wake_unlock sysfs
> files to have the CAP_BLOCK_SUSPEND capability, which also is
> required for the eventpoll EPOLLWAKEUP flag to be effective, so that
> all interfaces related to blocking autosleep depend on the same
> capability.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> kernel/power/wakelock.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> Index: linux/kernel/power/wakelock.c
> ===================================================================
> --- linux.orig/kernel/power/wakelock.c
> +++ linux/kernel/power/wakelock.c
> @@ -9,6 +9,7 @@
> * manipulate wakelocks on Android.
> */
>
> +#include <linux/capability.h>
> #include <linux/ctype.h>
> #include <linux/device.h>
> #include <linux/err.h>
> @@ -188,6 +189,9 @@ int pm_wake_lock(const char *buf)
> size_t len;
> int ret = 0;
>
> + if (!capable(CAP_BLOCK_SUSPEND))
> + return -EPERM;
> +
> while (*str && !isspace(*str))
> str++;
>
> @@ -231,6 +235,9 @@ int pm_wake_unlock(const char *buf)
> size_t len;
> int ret = 0;
>
> + if (!capable(CAP_BLOCK_SUSPEND))
> + return -EPERM;
> +
> len = strlen(buf);
> if (!len)
> return -EINVAL;



--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/


\
 
 \ /
  Last update: 2012-07-18 09:41    [W:0.228 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site