Lines Matching refs:epoll

237     engine->u.epoll.fd = -1;  in nxt_epoll_create()
238 engine->u.epoll.mode = mode; in nxt_epoll_create()
239 engine->u.epoll.mchanges = mchanges; in nxt_epoll_create()
240 engine->u.epoll.mevents = mevents; in nxt_epoll_create()
242 engine->u.epoll.signalfd.fd = -1; in nxt_epoll_create()
245 engine->u.epoll.changes = nxt_malloc(sizeof(nxt_epoll_change_t) * mchanges); in nxt_epoll_create()
246 if (engine->u.epoll.changes == NULL) { in nxt_epoll_create()
250 engine->u.epoll.events = nxt_malloc(sizeof(struct epoll_event) * mevents); in nxt_epoll_create()
251 if (engine->u.epoll.events == NULL) { in nxt_epoll_create()
255 engine->u.epoll.fd = epoll_create(1); in nxt_epoll_create()
256 if (engine->u.epoll.fd == -1) { in nxt_epoll_create()
261 nxt_debug(&engine->task, "epoll_create(): %d", engine->u.epoll.fd); in nxt_epoll_create()
319 nxt_debug(&engine->task, "epoll %d free", engine->u.epoll.fd); in nxt_epoll_free()
323 fd = engine->u.epoll.signalfd.fd; in nxt_epoll_free()
333 fd = engine->u.epoll.eventfd.fd; in nxt_epoll_free()
341 fd = engine->u.epoll.fd; in nxt_epoll_free()
347 nxt_free(engine->u.epoll.events); in nxt_epoll_free()
348 nxt_free(engine->u.epoll.changes); in nxt_epoll_free()
350 nxt_memzero(&engine->u.epoll, sizeof(nxt_epoll_engine_t)); in nxt_epoll_free()
361 EPOLLIN | EPOLLOUT | engine->u.epoll.mode); in nxt_epoll_enable()
418 events = EPOLLIN | engine->u.epoll.mode; in nxt_epoll_enable_read()
443 events = EPOLLOUT | engine->u.epoll.mode; in nxt_epoll_enable_write()
474 events = EPOLLOUT | engine->u.epoll.mode; in nxt_epoll_disable_read()
496 events = EPOLLIN | engine->u.epoll.mode; in nxt_epoll_disable_write()
593 engine->u.epoll.fd, ev->fd, op, events); in nxt_epoll_change()
595 if (engine->u.epoll.nchanges >= engine->u.epoll.mchanges) { in nxt_epoll_change()
601 change = &engine->u.epoll.changes[engine->u.epoll.nchanges++]; in nxt_epoll_change()
616 engine->u.epoll.fd, engine->u.epoll.nchanges); in nxt_epoll_commit_changes()
618 change = engine->u.epoll.changes; in nxt_epoll_commit_changes()
619 end = change + engine->u.epoll.nchanges; in nxt_epoll_commit_changes()
626 engine->u.epoll.fd, ev->fd, change->op, in nxt_epoll_commit_changes()
629 ret = epoll_ctl(engine->u.epoll.fd, change->op, ev->fd, &change->event); in nxt_epoll_commit_changes()
633 engine->u.epoll.fd, change->op, ev->fd, nxt_errno); in nxt_epoll_commit_changes()
638 engine->u.epoll.error = 1; in nxt_epoll_commit_changes()
645 engine->u.epoll.nchanges = 0; in nxt_epoll_commit_changes()
689 engine->u.epoll.signalfd.fd, nxt_errno); in nxt_epoll_add_signal()
693 engine->u.epoll.signalfd.fd = fd; in nxt_epoll_add_signal()
701 engine->u.epoll.signalfd.data = engine->signals->handler; in nxt_epoll_add_signal()
702 engine->u.epoll.signalfd.read_work_queue = &engine->fast_work_queue; in nxt_epoll_add_signal()
703 engine->u.epoll.signalfd.read_handler = nxt_epoll_signalfd_handler; in nxt_epoll_add_signal()
704 engine->u.epoll.signalfd.log = engine->task.log; in nxt_epoll_add_signal()
705 engine->u.epoll.signalfd.task = &engine->task; in nxt_epoll_add_signal()
708 ee.data.ptr = &engine->u.epoll.signalfd; in nxt_epoll_add_signal()
710 if (epoll_ctl(engine->u.epoll.fd, EPOLL_CTL_ADD, fd, &ee) != 0) { in nxt_epoll_add_signal()
712 engine->u.epoll.fd, EPOLL_CTL_ADD, fd, nxt_errno); in nxt_epoll_add_signal()
759 engine->u.epoll.post_handler = handler; in nxt_epoll_enable_post()
770 engine->u.epoll.eventfd.fd = eventfd(0, 0); in nxt_epoll_enable_post()
772 if (engine->u.epoll.eventfd.fd == -1) { in nxt_epoll_enable_post()
777 ret = nxt_fd_nonblocking(&engine->task, engine->u.epoll.eventfd.fd); in nxt_epoll_enable_post()
782 nxt_debug(&engine->task, "eventfd(): %d", engine->u.epoll.eventfd.fd); in nxt_epoll_enable_post()
784 engine->u.epoll.eventfd.read_work_queue = &engine->fast_work_queue; in nxt_epoll_enable_post()
785 engine->u.epoll.eventfd.read_handler = nxt_epoll_eventfd_handler; in nxt_epoll_enable_post()
786 engine->u.epoll.eventfd.data = engine; in nxt_epoll_enable_post()
787 engine->u.epoll.eventfd.log = engine->task.log; in nxt_epoll_enable_post()
788 engine->u.epoll.eventfd.task = &engine->task; in nxt_epoll_enable_post()
791 ee.data.ptr = &engine->u.epoll.eventfd; in nxt_epoll_enable_post()
793 ret = epoll_ctl(engine->u.epoll.fd, EPOLL_CTL_ADD, in nxt_epoll_enable_post()
794 engine->u.epoll.eventfd.fd, &ee); in nxt_epoll_enable_post()
801 engine->u.epoll.fd, EPOLL_CTL_ADD, engine->u.epoll.eventfd.fd, in nxt_epoll_enable_post()
817 nxt_debug(task, "eventfd handler, times:%ui", engine->u.epoll.neventfd); in nxt_epoll_eventfd_handler()
828 if (engine->u.epoll.neventfd++ >= 0xFFFFFFFE) { in nxt_epoll_eventfd_handler()
829 engine->u.epoll.neventfd = 0; in nxt_epoll_eventfd_handler()
831 n = read(engine->u.epoll.eventfd.fd, &events, sizeof(uint64_t)); in nxt_epoll_eventfd_handler()
834 engine->u.epoll.eventfd.fd, n, events); in nxt_epoll_eventfd_handler()
838 engine->u.epoll.eventfd.fd, nxt_errno); in nxt_epoll_eventfd_handler()
842 engine->u.epoll.post_handler(task, NULL, NULL); in nxt_epoll_eventfd_handler()
859 ret = write(engine->u.epoll.eventfd.fd, &event, sizeof(uint64_t)); in nxt_epoll_signal()
863 engine->u.epoll.eventfd.fd, nxt_errno); in nxt_epoll_signal()
882 if (engine->u.epoll.nchanges != 0) { in nxt_epoll_poll()
886 if (engine->u.epoll.error) { in nxt_epoll_poll()
887 engine->u.epoll.error = 0; in nxt_epoll_poll()
893 engine->u.epoll.fd, timeout); in nxt_epoll_poll()
895 nevents = epoll_wait(engine->u.epoll.fd, engine->u.epoll.events, in nxt_epoll_poll()
896 engine->u.epoll.mevents, timeout); in nxt_epoll_poll()
902 nxt_debug(&engine->task, "epoll_wait(%d): %d", engine->u.epoll.fd, nevents); in nxt_epoll_poll()
908 engine->u.epoll.fd, err); in nxt_epoll_poll()
915 event = &engine->u.epoll.events[i]; in nxt_epoll_poll()
956 } else if (engine->u.epoll.mode == 0) { in nxt_epoll_poll()
976 } else if (engine->u.epoll.mode == 0) { in nxt_epoll_poll()
991 if (engine->u.epoll.mode == 0) { in nxt_epoll_poll()