Commit c3c998dc authored by Ramon Nou's avatar Ramon Nou
Browse files

IFDEF close_range (only appears on newer kernels)

parent c77f70d0
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ hook_internal(long syscall_number, long arg0, long arg1, long arg2, long arg3,
                CTX->unregister_internal_fd(arg0);
            }
            break;

#ifdef SYS_close_range
        case SYS_close_range:
            *result = syscall_no_intercept_wrapper(
                    syscall_number, static_cast<int>(arg0),
@@ -424,7 +424,7 @@ hook_internal(long syscall_number, long arg0, long arg1, long arg2, long arg3,
                }
            }
            break;

#endif
        default:
            // ignore any other syscalls, i.e.: pass them on to the kernel
            // (syscalls forwarded to the kernel that return are logged in
@@ -502,6 +502,7 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4,
        case SYS_close:
            *result = gkfs::hook::hook_close(static_cast<int>(arg0));
            break;
#ifdef SYS_close_range
        case SYS_close_range:
            for(auto i = arg0; i <= arg1; i++) {
                if(i >= GKFS_MAX_OPEN_FDS)
@@ -515,6 +516,7 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4,
            }
            *result = 0;
            break;
#endif SYS_close_range
#ifdef SYS_stat
        case SYS_stat:
            *result =
+2 −1
Original line number Diff line number Diff line
@@ -541,7 +541,8 @@ PreloadContext::register_internal_fd(int fd) {
void
PreloadContext::unregister_internal_fd(int fd) {

    LOG(DEBUG, "unregistering internal fd {} >= {} -> {}'", fd, MIN_INTERNAL_FD, fd >= MIN_INTERNAL_FD);
    LOG(DEBUG, "unregistering internal fd {} >= {} -> {}'", fd, MIN_INTERNAL_FD,
        fd >= MIN_INTERNAL_FD);

    assert(fd >= MIN_INTERNAL_FD);