@@ -35,8 +35,8 @@ std::string compute_abs_path(char *pathname, int dirfd) {
3535#if defined(SYS_creat)
3636int creat_handler (long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long *result) {
3737 std::string pathname (reinterpret_cast <const char *>(arg0));
38- auto tid = static_cast <pid_t >(syscall_no_intercept (SYS_gettid));
39- int flags = O_CREAT | O_WRONLY | O_TRUNC;
38+ auto tid = static_cast <pid_t >(syscall_no_intercept (SYS_gettid));
39+ int flags = O_CREAT | O_WRONLY | O_TRUNC;
4040 mode_t mode = static_cast <int >(arg2);
4141 START_LOG (tid, " call(path=%s, flags=%d, mode=%d)" , pathname.data (), flags, mode);
4242
@@ -64,9 +64,9 @@ int creat_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
6464#if defined(SYS_open)
6565int open_handler (long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long *result) {
6666 std::string pathname (reinterpret_cast <const char *>(arg0));
67- int flags = static_cast <int >(arg1);
67+ int flags = static_cast <int >(arg1);
6868 mode_t mode = static_cast <int >(arg2);
69- auto tid = static_cast <pid_t >(syscall_no_intercept (SYS_gettid));
69+ auto tid = static_cast <pid_t >(syscall_no_intercept (SYS_gettid));
7070 START_LOG (tid, " call(path=%s, flags=%d, mode=%d)" , pathname.data (), flags, mode);
7171
7272 std::string path = compute_abs_path (pathname.data (), -1 );
@@ -79,6 +79,9 @@ int open_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg
7979 LOG (" not O_CREAT" );
8080 open_request (-1 , path.data (), tid);
8181 }
82+ } else {
83+ LOG (" Not a CAPIO path. skipping..." );
84+ return CAPIO_POSIX_SYSCALL_REQUEST_SKIP;
8285 }
8386
8487 int fd = static_cast <int >(syscall_no_intercept (SYS_open, arg0, arg1, arg2, arg3, arg4, arg5));
@@ -97,9 +100,9 @@ int open_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg
97100int openat_handler (long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long *result) {
98101 int dirfd = static_cast <int >(arg0);
99102 std::string pathname (reinterpret_cast <const char *>(arg1));
100- int flags = static_cast <int >(arg2);
103+ int flags = static_cast <int >(arg2);
101104 mode_t mode = static_cast <int >(arg3);
102- auto tid = static_cast <pid_t >(syscall_no_intercept (SYS_gettid));
105+ auto tid = static_cast <pid_t >(syscall_no_intercept (SYS_gettid));
103106 START_LOG (tid, " call(path=%s, flags=%d, mode=%d)" , pathname.data (), flags, mode);
104107
105108 std::string path = compute_abs_path (pathname.data (), dirfd);
@@ -112,6 +115,9 @@ int openat_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
112115 LOG (" not O_CREAT" );
113116 open_request (-1 , path.data (), tid);
114117 }
118+ } else {
119+ LOG (" Not a CAPIO path. skipping..." );
120+ return CAPIO_POSIX_SYSCALL_REQUEST_SKIP;
115121 }
116122
117123 int fd = static_cast <int >(syscall_no_intercept (SYS_openat, arg0, arg1, arg2, arg3, arg4, arg5));
@@ -127,4 +133,4 @@ int openat_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
127133}
128134#endif // SYS_openat
129135
130- #endif // CAPIO_POSIX_HANDLERS_OPENAT_HPP
136+ #endif // CAPIO_POSIX_HANDLERS_OPENAT_HPP
0 commit comments