/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
/* @UNSAFE: whole file */
#include "lib.h"
#include "ioloop-private.h"
#ifdef IOLOOP_POLL
#include <fcntl.h>
struct ioloop_handler_context {
unsigned int idx_count;
int *fd_index;
};
{
}
{
}
{
unsigned int old_count;
/* grow the fd -> index array */
}
/* 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 */
}
}
{
bool call;
/* get the time left for next timeout task */
#ifdef _AIX
if (msecs > 1000) {
/* AIX seems to check IO_POLL_ERRORs only at the beginning of
the poll() call, not during it. keep timeouts short enough
so that we'll notice them pretty quickly. */
msecs = 1000;
}
#endif
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)
}
}
}
#endif