Mercurial > dovecot > core-2.2
view src/lib/ioloop-notify-fd.c @ 18137:3009a1a6f6d5
global: freshen copyright
Robomatically:
git ls-files | xargs perl -p -i -e 's/(\d+)-201[0-4]/$1-2015/g;s/ (201[0-4]) Dovecot/ $1-2015 Dovecot/'
Happy 2015 everyone!
Signed-off-by: Phil Carmody <phil@dovecot.fi>
author | Phil Carmody <phil@dovecot.fi> |
---|---|
date | Mon, 05 Jan 2015 22:20:10 +0200 |
parents | add8c00fb3cc |
children | 39255150d521 |
line wrap: on
line source
/* Copyright (c) 2007-2015 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "ioloop-private.h" #include "ioloop-notify-fd.h" #if defined(IOLOOP_NOTIFY_DNOTIFY) || defined(IOLOOP_NOTIFY_INOTIFY) struct io *io_notify_fd_add(struct ioloop_notify_fd_context *ctx, int fd, io_callback_t *callback, void *context) { struct io_notify *io; io = i_new(struct io_notify, 1); io->io.condition = IO_NOTIFY; io->io.callback = callback; io->io.context = context; io->io.ioloop = current_ioloop; io->fd = fd; if (ctx->notifies != NULL) { ctx->notifies->prev = io; io->next = ctx->notifies; } ctx->notifies = io; return &io->io; } void io_notify_fd_free(struct ioloop_notify_fd_context *ctx, struct io_notify *io) { if (io->prev != NULL) io->prev->next = io->next; else ctx->notifies = io->next; if (io->next != NULL) io->next->prev = io->prev; i_free(io); } struct io_notify * io_notify_fd_find(struct ioloop_notify_fd_context *ctx, int fd) { struct io_notify *io; for (io = ctx->notifies; io != NULL; io = io->next) { if (io->fd == fd) return io; } return NULL; } #endif