mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-22 19:29:06 +08:00
feature: Add syscall wrappers for pidfdopen and pidfdgetfd
Related-To: NEO-12952 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3596522637
commit
a2d25ca31f
@@ -66,6 +66,8 @@ int flockCalled = 0;
|
||||
int opendirCalled = 0;
|
||||
int readdirCalled = 0;
|
||||
int closedirCalled = 0;
|
||||
int pidfdopenCalled = 0;
|
||||
int pidfdgetfdCalled = 0;
|
||||
int fsyncCalled = 0;
|
||||
int fsyncArgPassed = 0;
|
||||
int fsyncRetVal = 0;
|
||||
@@ -112,6 +114,8 @@ DIR *(*sysCallsOpendir)(const char *name) = nullptr;
|
||||
struct dirent *(*sysCallsReaddir)(DIR *dir) = nullptr;
|
||||
int (*sysCallsClosedir)(DIR *dir) = nullptr;
|
||||
int (*sysCallsGetDevicePath)(int deviceFd, char *buf, size_t &bufSize) = nullptr;
|
||||
int (*sysCallsPidfdOpen)(pid_t pid, unsigned int flags) = nullptr;
|
||||
int (*sysCallsPidfdGetfd)(int pidfd, int fd, unsigned int flags) = nullptr;
|
||||
off_t lseekReturn = 4096u;
|
||||
std::atomic<int> lseekCalledCount(0);
|
||||
long sysconfReturn = 1ull << 30;
|
||||
@@ -536,5 +540,21 @@ int mkfifo(const char *pathname, mode_t mode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pidfdopen(pid_t pid, unsigned int flags) {
|
||||
pidfdopenCalled++;
|
||||
if (sysCallsPidfdOpen != nullptr) {
|
||||
return sysCallsPidfdOpen(pid, flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pidfdgetfd(int pid, int targetfd, unsigned int flags) {
|
||||
pidfdgetfdCalled++;
|
||||
if (sysCallsPidfdGetfd != nullptr) {
|
||||
return sysCallsPidfdGetfd(pid, targetfd, flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace SysCalls
|
||||
} // namespace NEO
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <iostream>
|
||||
#include <poll.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
@@ -49,6 +50,8 @@ extern struct dirent *(*sysCallsReaddir)(DIR *dir);
|
||||
extern int (*sysCallsClosedir)(DIR *dir);
|
||||
extern int (*sysCallsGetDevicePath)(int deviceFd, char *buf, size_t &bufSize);
|
||||
extern int (*sysCallsClose)(int fileDescriptor);
|
||||
extern int (*sysCallsPidfdOpen)(pid_t pid, unsigned int flags);
|
||||
extern int (*sysCallsPidfdGetfd)(int pidfd, int fd, unsigned int flags);
|
||||
|
||||
extern bool allowFakeDevicePath;
|
||||
extern int flockRetVal;
|
||||
@@ -83,6 +86,8 @@ extern bool failFcntl;
|
||||
extern bool failFcntl1;
|
||||
extern bool failAccess;
|
||||
extern int setErrno;
|
||||
extern int pidfdopenCalled;
|
||||
extern int pidfdgetfdCalled;
|
||||
|
||||
extern std::vector<void *> mmapVector;
|
||||
extern std::vector<void *> mmapCapturedExtendedPointers;
|
||||
|
||||
Reference in New Issue
Block a user