summaryrefslogtreecommitdiff
path: root/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2005-11-22 12:08:08 -0500
committerKevin Lim <ktlim@umich.edu>2005-11-22 12:08:08 -0500
commit6da93ea526cf266c1b82ded99b4a4db3b1be2f97 (patch)
tree9bc777a5cb10c0d3cb00ea82c10d3c43368c1bf0 /sim/syscall_emul.cc
parentfb3ae7264fd84b7a7e7a65a01021d4de4996738f (diff)
downloadgem5-6da93ea526cf266c1b82ded99b4a4db3b1be2f97.tar.xz
Apply patch for syscall emulation provided by Antti Miettinen (apm@brigitte.dna.fi). It provides support for more syscalls in syscall emulation mode.
arch/alpha/alpha_linux_process.cc: sim/syscall_emul.cc: sim/syscall_emul.hh: Apply patch for syscall emulation provided by Antti Miettinen (apm@brigitte.dna.fi). --HG-- extra : convert_revision : 37fbc78a927110b7798343afd2c5f37a269e42b4
Diffstat (limited to 'sim/syscall_emul.cc')
-rw-r--r--sim/syscall_emul.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc
index 50650018e..4b6388a41 100644
--- a/sim/syscall_emul.cc
+++ b/sim/syscall_emul.cc
@@ -242,3 +242,39 @@ ftruncateFunc(SyscallDesc *desc, int num, Process *process, ExecContext *xc)
int result = ftruncate(fd, length);
return (result == -1) ? -errno : result;
}
+
+SyscallReturn
+chownFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
+{
+ string path;
+
+ if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
+
+ /* XXX endianess */
+ uint32_t owner = xc->getSyscallArg(1);
+ uid_t hostOwner = owner;
+ uint32_t group = xc->getSyscallArg(2);
+ gid_t hostGroup = group;
+
+ int result = chown(path.c_str(), hostOwner, hostGroup);
+ return (result == -1) ? -errno : result;
+}
+
+SyscallReturn
+fchownFunc(SyscallDesc *desc, int num, Process *process, ExecContext *xc)
+{
+ int fd = process->sim_fd(xc->getSyscallArg(0));
+
+ if (fd < 0)
+ return -EBADF;
+
+ /* XXX endianess */
+ uint32_t owner = xc->getSyscallArg(1);
+ uid_t hostOwner = owner;
+ uint32_t group = xc->getSyscallArg(2);
+ gid_t hostGroup = group;
+
+ int result = fchown(fd, hostOwner, hostGroup);
+ return (result == -1) ? -errno : result;
+}