123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
#ifndef _LINUX_EVENTPOLL_H
#define _LINUX_EVENTPOLL_H
#include <uapi/linux/eventpoll.h>
#include <uapi/linux/kcmp.h>
struct file;
#ifdef CONFIG_EPOLL
#ifdef CONFIG_KCMP
struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long toff);
#endif
void eventpoll_release_file(struct file *file);
int epoll_sendevents(struct file *file, struct epoll_event __user *events,
int maxevents);
static inline void eventpoll_release(struct file *file)
{
if (likely(!READ_ONCE(file->f_ep)))
return;
eventpoll_release_file(file);
}
struct epoll_key {
struct file *file;
int fd;
} __packed;
int do_epoll_ctl_file(struct file *f, int op, struct epoll_key *tf,
struct epoll_event *epds, bool nonblock);
int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
bool nonblock);
bool is_file_epoll(struct file *f);
static inline int ep_op_has_event(int op)
{
return op != EPOLL_CTL_DEL;
}
#else
static inline void eventpoll_release(struct file *file) {}
#endif
#if defined(CONFIG_ARM) && defined(CONFIG_OABI_COMPAT)
extern struct epoll_event __user *
epoll_put_uevent(__poll_t revents, __u64 data,
struct epoll_event __user *uevent);
#else
static inline struct epoll_event __user *
epoll_put_uevent(__poll_t revents, __u64 data,
struct epoll_event __user *uevent)
{
scoped_user_write_access_size(uevent, sizeof(*uevent), efault) {
unsafe_put_user(revents, &uevent->events, efault);
unsafe_put_user(data, &uevent->data, efault);
}
return uevent+1;
efault:
return NULL;
}
#endif
#endif /* #ifndef _LINUX_EVENTPOLL_H */