Skip to content

Commit

Permalink
fork: fix pidfd_poll()'s return type
Browse files Browse the repository at this point in the history
pidfd_poll() is defined as returning 'unsigned int' but the
.poll method is declared as returning '__poll_t', a bitwise type.

Fix this by using the proper return type and using the EPOLL
constants instead of the POLL ones, as required for __poll_t.

Fixes: b53b0b9 ("pidfd: add polling support")
Cc: Joel Fernandes (Google) <[email protected]>
Cc: [email protected] # 5.3
Signed-off-by: Luc Van Oostenryck <[email protected]>
Reviewed-by: Christian Brauner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
lucvoo authored and Christian Brauner committed Nov 20, 2019
1 parent af42d34 commit 9e77716
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1708,11 +1708,11 @@ static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)
/*
* Poll support for process exit notification.
*/
static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
static __poll_t pidfd_poll(struct file *file, struct poll_table_struct *pts)
{
struct task_struct *task;
struct pid *pid = file->private_data;
int poll_flags = 0;
__poll_t poll_flags = 0;

poll_wait(file, &pid->wait_pidfd, pts);

Expand All @@ -1724,7 +1724,7 @@ static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
* group, then poll(2) should block, similar to the wait(2) family.
*/
if (!task || (task->exit_state && thread_group_empty(task)))
poll_flags = POLLIN | POLLRDNORM;
poll_flags = EPOLLIN | EPOLLRDNORM;
rcu_read_unlock();

return poll_flags;
Expand Down

0 comments on commit 9e77716

Please sign in to comment.