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

Adding pthread_atfork to syscall

parent 3ae7aa05
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -79,4 +79,11 @@ void
at_child();
void
at_parent();

void
at_fork_syscall();
void
at_child_syscall();
void
at_parent_syscall();
#endif // IOINTERCEPT_PRELOAD_HPP
+1 −8
Original line number Diff line number Diff line
@@ -1274,7 +1274,6 @@ lseek(int fd, off_t offset, int whence) {
    initializeGekko();
    // Is fd from GekkoFS?
    if(CTX->file_map()->exist(fd)) {
        debug_info("[xLSEEK GEKKO]....%ld %d\n", offset, whence);
        return gkfs::syscall::gkfs_lseek(fd, offset, whence);
    }

@@ -1289,7 +1288,6 @@ lseek64(int fd, off64_t offset, int whence) {
    // Is fd from GekkoFS?
    initializeGekko();
    if(CTX->file_map()->exist(fd)) {
        debug_info("[LSEEK64 GEKKO]... %d.%ld %d\n", fd, offset, whence);
        return gkfs::syscall::gkfs_lseek(fd, offset, whence);
    }

@@ -2095,8 +2093,6 @@ opendir(const char* dirname) {
                struct stat st;
                if(gkfs::syscall::gkfs_stat(resolved, &st) != 0 or
                   S_ISREG(st.st_mode)) {
                    debug_info("[BYPASS] >> opendir GKFS NOT A DIR.... %s\n",
                               dirname);
                    errno = ENOTDIR;
                    return NULL;
                }
@@ -2133,8 +2129,6 @@ opendir64(const char* dirname) {
        auto rstatus = CTX->relativize_fd_path(AT_FDCWD, dirname, resolved);
        switch(rstatus) {
            case gkfs::preload::RelativizeStatus::fd_not_a_dir:
                debug_info("[BYPASS] >> opendir64 GKFS NOT A DIR.... %s\n",
                           dirname);
                errno = ENOTDIR;
                return NULL;

@@ -2146,8 +2140,7 @@ opendir64(const char* dirname) {
                struct stat st;
                if(gkfs::syscall::gkfs_stat(resolved, &st) != 0 or
                   S_ISREG(st.st_mode)) {
                    debug_info("[BYPASS] >> opendir64 GKFS NOT A DIR.... %s\n",
                               dirname);

                    errno = ENOTDIR;
                    return NULL;
                }
+22 −0
Original line number Diff line number Diff line
@@ -551,3 +551,25 @@ at_child() {
    init_libc();
    printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled());
}


void
at_fork_syscall() {
    printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled());
    destroy_preload();
}
void
at_parent_syscall() {
    printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled());
    init_preload();
    printf("%d -> x At fork parent %d\n", gettid(),
           CTX->interception_enabled());
}

void
at_child_syscall() {

    printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled());
    init_preload();
    printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled());
}