Loading include/client/gkfs_libc.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,10 @@ stat(const char* path, struct stat* buf); int stat64(const char* path, struct stat64* buf); /* This is called on cp <file> <dir>*/ int fstatat(int dfd, const char* path, struct stat* buf, int flags); int __xstat(int ver, const char* path, struct stat* buf); int Loading src/client/gkfs_libc.cpp +34 −2 Original line number Diff line number Diff line Loading @@ -995,7 +995,7 @@ openat(int dirfd, const char* path, int flags, ...) { if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved); auto rstatus = CTX->relativize_fd_path(dirfd, path, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: Loading Loading @@ -1724,6 +1724,36 @@ fstat(int fd, struct stat* buf) { return ret; } /* Used with cp <file> <dir> */ int fstatat(int dfd, const char* path, struct stat* buf, int flags) { debug_info("[FSTATAT from GKFS]....%s \n", path); initializeGekko(); if(CTX->interception_enabled()) { std::string resolved; int res; auto rstatus = CTX->relativize_fd_path(dfd, path, resolved, flags); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; case gkfs::preload::RelativizeStatus::fd_unknown: return -EBADF; case gkfs::preload::RelativizeStatus::internal: res = gkfs::syscall::gkfs_stat(resolved, buf); return res; default: // Try normal open. break; } } int ret = dlsym_fstatat(dfd, path, buf, flags); return ret; } int rename(const char* oldpath, const char* newpath) { Loading Loading @@ -2196,6 +2226,7 @@ opendir64(const char* dirname) { ret = dlsym_opendir64((char*) dirname); return ret; } // clang-format off #ifndef __ALIGN_KERNEL_MASK #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) Loading @@ -2203,6 +2234,7 @@ opendir64(const char* dirname) { #ifndef __ALIGN_KERNEL #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x)) (a) -1) #endif // clang-format on #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) // readdir Loading Loading
include/client/gkfs_libc.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,10 @@ stat(const char* path, struct stat* buf); int stat64(const char* path, struct stat64* buf); /* This is called on cp <file> <dir>*/ int fstatat(int dfd, const char* path, struct stat* buf, int flags); int __xstat(int ver, const char* path, struct stat* buf); int Loading
src/client/gkfs_libc.cpp +34 −2 Original line number Diff line number Diff line Loading @@ -995,7 +995,7 @@ openat(int dirfd, const char* path, int flags, ...) { if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved); auto rstatus = CTX->relativize_fd_path(dirfd, path, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: Loading Loading @@ -1724,6 +1724,36 @@ fstat(int fd, struct stat* buf) { return ret; } /* Used with cp <file> <dir> */ int fstatat(int dfd, const char* path, struct stat* buf, int flags) { debug_info("[FSTATAT from GKFS]....%s \n", path); initializeGekko(); if(CTX->interception_enabled()) { std::string resolved; int res; auto rstatus = CTX->relativize_fd_path(dfd, path, resolved, flags); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; case gkfs::preload::RelativizeStatus::fd_unknown: return -EBADF; case gkfs::preload::RelativizeStatus::internal: res = gkfs::syscall::gkfs_stat(resolved, buf); return res; default: // Try normal open. break; } } int ret = dlsym_fstatat(dfd, path, buf, flags); return ret; } int rename(const char* oldpath, const char* newpath) { Loading Loading @@ -2196,6 +2226,7 @@ opendir64(const char* dirname) { ret = dlsym_opendir64((char*) dirname); return ret; } // clang-format off #ifndef __ALIGN_KERNEL_MASK #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) Loading @@ -2203,6 +2234,7 @@ opendir64(const char* dirname) { #ifndef __ALIGN_KERNEL #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x)) (a) -1) #endif // clang-format on #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) // readdir Loading