Skip to content

Commit

Permalink
PM: Rename CAP_EPOLLWAKEUP to CAP_BLOCK_SUSPEND
Browse files Browse the repository at this point in the history
As discussed in
http://thread.gmane.org/gmane.linux.kernel/1249726/focus=1288990,
the capability introduced in 4d7e30d
to govern EPOLLWAKEUP seems misnamed: this capability is about governing
the ability to suspend the system, not using a particular API flag
(EPOLLWAKEUP). We should make the name of the capability more general
to encourage reuse in related cases. (Whether or not this capability
should also be used to govern the use of /sys/power/wake_lock is a
question that needs to be separately resolved.)

This patch renames the capability to CAP_BLOCK_SUSPEND. In order to ensure
that the old capability name doesn't make it out into the wild, could you
please apply and push up the tree to ensure that it is incorporated
for the 3.5 release.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
  • Loading branch information
mkerrisk authored and rjwysocki committed Jul 17, 2012
1 parent 84a1caf commit d9914cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fs/eventpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
goto error_tgt_fput;

/* Check if EPOLLWAKEUP is allowed */
if ((epds.events & EPOLLWAKEUP) && !capable(CAP_EPOLLWAKEUP))
if ((epds.events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
epds.events &= ~EPOLLWAKEUP;

/*
Expand Down
6 changes: 3 additions & 3 deletions include/linux/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@ struct cpu_vfs_cap_data {

#define CAP_WAKE_ALARM 35

/* Allow preventing system suspends while epoll events are pending */
/* Allow preventing system suspends */

#define CAP_EPOLLWAKEUP 36
#define CAP_BLOCK_SUSPEND 36

#define CAP_LAST_CAP CAP_EPOLLWAKEUP
#define CAP_LAST_CAP CAP_BLOCK_SUSPEND

#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)

Expand Down
2 changes: 1 addition & 1 deletion include/linux/eventpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* re-allowed until epoll_wait is called again after consuming the wakeup
* event(s).
*
* Requires CAP_EPOLLWAKEUP
* Requires CAP_BLOCK_SUSPEND
*/
#define EPOLLWAKEUP (1 << 29)

Expand Down

0 comments on commit d9914cf

Please sign in to comment.