Commit e4989231 authored by Ramon Nou's avatar Ramon Nou Committed by Ramon Nou
Browse files

Avoid multiple pthread_fork

parent 49602aca
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -960,8 +960,8 @@ open64(const char* path, int flags, ...) {

                fd = gkfs::syscall::gkfs_open(resolved, mode, flags);

                debug_info("[GEKKO] >> End open64.... %s %d %o %o\n", path, fd,
                           flags, mode);
                //debug_info("[GEKKO] >> End open64.... %s %d %o %o\n", path, fd,
                //           flags, mode);
                va_end(ap);
                return fd;
            default:
+4 −2
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ init_environment() {
}

} // namespace gkfs::preload

std::atomic<bool> init{false};
/**
 * Called initially ONCE when preload library is used with the LD_PRELOAD
 * environment variable
@@ -346,7 +346,9 @@ init_preload() {
    // The original errno value will be restored after initialization to not
    // leak internal error codes
    auto oerrno = errno;
    pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall);
    if (!init) { init = true; pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall);
    
    }
    CTX->enable_interception();
    gkfs::preload::start_self_interception();