[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKgNAkgudHT_PC7OnjmbL1eL2dssFeLcxp90kSFTZkqGuFaa=w@mail.gmail.com>
Date: Wed, 18 Jul 2012 08:41:37 +0200
From: "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Arve Hjønnevåg <arve@...roid.com>,
NeilBrown <neilb@...e.de>,
Linux PM list <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Magnus Damm <magnus.damm@...il.com>, markgross@...gnar.org,
Matthew Garrett <mjg@...hat.com>,
Greg KH <gregkh@...uxfoundation.org>,
John Stultz <john.stultz@...aro.org>,
Brian Swetland <swetland@...gle.com>,
Alan Stern <stern@...land.harvard.edu>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>, mtk@....net
Subject: Re: [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@...k.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@...il.com>
Thanks,
Michael
> ---
> From: Rafael J. Wysocki <rjw@...k.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@...k.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/
--
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