Giacomo Travaglini has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/23260 )
Change subject: sim-se: Avoid function overloading for syscall
implementation
..
sim-se: Avoid function overloading for syscall implementation
This patch is aligning the readlink and access syscalls to the open one,
which is not overloading the openFunc, but it is factoring the
implementation into a openImpl, which is used by both open and openat.
This is needed if passing them to std::function, whose constructor is
not able to handle overloaded functions.
Change-Id: I50a8aacdfd675181b6fe9a2696220ee29cc5bc4b
Signed-off-by: Giacomo Travaglini
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23260
Reviewed-by: Brandon Potter
Maintainer: Brandon Potter
Tested-by: kokoro
---
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
2 files changed, 10 insertions(+), 10 deletions(-)
Approvals:
Brandon Potter: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 49fee7e..8dc055c 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -422,11 +422,11 @@
SyscallReturn
readlinkFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
{
-return readlinkFunc(desc, callnum, tc, 0);
+return readlinkImpl(desc, callnum, tc, 0);
}
SyscallReturn
-readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, int index)
+readlinkImpl(SyscallDesc *desc, int num, ThreadContext *tc, int index)
{
string path;
auto p = tc->getProcessPtr();
@@ -1147,7 +1147,7 @@
}
SyscallReturn
-accessFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int index)
+accessImpl(SyscallDesc *desc, int callnum, ThreadContext *tc, int index)
{
string path;
auto p = tc->getProcessPtr();
@@ -1166,7 +1166,7 @@
SyscallReturn
accessFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
{
-return accessFunc(desc, callnum, tc, 0);
+return accessImpl(desc, callnum, tc, 0);
}
SyscallReturn
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 0eaec4c..fc6ed62 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -171,8 +171,8 @@
SyscallReturn getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc);
/// Target readlink() handler.
-SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc,
- int index = 0);
+SyscallReturn readlinkImpl(SyscallDesc *desc, int num, ThreadContext *tc,
+ int index);
SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc);
/// Target unlink() handler.
@@ -313,9 +313,9 @@
SyscallReturn getegidFunc(SyscallDesc *desc, int num, ThreadContext *tc);
/// Target access() handler
-SyscallReturn accessFunc(SyscallDesc *desc, int num, ThreadContext *tc);
-SyscallReturn accessFunc(SyscallDesc *desc, int num, ThreadContext *tc,
+SyscallReturn accessImpl(SyscallDesc *desc, int num, ThreadContext *tc,
int index);
+SyscallReturn accessFunc(SyscallDesc *desc, int num, ThreadContext *tc);
// Target getsockopt() handler.
SyscallReturn getsockoptFunc(SyscallDesc *desc, int num, ThreadContext
*tc);
@@ -953,7 +953,7 @@
int dirfd = process->getSyscallArg(tc, index);
if (dirfd != OS::TGT_AT_FDCWD)
warn("faccessat: first argument not AT_FDCWD; unlikely to work");
-return accessFunc(desc, callnum, tc, 1);
+return accessImpl(desc, callnum, tc, 1);
}
/// Target readlinkat() handler
@@ -966,7 +966,7 @@
int dirfd = process->getSyscallArg(tc, index);
if (dirfd != OS::TGT_AT_FDCWD)
warn("openat: first argument not AT_FDCWD; unlikely to work");
-return readlinkFunc(desc, callnum, tc, 1);
+return readlinkImpl(desc, callnum, tc, 1);
}
/// Target renameat() handler.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23260
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I50a8aacdfd675181b6fe9a2696220ee29cc5bc4b
Gerrit-Change-Number: 23260
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini
Gerrit-Reviewer: Brandon Potter
Gerrit-Reviewer: Gabe Black
Gerrit-Reviewer: Giacomo Travaglini
Gerrit-Reviewer: kokoro
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev