Merge zizzer.eecs.umich.edu:/bk/m5

into ziff.eecs.umich.edu:/z/binkertn/research/m5/kernel

--HG--
extra : convert_revision : fa0e28dc72b54add9e534f8f689b0f6dd8e7731c
This commit is contained in:
Nathan Binkert
2004-02-06 19:00:12 -05:00
4 changed files with 50 additions and 9 deletions

View File

@@ -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;
}

View File

@@ -191,6 +191,12 @@ int munmapFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
/// Target gethostname() handler.
int gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
/// Target unlink() handler.
int unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
/// Target rename() handler.
int renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc);
//////////////////////////////////////////////////////////////////////
//
// The following emulation functions are generic, but need to be
@@ -223,10 +229,12 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *process,
case OS::TIOCSETN:
case OS::TIOCSETC:
case OS::TIOCGETC:
case OS::TIOCGETS:
case OS::TIOCGETA:
return -ENOTTY;
default:
fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...)\n", fd, req);
fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ 0x%llx\n", fd, req, xc->readPC());
}
}