diff options
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r-- | src/sim/syscall_emul.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 6620d95e3..fe0260223 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -301,6 +301,19 @@ fchownFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) SyscallReturn +dupFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) +{ + int fd = process->sim_fd(tc->getSyscallArg(0)); + + if (fd < 0) + return -EBADF; + + int result = dup(fd); + return (result == -1) ? -errno : process->alloc_fd(result); +} + + +SyscallReturn fcntlFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) { |