]> granicus.if.org Git - strace/blobdiff - pathtrace.c
mips n32: fix preadv/pwritev offset decoding
[strace] / pathtrace.c
index f76f3ced6251c85cc460bbf3c757379be68568cb..28fc7c9ad8773c82c16bcc206a4514da922b6ec3 100644 (file)
 
 #include "defs.h"
 #include <sys/param.h>
-#ifdef HAVE_POLL_H
+#if defined HAVE_POLL_H
 # include <poll.h>
-#endif
-#ifdef HAVE_SYS_POLL_H
+#elif defined HAVE_SYS_POLL_H
 # include <sys/poll.h>
 #endif
 
@@ -81,7 +80,7 @@ fdmatch(struct tcb *tcp, int fd)
 
 /*
  * Add a path to the set we're tracing.
- * Secifying NULL will delete all paths.
+ * Specifying NULL will delete all paths.
  */
 static void
 storepath(const char *path)
@@ -159,7 +158,7 @@ pathtrace_match(struct tcb *tcp)
 
        s = tcp->s_ent;
 
-       if (!(s->sys_flags & (TRACE_FILE | TRACE_DESC)))
+       if (!(s->sys_flags & (TRACE_FILE | TRACE_DESC | TRACE_NETWORK)))
                return 0;
 
        /*
@@ -182,7 +181,6 @@ pathtrace_match(struct tcb *tcp)
            s->sys_func == sys_faccessat ||
            s->sys_func == sys_fchmodat ||
            s->sys_func == sys_futimesat ||
-           s->sys_func == sys_mkdirat ||
            s->sys_func == sys_unlinkat ||
            s->sys_func == sys_newfstatat ||
            s->sys_func == sys_mknodat ||
@@ -212,6 +210,7 @@ pathtrace_match(struct tcb *tcp)
        }
 
        if (s->sys_func == sys_renameat ||
+           s->sys_func == sys_renameat2 ||
            s->sys_func == sys_linkat)
        {
                /* fd, path, fd, path */
@@ -252,6 +251,12 @@ pathtrace_match(struct tcb *tcp)
                return fdmatch(tcp, tcp->u_arg[2]);
        }
 
+       if (s->sys_func == sys_fanotify_mark) {
+               /* x, x, x, fd, path */
+               return fdmatch(tcp, tcp->u_arg[3]) ||
+                       upathmatch(tcp, tcp->u_arg[4]);
+       }
+
        if (s->sys_func == sys_select ||
            s->sys_func == sys_oldselect ||
            s->sys_func == sys_pselect6)
@@ -340,11 +345,13 @@ pathtrace_match(struct tcb *tcp)
            s->sys_func == sys_timerfd_settime ||
            s->sys_func == sys_timerfd_gettime ||
            s->sys_func == sys_epoll_create ||
-           strcmp(s->sys_name, "fanotify_init") == 0)
+           s->sys_func == sys_socket ||
+           s->sys_func == sys_socketpair ||
+           s->sys_func == sys_fanotify_init)
        {
                /*
-                * These have TRACE_FILE or TRACE_DESCRIPTOR set, but they
-                * don't have any file descriptor or path args to test.
+                * These have TRACE_FILE or TRACE_DESCRIPTOR or TRACE_NETWORK set,
+                * but they don't have any file descriptor or path args to test.
                 */
                return 0;
        }
@@ -357,7 +364,7 @@ pathtrace_match(struct tcb *tcp)
        if (s->sys_flags & TRACE_FILE)
                return upathmatch(tcp, tcp->u_arg[0]);
 
-       if (s->sys_flags & TRACE_DESC)
+       if (s->sys_flags & (TRACE_DESC | TRACE_NETWORK))
                return fdmatch(tcp, tcp->u_arg[0]);
 
        return 0;