fix: add FileDescriptor class to ensure file descriptor is closed

Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-10-09 10:55:30 +00:00
committed by Compute-Runtime-Automation
parent c2d69e5857
commit 099a3f30e3
15 changed files with 139 additions and 217 deletions

View File

@@ -32,6 +32,7 @@ namespace NEO {
namespace SysCalls {
uint32_t closeFuncCalled = 0u;
uint32_t openFuncCalled = 0u;
int openFuncRetVal = 0;
int closeFuncArgPassed = 0;
int closeFuncRetVal = 0;
int dlOpenFlags = 0;
@@ -145,7 +146,7 @@ int open(const char *file, int flags) {
return fakeFileDescriptor;
}
return 0;
return openFuncRetVal;
}
int openWithMode(const char *file, int flags, int mode) {

View File

@@ -48,6 +48,8 @@ extern int (*sysCallsClosedir)(DIR *dir);
extern int (*sysCallsGetDevicePath)(int deviceFd, char *buf, size_t &bufSize);
extern int flockRetVal;
extern int openFuncRetVal;
extern uint32_t openFuncCalled;
extern int closeFuncRetVal;
extern int closeFuncArgPassed;
extern const char *drmVersion;