sim-se: Implemnt fchownat syscall
JIRA: https://gem5.atlassian.net/browse/GEM5-1098 Change-Id: I46f9a5ba30a27c29a8a50323a0fb95074016ddb2 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51050 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -657,11 +657,18 @@ chownFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
VPtr<> pathname, uint32_t owner, uint32_t group)
|
||||
{
|
||||
std::string path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
return chownImpl(desc, tc, path, owner, group);
|
||||
}
|
||||
|
||||
SyscallReturn
|
||||
chownImpl(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path, uint32_t owner, uint32_t group)
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
/* XXX endianess */
|
||||
uid_t hostOwner = owner;
|
||||
gid_t hostGroup = group;
|
||||
|
||||
@@ -256,6 +256,8 @@ SyscallReturn gettidFunc(SyscallDesc *desc, ThreadContext *tc);
|
||||
/// Target chown() handler.
|
||||
SyscallReturn chownFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
VPtr<> pathname, uint32_t owner, uint32_t group);
|
||||
SyscallReturn chownImpl(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path, uint32_t owner, uint32_t group);
|
||||
|
||||
/// Target getpgrpFunc() handler.
|
||||
SyscallReturn getpgrpFunc(SyscallDesc *desc, ThreadContext *tc);
|
||||
@@ -1019,6 +1021,25 @@ renameatFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return renameImpl(desc, tc, old_name, new_name);
|
||||
}
|
||||
|
||||
/// Target fchownat() handler
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
fchownatFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int dirfd, VPtr<> pathname, uint32_t owner, uint32_t group,
|
||||
int flags)
|
||||
{
|
||||
std::string path;
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Modifying path from the directory descriptor
|
||||
if (auto res = atSyscallPath<OS>(tc, dirfd, path); !res.successful()) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return chownImpl(desc, tc, path, owner, group);
|
||||
}
|
||||
|
||||
/// Target sysinfo() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
|
||||
Reference in New Issue
Block a user