Lines Matching refs:ev

45 static void nxt_epoll_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
46 static void nxt_epoll_disable(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
47 static void nxt_epoll_delete(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
49 nxt_fd_event_t *ev);
51 nxt_fd_event_t *ev);
53 nxt_fd_event_t *ev);
55 nxt_fd_event_t *ev);
57 nxt_fd_event_t *ev);
59 nxt_fd_event_t *ev);
61 nxt_fd_event_t *ev);
63 nxt_fd_event_t *ev);
65 nxt_fd_event_t *ev);
67 nxt_fd_event_t *ev);
68 static void nxt_epoll_change(nxt_event_engine_t *engine, nxt_fd_event_t *ev,
355 nxt_epoll_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_enable() argument
357 ev->read = NXT_EVENT_ACTIVE; in nxt_epoll_enable()
358 ev->write = NXT_EVENT_ACTIVE; in nxt_epoll_enable()
360 nxt_epoll_change(engine, ev, EPOLL_CTL_ADD, in nxt_epoll_enable()
366 nxt_epoll_disable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_disable() argument
368 if (ev->read > NXT_EVENT_DISABLED || ev->write > NXT_EVENT_DISABLED) { in nxt_epoll_disable()
370 ev->read = NXT_EVENT_INACTIVE; in nxt_epoll_disable()
371 ev->write = NXT_EVENT_INACTIVE; in nxt_epoll_disable()
373 nxt_epoll_change(engine, ev, EPOLL_CTL_DEL, 0); in nxt_epoll_disable()
379 nxt_epoll_delete(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_delete() argument
381 if (ev->read != NXT_EVENT_INACTIVE || ev->write != NXT_EVENT_INACTIVE) { in nxt_epoll_delete()
383 ev->read = NXT_EVENT_INACTIVE; in nxt_epoll_delete()
384 ev->write = NXT_EVENT_INACTIVE; in nxt_epoll_delete()
386 nxt_epoll_change(engine, ev, EPOLL_CTL_DEL, 0); in nxt_epoll_delete()
401 nxt_epoll_close(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_close() argument
403 nxt_epoll_delete(engine, ev); in nxt_epoll_close()
405 return ev->changing; in nxt_epoll_close()
410 nxt_epoll_enable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_enable_read() argument
415 if (ev->read != NXT_EVENT_BLOCKED) { in nxt_epoll_enable_read()
420 if (ev->read == NXT_EVENT_INACTIVE && ev->write == NXT_EVENT_INACTIVE) { in nxt_epoll_enable_read()
423 } else if (ev->write >= NXT_EVENT_BLOCKED) { in nxt_epoll_enable_read()
427 nxt_epoll_change(engine, ev, op, events); in nxt_epoll_enable_read()
430 ev->read = NXT_EVENT_ACTIVE; in nxt_epoll_enable_read()
435 nxt_epoll_enable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_enable_write() argument
440 if (ev->write != NXT_EVENT_BLOCKED) { in nxt_epoll_enable_write()
445 if (ev->read == NXT_EVENT_INACTIVE && ev->write == NXT_EVENT_INACTIVE) { in nxt_epoll_enable_write()
448 } else if (ev->read >= NXT_EVENT_BLOCKED) { in nxt_epoll_enable_write()
452 nxt_epoll_change(engine, ev, op, events); in nxt_epoll_enable_write()
455 ev->write = NXT_EVENT_ACTIVE; in nxt_epoll_enable_write()
460 nxt_epoll_disable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_disable_read() argument
465 ev->read = NXT_EVENT_INACTIVE; in nxt_epoll_disable_read()
467 if (ev->write <= NXT_EVENT_DISABLED) { in nxt_epoll_disable_read()
468 ev->write = NXT_EVENT_INACTIVE; in nxt_epoll_disable_read()
477 nxt_epoll_change(engine, ev, op, events); in nxt_epoll_disable_read()
482 nxt_epoll_disable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_disable_write() argument
487 ev->write = NXT_EVENT_INACTIVE; in nxt_epoll_disable_write()
489 if (ev->read <= NXT_EVENT_DISABLED) { in nxt_epoll_disable_write()
490 ev->read = NXT_EVENT_INACTIVE; in nxt_epoll_disable_write()
499 nxt_epoll_change(engine, ev, op, events); in nxt_epoll_disable_write()
504 nxt_epoll_block_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_block_read() argument
506 if (ev->read != NXT_EVENT_INACTIVE) { in nxt_epoll_block_read()
507 ev->read = NXT_EVENT_BLOCKED; in nxt_epoll_block_read()
513 nxt_epoll_block_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_block_write() argument
515 if (ev->write != NXT_EVENT_INACTIVE) { in nxt_epoll_block_write()
516 ev->write = NXT_EVENT_BLOCKED; in nxt_epoll_block_write()
535 nxt_epoll_oneshot_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_oneshot_read() argument
539 op = (ev->read == NXT_EVENT_INACTIVE && ev->write == NXT_EVENT_INACTIVE) ? in nxt_epoll_oneshot_read()
542 ev->read = NXT_EVENT_ONESHOT; in nxt_epoll_oneshot_read()
543 ev->write = NXT_EVENT_INACTIVE; in nxt_epoll_oneshot_read()
545 nxt_epoll_change(engine, ev, op, EPOLLIN | EPOLLONESHOT); in nxt_epoll_oneshot_read()
550 nxt_epoll_oneshot_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_oneshot_write() argument
554 op = (ev->read == NXT_EVENT_INACTIVE && ev->write == NXT_EVENT_INACTIVE) ? in nxt_epoll_oneshot_write()
557 ev->read = NXT_EVENT_INACTIVE; in nxt_epoll_oneshot_write()
558 ev->write = NXT_EVENT_ONESHOT; in nxt_epoll_oneshot_write()
560 nxt_epoll_change(engine, ev, op, EPOLLOUT | EPOLLONESHOT); in nxt_epoll_oneshot_write()
565 nxt_epoll_enable_accept(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_epoll_enable_accept() argument
569 ev->read = NXT_EVENT_ACTIVE; in nxt_epoll_enable_accept()
577 nxt_epoll_change(engine, ev, EPOLL_CTL_ADD, events); in nxt_epoll_enable_accept()
587 nxt_epoll_change(nxt_event_engine_t *engine, nxt_fd_event_t *ev, int op, in nxt_epoll_change() argument
592 nxt_debug(ev->task, "epoll %d set event: fd:%d op:%d ev:%XD", in nxt_epoll_change()
593 engine->u.epoll.fd, ev->fd, op, events); in nxt_epoll_change()
599 ev->changing = 1; in nxt_epoll_change()
604 change->event.data.ptr = ev; in nxt_epoll_change()
612 nxt_fd_event_t *ev; in nxt_epoll_commit_changes() local
622 ev = change->event.data.ptr; in nxt_epoll_commit_changes()
623 ev->changing = 0; in nxt_epoll_commit_changes()
625 nxt_debug(ev->task, "epoll_ctl(%d): fd:%d op:%d ev:%XD", 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()
632 nxt_alert(ev->task, "epoll_ctl(%d, %d, %d) failed %E", in nxt_epoll_commit_changes()
633 engine->u.epoll.fd, change->op, ev->fd, nxt_errno); in nxt_epoll_commit_changes()
636 nxt_epoll_error_handler, ev->task, ev, ev->data); in nxt_epoll_commit_changes()
652 nxt_fd_event_t *ev; in nxt_epoll_error_handler() local
654 ev = obj; in nxt_epoll_error_handler()
656 ev->read = NXT_EVENT_INACTIVE; in nxt_epoll_error_handler()
657 ev->write = NXT_EVENT_INACTIVE; in nxt_epoll_error_handler()
659 ev->error_handler(ev->task, ev, data); in nxt_epoll_error_handler()
725 nxt_fd_event_t *ev; in nxt_epoll_signalfd_handler() local
729 ev = obj; in nxt_epoll_signalfd_handler()
734 n = read(ev->fd, &sfd, sizeof(struct signalfd_siginfo)); in nxt_epoll_signalfd_handler()
736 nxt_debug(task, "read signalfd(%d): %d", ev->fd, n); in nxt_epoll_signalfd_handler()
739 nxt_alert(task, "read signalfd(%d) failed %E", ev->fd, nxt_errno); in nxt_epoll_signalfd_handler()
743 nxt_debug(task, "signalfd(%d) signo:%d", ev->fd, sfd.ssi_signo); in nxt_epoll_signalfd_handler()
879 nxt_fd_event_t *ev; in nxt_epoll_poll() local
917 ev = event->data.ptr; in nxt_epoll_poll()
919 nxt_debug(ev->task, "epoll: fd:%d ev:%04XD d:%p rd:%d wr:%d", in nxt_epoll_poll()
920 ev->fd, events, ev, ev->read, ev->write); in nxt_epoll_poll()
927 ev->epoll_error = error; in nxt_epoll_poll()
930 && ev->read <= NXT_EVENT_BLOCKED in nxt_epoll_poll()
931 && ev->write <= NXT_EVENT_BLOCKED) in nxt_epoll_poll()
938 ev->epoll_eof = ((events & EPOLLRDHUP) != 0); in nxt_epoll_poll()
943 ev->read_ready = 1; in nxt_epoll_poll()
945 if (ev->read != NXT_EVENT_BLOCKED) { in nxt_epoll_poll()
947 if (ev->read == NXT_EVENT_ONESHOT) { in nxt_epoll_poll()
948 ev->read = NXT_EVENT_DISABLED; in nxt_epoll_poll()
951 nxt_work_queue_add(ev->read_work_queue, ev->read_handler, in nxt_epoll_poll()
952 ev->task, ev, ev->data); in nxt_epoll_poll()
958 nxt_epoll_disable_read(engine, ev); in nxt_epoll_poll()
963 ev->write_ready = 1; in nxt_epoll_poll()
965 if (ev->write != NXT_EVENT_BLOCKED) { in nxt_epoll_poll()
967 if (ev->write == NXT_EVENT_ONESHOT) { in nxt_epoll_poll()
968 ev->write = NXT_EVENT_DISABLED; in nxt_epoll_poll()
971 nxt_work_queue_add(ev->write_work_queue, ev->write_handler, in nxt_epoll_poll()
972 ev->task, ev, ev->data); in nxt_epoll_poll()
978 nxt_epoll_disable_write(engine, ev); in nxt_epoll_poll()
986 ev->read_ready = 1; in nxt_epoll_poll()
987 ev->write_ready = 1; in nxt_epoll_poll()
989 if (ev->read == NXT_EVENT_BLOCKED && ev->write == NXT_EVENT_BLOCKED) { in nxt_epoll_poll()
993 nxt_epoll_disable(engine, ev); in nxt_epoll_poll()
1000 ev->task, ev, ev->data); in nxt_epoll_poll()