changeset 024af426b59a in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=024af426b59a
description:
sim: fix function for emulating dup()
The function was using the host fd to obtain the fd object from the
simulated
process.
diffstat:
src/sim/syscall_emul.cc | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (22 lines):
diff -r 46070443051e -r 024af426b59a src/sim/syscall_emul.cc
--- a/src/sim/syscall_emul.cc Wed Apr 08 15:56:06 2015 -0500
+++ b/src/sim/syscall_emul.cc Mon Apr 13 17:33:57 2015 -0500
@@ -594,13 +594,14 @@
dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc)
{
int index = 0;
- int fd = process->sim_fd(process->getSyscallArg(tc, index));
- if (fd < 0)
+ int tgt_fd = process->getSyscallArg(tc, index);
+ int sim_fd = process->sim_fd(tgt_fd);
+ if (sim_fd < 0)
return -EBADF;
- Process::FdMap *fdo = process->sim_fd_obj(fd);
+ Process::FdMap *fdo = process->sim_fd_obj(tgt_fd);
- int result = dup(fd);
+ int result = dup(sim_fd);
return (result == -1) ? -errno :
process->alloc_fd(result, fdo->filename, fdo->flags, fdo->mode, false);
}
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev