ioloop-poll.c revision a718b37c944315db5d7189db214d7325466253d7
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2002-2003 Timo Sirainen */
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen/* @UNSAFE: whole file */
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainenvoid io_loop_handler_init(struct ioloop *ioloop)
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen p_new(ioloop->pool, struct ioloop_handler_context, 1);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen ctx->fds = p_new(ioloop->pool, struct pollfd, ctx->fds_size);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen ctx->fd_index = p_new(ioloop->pool, int, ctx->idx_size);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen memset(ctx->fd_index, 0xff, sizeof(int) * ctx->idx_size);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainenvoid io_loop_handler_deinit(struct ioloop *ioloop)
a4985564b81d51caaddd38376792432428fd449bStephan Bosch p_free(ioloop->pool, ioloop->handler_context->fds);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen p_free(ioloop->pool, ioloop->handler_context->fd_index);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen p_free(ioloop->pool, ioloop->handler_context);
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainen#define IO_POLL_ERROR (POLLERR | POLLHUP | POLLNVAL)
fddfa139c8f7621bd13d44537698ba58d1965078Phil Carmody#define IO_POLL_INPUT (POLLIN | POLLPRI | IO_POLL_ERROR)
fddfa139c8f7621bd13d44537698ba58d1965078Phil Carmody#define IO_POLL_OUTPUT (POLLOUT | IO_POLL_ERROR)
289bb39856d74484c1622d096922acf126dd90fcTimo Sirainenvoid io_loop_handle_add(struct ioloop *ioloop, struct io *io)
unsigned int old_size;
sizeof(int) * old_size,
unsigned int t_id;
ret--;
if (call) {