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

Merge branch 'statx-glibc' into 'master'

Check for statx support

See merge request !49
parents 7c034057 61256a94
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -203,6 +203,18 @@ include_directories(
)

include(GNUInstallDirs)
include(CheckSymbolExists)

check_cxx_source_compiles("
    #include <fcntl.h>
    #include <sys/stat.h>

    int main() {
        struct statx buf;
        statx(AT_FDCWD, \"/foo\", AT_EMPTY_PATH, STATX_BASIC_STATS, &buf);
        return 0;
    }
" GLIBC_HAS_STATX)

# Global components
add_subdirectory(src/global)
+2 −0
Original line number Diff line number Diff line
@@ -41,7 +41,9 @@ int gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = tru

// Implementation of statx, it uses the normal stat and maps the information to the statx structure
// Follow links is true by default 
#ifdef STATX_TYPE
int gkfs_statx(int dirfd, const std::string& path, int flags, unsigned int mask,struct statx* buf, bool follow_links = true );
#endif

int gkfs_statfs(struct statfs* buf);

+2 −0
Original line number Diff line number Diff line
@@ -30,7 +30,9 @@ int hook_close(int fd);

int hook_stat(const char* path, struct stat* buf);

#ifdef STATX_TYPE
int hook_statx(int dirfd, const char* path, int flags, unsigned int mask,struct statx* buf);
#endif

int hook_lstat(const char* path, struct stat* buf);

+2 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ int gkfs_stat(const string& path, struct stat* buf, bool follow_links) {
    return 0;
}


#ifdef STATX_TYPE
int gkfs_statx(int dirfs, const std::string& path, int flags, unsigned int mask, struct statx* buf, bool follow_links) {
    auto md = gkfs::util::get_metadata(path, follow_links);
    if (!md) {
@@ -268,6 +268,7 @@ int gkfs_statx(int dirfs, const std::string& path, int flags, unsigned int mask,
    
    return 0;
}
#endif

int gkfs_statfs(struct statfs* buf) {
    auto blk_stat = gkfs::rpc::forward_get_chunk_stat();
+2 −4
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ int hook_stat(const char* path, struct stat* buf) {
    return syscall_no_intercept(SYS_stat, rel_path.c_str(), buf);
}


#ifdef STATX_TYPE
int hook_statx(int dirfd, const char* path, int flags, unsigned int mask, struct ::statx* buf) {

    LOG(DEBUG, "{}() called with dirfd: '{}', path: \"{}\", flags: '{}', mask: '{}', buf: '{}'",
@@ -127,9 +127,7 @@ int hook_statx(int dirfd, const char* path, int flags, unsigned int mask, struct
   
    return syscall_no_intercept(SYS_statx, dirfd, path, flags, mask,  buf);
}



#endif

int hook_lstat(const char* path, struct stat* buf) {

Loading