Discussion:
[gem5-dev] Change in gem5/gem5[master]: sim-se: only implement getdentsFunc on supported hosts
Ciro Santilli (Gerrit)
2018-11-23 18:03:07 UTC
Permalink
Ciro Santilli has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/14596


Change subject: sim-se: only implement getdentsFunc on supported hosts
......................................................................

sim-se: only implement getdentsFunc on supported hosts

The implementation of the getdents syscall relies on SYS_getdents, which
is not available on all archs, because the getdents syscall has been
superseded by getdents64, and does not exist on newer archs such as
aarch64.

This leads the build to break on aarch64 hosts with error:

error: 'SYS_getdents' was not declared in this scope

Change-Id: I8701fb5b61c0418b14a9463ef135a391a7f7a9ba
---
M src/arch/x86/linux/process.cc
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
3 files changed, 12 insertions(+), 1 deletion(-)



diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc
index 9ec4ca0..22fe002 100644
--- a/src/arch/x86/linux/process.cc
+++ b/src/arch/x86/linux/process.cc
@@ -298,7 +298,11 @@
/* 75 */ SyscallDesc("fdatasync", unimplementedFunc),
/* 76 */ SyscallDesc("truncate", truncateFunc),
/* 77 */ SyscallDesc("ftruncate", ftruncateFunc),
+#if defined(SYS_getdents)
/* 78 */ SyscallDesc("getdents", getdentsFunc),
+#else
+ /* 78 */ SyscallDesc("getdents", unimplementedFunc),
+#endif
/* 79 */ SyscallDesc("getcwd", getcwdFunc),
/* 80 */ SyscallDesc("chdir", chdirFunc),
/* 81 */ SyscallDesc("fchdir", unimplementedFunc),
@@ -690,7 +694,11 @@
/* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
/* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
/* 140 */ SyscallDesc("_llseek", _llseekFunc),
+#if defined(SYS_getdents)
/* 141 */ SyscallDesc("getdents", getdentsFunc),
+#else
+ /* 141 */ SyscallDesc("getdents", unimplementedFunc),
+#endif
/* 142 */ SyscallDesc("_newselect", unimplementedFunc),
/* 143 */ SyscallDesc("flock", unimplementedFunc),
/* 144 */ SyscallDesc("msync", unimplementedFunc),
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 794b0bc..4a6fafa 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -1151,6 +1151,7 @@
return (result == -1) ? -errno : result;
}

+#if defined(SYS_getdents)
SyscallReturn
getdentsFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
{
@@ -1198,4 +1199,4 @@
buf_arg.copyOut(tc->getMemProxy());
return status;
}
-
+#endif
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 17d4109..ba607c9 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -303,9 +303,11 @@
SyscallReturn getpidFunc(SyscallDesc *desc, int num,
Process *p, ThreadContext *tc);

+#if defined(SYS_getdents)
// Target getdents() handler.
SyscallReturn getdentsFunc(SyscallDesc *desc, int num,
Process *p, ThreadContext *tc);
+#endif

// Target getuid() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, int num,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14596
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: I8701fb5b61c0418b14a9463ef135a391a7f7a9ba
Gerrit-Change-Number: 14596
Gerrit-PatchSet: 1
Gerrit-Owner: Ciro Santilli <***@arm.com>
Gerrit-MessageType: newchange
Ciro Santilli (Gerrit)
2018-11-27 11:46:37 UTC
Permalink
Ciro Santilli has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/14596 )

Change subject: sim-se: only implement getdentsFunc on supported hosts
......................................................................

sim-se: only implement getdentsFunc on supported hosts

The implementation of the getdents syscall relies on SYS_getdents, which
is not available on all archs, because the getdents syscall has been
superseded by getdents64, and does not exist on newer archs such as
aarch64.

This leads the build to break on aarch64 hosts with error:

error: 'SYS_getdents' was not declared in this scope

Change-Id: I8701fb5b61c0418b14a9463ef135a391a7f7a9ba
Reviewed-on: https://gem5-review.googlesource.com/c/14596
Reviewed-by: Brandon Potter <***@amd.com>
Maintainer: Brandon Potter <***@amd.com>
---
M src/arch/x86/linux/process.cc
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
3 files changed, 12 insertions(+), 1 deletion(-)

Approvals:
Brandon Potter: Looks good to me, approved; Looks good to me, approved



diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc
index 9ec4ca0..22fe002 100644
--- a/src/arch/x86/linux/process.cc
+++ b/src/arch/x86/linux/process.cc
@@ -298,7 +298,11 @@
/* 75 */ SyscallDesc("fdatasync", unimplementedFunc),
/* 76 */ SyscallDesc("truncate", truncateFunc),
/* 77 */ SyscallDesc("ftruncate", ftruncateFunc),
+#if defined(SYS_getdents)
/* 78 */ SyscallDesc("getdents", getdentsFunc),
+#else
+ /* 78 */ SyscallDesc("getdents", unimplementedFunc),
+#endif
/* 79 */ SyscallDesc("getcwd", getcwdFunc),
/* 80 */ SyscallDesc("chdir", chdirFunc),
/* 81 */ SyscallDesc("fchdir", unimplementedFunc),
@@ -690,7 +694,11 @@
/* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
/* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
/* 140 */ SyscallDesc("_llseek", _llseekFunc),
+#if defined(SYS_getdents)
/* 141 */ SyscallDesc("getdents", getdentsFunc),
+#else
+ /* 141 */ SyscallDesc("getdents", unimplementedFunc),
+#endif
/* 142 */ SyscallDesc("_newselect", unimplementedFunc),
/* 143 */ SyscallDesc("flock", unimplementedFunc),
/* 144 */ SyscallDesc("msync", unimplementedFunc),
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 794b0bc..4a6fafa 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -1151,6 +1151,7 @@
return (result == -1) ? -errno : result;
}

+#if defined(SYS_getdents)
SyscallReturn
getdentsFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
{
@@ -1198,4 +1199,4 @@
buf_arg.copyOut(tc->getMemProxy());
return status;
}
-
+#endif
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 17d4109..ba607c9 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -303,9 +303,11 @@
SyscallReturn getpidFunc(SyscallDesc *desc, int num,
Process *p, ThreadContext *tc);

+#if defined(SYS_getdents)
// Target getdents() handler.
SyscallReturn getdentsFunc(SyscallDesc *desc, int num,
Process *p, ThreadContext *tc);
+#endif

// Target getuid() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, int num,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14596
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: I8701fb5b61c0418b14a9463ef135a391a7f7a9ba
Gerrit-Change-Number: 14596
Gerrit-PatchSet: 2
Gerrit-Owner: Ciro Santilli <***@arm.com>
Gerrit-Reviewer: Brandon Potter <***@amd.com>
Gerrit-Reviewer: Ciro Santilli <***@arm.com>
Gerrit-Reviewer: Giacomo Travaglini <***@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <***@lowepower.com>
Gerrit-MessageType: merged
Loading...