fix: void

This commit is contained in:
xsren 2024-09-13 16:14:40 +08:00
parent 661a170a9b
commit a91085eef6
5 changed files with 35 additions and 23 deletions

View File

@ -127,7 +127,10 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) {
snprintf(dnodeIdEnvItem, 32, "%s=%d", "DNODE_ID", pData->dnodeId);
float numCpuCores = 4;
taosGetCpuCores(&numCpuCores, false);
int32_t code = taosGetCpuCores(&numCpuCores, false);
if(code != 0) {
fnError("failed to get cpu cores, code:%d", code);
}
numCpuCores = TMAX(numCpuCores, 2);
snprintf(thrdPoolSizeEnvItem, 32, "%s=%d", "UV_THREADPOOL_SIZE", (int)numCpuCores * 2);

View File

@ -109,8 +109,8 @@ void taosRemoveDir(const char *dirname) {
}
}
(void)taosCloseDir(&pDir);
(void)rmdir(dirname);
TAOS_UNUSED(taosCloseDir(&pDir));
TAOS_UNUSED(rmdir(dirname));
// printf("dir:%s is removed\n", dirname);
return;
@ -374,7 +374,7 @@ int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen) {
bool taosIsDir(const char *dirname) {
TdDirPtr pDir = taosOpenDir(dirname);
if (pDir != NULL) {
(void)taosCloseDir(&pDir);
TAOS_SKIP_ERROR(taosCloseDir(&pDir));
return true;
}
return false;

View File

@ -37,7 +37,7 @@ void taosMsleep(int32_t ms) {
#ifdef WINDOWS
Sleep(ms);
#else
(void)usleep(ms * 1000);
TAOS_SKIP_ERROR(usleep(ms * 1000));
#endif
}
@ -49,10 +49,15 @@ void taosUsleep(int32_t us) {
interval.QuadPart = (10 * us);
timer = CreateWaitableTimer(NULL, TRUE, NULL);
SetWaitableTimer(timer, &interval, 0, NULL, NULL, 0);
WaitForSingleObject(timer, INFINITE);
CloseHandle(timer);
if (timer == NULL) {
return;
}
if (!SetWaitableTimer(timer, &interval, 0, NULL, NULL, 0)) {
return;
}
TAOS_SKIP_ERROR(WaitForSingleObject(timer, INFINITE));
TAOS_SKIP_ERROR(CloseHandle(timer));
#else
(void)usleep(us);
TAOS_SKIP_ERROR(usleep(us));
#endif
}

View File

@ -191,10 +191,11 @@ static int32_t taosGetSysCpuInfo(SysCpuInfo *cpuInfo) {
&cpuInfo->si, &cpuInfo->st, &cpuInfo->guest, &cpuInfo->guest_nice);
if (EOF == code) {
terrno = TAOS_SYSTEM_ERROR(errno);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
return terrno;
}
(void)taosCloseFile(&pFile);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
#endif
return 0;
@ -263,9 +264,9 @@ bool taosCheckSystemIsLittleEnd() {
void taosGetSystemInfo() {
#ifdef WINDOWS
taosGetCpuCores(&tsNumOfCores, false);
taosGetTotalMemory(&tsTotalMemoryKB);
taosGetCpuUsage(NULL, NULL);
TAOS_SKIP_ERROR(taosGetCpuCores(&tsNumOfCores, false));
TAOS_SKIP_ERROR(taosGetTotalMemory(&tsTotalMemoryKB));
TAOS_SKIP_ERROR(taosGetCpuUsage(NULL, NULL));
#elif defined(_TD_DARWIN_64)
long physical_pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGESIZE);
@ -274,10 +275,10 @@ void taosGetSystemInfo() {
tsNumOfCores = sysconf(_SC_NPROCESSORS_ONLN);
#else
taosGetProcIOnfos();
(void)taosGetCpuCores(&tsNumOfCores, false);
(void)taosGetTotalMemory(&tsTotalMemoryKB);
(void)taosGetCpuUsage(NULL, NULL);
(void)taosGetCpuInstructions(&tsSSE42Supported, &tsAVXSupported, &tsAVX2Supported, &tsFMASupported, &tsAVX512Supported);
TAOS_SKIP_ERROR(taosGetCpuCores(&tsNumOfCores, false));
TAOS_SKIP_ERROR(taosGetTotalMemory(&tsTotalMemoryKB));
TAOS_SKIP_ERROR(taosGetCpuUsage(NULL, NULL));
TAOS_SKIP_ERROR(taosGetCpuInstructions(&tsSSE42Supported, &tsAVXSupported, &tsAVX2Supported, &tsFMASupported, &tsAVX512Supported));
#endif
}
@ -313,11 +314,11 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
if (taosReadFile(pFile, (void *)email, maxLen) < 0) {
int32_t code = terrno;
(void)taosCloseFile(&pFile);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
return code;
}
(void)taosCloseFile(&pFile);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
return 0;
#endif
@ -748,7 +749,7 @@ int32_t taosGetProcMemory(int64_t *usedKB) {
char tmp[10];
(void)sscanf(line, "%s %" PRId64, tmp, usedKB);
(void)taosCloseFile(&pFile);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
return 0;
#endif
@ -1045,7 +1046,7 @@ int32_t taosGetSystemUUID(char *uid, int32_t uidlen) {
return terrno;
} else {
len = taosReadFile(pFile, uid, uidlen);
(void)taosCloseFile(&pFile);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
if (len < 0) {
return len;
}
@ -1087,7 +1088,7 @@ char *taosGetCmdlineByPID(int pid) {
cmdline[n] = 0;
(void)taosCloseFile(&pFile);
TAOS_SKIP_ERROR(taosCloseFile(&pFile));
} else {
cmdline[0] = 0;
}

View File

@ -215,7 +215,10 @@ int32_t taosInitSlowLog() {
int32_t taosInitLog(const char *logName, int32_t maxFiles, bool tsc) {
if (atomic_val_compare_exchange_8(&tsLogInited, 0, 1) != 0) return 0;
TAOS_CHECK_RETURN(osUpdate());
int32_t code = osUpdate();
if (code != 0) {
uError("failed to update os info, reason:%s", tstrerror(code));
}
TAOS_CHECK_RETURN(taosInitNormalLog(logName, maxFiles));
if (tsc){