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

Added ALIGN_KERNEL macros for MOGON

parent a093469a
Loading
Loading
Loading
Loading
+27 −18
Original line number Diff line number Diff line
@@ -960,7 +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,
                // debug_info("[GEKKO] >> End open64.... %s %d %o %o\n", path,
                // fd,
                //            flags, mode);
                va_end(ap);
                return fd;
@@ -2154,6 +2155,14 @@ opendir64(const char* dirname) {
    ret = dlsym_opendir64((char*) dirname);
    return ret;
}

#ifndef __ALIGN_KERNEL_MASK
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
#endif
#ifndef __ALIGN_KERNEL
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x)) (a) - 1)
#endif

#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
// readdir
struct dirent*
+13 −4
Original line number Diff line number Diff line
@@ -359,6 +359,12 @@ init_preload() {
    // The original errno value will be restored after initialization to not
    // leak internal error codes
    auto oerrno = errno;
    if(!init) {
        init = true;
        pthread_atfork(&at_fork_syscall, &at_parent_syscall, &at_child_syscall);
    }
    CTX->enable_interception();
    gkfs::preload::start_self_interception();

    CTX->enable_interception();
    gkfs::preload::start_self_interception();
@@ -514,7 +520,10 @@ init_libc() {
    CTX->init_logging();
    // from here ownwards it is safe to print messages
    LOG(DEBUG, "Logging subsystem initialized");
    if (!init) { init = true; pthread_atfork(&at_fork, &at_parent, &at_child);}
    if(!init) {
        init = true;
        pthread_atfork(&at_fork, &at_parent, &at_child);
    }
    gkfs::preload::init_environment();
    CTX->enable_interception();
}