diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c948610b68a20bfdeceebe867bd540bee59f9a38..3e4fcb5e05c8dbbd0b562a89af330cf1569ef774 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,12 @@ variables: LIBGKFS_LOG: "all" LIBGKFS_LOG_OUTPUT: "${CI_PROJECT_DIR}/logs/gkfs_client.log" GIT_SUBMODULE_STRATEGY: recursive + CCACHE_BASEDIR: "$CI_PROJECT_DIR" + CCACHE_DIR: "$CI_PROJECT_DIR/ccache" + +cache: + paths: + - $CCACHE_DIR # base image image: gekkofs/core:0.9.4-dev @@ -55,15 +61,21 @@ gkfs: - sed -i 's/constexpr auto use_mtime = false;/constexpr auto use_mtime = true;/g' "${CI_PROJECT_DIR}/include/config.hpp" - sed -i 's/constexpr auto use_link_cnt = false;/constexpr auto use_link_cnt = true;/g' "${CI_PROJECT_DIR}/include/config.hpp" - sed -i 's/constexpr auto use_blocks = false;/constexpr auto use_blocks = true;/g' "${CI_PROJECT_DIR}/include/config.hpp" + # use ccache + - ccache --zero-stats + - /usr/sbin/update-ccache-symlinks + - export PATH="/usr/lib/ccache:$PATH" - cmake --preset ci-coverage -DCOVERAGE_OUTPUT_DIR=${COVERAGE_PATH} - cmake --build ${BUILD_PATH} -j $(nproc) --target install # reduce artifacts size - ${CI_SCRIPTS_DIR}/trim_build_artifacts.sh ${BUILD_PATH} + - ccache --show-stats artifacts: paths: - ${BUILD_PATH} - ${INSTALL_PATH} expire_in: 1 week + ################################################################################ ## Testing diff --git a/.gitmodules b/.gitmodules index 1fe5c04e2a3f395cf28265b7b4c9ea1e8c8a4dc1..2763952410498bb4175ac57565a5f3bfb7d2ea1f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,6 +25,3 @@ [submodule "external/MessagePack"] path = external/MessagePack url = https://github.com/GekkoFS/MessagePackCPP.git -[submodule "external/GSL"] - path = external/GSL - url = https://github.com/microsoft/GSL diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5f4cf3eb7e95711399d059fd6ad80e3daac31f..66be593383ce44de3226ad8c62edcedc65a131aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,8 +87,6 @@ replicas ([!166](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141) ### New -- Use of GSL to narrow cast syscall return types, corrected syscall return types - ([!182](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/182)). - Support for client-side per process logging, activated with `LIBGKFS_LOG_PER_PROCESS` ([!179](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/179)). - Support mtime with option gkfs::config::metadata:: diff --git a/CMakeLists.txt b/CMakeLists.txt index ae0ec5d4891a7573a521aa143cde554a644a5f94..a7f6b347d62283ea98a84570578ee2095305a1fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,14 +261,6 @@ if (GKFS_ENABLE_CLIENT_METRICS) ) endif () -### GSL: Guidelines Support Library -include_from_source(gsl - MESSAGE "[${PROJECT_NAME}] Searching for GSL" - SOURCE_DIR ${GKFS_DEPENDENCIES_PATH}/GSL - GIT_REPOSITORY https://github.com/microsoft/GSL - GIT_TAG v4.0.0 -) - ################################################################################ ## Check configured variables/options and act accordingly ################################################################################ diff --git a/docker/0.9.4/core/Dockerfile b/docker/0.9.4/core/Dockerfile index a55434924b2cfe720195c371de6736ac049826f7..ced6c14a32bda048afb0a50547a3792f0d4118c8 100644 --- a/docker/0.9.4/core/Dockerfile +++ b/docker/0.9.4/core/Dockerfile @@ -28,7 +28,7 @@ RUN apt-get update && \ libcapstone-dev \ # GekkoFS dependencies libboost-program-options-dev \ - uuid-dev && \ + uuid-dev ccache && \ # install cmake 3.14+ since it's needed for some dependencies curl -OL https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2-Linux-x86_64.sh && \ chmod u+x ./cmake-3.25.2-Linux-x86_64.sh && \ diff --git a/external/GSL b/external/GSL deleted file mode 160000 index a3534567187d2edc428efd3f13466ff75fe5805c..0000000000000000000000000000000000000000 --- a/external/GSL +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a3534567187d2edc428efd3f13466ff75fe5805c diff --git a/include/client/hooks.hpp b/include/client/hooks.hpp index 97765d27b4bec4b79e94ea5f8683f78cc11b49d9..7044caffddef9a8b9df4fd295a14a959a3eedfbc 100644 --- a/include/client/hooks.hpp +++ b/include/client/hooks.hpp @@ -94,29 +94,29 @@ hook_fstat(unsigned int fd, struct stat* buf); int hook_fstatat(int dirfd, const char* cpath, struct stat* buf, int flags); -ssize_t +int hook_read(unsigned int fd, void* buf, size_t count); -ssize_t +int hook_pread(unsigned int fd, char* buf, size_t count, loff_t pos); -ssize_t +int hook_readv(unsigned long fd, const struct iovec* iov, unsigned long iovcnt); -ssize_t +int hook_preadv(unsigned long fd, const struct iovec* iov, unsigned long iovcnt, unsigned long pos_l, unsigned long pos_h); -ssize_t +int hook_write(unsigned int fd, const char* buf, size_t count); -ssize_t +int hook_pwrite(unsigned int fd, const char* buf, size_t count, loff_t pos); -ssize_t +int hook_writev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt); -ssize_t +int hook_pwritev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt, unsigned long pos_l, unsigned long pos_h); @@ -158,10 +158,10 @@ hook_dup2(unsigned int oldfd, unsigned int newfd); int hook_dup3(unsigned int oldfd, unsigned int newfd, int flags); -long +int hook_getdents(unsigned int fd, struct linux_dirent* dirp, unsigned int count); -ssize_t +int hook_getdents64(unsigned int fd, struct linux_dirent64* dirp, unsigned int count); @@ -183,7 +183,7 @@ hook_fchdir(unsigned int fd); int hook_getcwd(char* buf, unsigned long size); -ssize_t +int hook_readlinkat(int dirfd, const char* cpath, char* buf, int bufsiz); int @@ -202,7 +202,7 @@ hook_fstatfs(unsigned int fd, struct statfs* buf); int hook_fsync(unsigned int fd); -ssize_t +int hook_getxattr(const char* path, const char* name, void* value, size_t size); int diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index c31abeedcfe4b304288e5eeafb3b0359bfa79d44..333c66269f671a9aa51999adbb78ab6b4e6bfcd7 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -97,7 +97,6 @@ target_link_libraries( fmt::fmt Threads::Threads Syscall_intercept::Syscall_intercept - Microsoft.GSL::GSL ) # Enable MSGPack metrics for intercept only if (GKFS_ENABLE_CLIENT_METRICS) @@ -117,7 +116,6 @@ target_link_libraries( hermes fmt::fmt Threads::Threads - Microsoft.GSL::GSL ) install( diff --git a/src/client/hooks.cpp b/src/client/hooks.cpp index 6f1b1c77154477f0bfe48211f600ffb07e91b5bb..c38688c591c1b5424a8476cb6f6bba8169a3acda 100644 --- a/src/client/hooks.cpp +++ b/src/client/hooks.cpp @@ -37,23 +37,19 @@ #include -#include - -#include +#include extern "C" { #include #include #include -#include } namespace { // TODO replace all internal gkfs errno variable usage with LEAF -template -inline T -with_errno(T ret) { +inline int +with_errno(int ret) { return (ret < 0) ? -errno : ret; } @@ -71,12 +67,12 @@ hook_openat(int dirfd, const char* cpath, int flags, mode_t mode) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_openat, dirfd, cpath, flags, mode)); + return syscall_no_intercept_wrapper(SYS_openat, dirfd, cpath, flags, + mode); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_openat, dirfd, resolved.c_str(), flags, mode)); + return syscall_no_intercept_wrapper(SYS_openat, dirfd, + resolved.c_str(), flags, mode); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -100,7 +96,7 @@ hook_close(int fd) { if(ret == 0) return 0; - return gsl::narrow_cast(syscall_no_intercept_wrapper(SYS_close, fd)); + return syscall_no_intercept_wrapper(SYS_close, fd); } #ifdef SYS_stat int @@ -114,8 +110,7 @@ hook_stat(const char* path, struct stat* buf) { return with_errno(gkfs::syscall::gkfs_stat(rel_path, buf)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_stat, rel_path.c_str(), buf)); + return syscall_no_intercept_wrapper(SYS_stat, rel_path.c_str(), buf); } #endif @@ -133,12 +128,12 @@ hook_statx(int dirfd, const char* path, int flags, unsigned int mask, auto rstatus = CTX->relativize_fd_path(dirfd, path, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_statx, dirfd, path, flags, mask, buf)); + return syscall_no_intercept_wrapper(SYS_statx, dirfd, path, flags, + mask, buf); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_statx, dirfd, resolved.c_str(), flags, mask, buf)); + return syscall_no_intercept_wrapper( + SYS_statx, dirfd, resolved.c_str(), flags, mask, buf); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -151,6 +146,8 @@ hook_statx(int dirfd, const char* path, int flags, unsigned int mask, LOG(ERROR, "{}() relativize status unknown: {}", __func__); return -EINVAL; } + + return syscall_no_intercept(SYS_statx, dirfd, path, flags, mask, buf); } #endif @@ -166,8 +163,7 @@ hook_lstat(const char* path, struct stat* buf) { if(CTX->relativize_path(path, rel_path)) { return with_errno(gkfs::syscall::gkfs_stat(rel_path, buf)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_lstat, rel_path.c_str(), buf)); + return syscall_no_intercept_wrapper(SYS_lstat, rel_path.c_str(), buf); } #endif @@ -188,8 +184,7 @@ hook_fstat(unsigned int fd, struct stat* buf) { #endif return with_errno(gkfs::syscall::gkfs_stat(path, buf)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_fstat, fd, buf)); + return syscall_no_intercept_wrapper(SYS_fstat, fd, buf); } int @@ -202,12 +197,12 @@ hook_fstatat(int dirfd, const char* cpath, struct stat* buf, int flags) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved, flags); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_newfstatat, dirfd, cpath, buf, flags)); + return syscall_no_intercept_wrapper(SYS_newfstatat, dirfd, cpath, + buf, flags); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_newfstatat, dirfd, resolved.c_str(), buf, flags)); + return syscall_no_intercept_wrapper(SYS_newfstatat, dirfd, + resolved.c_str(), buf, flags); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -221,7 +216,7 @@ hook_fstatat(int dirfd, const char* cpath, struct stat* buf, int flags) { } } -ssize_t +int hook_read(unsigned int fd, void* buf, size_t count) { LOG(DEBUG, "{}() called with fd: {}, buf: {} count: {}", __func__, fd, @@ -233,7 +228,7 @@ hook_read(unsigned int fd, void* buf, size_t count) { return syscall_no_intercept_wrapper(SYS_read, fd, buf, count); } -ssize_t +int hook_pread(unsigned int fd, char* buf, size_t count, loff_t pos) { LOG(DEBUG, "{}() called with fd: {}, buf: {}, count: {}, pos: {}", __func__, @@ -247,7 +242,7 @@ hook_pread(unsigned int fd, char* buf, size_t count, loff_t pos) { return syscall_no_intercept_wrapper(SYS_pread64, fd, buf, count, pos); } -ssize_t +int hook_readv(unsigned long fd, const struct iovec* iov, unsigned long iovcnt) { LOG(DEBUG, "{}() called with fd: {}, iov: {}, iovcnt: {}", __func__, fd, @@ -259,7 +254,7 @@ hook_readv(unsigned long fd, const struct iovec* iov, unsigned long iovcnt) { return syscall_no_intercept_wrapper(SYS_readv, fd, iov, iovcnt); } -ssize_t +int hook_preadv(unsigned long fd, const struct iovec* iov, unsigned long iovcnt, unsigned long pos_l, unsigned long pos_h) { @@ -275,7 +270,7 @@ hook_preadv(unsigned long fd, const struct iovec* iov, unsigned long iovcnt, return syscall_no_intercept_wrapper(SYS_preadv, fd, iov, iovcnt, pos_l); } -ssize_t +int hook_write(unsigned int fd, const char* buf, size_t count) { LOG(DEBUG, "{}() called with fd: {}, buf: {}, count {}", __func__, fd, @@ -287,7 +282,7 @@ hook_write(unsigned int fd, const char* buf, size_t count) { return syscall_no_intercept_wrapper(SYS_write, fd, buf, count); } -ssize_t +int hook_pwrite(unsigned int fd, const char* buf, size_t count, loff_t pos) { LOG(DEBUG, "{}() called with fd: {}, buf: {}, count: {}, pos: {}", __func__, @@ -301,7 +296,7 @@ hook_pwrite(unsigned int fd, const char* buf, size_t count, loff_t pos) { return syscall_no_intercept_wrapper(SYS_pwrite64, fd, buf, count, pos); } -ssize_t +int hook_writev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt) { LOG(DEBUG, "{}() called with fd: {}, iov: {}, iovcnt: {}", __func__, fd, @@ -313,7 +308,7 @@ hook_writev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt) { return syscall_no_intercept_wrapper(SYS_writev, fd, iov, iovcnt); } -ssize_t +int hook_pwritev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt, unsigned long pos_l, unsigned long pos_h) { @@ -344,12 +339,12 @@ hook_unlinkat(int dirfd, const char* cpath, int flags) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_unlinkat, dirfd, cpath, flags)); + return syscall_no_intercept_wrapper(SYS_unlinkat, dirfd, cpath, + flags); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_unlinkat, dirfd, resolved.c_str(), flags)); + return syscall_no_intercept_wrapper(SYS_unlinkat, dirfd, + resolved.c_str(), flags); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -384,12 +379,12 @@ hook_symlinkat(const char* oldname, int newdfd, const char* newname) { CTX->relativize_fd_path(newdfd, newname, newname_resolved, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_symlinkat, oldname, newdfd, newname)); + return syscall_no_intercept_wrapper(SYS_symlinkat, oldname, newdfd, + newname); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_symlinkat, oldname, newdfd, newname_resolved.c_str())); + return syscall_no_intercept_wrapper(SYS_symlinkat, oldname, newdfd, + newname_resolved.c_str()); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -429,8 +424,7 @@ hook_access(const char* path, int mask) { } return ret; } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_access, rel_path.c_str(), mask)); + return syscall_no_intercept_wrapper(SYS_access, rel_path.c_str(), mask); } #endif @@ -444,12 +438,12 @@ hook_faccessat(int dirfd, const char* cpath, int mode) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_faccessat, dirfd, cpath, mode)); + return syscall_no_intercept_wrapper(SYS_faccessat, dirfd, cpath, + mode); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_faccessat, dirfd, resolved.c_str(), mode)); + return syscall_no_intercept_wrapper(SYS_faccessat, dirfd, + resolved.c_str(), mode); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -475,12 +469,12 @@ hook_faccessat2(int dirfd, const char* cpath, int mode, int flags) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_faccessat2, dirfd, cpath, mode, flags)); + return syscall_no_intercept_wrapper(SYS_faccessat2, dirfd, cpath, + mode, flags); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_faccessat2, dirfd, resolved.c_str(), mode, flags)); + return syscall_no_intercept_wrapper(SYS_faccessat2, dirfd, + resolved.c_str(), mode, flags); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -526,8 +520,7 @@ hook_truncate(const char* path, long length) { if(CTX->relativize_path(path, rel_path)) { return with_errno(gkfs::syscall::gkfs_truncate(rel_path, length)); } - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_truncate, rel_path.c_str(), length)); + return syscall_no_intercept_wrapper(SYS_truncate, rel_path.c_str(), length); } int @@ -539,8 +532,7 @@ hook_ftruncate(unsigned int fd, unsigned long length) { auto path = CTX->file_map()->get(fd)->path(); return with_errno(gkfs::syscall::gkfs_truncate(path, length)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_ftruncate, fd, length)); + return syscall_no_intercept_wrapper(SYS_ftruncate, fd, length); } int @@ -551,7 +543,7 @@ hook_dup(unsigned int fd) { if(CTX->file_map()->exist(fd)) { return with_errno(gkfs::syscall::gkfs_dup(fd)); } - return gsl::narrow_cast(syscall_no_intercept_wrapper(SYS_dup, fd)); + return syscall_no_intercept_wrapper(SYS_dup, fd); } #ifdef SYS_dup2 int @@ -562,8 +554,7 @@ hook_dup2(unsigned int oldfd, unsigned int newfd) { if(CTX->file_map()->exist(oldfd)) { return with_errno(gkfs::syscall::gkfs_dup2(oldfd, newfd)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_dup2, oldfd, newfd)); + return syscall_no_intercept_wrapper(SYS_dup2, oldfd, newfd); } #endif int @@ -578,11 +569,10 @@ hook_dup3(unsigned int oldfd, unsigned int newfd, int flags) { LOG(WARNING, "{}() Not supported", __func__); return -ENOTSUP; } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_dup3, oldfd, newfd, flags)); + return syscall_no_intercept_wrapper(SYS_dup3, oldfd, newfd, flags); } #ifdef SYS_getdents -long +int hook_getdents(unsigned int fd, struct linux_dirent* dirp, unsigned int count) { LOG(DEBUG, "{}() called with fd: {}, dirp: {}, count: {}", __func__, fd, @@ -595,7 +585,7 @@ hook_getdents(unsigned int fd, struct linux_dirent* dirp, unsigned int count) { } #endif -ssize_t +int hook_getdents64(unsigned int fd, struct linux_dirent64* dirp, unsigned int count) { @@ -619,12 +609,12 @@ hook_mkdirat(int dirfd, const char* cpath, mode_t mode) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_mkdirat, dirfd, resolved.c_str(), mode)); + return syscall_no_intercept_wrapper(SYS_mkdirat, dirfd, + resolved.c_str(), mode); case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_mkdirat, dirfd, cpath, mode)); + return syscall_no_intercept_wrapper(SYS_mkdirat, dirfd, cpath, + mode); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -649,12 +639,12 @@ hook_fchmodat(int dirfd, const char* cpath, mode_t mode) { auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_unknown: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_fchmodat, dirfd, cpath, mode)); + return syscall_no_intercept_wrapper(SYS_fchmodat, dirfd, cpath, + mode); case gkfs::preload::RelativizeStatus::external: - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_fchmodat, dirfd, resolved.c_str(), mode)); + return syscall_no_intercept_wrapper(SYS_fchmodat, dirfd, + resolved.c_str(), mode); case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; @@ -678,8 +668,7 @@ hook_fchmod(unsigned int fd, mode_t mode) { LOG(WARNING, "{}() operation not supported", __func__); return -ENOTSUP; } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_fchmod, fd, mode)); + return syscall_no_intercept_wrapper(SYS_fchmod, fd, mode); } int @@ -770,7 +759,7 @@ hook_getcwd(char* buf, unsigned long size) { return (CTX->cwd().size() + 1); } -ssize_t +int hook_readlinkat(int dirfd, const char* cpath, char* buf, int bufsiz) { LOG(DEBUG, "{}() called with dirfd: {}, path \"{}\", buf: {}, bufsize: {}", @@ -807,8 +796,7 @@ hook_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) { arg); if(!CTX->file_map()->exist(fd)) { - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_fcntl, fd, cmd, arg)); + return syscall_no_intercept_wrapper(SYS_fcntl, fd, cmd, arg); } int ret; switch(cmd) { @@ -939,8 +927,8 @@ hook_renameat(int olddfd, const char* oldname, int newdfd, const char* newname, return -EINVAL; } - return gsl::narrow_cast(syscall_no_intercept_wrapper( - SYS_renameat2, olddfd, oldpath_pass, newdfd, newpath_pass, flags)); + return syscall_no_intercept_wrapper(SYS_renameat2, olddfd, oldpath_pass, + newdfd, newpath_pass, flags); } int @@ -953,8 +941,7 @@ hook_statfs(const char* path, struct statfs* buf) { if(CTX->relativize_path(path, rel_path)) { return with_errno(gkfs::syscall::gkfs_statfs(buf)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_statfs, rel_path.c_str(), buf)); + return syscall_no_intercept_wrapper(SYS_statfs, rel_path.c_str(), buf); } int @@ -965,8 +952,7 @@ hook_fstatfs(unsigned int fd, struct statfs* buf) { if(CTX->file_map()->exist(fd)) { return with_errno(gkfs::syscall::gkfs_statfs(buf)); } - return gsl::narrow_cast( - syscall_no_intercept_wrapper(SYS_fstatfs, fd, buf)); + return syscall_no_intercept_wrapper(SYS_fstatfs, fd, buf); } /* The function should broadcast a flush message (pmem_persist i.e.) if the @@ -978,11 +964,10 @@ hook_fsync(unsigned int fd) { if(CTX->file_map()->exist(fd)) { return with_errno(gkfs::syscall::gkfs_fsync(fd)); } - - return gsl::narrow_cast(syscall_no_intercept_wrapper(SYS_fsync, fd)); + return syscall_no_intercept_wrapper(SYS_fsync, fd); } -ssize_t +int hook_getxattr(const char* path, const char* name, void* value, size_t size) { LOG(DEBUG, "{}() called with path '{}' name '{}' value '{}' size '{}'",