Lines Matching refs:ev

57 static void nxt_kqueue_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
58 static void nxt_kqueue_disable(nxt_event_engine_t *engine, nxt_fd_event_t *ev);
59 static void nxt_kqueue_delete(nxt_event_engine_t *engine, 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);
69 nxt_fd_event_t *ev);
71 nxt_fd_event_t *ev);
73 nxt_fd_event_t *ev);
75 nxt_fd_event_t *ev);
77 nxt_fd_event_t *ev);
79 nxt_fd_event_t *ev);
81 nxt_file_event_t *ev);
83 nxt_file_event_t *ev);
84 static void nxt_kqueue_fd_set(nxt_event_engine_t *engine, nxt_fd_event_t *ev,
245 nxt_kqueue_enable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_enable() argument
247 nxt_kqueue_enable_read(engine, ev); in nxt_kqueue_enable()
248 nxt_kqueue_enable_write(engine, ev); in nxt_kqueue_enable()
258 nxt_kqueue_disable(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_disable() argument
260 if (ev->read != NXT_EVENT_INACTIVE) { in nxt_kqueue_disable()
261 ev->read = NXT_EVENT_INACTIVE; in nxt_kqueue_disable()
262 nxt_kqueue_fd_set(engine, ev, EVFILT_READ, EV_DISABLE); in nxt_kqueue_disable()
265 if (ev->write != NXT_EVENT_INACTIVE) { in nxt_kqueue_disable()
266 ev->write = NXT_EVENT_INACTIVE; in nxt_kqueue_disable()
267 nxt_kqueue_fd_set(engine, ev, EVFILT_WRITE, EV_DISABLE); in nxt_kqueue_disable()
273 nxt_kqueue_delete(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_delete() argument
275 if (ev->read != NXT_EVENT_INACTIVE) { in nxt_kqueue_delete()
276 ev->read = NXT_EVENT_INACTIVE; in nxt_kqueue_delete()
277 nxt_kqueue_fd_set(engine, ev, EVFILT_READ, EV_DELETE); in nxt_kqueue_delete()
280 if (ev->write != NXT_EVENT_INACTIVE) { in nxt_kqueue_delete()
281 ev->write = NXT_EVENT_INACTIVE; in nxt_kqueue_delete()
282 nxt_kqueue_fd_set(engine, ev, EVFILT_WRITE, EV_DELETE); in nxt_kqueue_delete()
297 nxt_kqueue_close(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_close() argument
301 ev->read = NXT_EVENT_INACTIVE; in nxt_kqueue_close()
302 ev->write = NXT_EVENT_INACTIVE; in nxt_kqueue_close()
307 if (kev->ident == (uintptr_t) ev->fd) { in nxt_kqueue_close()
324 nxt_kqueue_enable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_enable_read() argument
326 if (ev->read == NXT_EVENT_INACTIVE) { in nxt_kqueue_enable_read()
327 nxt_kqueue_fd_set(engine, ev, EVFILT_READ, in nxt_kqueue_enable_read()
331 ev->read = NXT_EVENT_ACTIVE; in nxt_kqueue_enable_read()
336 nxt_kqueue_enable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_enable_write() argument
338 if (ev->write == NXT_EVENT_INACTIVE) { in nxt_kqueue_enable_write()
339 nxt_kqueue_fd_set(engine, ev, EVFILT_WRITE, in nxt_kqueue_enable_write()
343 ev->write = NXT_EVENT_ACTIVE; in nxt_kqueue_enable_write()
348 nxt_kqueue_disable_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_disable_read() argument
350 ev->read = NXT_EVENT_INACTIVE; in nxt_kqueue_disable_read()
352 nxt_kqueue_fd_set(engine, ev, EVFILT_READ, EV_DISABLE); in nxt_kqueue_disable_read()
357 nxt_kqueue_disable_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_disable_write() argument
359 ev->write = NXT_EVENT_INACTIVE; in nxt_kqueue_disable_write()
361 nxt_kqueue_fd_set(engine, ev, EVFILT_WRITE, EV_DISABLE); in nxt_kqueue_disable_write()
366 nxt_kqueue_block_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_block_read() argument
368 if (ev->read != NXT_EVENT_INACTIVE) { in nxt_kqueue_block_read()
369 ev->read = NXT_EVENT_BLOCKED; in nxt_kqueue_block_read()
375 nxt_kqueue_block_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_block_write() argument
377 if (ev->write != NXT_EVENT_INACTIVE) { in nxt_kqueue_block_write()
378 ev->write = NXT_EVENT_BLOCKED; in nxt_kqueue_block_write()
384 nxt_kqueue_oneshot_read(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_oneshot_read() argument
386 ev->write = NXT_EVENT_ACTIVE; in nxt_kqueue_oneshot_read()
388 nxt_kqueue_fd_set(engine, ev, EVFILT_WRITE, in nxt_kqueue_oneshot_read()
394 nxt_kqueue_oneshot_write(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_oneshot_write() argument
396 ev->write = NXT_EVENT_ACTIVE; in nxt_kqueue_oneshot_write()
398 nxt_kqueue_fd_set(engine, ev, EVFILT_WRITE, in nxt_kqueue_oneshot_write()
404 nxt_kqueue_enable_accept(nxt_event_engine_t *engine, nxt_fd_event_t *ev) in nxt_kqueue_enable_accept() argument
406 ev->read = NXT_EVENT_ACTIVE; in nxt_kqueue_enable_accept()
407 ev->read_handler = nxt_kqueue_listen_handler; in nxt_kqueue_enable_accept()
409 nxt_kqueue_fd_set(engine, ev, EVFILT_READ, EV_ADD | EV_ENABLE); in nxt_kqueue_enable_accept()
414 nxt_kqueue_enable_file(nxt_event_engine_t *engine, nxt_file_event_t *ev) in nxt_kqueue_enable_file() argument
423 engine->u.kqueue.fd, ev->file->fd, EVFILT_VNODE, flags, fflags); in nxt_kqueue_enable_file()
427 kev->ident = ev->file->fd; in nxt_kqueue_enable_file()
432 kev->udata = nxt_kevent_set_udata(ev); in nxt_kqueue_enable_file()
437 nxt_kqueue_close_file(nxt_event_engine_t *engine, nxt_file_event_t *ev) in nxt_kqueue_close_file() argument
444 nxt_kqueue_fd_set(nxt_event_engine_t *engine, nxt_fd_event_t *ev, in nxt_kqueue_fd_set() argument
449 nxt_debug(ev->task, "kevent(%d) set event: id:%d ft:%i fl:%04Xui", in nxt_kqueue_fd_set()
450 engine->u.kqueue.fd, ev->fd, filter, flags); in nxt_kqueue_fd_set()
454 kev->ident = ev->fd; in nxt_kqueue_fd_set()
459 kev->udata = nxt_kevent_set_udata(ev); in nxt_kqueue_fd_set()
496 nxt_fd_event_t *ev; in nxt_kqueue_error() local
509 ev = nxt_kevent_get_udata(kev->udata); in nxt_kqueue_error()
511 ev->task, ev, ev->data); in nxt_kqueue_error()
527 nxt_fd_event_t *ev; in nxt_kqueue_fd_error_handler() local
529 ev = obj; in nxt_kqueue_fd_error_handler()
531 nxt_debug(task, "kqueue fd error handler fd:%d", ev->fd); in nxt_kqueue_fd_error_handler()
533 if (ev->kq_eof && ev->kq_errno != 0) { in nxt_kqueue_fd_error_handler()
534 ev->error = ev->kq_errno; in nxt_kqueue_fd_error_handler()
535 nxt_log(task, nxt_socket_error_level(ev->kq_errno), in nxt_kqueue_fd_error_handler()
537 ev->fd, ev->kq_errno); in nxt_kqueue_fd_error_handler()
540 ev->read = NXT_EVENT_INACTIVE; in nxt_kqueue_fd_error_handler()
541 ev->write = NXT_EVENT_INACTIVE; in nxt_kqueue_fd_error_handler()
542 ev->error = ev->kq_errno; in nxt_kqueue_fd_error_handler()
544 ev->error_handler(task, ev, data); in nxt_kqueue_fd_error_handler()
551 nxt_file_event_t *ev; in nxt_kqueue_file_error_handler() local
553 ev = obj; in nxt_kqueue_file_error_handler()
555 nxt_debug(task, "kqueue file error handler fd:%d", ev->file->fd); in nxt_kqueue_file_error_handler()
557 ev->handler(task, ev, data); in nxt_kqueue_file_error_handler()
673 nxt_fd_event_t *ev; in nxt_kqueue_poll() local
744 ev = obj; in nxt_kqueue_poll()
745 ev->read_ready = 1; in nxt_kqueue_poll()
746 ev->kq_available = (int32_t) kev->data; in nxt_kqueue_poll()
749 ev->kq_errno = err; in nxt_kqueue_poll()
750 ev->kq_eof |= eof; in nxt_kqueue_poll()
752 if (ev->read <= NXT_EVENT_BLOCKED) { in nxt_kqueue_poll()
753 nxt_debug(ev->task, "blocked read event fd:%d", ev->fd); in nxt_kqueue_poll()
758 ev->read = NXT_EVENT_INACTIVE; in nxt_kqueue_poll()
761 if (nxt_slow_path(ev->kq_available == 0 && eof && err != 0)) { in nxt_kqueue_poll()
766 handler = ev->read_handler; in nxt_kqueue_poll()
767 wq = ev->read_work_queue; in nxt_kqueue_poll()
770 task = ev->task; in nxt_kqueue_poll()
771 data = ev->data; in nxt_kqueue_poll()
776 ev = obj; in nxt_kqueue_poll()
777 ev->write_ready = 1; in nxt_kqueue_poll()
780 ev->kq_errno = err; in nxt_kqueue_poll()
781 ev->kq_eof |= eof; in nxt_kqueue_poll()
783 if (ev->write <= NXT_EVENT_BLOCKED) { in nxt_kqueue_poll()
784 nxt_debug(ev->task, "blocked write event fd:%d", ev->fd); in nxt_kqueue_poll()
789 ev->write = NXT_EVENT_INACTIVE; in nxt_kqueue_poll()
797 handler = ev->write_handler; in nxt_kqueue_poll()
798 wq = ev->write_work_queue; in nxt_kqueue_poll()
801 task = ev->task; in nxt_kqueue_poll()
802 data = ev->data; in nxt_kqueue_poll()