sim-se: Define rmdirImpl helper

This will be used by the following commit when properly reimplementing
unlinkat syscall

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Change-Id: If207bed196ad467decaa1cfee70a538e6dfe8d1d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51547
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2021-10-11 10:13:38 +01:00
parent bad6fa679d
commit 65ef21a308
2 changed files with 11 additions and 2 deletions

View File

@@ -963,11 +963,17 @@ chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
SyscallReturn
rmdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
{
auto p = tc->getProcessPtr();
std::string path;
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
return -EFAULT;
return rmdirImpl(desc, tc, path);
}
SyscallReturn
rmdirImpl(SyscallDesc *desc, ThreadContext *tc, std::string path)
{
auto p = tc->getProcessPtr();
path = p->checkPathRedirect(path);
auto result = rmdir(path.c_str());

View File

@@ -206,7 +206,10 @@ SyscallReturn mknodFunc(SyscallDesc *desc, ThreadContext *tc,
SyscallReturn chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname);
// Target rmdir() handler.
SyscallReturn rmdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname);
SyscallReturn rmdirFunc(SyscallDesc *desc, ThreadContext *tc,
VPtr<> pathname);
SyscallReturn rmdirImpl(SyscallDesc *desc, ThreadContext *tc,
std::string path);
/// Target rename() handler.
SyscallReturn renameFunc(SyscallDesc *desc, ThreadContext *tc,