Adds support for faccessat2 to FileManager

This commit is contained in:
Ryan Houdek 2021-02-24 09:51:29 -08:00
parent 74a00fee0f
commit ac92a103df
2 changed files with 13 additions and 0 deletions

View File

@ -95,6 +95,18 @@ uint64_t FileManager::FAccessat(int dirfd, const char *pathname, int mode) {
return ::syscall(SYS_faccessat, dirfd, pathname, mode); return ::syscall(SYS_faccessat, dirfd, pathname, mode);
} }
uint64_t FileManager::FAccessat2(int dirfd, const char *pathname, int mode, int flags) {
const uint32_t SYS_faccessat2 = 439;
auto Path = GetEmulatedPath(pathname);
if (!Path.empty()) {
uint64_t Result = ::syscall(SYS_faccessat2, dirfd, Path.c_str(), mode, flags);
if (Result != -1)
return Result;
}
return ::syscall(SYS_faccessat2, dirfd, pathname, mode, flags);
}
uint64_t FileManager::Readlink(const char *pathname, char *buf, size_t bufsiz) { uint64_t FileManager::Readlink(const char *pathname, char *buf, size_t bufsiz) {
if (strcmp(pathname, "/proc/self/exe") == 0 || strcmp(pathname, PidSelfPath.c_str()) == 0) { if (strcmp(pathname, "/proc/self/exe") == 0 || strcmp(pathname, PidSelfPath.c_str()) == 0) {
auto App = Filename(); auto App = Filename();

View File

@ -28,6 +28,7 @@ public:
uint64_t Lstat(const char *path, void *buf); uint64_t Lstat(const char *path, void *buf);
uint64_t Access(const char *pathname, int mode); uint64_t Access(const char *pathname, int mode);
uint64_t FAccessat(int dirfd, const char *pathname, int mode); uint64_t FAccessat(int dirfd, const char *pathname, int mode);
uint64_t FAccessat2(int dirfd, const char *pathname, int mode, int flags);
uint64_t Readlink(const char *pathname, char *buf, size_t bufsiz); uint64_t Readlink(const char *pathname, char *buf, size_t bufsiz);
uint64_t Chmod(const char *pathname, mode_t mode); uint64_t Chmod(const char *pathname, mode_t mode);
uint64_t Readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz); uint64_t Readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);