Giacomo Travaglini has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/51059 )

 (

3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
 )Change subject: sim-se: Implement futimesat syscall
......................................................................

sim-se: Implement futimesat syscall

Change-Id: I0cfb577b77663f8e4fac5c68633bdd69c4c8e2ea
Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51059
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
---
M src/sim/syscall_emul.hh
1 file changed, 32 insertions(+), 6 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 0f27cb2..52110db 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -2075,19 +2075,21 @@
     return 0;
 }

-
-/// Target utimes() handler.
+/// Target futimesat() handler.
 template <class OS>
 SyscallReturn
-utimesFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname,
-           VPtr<typename OS::timeval [2]> tp)
+futimesatFunc(SyscallDesc *desc, ThreadContext *tc,
+ int dirfd, VPtr<> pathname, VPtr<typename OS::timeval [2]> tp)
 {
     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;
+    }
+
     struct timeval hostTimeval[2];
     for (int i = 0; i < 2; ++i) {
         hostTimeval[i].tv_sec = gtoh((*tp)[i].tv_sec, OS::byteOrder);
@@ -2095,6 +2097,7 @@
     }

     // Adjust path for cwd and redirection
+    auto process = tc->getProcessPtr();
     path = process->checkPathRedirect(path);

     int result = utimes(path.c_str(), hostTimeval);
@@ -2105,6 +2108,15 @@
     return 0;
 }

+/// Target utimes() handler.
+template <class OS>
+SyscallReturn
+utimesFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname,
+           VPtr<typename OS::timeval [2]> tp)
+{
+    return futimesatFunc<OS>(desc, tc, OS::TGT_AT_FDCWD, pathname, tp);
+}
+
 template <class OS>
 SyscallReturn
 execveFunc(SyscallDesc *desc, ThreadContext *tc,

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51059
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: I0cfb577b77663f8e4fac5c68633bdd69c4c8e2ea
Gerrit-Change-Number: 51059
Gerrit-PatchSet: 5
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Richard Cooper <richard.coo...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to