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); snprintf(dnodeIdEnvItem, 32, "%s=%d", "DNODE_ID", pData->dnodeId);
float numCpuCores = 4; 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); numCpuCores = TMAX(numCpuCores, 2);
snprintf(thrdPoolSizeEnvItem, 32, "%s=%d", "UV_THREADPOOL_SIZE", (int)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); TAOS_UNUSED(taosCloseDir(&pDir));
(void)rmdir(dirname); TAOS_UNUSED(rmdir(dirname));
// printf("dir:%s is removed\n", dirname); // printf("dir:%s is removed\n", dirname);
return; return;
@ -374,7 +374,7 @@ int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen) {
bool taosIsDir(const char *dirname) { bool taosIsDir(const char *dirname) {
TdDirPtr pDir = taosOpenDir(dirname); TdDirPtr pDir = taosOpenDir(dirname);
if (pDir != NULL) { if (pDir != NULL) {
(void)taosCloseDir(&pDir); TAOS_SKIP_ERROR(taosCloseDir(&pDir));
return true; return true;
} }
return false; return false;

View File

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

View File

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

View File

@ -215,7 +215,10 @@ int32_t taosInitSlowLog() {
int32_t taosInitLog(const char *logName, int32_t maxFiles, bool tsc) { int32_t taosInitLog(const char *logName, int32_t maxFiles, bool tsc) {
if (atomic_val_compare_exchange_8(&tsLogInited, 0, 1) != 0) return 0; 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)); TAOS_CHECK_RETURN(taosInitNormalLog(logName, maxFiles));
if (tsc){ if (tsc){