]> granicus.if.org Git - strace/blob - inotify.c
Fix decoding of arm struct stat64 by aarch64 strace.
[strace] / inotify.c
1 #include "defs.h"
2 #include <fcntl.h>
3 #include <linux/inotify.h>
4
5 static const struct xlat inotify_flags[] = {
6         XLAT(IN_ACCESS),
7         XLAT(IN_MODIFY),
8         XLAT(IN_ATTRIB),
9         XLAT(IN_CLOSE),
10         XLAT(IN_CLOSE_WRITE),
11         XLAT(IN_CLOSE_NOWRITE),
12         XLAT(IN_OPEN),
13         XLAT(IN_MOVE),
14         XLAT(IN_MOVED_FROM),
15         XLAT(IN_MOVED_TO),
16         XLAT(IN_CREATE),
17         XLAT(IN_DELETE),
18         XLAT(IN_DELETE_SELF),
19         XLAT(IN_MOVE_SELF),
20         XLAT(IN_UNMOUNT),
21         XLAT(IN_Q_OVERFLOW),
22         XLAT(IN_IGNORED),
23         XLAT(IN_ONLYDIR),
24         XLAT(IN_DONT_FOLLOW),
25         XLAT(IN_EXCL_UNLINK),
26         XLAT(IN_MASK_ADD),
27         XLAT(IN_ISDIR),
28         XLAT(IN_ONESHOT),
29         XLAT_END
30 };
31
32 static const struct xlat inotify_init_flags[] = {
33         XLAT(O_NONBLOCK),
34         XLAT(O_CLOEXEC),
35         XLAT_END
36 };
37
38 int
39 sys_inotify_add_watch(struct tcb *tcp)
40 {
41         if (entering(tcp)) {
42                 /* file descriptor */
43                 printfd(tcp, tcp->u_arg[0]);
44                 tprints(", ");
45                 /* pathname */
46                 printpath(tcp, tcp->u_arg[1]);
47                 tprints(", ");
48                 /* mask */
49                 printflags(inotify_flags, tcp->u_arg[2], "IN_???");
50         }
51         return 0;
52 }
53
54 int
55 sys_inotify_rm_watch(struct tcb *tcp)
56 {
57         if (entering(tcp)) {
58                 /* file descriptor */
59                 printfd(tcp, tcp->u_arg[0]);
60                 /* watch descriptor */
61                 tprintf(", %d", (int) tcp->u_arg[1]);
62         }
63         return 0;
64 }
65
66 int
67 sys_inotify_init1(struct tcb *tcp)
68 {
69         if (entering(tcp))
70                 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
71         return 0;
72 }