1 #ifndef __LUNAIX_IOPOLL_H
2 #define __LUNAIX_IOPOLL_H
4 #include <lunaix/device.h>
5 #include <lunaix/ds/llist.h>
7 #include <usr/lunaix/poll.h>
9 struct thread; // <lunaix/process.h>
10 struct proc_info; // <lunaix/process.h>
11 struct v_fd; // <lunaix/fs.h>
13 typedef struct llist_header poll_evt_q;
17 struct pollfd** upoll;
24 poll_evt_q evt_listener;
25 struct v_file* file_ref;
26 struct thread* thread;
31 struct iopoller** pollers;
36 iopoll_listen_on(struct iopoller* listener, poll_evt_q* source)
38 llist_append(source, &listener->evt_listener);
42 iopoll_init_evt_q(poll_evt_q* source)
44 llist_init_head(source);
48 iopoll_wake_pollers(poll_evt_q*);
51 iopoll_init(struct iopoll*);
54 iopoll_free(struct proc_info*);
57 iopoll_install(struct thread* thread, struct v_fd* fd);
60 iopoll_remove(struct thread*, int);
63 poll_setrevt(struct poll_info* pinfo, int evt)
65 pinfo->revents = (pinfo->revents & ~evt) | evt;
69 poll_checkevt(struct poll_info* pinfo, int evt)
71 return pinfo->events & evt;
74 #endif /* __LUNAIX_POLL_H */