Lines Matching refs:io
58 void io_loop_handle_add(struct io_file *io)
60 struct ioloop_handler_context *ctx = io->io.ioloop->handler_context;
63 if ((io->io.condition & (IO_READ | IO_ERROR)) != 0) {
64 MY_EV_SET(&ev, io->fd, EVFILT_READ, EV_ADD, 0, 0, io);
66 i_panic("kevent(EV_ADD, READ, %d) failed: %m", io->fd);
68 if ((io->io.condition & IO_WRITE) != 0) {
69 MY_EV_SET(&ev, io->fd, EVFILT_WRITE, EV_ADD, 0, 0, io);
71 i_panic("kevent(EV_ADD, WRITE, %d) failed: %m", io->fd);
82 void io_loop_handle_remove(struct io_file *io, bool closed)
84 struct ioloop_handler_context *ctx = io->io.ioloop->handler_context;
87 i_assert(io->io.condition != 0);
88 if ((io->io.condition & (IO_READ | IO_ERROR)) != 0 && !closed) {
89 MY_EV_SET(&ev, io->fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
91 i_error("kevent(EV_DELETE, %d) failed: %m", io->fd);
93 if ((io->io.condition & IO_WRITE) != 0 && !closed) {
94 MY_EV_SET(&ev, io->fd, EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
96 i_error("kevent(EV_DELETE, %d) failed: %m", io->fd);
98 io->io.condition = 0;
105 i_assert(io->refcount > 0);
106 if (--io->refcount == 0)
107 i_free(io);
117 struct io_file *io;
145 io = (void *)events[i].udata;
146 i_assert(io->refcount > 0);
147 io->refcount++;
157 io = (void *)event->udata;
160 if (io->io.callback != NULL)
161 io_loop_call_io(&io->io);
163 i_assert(io->refcount > 0);
164 if (--io->refcount == 0)
165 i_free(io);