summaryrefslogtreecommitdiffstats
path: root/src/lib/ioloop-notify-fd.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
commitf7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch)
treea3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib/ioloop-notify-fd.h
parentInitial commit. (diff)
downloaddovecot-upstream.tar.xz
dovecot-upstream.zip
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/lib/ioloop-notify-fd.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/ioloop-notify-fd.h b/src/lib/ioloop-notify-fd.h
new file mode 100644
index 0000000..95bbb73
--- /dev/null
+++ b/src/lib/ioloop-notify-fd.h
@@ -0,0 +1,28 @@
+#ifndef IOLOOP_NOTIFY_FD_H
+#define IOLOOP_NOTIFY_FD_H
+
+/* common notify code for fd-based notifications (dnotify, inotify) */
+
+struct io_notify {
+ struct io io;
+
+ /* use a doubly linked list so that io_remove() is quick */
+ struct io_notify *prev, *next;
+
+ int fd;
+};
+
+struct ioloop_notify_fd_context {
+ struct io_notify *notifies;
+};
+
+struct io *
+io_notify_fd_add(struct ioloop_notify_fd_context *ctx, int fd,
+ io_callback_t *callback, void *context) ATTR_NULL(4);
+void io_notify_fd_free(struct ioloop_notify_fd_context *ctx,
+ struct io_notify *io);
+
+struct io_notify *
+io_notify_fd_find(struct ioloop_notify_fd_context *ctx, int fd);
+
+#endif