diff options
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r-- | src/sim/syscall_emul.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index c56963acf..dd2323eaa 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -540,6 +540,26 @@ linkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) } SyscallReturn +symlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) +{ + string path; + string new_path; + + int index = 0; + auto &virt_mem = tc->getMemProxy(); + if (!virt_mem.tryReadString(path, p->getSyscallArg(tc, index))) + return -EFAULT; + if (!virt_mem.tryReadString(new_path, p->getSyscallArg(tc, index))) + return -EFAULT; + + path = p->fullPath(path); + new_path = p->fullPath(new_path); + + int result = symlink(path.c_str(), new_path.c_str()); + return (result == -1) ? -errno : result; +} + +SyscallReturn mkdirFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { string path; |