diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2014-02-05 15:43:04 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2014-02-05 15:43:04 +0000 |
commit | 2f332e937a549f7073a74ebeb66d0a4fe70040c9 (patch) | |
tree | 30dc5fc37422fcbf4c39add55c9d332a718c4db4 /inotify.c | |
parent | 9aaf88c0004f0d9856947aad7d618fb84d5dba40 (diff) | |
download | strace-2f332e937a549f7073a74ebeb66d0a4fe70040c9.tar.gz strace-2f332e937a549f7073a74ebeb66d0a4fe70040c9.tar.bz2 strace-2f332e937a549f7073a74ebeb66d0a4fe70040c9.tar.xz |
Cleanup inotify syscalls decoding
* linux/inotify.h: New file.
* file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch,
sys_inotify_rm_watch, sys_inotify_init1): Move...
* inotify.c: ... here.
(inotify_modes): Rename to inotify_flags, convert to XLAT form.
(inotify_init_flags): Convert to XLAT form.
* Makefile.am (strace_SOURCES): Add inotify.c.
(EXTRA_DIST): Add linux/inotify.h.
Diffstat (limited to 'inotify.c')
-rw-r--r-- | inotify.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/inotify.c b/inotify.c new file mode 100644 index 0000000..03689b5 --- /dev/null +++ b/inotify.c @@ -0,0 +1,72 @@ +#include "defs.h" +#include <fcntl.h> +#include <linux/inotify.h> + +static const struct xlat inotify_flags[] = { + XLAT(IN_ACCESS), + XLAT(IN_MODIFY), + XLAT(IN_ATTRIB), + XLAT(IN_CLOSE), + XLAT(IN_CLOSE_WRITE), + XLAT(IN_CLOSE_NOWRITE), + XLAT(IN_OPEN), + XLAT(IN_MOVE), + XLAT(IN_MOVED_FROM), + XLAT(IN_MOVED_TO), + XLAT(IN_CREATE), + XLAT(IN_DELETE), + XLAT(IN_DELETE_SELF), + XLAT(IN_MOVE_SELF), + XLAT(IN_UNMOUNT), + XLAT(IN_Q_OVERFLOW), + XLAT(IN_IGNORED), + XLAT(IN_ONLYDIR), + XLAT(IN_DONT_FOLLOW), + XLAT(IN_EXCL_UNLINK), + XLAT(IN_MASK_ADD), + XLAT(IN_ISDIR), + XLAT(IN_ONESHOT), + XLAT_END +}; + +static const struct xlat inotify_init_flags[] = { + XLAT(O_NONBLOCK), + XLAT(O_CLOEXEC), + XLAT_END +}; + +int +sys_inotify_add_watch(struct tcb *tcp) +{ + if (entering(tcp)) { + /* file descriptor */ + printfd(tcp, tcp->u_arg[0]); + tprints(", "); + /* pathname */ + printpath(tcp, tcp->u_arg[1]); + tprints(", "); + /* mask */ + printflags(inotify_flags, tcp->u_arg[2], "IN_???"); + } + return 0; +} + +int +sys_inotify_rm_watch(struct tcb *tcp) +{ + if (entering(tcp)) { + /* file descriptor */ + printfd(tcp, tcp->u_arg[0]); + /* watch descriptor */ + tprintf(", %d", (int) tcp->u_arg[1]); + } + return 0; +} + +int +sys_inotify_init1(struct tcb *tcp) +{ + if (entering(tcp)) + printflags(inotify_init_flags, tcp->u_arg[0], "IN_???"); + return 0; +} |