Codebase list trinity / 7804858
log & decode fanotify objects Dave Jones 7 years ago
3 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1515 #include "compat.h"
1616 #include "trinity.h"
1717 #include "utils.h"
18 #include "udp.h"
1819
1920 #define NR_FANOTIFYFDS 10
2021
3536 static void fanotifyfd_dump(struct object *obj, __unused__ bool global)
3637 {
3738 struct fanotifyobj *fo = &obj->fanotifyobj;
39 struct msg_objcreatedfanotify objmsg;
3840
3941 output(0, "fanotify fd:%d flags:%x eventflags:%x\n",
4042 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));
4149 }
4250
4351 static int open_fanotify_fds(void)
3232 OBJ_CREATED_DRM,
3333 OBJ_CREATED_INOTIFY,
3434 OBJ_CREATED_USERFAULT,
35 OBJ_CREATED_FANOTIFY,
3536
3637 MAX_LOGMSGTYPE,
3738 };
166167 int fd;
167168 int flags;
168169 };
170
171 struct msg_objcreatedfanotify {
172 struct trinity_msgobjhdr hdr;
173 int fd;
174 int flags;
175 int eventflags;
176 };
217217 printf("%s userfault object created at %p by pid %d: fd:%d flags:%x\n",
218218 objmsg->hdr.global ? "local" : "global",
219219 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);
220231 }
221232
222233
238249 [OBJ_CREATED_DRM] = { decode_obj_created_drm },
239250 [OBJ_CREATED_INOTIFY] = { decode_obj_created_inotify },
240251 [OBJ_CREATED_USERFAULT] = { decode_obj_created_userfault },
252 [OBJ_CREATED_FANOTIFY] = { decode_obj_created_fanotify },
241253 };