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

Enhance close_range function with support for CLOSE_RANGE_UNSHARE and CLOSE_RANGE_CLOEXEC flags

parent feee85b5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -602,6 +602,7 @@ close_range(unsigned low, unsigned high, int flags) {
    LOG(DEBUG, "close_range({}, {}, {})", low, high, flags);
    return 0;
    auto fds = get_open_fds();
#ifdef CLOSE_RANGE_UNSHARE
    if(flags & CLOSE_RANGE_UNSHARE) {
        // Unshare the file descriptor table
        LOG(DEBUG, "close_range with CLOSE_RANGE_UNSHARE");
@@ -610,10 +611,13 @@ close_range(unsigned low, unsigned high, int flags) {
            return -1;
        }
    }
#endif
#ifdef CLOSE_RANGE_CLOEXEC
    if(flags & CLOSE_RANGE_CLOEXEC) {
        // Close all file descriptors in the range
        LOG(DEBUG, "close_range with CLOSE_RANGE_CLOEXEC");
    }
#endif
    // Is fd from gekkofs ?
    initializeGekko();
    if(CTX->interception_enabled()) {