NeoMutt  2024-02-01-23-g345d7b
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
monitor.c File Reference

Monitor files for changes. More...

#include "config.h"
#include <errno.h>
#include <limits.h>
#include <poll.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/inotify.h>
#include <sys/stat.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "monitor.h"
#include "index/lib.h"
#include <fcntl.h>
+ Include dependency graph for monitor.c:

Go to the source code of this file.

Data Structures

struct  Monitor
 A watch on a file. More...
 
struct  MonitorInfo
 Information about a monitored file. More...
 

Macros

#define INOTIFY_MASK_DIR   (IN_MOVED_TO | IN_ATTRIB | IN_CLOSE_WRITE | IN_ISDIR)
 
#define INOTIFY_MASK_FILE   IN_CLOSE_WRITE
 
#define EVENT_BUFLEN   MAX(4096, sizeof(struct inotify_event) + NAME_MAX + 1)
 

Enumerations

enum  ResolveResult {
  RESOLVE_RES_FAIL_NOMAILBOX = -3 , RESOLVE_RES_FAIL_NOTYPE = -2 , RESOLVE_RES_FAIL_STAT = -1 , RESOLVE_RES_OK_NOTEXISTING = 0 ,
  RESOLVE_RES_OK_EXISTING = 1
}
 Results for the Monitor functions. More...
 

Functions

static void mutt_poll_fd_add (int fd, short events)
 Add a file to the watch list.
 
static int mutt_poll_fd_remove (int fd)
 Remove a file from the watch list.
 
static int monitor_init (void)
 Set up file monitoring.
 
static void monitor_check_cleanup (void)
 Close down file monitoring.
 
static struct Monitormonitor_new (struct MonitorInfo *info, int descriptor)
 Create a new file monitor.
 
static void monitor_info_free (struct MonitorInfo *info)
 Shutdown a file monitor.
 
static void monitor_delete (struct Monitor *monitor)
 Free a file monitor.
 
static int monitor_handle_ignore (int desc)
 Listen for when a backup file is closed.
 
static enum ResolveResult monitor_resolve (struct MonitorInfo *info, struct Mailbox *m)
 Get the monitor for a mailbox.
 
int mutt_monitor_poll (void)
 Check for filesystem changes.
 
int mutt_monitor_add (struct Mailbox *m)
 Add a watch for a mailbox.
 
int mutt_monitor_remove (struct Mailbox *m)
 Remove a watch for a mailbox.
 

Variables

bool MonitorFilesChanged = false
 Set to true when a monitored file has changed.
 
bool MonitorCurMboxChanged = false
 Set to true when the current mailbox has changed.
 
static int INotifyFd = -1
 Inotify file descriptor.
 
static struct MonitorMonitor = NULL
 Linked list of monitored Mailboxes.
 
static size_t PollFdsCount = 0
 Number of used entries in the PollFds array.
 
static size_t PollFdsLen = 0
 Size of PollFds array.
 
static struct pollfd * PollFds = NULL
 Array of monitored file descriptors.
 
static int MonitorCurMboxDescriptor = -1
 Monitor file descriptor of the current mailbox.
 

Detailed Description

Monitor files for changes.

Authors
  • Gero Treuer
  • Richard Russon
  • Ian Zimmerman
  • Pietro Cerutti
  • R Primus

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file monitor.c.

Macro Definition Documentation

◆ INOTIFY_MASK_DIR

#define INOTIFY_MASK_DIR   (IN_MOVED_TO | IN_ATTRIB | IN_CLOSE_WRITE | IN_ISDIR)

Definition at line 69 of file monitor.c.

◆ INOTIFY_MASK_FILE

#define INOTIFY_MASK_FILE   IN_CLOSE_WRITE

Definition at line 70 of file monitor.c.

◆ EVENT_BUFLEN

#define EVENT_BUFLEN   MAX(4096, sizeof(struct inotify_event) + NAME_MAX + 1)

Definition at line 72 of file monitor.c.

Enumeration Type Documentation

◆ ResolveResult

Results for the Monitor functions.

Enumerator
RESOLVE_RES_FAIL_NOMAILBOX 

No Mailbox to work on.

RESOLVE_RES_FAIL_NOTYPE 

Can't identify Mailbox type.

RESOLVE_RES_FAIL_STAT 

Can't stat() the Mailbox file.

RESOLVE_RES_OK_NOTEXISTING 

File exists, no monitor is attached.

RESOLVE_RES_OK_EXISTING 

File exists, monitor is already attached.

Definition at line 77 of file monitor.c.

78{
84};
@ RESOLVE_RES_FAIL_NOTYPE
Can't identify Mailbox type.
Definition: monitor.c:80
@ RESOLVE_RES_FAIL_STAT
Can't stat() the Mailbox file.
Definition: monitor.c:81
@ RESOLVE_RES_OK_NOTEXISTING
File exists, no monitor is attached.
Definition: monitor.c:82
@ RESOLVE_RES_FAIL_NOMAILBOX
No Mailbox to work on.
Definition: monitor.c:79
@ RESOLVE_RES_OK_EXISTING
File exists, monitor is already attached.
Definition: monitor.c:83

Function Documentation

◆ mutt_poll_fd_add()

static void mutt_poll_fd_add ( int  fd,
short  events 
)
static

Add a file to the watch list.

Parameters
fdFile to watch
eventsEvents to listen for, e.g. POLLIN

Definition at line 118 of file monitor.c.

119{
120 int i = 0;
121 for (; (i < PollFdsCount) && (PollFds[i].fd != fd); i++)
122 ; // do nothing
123
124 if (i == PollFdsCount)
125 {
127 {
128 PollFdsLen += 2;
129 mutt_mem_realloc(&PollFds, PollFdsLen * sizeof(struct pollfd));
130 }
131 PollFdsCount++;
132 PollFds[i].fd = fd;
133 PollFds[i].events = events;
134 }
135 else
136 {
137 PollFds[i].events |= events;
138 }
139}
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
static size_t PollFdsCount
Number of used entries in the PollFds array.
Definition: monitor.c:61
static size_t PollFdsLen
Size of PollFds array.
Definition: monitor.c:63
static struct pollfd * PollFds
Array of monitored file descriptors.
Definition: monitor.c:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_poll_fd_remove()

static int mutt_poll_fd_remove ( int  fd)
static

Remove a file from the watch list.

Parameters
fdFile to remove
Return values
0Success
-1Error

Definition at line 147 of file monitor.c.

148{
149 int i = 0;
150 for (; (i < PollFdsCount) && (PollFds[i].fd != fd); i++)
151 ; // do nothing
152
153 if (i == PollFdsCount)
154 return -1;
155 int d = PollFdsCount - i - 1;
156 if (d != 0)
157 memmove(&PollFds[i], &PollFds[i + 1], d * sizeof(struct pollfd));
158 PollFdsCount--;
159 return 0;
160}
+ Here is the caller graph for this function:

◆ monitor_init()

static int monitor_init ( void  )
static

Set up file monitoring.

Return values
0Success
-1Error

Definition at line 167 of file monitor.c.

168{
169 if (INotifyFd != -1)
170 return 0;
171
172#ifdef HAVE_INOTIFY_INIT1
173 INotifyFd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
174 if (INotifyFd == -1)
175 {
176 mutt_debug(LL_DEBUG2, "inotify_init1 failed, errno=%d %s\n", errno, strerror(errno));
177 return -1;
178 }
179#else
180 INotifyFd = inotify_init();
181 if (INotifyFd == -1)
182 {
183 mutt_debug(LL_DEBUG2, "monitor: inotify_init failed, errno=%d %s\n", errno,
184 strerror(errno));
185 return -1;
186 }
187 fcntl(INotifyFd, F_SETFL, O_NONBLOCK);
188 fcntl(INotifyFd, F_SETFD, FD_CLOEXEC);
189#endif
190 mutt_poll_fd_add(0, POLLIN);
192
193 return 0;
194}
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG2
Log at debug level 2.
Definition: logging2.h:44
static int INotifyFd
Inotify file descriptor.
Definition: monitor.c:57
static void mutt_poll_fd_add(int fd, short events)
Add a file to the watch list.
Definition: monitor.c:118
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monitor_check_cleanup()

static void monitor_check_cleanup ( void  )
static

Close down file monitoring.

Definition at line 199 of file monitor.c.

200{
201 if (!Monitor && (INotifyFd != -1))
202 {
204 close(INotifyFd);
205 INotifyFd = -1;
206 MonitorFilesChanged = false;
207 }
208}
static int mutt_poll_fd_remove(int fd)
Remove a file from the watch list.
Definition: monitor.c:147
bool MonitorFilesChanged
Set to true when a monitored file has changed.
Definition: monitor.c:52
A watch on a file.
Definition: monitor.c:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monitor_new()

static struct Monitor * monitor_new ( struct MonitorInfo info,
int  descriptor 
)
static

Create a new file monitor.

Parameters
infoDetails of file to monitor
descriptorWatch descriptor
Return values
ptrNewly allocated Monitor

Definition at line 216 of file monitor.c.

217{
218 struct Monitor *monitor = mutt_mem_calloc(1, sizeof(struct Monitor));
219 monitor->type = info->type;
220 monitor->st_dev = info->st_dev;
221 monitor->st_ino = info->st_ino;
222 monitor->desc = descriptor;
223 monitor->next = Monitor;
224 if (info->type == MUTT_MH)
225 monitor->mh_backup_path = mutt_str_dup(info->path);
226
227 Monitor = monitor;
228
229 return monitor;
230}
@ MUTT_MH
'MH' Mailbox type
Definition: mailbox.h:47
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
dev_t st_dev
Definition: monitor.c:107
enum MailboxType type
Definition: monitor.c:104
ino_t st_ino
Definition: monitor.c:108
const char * path
Definition: monitor.c:106
struct Monitor * next
Linked list.
Definition: monitor.c:91
ino_t st_ino
Definition: monitor.c:94
dev_t st_dev
Definition: monitor.c:93
int desc
Definition: monitor.c:96
enum MailboxType type
Definition: monitor.c:95
char * mh_backup_path
Definition: monitor.c:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monitor_info_free()

static void monitor_info_free ( struct MonitorInfo info)
static

Shutdown a file monitor.

Parameters
infoMonitor to shut down

Definition at line 236 of file monitor.c.

237{
238 buf_dealloc(&info->path_buf);
239}
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:394
struct Buffer path_buf
access via path only (maybe not initialized)
Definition: monitor.c:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monitor_delete()

static void monitor_delete ( struct Monitor monitor)
static

Free a file monitor.

Parameters
monitorMonitor to free

Definition at line 245 of file monitor.c.

246{
247 if (!monitor)
248 return;
249
250 struct Monitor **ptr = &Monitor;
251
252 while (true)
253 {
254 if (!*ptr)
255 return;
256 if (*ptr == monitor)
257 break;
258 ptr = &(*ptr)->next;
259 }
260
261 FREE(&monitor->mh_backup_path);
262 monitor = monitor->next;
263 FREE(ptr);
264 *ptr = monitor;
265}
#define FREE(x)
Definition: memory.h:45
+ Here is the caller graph for this function:

◆ monitor_handle_ignore()

static int monitor_handle_ignore ( int  desc)
static

Listen for when a backup file is closed.

Parameters
descWatch descriptor
Return values
>=0New descriptor
-1Error

Definition at line 273 of file monitor.c.

274{
275 int new_desc = -1;
276 struct Monitor *iter = Monitor;
277 struct stat st = { 0 };
278
279 while (iter && (iter->desc != desc))
280 iter = iter->next;
281
282 if (iter)
283 {
284 if ((iter->type == MUTT_MH) && (stat(iter->mh_backup_path, &st) == 0))
285 {
286 new_desc = inotify_add_watch(INotifyFd, iter->mh_backup_path, INOTIFY_MASK_FILE);
287 if (new_desc == -1)
288 {
289 mutt_debug(LL_DEBUG2, "inotify_add_watch failed for '%s', errno=%d %s\n",
290 iter->mh_backup_path, errno, strerror(errno));
291 }
292 else
293 {
294 mutt_debug(LL_DEBUG3, "inotify_add_watch descriptor=%d for '%s'\n",
295 desc, iter->mh_backup_path);
296 iter->st_dev = st.st_dev;
297 iter->st_ino = st.st_ino;
298 iter->desc = new_desc;
299 }
300 }
301 else
302 {
303 mutt_debug(LL_DEBUG3, "cleanup watch (implicitly removed) - descriptor=%d\n", desc);
304 }
305
306 if (MonitorCurMboxDescriptor == desc)
307 MonitorCurMboxDescriptor = new_desc;
308
309 if (new_desc == -1)
310 {
311 monitor_delete(iter);
313 }
314 }
315
316 return new_desc;
317}
@ LL_DEBUG3
Log at debug level 3.
Definition: logging2.h:45
static void monitor_delete(struct Monitor *monitor)
Free a file monitor.
Definition: monitor.c:245
static int MonitorCurMboxDescriptor
Monitor file descriptor of the current mailbox.
Definition: monitor.c:67
static void monitor_check_cleanup(void)
Close down file monitoring.
Definition: monitor.c:199
#define INOTIFY_MASK_FILE
Definition: monitor.c:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monitor_resolve()

static enum ResolveResult monitor_resolve ( struct MonitorInfo info,
struct Mailbox m 
)
static

Get the monitor for a mailbox.

Parameters
[out]infoDetails of the mailbox's monitor
[in]mMailbox
Return values
>=0mailbox is valid and locally accessible: 0: no monitor / 1: preexisting monitor
-3no mailbox (MonitorInfo: no fields set)
-2type not set
-1stat() failed (see errno; MonitorInfo fields: type, is_dir, path)

If m is NULL, try to get the current mailbox from the Index.

Definition at line 331 of file monitor.c.

332{
333 char *fmt = NULL;
334 struct stat st = { 0 };
335
336 struct Mailbox *m_cur = get_current_mailbox();
337 if (m)
338 {
339 info->type = m->type;
340 info->path = m->realpath;
341 }
342 else if (m_cur)
343 {
344 info->type = m_cur->type;
345 info->path = m_cur->realpath;
346 }
347 else
348 {
350 }
351
352 if (info->type == MUTT_UNKNOWN)
353 {
355 }
356 else if (info->type == MUTT_MAILDIR)
357 {
358 info->is_dir = true;
359 fmt = "%s/new";
360 }
361 else
362 {
363 info->is_dir = false;
364 if (info->type == MUTT_MH)
365 fmt = "%s/.mh_sequences";
366 }
367 if (fmt)
368 {
369 buf_printf(&info->path_buf, fmt, info->path);
370 info->path = buf_string(&info->path_buf);
371 }
372 if (stat(info->path, &st) != 0)
374
375 struct Monitor *iter = Monitor;
376 while (iter && ((iter->st_ino != st.st_ino) || (iter->st_dev != st.st_dev)))
377 iter = iter->next;
378
379 info->st_dev = st.st_dev;
380 info->st_ino = st.st_ino;
381 info->monitor = iter;
382
384}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:178
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:97
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition: mailbox.h:44
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition: mailbox.h:48
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:715
A mailbox.
Definition: mailbox.h:79
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
struct Monitor * monitor
Definition: monitor.c:109
bool is_dir
Definition: monitor.c:105
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_monitor_poll()

int mutt_monitor_poll ( void  )

Check for filesystem changes.

Return values
-3unknown/unexpected events: poll timeout / fds not handled by us
-2monitor detected changes, no STDIN input
-1error (see errno)
0(1) input ready from STDIN, or (2) monitoring inactive -> no poll()

Wait for I/O ready file descriptors or signals.

MonitorFilesChanged also reflects changes to monitored files.

Only STDIN and INotify file handles currently expected/supported. More would ask for common infrastructure (sockets?).

Definition at line 400 of file monitor.c.

401{
402 int rc = 0;
403 char buf[EVENT_BUFLEN]
404 __attribute__((aligned(__alignof__(struct inotify_event)))) = { 0 };
405
406 MonitorFilesChanged = false;
407
408 if (INotifyFd != -1)
409 {
410 int fds = poll(PollFds, PollFdsCount, 1000); // 1 Second
411
412 if (fds == -1)
413 {
414 rc = -1;
415 if (errno != EINTR)
416 {
417 mutt_debug(LL_DEBUG2, "poll() failed, errno=%d %s\n", errno, strerror(errno));
418 }
419 }
420 else
421 {
422 bool input_ready = false;
423 for (int i = 0; fds && (i < PollFdsCount); i++)
424 {
425 if (PollFds[i].revents)
426 {
427 fds--;
428 if (PollFds[i].fd == 0)
429 {
430 input_ready = true;
431 }
432 else if (PollFds[i].fd == INotifyFd)
433 {
434 MonitorFilesChanged = true;
435 mutt_debug(LL_DEBUG3, "file change(s) detected\n");
436 char *ptr = buf;
437 const struct inotify_event *event = NULL;
438
439 while (true)
440 {
441 int len = read(INotifyFd, buf, sizeof(buf));
442 if (len == -1)
443 {
444 if (errno != EAGAIN)
445 {
446 mutt_debug(LL_DEBUG2, "read inotify events failed, errno=%d %s\n",
447 errno, strerror(errno));
448 }
449 break;
450 }
451
452 while (ptr < (buf + len))
453 {
454 event = (const struct inotify_event *) ptr;
455 mutt_debug(LL_DEBUG3, "+ detail: descriptor=%d mask=0x%x\n",
456 event->wd, event->mask);
457 if (event->mask & IN_IGNORED)
458 monitor_handle_ignore(event->wd);
459 else if (event->wd == MonitorCurMboxDescriptor)
461 ptr += sizeof(struct inotify_event) + event->len;
462 }
463 }
464 }
465 }
466 }
467 if (!input_ready)
468 rc = MonitorFilesChanged ? -2 : -3;
469 }
470 }
471
472 return rc;
473}
static int monitor_handle_ignore(int desc)
Listen for when a backup file is closed.
Definition: monitor.c:273
bool MonitorCurMboxChanged
Set to true when the current mailbox has changed.
Definition: monitor.c:54
#define EVENT_BUFLEN
Definition: monitor.c:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_monitor_add()

int mutt_monitor_add ( struct Mailbox m)

Add a watch for a mailbox.

Parameters
mMailbox to watch
Return values
0success: new or already existing monitor
-1failed: no mailbox, inaccessible file, create monitor/watcher failed

If m is NULL, try to get the current mailbox from the Index.

Definition at line 483 of file monitor.c.

484{
485 struct MonitorInfo info = { 0 };
486
487 int rc = 0;
488 enum ResolveResult desc = monitor_resolve(&info, m);
489 if (desc != RESOLVE_RES_OK_NOTEXISTING)
490 {
491 if (!m && (desc == RESOLVE_RES_OK_EXISTING))
493 rc = (desc == RESOLVE_RES_OK_EXISTING) ? 0 : -1;
494 goto cleanup;
495 }
496
497 uint32_t mask = info.is_dir ? INOTIFY_MASK_DIR : INOTIFY_MASK_FILE;
498 if (((INotifyFd == -1) && (monitor_init() == -1)) ||
499 ((desc = inotify_add_watch(INotifyFd, info.path, mask)) == -1))
500 {
501 mutt_debug(LL_DEBUG2, "inotify_add_watch failed for '%s', errno=%d %s\n",
502 info.path, errno, strerror(errno));
503 rc = -1;
504 goto cleanup;
505 }
506
507 mutt_debug(LL_DEBUG3, "inotify_add_watch descriptor=%d for '%s'\n", desc, info.path);
508 if (!m)
510
511 monitor_new(&info, desc);
512
513cleanup:
514 monitor_info_free(&info);
515 return rc;
516}
#define INOTIFY_MASK_DIR
Definition: monitor.c:69
static enum ResolveResult monitor_resolve(struct MonitorInfo *info, struct Mailbox *m)
Get the monitor for a mailbox.
Definition: monitor.c:331
static struct Monitor * monitor_new(struct MonitorInfo *info, int descriptor)
Create a new file monitor.
Definition: monitor.c:216
ResolveResult
Results for the Monitor functions.
Definition: monitor.c:78
static int monitor_init(void)
Set up file monitoring.
Definition: monitor.c:167
static void monitor_info_free(struct MonitorInfo *info)
Shutdown a file monitor.
Definition: monitor.c:236
Information about a monitored file.
Definition: monitor.c:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_monitor_remove()

int mutt_monitor_remove ( struct Mailbox m)

Remove a watch for a mailbox.

Parameters
mMailbox
Return values
0monitor removed (not shared)
1monitor not removed (shared)
2no monitor

If m is NULL, try to get the current mailbox from the Index.

Definition at line 527 of file monitor.c.

528{
529 struct MonitorInfo info = { 0 };
530 struct MonitorInfo info2 = { 0 };
531 int rc = 0;
532
533 if (!m)
534 {
536 MonitorCurMboxChanged = false;
537 }
538
540 {
541 rc = 2;
542 goto cleanup;
543 }
544
545 struct Mailbox *m_cur = get_current_mailbox();
546 if (m_cur)
547 {
548 if (m)
549 {
550 if ((monitor_resolve(&info2, NULL) == RESOLVE_RES_OK_EXISTING) &&
551 (info.st_ino == info2.st_ino) && (info.st_dev == info2.st_dev))
552 {
553 rc = 1;
554 goto cleanup;
555 }
556 }
557 else
558 {
559 if (mailbox_find(m_cur->realpath))
560 {
561 rc = 1;
562 goto cleanup;
563 }
564 }
565 }
566
567 inotify_rm_watch(info.monitor->desc, INotifyFd);
568 mutt_debug(LL_DEBUG3, "inotify_rm_watch for '%s' descriptor=%d\n", info.path,
569 info.monitor->desc);
570
573
574cleanup:
575 monitor_info_free(&info);
576 monitor_info_free(&info2);
577 return rc;
578}
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
Definition: mailbox.c:143
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ MonitorFilesChanged

bool MonitorFilesChanged = false

Set to true when a monitored file has changed.

true after a monitored file has changed

Definition at line 52 of file monitor.c.

◆ MonitorCurMboxChanged

bool MonitorCurMboxChanged = false

Set to true when the current mailbox has changed.

true after the current mailbox has changed

Definition at line 54 of file monitor.c.

◆ INotifyFd

int INotifyFd = -1
static

Inotify file descriptor.

Definition at line 57 of file monitor.c.

◆ Monitor

struct Monitor* Monitor = NULL
static

Linked list of monitored Mailboxes.

Definition at line 59 of file monitor.c.

◆ PollFdsCount

size_t PollFdsCount = 0
static

Number of used entries in the PollFds array.

Definition at line 61 of file monitor.c.

◆ PollFdsLen

size_t PollFdsLen = 0
static

Size of PollFds array.

Definition at line 63 of file monitor.c.

◆ PollFds

struct pollfd* PollFds = NULL
static

Array of monitored file descriptors.

Definition at line 65 of file monitor.c.

◆ MonitorCurMboxDescriptor

int MonitorCurMboxDescriptor = -1
static

Monitor file descriptor of the current mailbox.

Definition at line 67 of file monitor.c.