Lines Matching refs:events
95 static void fdevent_subproc_event_func(int fd, unsigned events, void *userdata);
131 ev.events = 0; in fdevent_connect()
147 ev.events = 0; in fdevent_disconnect()
158 static void fdevent_update(fdevent *fde, unsigned events) in fdevent_update() argument
166 ev.events = 0; in fdevent_update()
169 if(events & FDE_READ) ev.events |= EPOLLIN; in fdevent_update()
170 if(events & FDE_WRITE) ev.events |= EPOLLOUT; in fdevent_update()
171 if(events & FDE_ERROR) ev.events |= (EPOLLERR | EPOLLHUP); in fdevent_update()
173 fde->state = (fde->state & FDE_STATEMASK) | events; in fdevent_update()
180 if(ev.events) { in fdevent_update()
195 if(ev.events) { in fdevent_update()
206 struct epoll_event events[256]; in fdevent_process() local
210 n = epoll_wait(epoll_fd, events, 256, -1); in fdevent_process()
219 struct epoll_event *ev = events + i; in fdevent_process()
222 if(ev->events & EPOLLIN) { in fdevent_process()
223 fde->events |= FDE_READ; in fdevent_process()
225 if(ev->events & EPOLLOUT) { in fdevent_process()
226 fde->events |= FDE_WRITE; in fdevent_process()
228 if(ev->events & (EPOLLERR | EPOLLHUP)) { in fdevent_process()
229 fde->events |= FDE_ERROR; in fdevent_process()
231 if(fde->events) { in fdevent_process()
281 static void fdevent_update(fdevent *fde, unsigned events) in fdevent_update() argument
283 if(events & FDE_READ) { in fdevent_update()
288 if(events & FDE_WRITE) { in fdevent_update()
293 if(events & FDE_ERROR) { in fdevent_update()
299 fde->state = (fde->state & FDE_STATEMASK) | events; in fdevent_update()
369 unsigned events; in fdevent_process() local
405 events = 0; in fdevent_process()
406 if(FD_ISSET(i, &rfd)) { events |= FDE_READ; n--; } in fdevent_process()
407 if(FD_ISSET(i, &wfd)) { events |= FDE_WRITE; n--; } in fdevent_process()
408 if(FD_ISSET(i, &efd)) { events |= FDE_ERROR; n--; } in fdevent_process()
410 if(events) { in fdevent_process()
415 fde->events |= events; in fdevent_process()
418 fde->fd, fde->events, fde->state); in fdevent_process()
509 unsigned events = fde->events; in fdevent_call_fdfunc() local
510 fde->events = 0; in fdevent_call_fdfunc()
514 fde->func(fde->fd, events, fde->arg); in fdevent_call_fdfunc()
566 subproc_fde->events |= FDE_READ; in fdevent_subproc_event_func()
624 fde->events = 0; in fdevent_remove()
628 void fdevent_set(fdevent *fde, unsigned events) in fdevent_set() argument
630 events &= FDE_EVENTMASK; in fdevent_set()
632 if((fde->state & FDE_EVENTMASK) == events) return; in fdevent_set()
635 fdevent_update(fde, events); in fdevent_set()
639 fde->state = (fde->state & FDE_STATEMASK) | events; in fdevent_set()
646 fde->events &= (~events); in fdevent_set()
647 if(fde->events == 0) { in fdevent_set()
654 void fdevent_add(fdevent *fde, unsigned events) in fdevent_add() argument
657 fde, (fde->state & FDE_EVENTMASK) | (events & FDE_EVENTMASK)); in fdevent_add()
660 void fdevent_del(fdevent *fde, unsigned events) in fdevent_del() argument
663 fde, (fde->state & FDE_EVENTMASK) & (~(events & FDE_EVENTMASK))); in fdevent_del()