Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/53205 )
Change subject: sim-se: Implement the newfstatat system call.
......................................................................
sim-se: Implement the newfstatat system call.
Jira Issue: https://gem5.atlassian.net/browse/GEM5-1117
Change-Id: Id611bc7d6369b7d94ce27f33aff74a61879ce900
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53205
Maintainer: Bobby Bruce <[email protected]>
Tested-by: kokoro <[email protected]>
Reviewed-by: Giacomo Travaglini <[email protected]>
---
M src/sim/syscall_emul.hh
1 file changed, 54 insertions(+), 0 deletions(-)
Approvals:
Giacomo Travaglini: Looks good to me, approved
Bobby Bruce: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 2f49f5e..a74aabf 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1371,6 +1371,45 @@
return 0;
}
+/// Target newfstatat() handler.
+template <class OS>
+SyscallReturn
+newfstatatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd,
+ VPtr<> pathname, VPtr<typename OS::tgt_stat> tgt_stat,
+ int flags)
+{
+ std::string path;
+
+ if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
+ return -EFAULT;
+
+ if (path.empty() && !(flags & OS::TGT_AT_EMPTY_PATH))
+ return -ENOENT;
+ flags = flags & ~OS::TGT_AT_EMPTY_PATH;
+
+ warn_if(flags != 0, "newfstatat: Flag bits %#x not supported.", flags);
+
+ // Modifying path from the directory descriptor
+ if (auto res = atSyscallPath<OS>(tc, dirfd, path); !res.successful()) {
+ return res;
+ }
+
+ auto p = tc->getProcessPtr();
+
+ // Adjust path for cwd and redirection
+ path = p->checkPathRedirect(path);
+
+ struct stat host_buf;
+ int result = stat(path.c_str(), &host_buf);
+
+ if (result < 0)
+ return -errno;
+
+ copyOutStatBuf<OS>(tgt_stat, &host_buf);
+
+ return 0;
+}
+
/// Target fstatat64() handler.
template <class OS>
SyscallReturn
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53205
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id611bc7d6369b7d94ce27f33aff74a61879ce900
Gerrit-Change-Number: 53205
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Matt Sinclair <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s