summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2017-01-20 14:12:58 -0500
committerBrandon Potter <brandon.potter@amd.com>2017-01-20 14:12:58 -0500
commit93d8e6b898a70a3f6dba9da385d5933683bf325f (patch)
tree276c296a11129ec68550f946ac8776b84e369461
parent1961a942f395d0b880461106a09761b92e2d53f6 (diff)
downloadgem5-93d8e6b898a70a3f6dba9da385d5933683bf325f.tar.xz
syscall_emul: #ifdef new system calls to allow builds on OSX and BSD
-rw-r--r--src/sim/syscall_emul.cc5
-rw-r--r--src/sim/syscall_emul.hh13
2 files changed, 16 insertions, 2 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index da89f7a08..b34e983a6 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -895,6 +895,9 @@ SyscallReturn
fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
+#if NO_FALLOCATE
+ warn("Host OS cannot support calls to fallocate. Ignoring syscall");
+#else
int index = 0;
int tgt_fd = process->getSyscallArg(tc, index);
int mode = process->getSyscallArg(tc, index);
@@ -908,7 +911,7 @@ fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
int result = fallocate(sim_fd, mode, offset, len);
if (result < 0)
return -errno;
-
+#endif
return 0;
}
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 3e7221c0b..4433b5039 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -49,6 +49,12 @@
defined(__FreeBSD__) || defined(__CYGWIN__) || \
defined(__NetBSD__))
+#define NO_STATFS (defined(__APPLE__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__))
+
+#define NO_FALLOCATE (defined(__APPLE__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__))
+
///
/// @file syscall_emul.hh
///
@@ -62,7 +68,9 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#if (NO_STATFS == 0)
#include <sys/statfs.h>
+#endif
#include <sys/time.h>
#include <sys/uio.h>
#include <unistd.h>
@@ -1123,6 +1131,9 @@ SyscallReturn
statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
+#if NO_STATFS
+ warn("Host OS cannot support calls to statfs. Ignoring syscall");
+#else
std::string path;
int index = 0;
@@ -1142,7 +1153,7 @@ statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
return -errno;
copyOutStatfsBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
-
+#endif
return 0;
}