log & decode fanotify objects
Dave Jones
7 years ago
15 | 15 |
#include "compat.h"
|
16 | 16 |
#include "trinity.h"
|
17 | 17 |
#include "utils.h"
|
|
18 |
#include "udp.h"
|
18 | 19 |
|
19 | 20 |
#define NR_FANOTIFYFDS 10
|
20 | 21 |
|
|
35 | 36 |
static void fanotifyfd_dump(struct object *obj, __unused__ bool global)
|
36 | 37 |
{
|
37 | 38 |
struct fanotifyobj *fo = &obj->fanotifyobj;
|
|
39 |
struct msg_objcreatedfanotify objmsg;
|
38 | 40 |
|
39 | 41 |
output(0, "fanotify fd:%d flags:%x eventflags:%x\n",
|
40 | 42 |
fo->fd, fo->flags, fo->eventflags);
|
|
43 |
|
|
44 |
init_msgobjhdr(&objmsg.hdr, OBJ_CREATED_FANOTIFY, global, obj);
|
|
45 |
objmsg.fd = fo->fd;
|
|
46 |
objmsg.flags = fo->flags;
|
|
47 |
objmsg.eventflags = fo->eventflags;
|
|
48 |
sendudp((char *) &objmsg, sizeof(objmsg));
|
41 | 49 |
}
|
42 | 50 |
|
43 | 51 |
static int open_fanotify_fds(void)
|
217 | 217 |
printf("%s userfault object created at %p by pid %d: fd:%d flags:%x\n",
|
218 | 218 |
objmsg->hdr.global ? "local" : "global",
|
219 | 219 |
objmsg->hdr.address, objmsg->hdr.pid, objmsg->fd, objmsg->flags);
|
|
220 |
}
|
|
221 |
|
|
222 |
static void decode_obj_created_fanotify(void)
|
|
223 |
{
|
|
224 |
struct msg_objcreatedfanotify *objmsg;
|
|
225 |
objmsg = (struct msg_objcreatedfanotify *) &buf;
|
|
226 |
|
|
227 |
printf("%s fanotify object created at %p by pid %d: fd:%d flags:%x eventflags:%x\n",
|
|
228 |
objmsg->hdr.global ? "local" : "global",
|
|
229 |
objmsg->hdr.address, objmsg->hdr.pid, objmsg->fd,
|
|
230 |
objmsg->flags, objmsg->eventflags);
|
220 | 231 |
}
|
221 | 232 |
|
222 | 233 |
|
|
238 | 249 |
[OBJ_CREATED_DRM] = { decode_obj_created_drm },
|
239 | 250 |
[OBJ_CREATED_INOTIFY] = { decode_obj_created_inotify },
|
240 | 251 |
[OBJ_CREATED_USERFAULT] = { decode_obj_created_userfault },
|
|
252 |
[OBJ_CREATED_FANOTIFY] = { decode_obj_created_fanotify },
|
241 | 253 |
};
|