sim-se, kern: Add flags parameter to unlinkat
The unlinkat syscall expects a "third" flags parameter [1]. It is using it to implement a sort of rmdirat (in case the parameter includes the AT_REMOVEDIR flag) [1]: https://man7.org/linux/man-pages/man2/unlink.2.html Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Change-Id: I38dd9268ae4de0f289abe779c4da03e969248065 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51548 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:
@@ -911,7 +911,8 @@ openFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
/// Target unlinkat() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
unlinkatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname)
|
||||
unlinkatFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int dirfd, VPtr<> pathname, int flags)
|
||||
{
|
||||
std::string path;
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
@@ -922,7 +923,11 @@ unlinkatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname)
|
||||
return res;
|
||||
}
|
||||
|
||||
return unlinkImpl(desc, tc, path);
|
||||
if (flags & OS::TGT_AT_REMOVEDIR) {
|
||||
return rmdirImpl(desc, tc, path);
|
||||
} else {
|
||||
return unlinkImpl(desc, tc, path);
|
||||
}
|
||||
}
|
||||
|
||||
/// Target facessat() handler
|
||||
|
||||
Reference in New Issue
Block a user