sim-se: Implement fchmodat syscall
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Change-Id: Id3b738fa50d0739da5df856c87a8e172ec7a423a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51747 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:
@@ -1130,19 +1130,24 @@ sysinfoFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
/// Target chmod() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
|
||||
fchmodatFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int dirfd, VPtr<> pathname, mode_t mode)
|
||||
{
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
mode_t hostMode = 0;
|
||||
|
||||
// XXX translate mode flags via OS::something???
|
||||
hostMode = mode;
|
||||
|
||||
auto process = tc->getProcessPtr();
|
||||
// Adjust path for cwd and redirection
|
||||
path = process->checkPathRedirect(path);
|
||||
|
||||
@@ -1154,6 +1159,14 @@ chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Target chmod() handler.
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
|
||||
{
|
||||
return fchmodatFunc<OS>(desc, tc, OS::TGT_AT_FDCWD, pathname, mode);
|
||||
}
|
||||
|
||||
template <class OS>
|
||||
SyscallReturn
|
||||
pollFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
Reference in New Issue
Block a user