fix(sysman): correct the error number for fd overflow

Related-To: NEO-10513

Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
Joshua Santosh Ranjan 2024-03-08 07:27:29 +00:00 committed by Compute-Runtime-Automation
parent 5e15543b14
commit c6bcdf8c7b
3 changed files with 7 additions and 7 deletions

View File

@ -74,7 +74,7 @@ ze_result_t LinuxEngineImp::getProperties(zes_engine_properties_t &properties) {
}
void LinuxEngineImp::checkErrorNumberAndUpdateStatus() {
if (errno == -EMFILE || errno == -ENFILE) {
if (errno == EMFILE || errno == ENFILE) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n");
initStatus = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
} else {

View File

@ -108,7 +108,7 @@ static ze_result_t openPmuHandlesForVfs(uint32_t numberOfVfs,
}
if (fd[1] < 0) {
if (errno == -EMFILE || errno == -ENFILE) {
if (errno == EMFILE || errno == ENFILE) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n");
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}
@ -211,7 +211,7 @@ ze_result_t LinuxEngineImp::getProperties(zes_engine_properties_t &properties) {
}
void LinuxEngineImp::checkErrorNumberAndUpdateStatus() {
if (errno == -EMFILE || errno == -ENFILE) {
if (errno == EMFILE || errno == ENFILE) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Engine Handles could not be created because system has run out of file handles. Suggested action is to increase the file handle limit. \n");
initStatus = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
} else {

View File

@ -130,7 +130,7 @@ TEST_F(ZesEngineFixture, GivenPmuOpenFailsDueToTooManyOpenFilesWhenCallingzesDev
pSysfsAccess->mockReadSymLinkSuccess = true;
pPmuInterface->mockPerfEventOpenRead = true;
pPmuInterface->mockPerfEventOpenFailAtCount = 3;
pPmuInterface->mockErrorNumber = -EMFILE;
pPmuInterface->mockErrorNumber = EMFILE;
pSysmanDeviceImp->pEngineHandleContext->handleList.clear();
pSysmanDeviceImp->pEngineHandleContext->init(deviceHandles);
@ -147,7 +147,7 @@ TEST_F(ZesEngineFixture, GivenPmuOpenFailsDueToTooManyOpenFilesInSystemWhenEnume
pSysfsAccess->mockReadSymLinkSuccess = true;
pPmuInterface->mockPerfEventOpenRead = true;
pPmuInterface->mockPerfEventOpenFailAtCount = 3;
pPmuInterface->mockErrorNumber = -ENFILE;
pPmuInterface->mockErrorNumber = ENFILE;
pSysmanDeviceImp->pEngineHandleContext->handleList.clear();
pSysmanDeviceImp->pEngineHandleContext->init(deviceHandles);
@ -423,7 +423,7 @@ TEST_F(ZesEngineFixture, GivenTooManyFilesErrorWhenCallingZesEngineGetActivityEx
uint32_t count = 0;
pPmuInterface->mockPerfEventOpenRead = true;
pPmuInterface->mockPerfEventOpenFailAtCount = 3;
pPmuInterface->mockErrorNumber = -EMFILE;
pPmuInterface->mockErrorNumber = EMFILE;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesEngineGetActivityExt(handle, &count, nullptr));
EXPECT_EQ(count, pSysfsAccess->mockReadVal + 1);
std::vector<zes_engine_stats_t> engineStats(count);
@ -445,7 +445,7 @@ TEST_F(ZesEngineFixture, GivenTooManyFilesInSystemErrorWhenCallingZesEngineGetAc
uint32_t count = 0;
pPmuInterface->mockPerfEventOpenRead = true;
pPmuInterface->mockPerfEventOpenFailAtCount = 3;
pPmuInterface->mockErrorNumber = -ENFILE;
pPmuInterface->mockErrorNumber = ENFILE;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesEngineGetActivityExt(handle, &count, nullptr));
EXPECT_EQ(count, pSysfsAccess->mockReadVal + 1);
std::vector<zes_engine_stats_t> engineStats(count);