view src/lib/ioloop-internal.h @ 9191:b340ecb24469 HEAD

Fix VPATH build of RQUOTA support. Some rpcgen derive #include "..." paths from the infile argument. This will be off for VPATH builds, as the generated rquota_xdr.c code will look in $(srcdir), but we'll generate the rquota.h file in $(builddir). Play safe and copy rquota.x to $(builddir) first. This fixes the build on openSUSE 11.1.
author Matthias Andree <>
date Tue, 07 Jul 2009 21:01:36 +0200
parents 86c28d14ddeb
line wrap: on
line source


#include "priorityq.h"
#include "ioloop.h"


struct ioloop {
        struct ioloop *prev;

	struct io_file *io_files;
	struct io_file *next_io_file;
	struct priorityq *timeouts;

        struct ioloop_handler_context *handler_context;
        struct ioloop_notify_handler_context *notify_handler_context;
	unsigned int max_fd_count;

	unsigned int running:1;

struct io {
	enum io_condition condition;

	io_callback_t *callback;
        void *context;

	struct ioloop *ioloop;

struct io_file {
	struct io io;

	/* use a doubly linked list so that io_remove() is quick */
	struct io_file *prev, *next;

	int refcount;
	int fd;

struct timeout {
	struct priorityq_item item;

        unsigned int msecs;
	struct timeval next_run;

	timeout_callback_t *callback;
        void *context;

	struct ioloop *ioloop;

int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r,
			  struct timeval *tv_now);
void io_loop_handle_timeouts(struct ioloop *ioloop);

/* I/O handler calls */
void io_loop_handle_add(struct io_file *io);
void io_loop_handle_remove(struct io_file *io, bool closed);

void io_loop_handler_init(struct ioloop *ioloop, unsigned int initial_fd_count);
void io_loop_handler_deinit(struct ioloop *ioloop);

void io_loop_notify_remove(struct io *io);
void io_loop_notify_handler_deinit(struct ioloop *ioloop);