summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2016-12-15 13:16:25 -0500
committerBrandon Potter <brandon.potter@amd.com>2016-12-15 13:16:25 -0500
commitcc84eb813c9455e3f8b222fd884d794af9ae0e7a (patch)
tree477d534585c7ddfe5190be21e2d38681423573fc /src/sim/syscall_emul.cc
parent68e9c0e73b1466b7e43c77a75cd38913afcfcafe (diff)
downloadgem5-cc84eb813c9455e3f8b222fd884d794af9ae0e7a.tar.xz
syscall_emul: implement fallocate
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r--src/sim/syscall_emul.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index e62a8686a..9c3f50bb3 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -935,6 +935,27 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
SyscallReturn
+fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+ int index = 0;
+ int tgt_fd = process->getSyscallArg(tc, index);
+ int mode = process->getSyscallArg(tc, index);
+ off_t offset = process->getSyscallArg(tc, index);
+ off_t len = process->getSyscallArg(tc, index);
+
+ int sim_fd = process->getSimFD(tgt_fd);
+ if (sim_fd < 0)
+ return -EBADF;
+
+ int result = fallocate(sim_fd, mode, offset, len);
+ if (result < 0)
+ return -errno;
+
+ return 0;
+}
+
+SyscallReturn
accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc,
int index)
{