mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
eventpoll: add epoll_sendevents() helper
Basic helper that copies ready events to the specified userspace address. The event checking is quick and racy, it's up to the caller to ensure it retries appropriately in case 0 events are copied. Signed-off-by: Jens Axboe <axboe@kernel.dk> Link: https://lore.kernel.org/r/20250219172552.1565603-4-axboe@kernel.dk Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
38d2035601
commit
ae3a4f1fdc
@@ -2474,6 +2474,26 @@ static int ep_check_params(struct file *file, struct epoll_event __user *evs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int epoll_sendevents(struct file *file, struct epoll_event __user *events,
|
||||
int maxevents)
|
||||
{
|
||||
struct eventpoll *ep;
|
||||
int ret;
|
||||
|
||||
ret = ep_check_params(file, events, maxevents);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
ep = file->private_data;
|
||||
/*
|
||||
* Racy call, but that's ok - it should get retried based on
|
||||
* poll readiness anyway.
|
||||
*/
|
||||
if (ep_events_available(ep))
|
||||
return ep_try_send_events(ep, events, maxevents);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement the event wait interface for the eventpoll file. It is the kernel
|
||||
* part of the user space epoll_wait(2).
|
||||
|
||||
Reference in New Issue
Block a user