diff options
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | fesvr/fesvr.ac | 5 | ||||
-rw-r--r-- | fesvr/syscall.cc | 6 |
3 files changed, 22 insertions, 0 deletions
@@ -4756,6 +4756,16 @@ else fi +ac_fn_cxx_check_member "$LINENO" "struct statx" "ino" "ac_cv_member_struct_statx_ino" "$ac_includes_default" +if test "x$ac_cv_member_struct_statx_ino" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STATX 1 +_ACEOF + +fi + + ac_fn_cxx_check_member "$LINENO" "struct statx" "stx_mnt_id" "ac_cv_member_struct_statx_stx_mnt_id" "$ac_includes_default" if test "x$ac_cv_member_struct_statx_stx_mnt_id" = xyes; then : @@ -4769,6 +4779,7 @@ fi + # Determine if this is a required or an optional subproject diff --git a/fesvr/fesvr.ac b/fesvr/fesvr.ac index 9a211b1..7a68733 100644 --- a/fesvr/fesvr.ac +++ b/fesvr/fesvr.ac @@ -1,5 +1,10 @@ AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR([libpthread is required])]) +AC_CHECK_MEMBER(struct statx.ino, + AC_DEFINE_UNQUOTED(HAVE_STATX, 1, [Define to 1 if struct statx exists.]), + , +) + AC_CHECK_MEMBER(struct statx.stx_mnt_id, AC_DEFINE_UNQUOTED(HAVE_STATX_MNT_ID, 1, [Define to 1 if struct statx has stx_mnt_id.]), , diff --git a/fesvr/syscall.cc b/fesvr/syscall.cc index 8a9b29b..298d851 100644 --- a/fesvr/syscall.cc +++ b/fesvr/syscall.cc @@ -64,6 +64,7 @@ struct riscv_statx_timestamp { target_endian<int32_t> __reserved; }; +#ifdef HAVE_STATX struct riscv_statx { target_endian<uint32_t> mask; @@ -134,6 +135,7 @@ struct riscv_statx #endif {} }; +#endif syscall_t::syscall_t(htif_t* htif) : htif(htif), memif(&htif->memif()), table(2048) @@ -303,6 +305,9 @@ reg_t syscall_t::sys_lstat(reg_t pname, reg_t len, reg_t pbuf, reg_t a3, reg_t a reg_t syscall_t::sys_statx(reg_t fd, reg_t pname, reg_t len, reg_t flags, reg_t mask, reg_t pbuf, reg_t a6) { +#ifndef HAVE_STATX + return -ENOSYS; +#else std::vector<char> name(len); memif->read(pname, len, &name[0]); @@ -314,6 +319,7 @@ reg_t syscall_t::sys_statx(reg_t fd, reg_t pname, reg_t len, reg_t flags, reg_t memif->write(pbuf, sizeof(rbuf), &rbuf); } return ret; +#endif } #define AT_SYSCALL(syscall, fd, name, ...) \ |