ioloop-poll.c revision dac0b2e5e0f38c6d95ef1a842d891480db580236
/* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */
/* @UNSAFE: whole file */
#include "lib.h"
#include "ioloop-internal.h"
#ifdef IOLOOP_POLL
#include <fcntl.h>
struct ioloop_handler_context {
unsigned int idx_count;
int *fd_index;
};
{
struct ioloop_handler_context *ctx;
}
{
}
{
unsigned int old_count;
/* grow the fd -> index array */
sizeof(int) * old_count,
}
/* grow the fd array */
}
/* update existing pollfd */
} else {
/* add new pollfd */
}
}
{
#ifdef DEBUG
if (!closed) {
/* io_remove() is required to be called before fd is closed.
commonly used while developing, this check here should catch
the error early enough not to cause problems for kqueue
users. */
else
}
}
#endif
}
}
/* remove the whole pollfd */
return; /* removing last one */
/* move the last pollfd over the removed one */
}
}
{
unsigned int t_id;
bool call;
/* get the time left for next timeout task */
i_fatal("poll(): %m");
/* execute timeout handlers */
/* no I/O events */
return;
}
i_error("invalid I/O fd %d, callback %p",
} else {
}
ret--;
if (call) {
i_panic("Leaked a t_pop() call in "
"I/O handler %p",
}
}
}
}
}
#endif