Coverage Report

Created: 2026-09-01 06:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dovecot/src/lib/ioloop-notify-fd.c
Line
Count
Source
1
/* Copyright (c) Dovecot authors, see top-level COPYING file */
2
3
#include "lib.h"
4
#include "ioloop-private.h"
5
#include "ioloop-notify-fd.h"
6
7
#if defined(IOLOOP_NOTIFY_INOTIFY)
8
9
struct io *io_notify_fd_add(struct ioloop_notify_fd_context *ctx, int fd,
10
          io_callback_t *callback, void *context)
11
0
{
12
0
  struct io_notify *io;
13
14
0
  io = i_new(struct io_notify, 1);
15
0
  io->io.condition = IO_NOTIFY;
16
0
  io->io.callback = callback;
17
0
  io->io.context = context;
18
0
  io->io.ioloop = current_ioloop;
19
0
  io->fd = fd;
20
21
0
  if (ctx->notifies != NULL) {
22
0
    ctx->notifies->prev = io;
23
0
    io->next = ctx->notifies;
24
0
  }
25
0
  ctx->notifies = io;
26
0
  return &io->io;
27
0
}
28
29
void io_notify_fd_free(struct ioloop_notify_fd_context *ctx,
30
           struct io_notify *io)
31
0
{
32
0
  if (io->prev != NULL)
33
0
    io->prev->next = io->next;
34
0
  else
35
0
    ctx->notifies = io->next;
36
37
0
  if (io->next != NULL)
38
0
    io->next->prev = io->prev;
39
0
  i_free(io);
40
0
}
41
42
struct io_notify *
43
io_notify_fd_find(struct ioloop_notify_fd_context *ctx, int fd)
44
0
{
45
0
  struct io_notify *io;
46
47
0
  for (io = ctx->notifies; io != NULL; io = io->next) {
48
0
    if (io->fd == fd)
49
0
      return io;
50
0
  }
51
52
0
  return NULL;
53
0
}
54
55
#endif