diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-02-06 19:00:12 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-02-06 19:00:12 -0500 |
commit | 22f78a6d03fbc390eca538b906aedea9121ab9bb (patch) | |
tree | 7bb464417a73cdd39ad57bb2800d5949ea02c72d /sim/syscall_emul.cc | |
parent | c76675be58b90657078cfb2638a3d0d7f285ef48 (diff) | |
parent | 8a89f8c80722e68d2563e6823dbcff832b112397 (diff) | |
download | gem5-22f78a6d03fbc390eca538b906aedea9121ab9bb.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/m5
into ziff.eecs.umich.edu:/z/binkertn/research/m5/kernel
--HG--
extra : convert_revision : fa0e28dc72b54add9e534f8f689b0f6dd8e7731c
Diffstat (limited to 'sim/syscall_emul.cc')
-rw-r--r-- | sim/syscall_emul.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc index 9955d4421..e953a7308 100644 --- a/sim/syscall_emul.cc +++ b/sim/syscall_emul.cc @@ -185,4 +185,32 @@ gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) return 0; } +int +unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) +{ + std::string path; + + if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + return -EFAULT; + + int result = unlink(path.c_str()); + return (result == -1) ? -errno : result; +} + +int +renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) +{ + std::string old_name; + + if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault) + return -EFAULT; + + std::string new_name; + + if (xc->mem->readString(new_name, xc->getSyscallArg(1)) != No_Fault) + return -EFAULT; + + int result = rename(old_name.c_str(),new_name.c_str()); + return (result == -1) ? -errno : result; +} |