diff options
author | Erik Hallnor <ehallnor@umich.edu> | 2004-02-06 00:13:44 -0500 |
---|---|---|
committer | Erik Hallnor <ehallnor@umich.edu> | 2004-02-06 00:13:44 -0500 |
commit | bdfb5de4b2a8d01143d09a1bc4ead1e8d74dbcd3 (patch) | |
tree | 97497d04270a5288a02ea8576aa220ed90fced52 /sim/syscall_emul.cc | |
parent | 8f0060b4aefc72ef9afa6aa6a79a36a234bdb1d7 (diff) | |
parent | 95c248c2139ff8d3568e1c92319727777f19920f (diff) | |
download | gem5-bdfb5de4b2a8d01143d09a1bc4ead1e8d74dbcd3.tar.xz |
Merge ehallnor@zizzer:/bk/m5 into zazzer.eecs.umich.edu:/z/ehallnor/m5
--HG--
extra : convert_revision : 158117a2cba91b8cb04f41a418155149bcbba777
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; +} |