Giacomo Travaglini has uploaded this change for review. ( 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
---
M src/sim/syscall_emul.hh
1 file changed, 26 insertions(+), 3 deletions(-)



diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 0f9b7b0..01ec1fa 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1090,19 +1090,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);

@@ -1114,6 +1119,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: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to