Giacomo Travaglini has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/51747 )
Change subject: sim-se: Implement fchmodat syscall
......................................................................
sim-se: Implement fchmodat syscall
Signed-off-by: Giacomo Travaglini <[email protected]>
Change-Id: Id3b738fa50d0739da5df856c87a8e172ec7a423a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51747
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/sim/syscall_emul.hh
1 file changed, 30 insertions(+), 3 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 52110db..6cbbf00 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1130,19 +1130,24 @@
/// Target chmod() handler.
template <class OS>
SyscallReturn
-chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t
mode)
+fchmodatFunc(SyscallDesc *desc, ThreadContext *tc,
+ int dirfd, VPtr<> pathname, mode_t mode)
{
std::string path;
- auto process = tc->getProcessPtr();
-
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
return -EFAULT;
+ // Modifying path from the directory descriptor
+ if (auto res = atSyscallPath<OS>(tc, dirfd, path); !res.successful()) {
+ return res;
+ }
+
mode_t hostMode = 0;
// XXX translate mode flags via OS::something???
hostMode = mode;
+ auto process = tc->getProcessPtr();
// Adjust path for cwd and redirection
path = process->checkPathRedirect(path);
@@ -1154,6 +1159,14 @@
return 0;
}
+/// Target chmod() handler.
+template <class OS>
+SyscallReturn
+chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t
mode)
+{
+ return fchmodatFunc<OS>(desc, tc, OS::TGT_AT_FDCWD, pathname, mode);
+}
+
template <class OS>
SyscallReturn
pollFunc(SyscallDesc *desc, ThreadContext *tc,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51747
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: Id3b738fa50d0739da5df856c87a8e172ec7a423a
Gerrit-Change-Number: 51747
Gerrit-PatchSet: 3
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[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