-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathkdebug.c
45 lines (38 loc) · 847 Bytes
/
kdebug.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* fsmon -- MIT - Copyright NowSecure 2016 - pancake@nowsecure.com */
#if __APPLE__
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <errno.h>
#include "fsmon.h"
#define PRIVATE
#define __APPLE_PRIVATE
#include "kdebug/kdebug.c"
static bool fm_begin (FileMonitor *fm) {
return kdebug_begin ();
}
static bool fm_loop (FileMonitor *fm, FileMonitorCallback cb) {
kdebug_env (fm, cb);
for (; fm->running; ) {
/* read events, run callback */
(void) kdebug_loop_once ();
fflush (stdout);
}
return true;
}
static bool fm_end(FileMonitor *fm) {
return kdebug_stop ();
}
FileMonitorBackend fmb_kdebug = {
.name = "kdebug",
.begin = fm_begin,
.loop = fm_loop,
.end = fm_end,
};
#endif