提交 67fbb739 编写于 作者: wafwerar's avatar wafwerar

build: release ver-3.0.0.10003

上级 38807616
...@@ -32,6 +32,7 @@ extern "C" { ...@@ -32,6 +32,7 @@ extern "C" {
typedef struct TdCmd *TdCmdPtr; typedef struct TdCmd *TdCmdPtr;
TdCmdPtr taosOpenCmd(const char* cmd); TdCmdPtr taosOpenCmd(const char* cmd);
int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char *__restrict buf);
int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf); int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf);
int32_t taosEOFCmd(TdCmdPtr pCmd); int32_t taosEOFCmd(TdCmdPtr pCmd);
int64_t taosCloseCmd(TdCmdPtr* ppCmd); int64_t taosCloseCmd(TdCmdPtr* ppCmd);
......
...@@ -398,7 +398,7 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { ...@@ -398,7 +398,7 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) {
if (line != NULL) taosMemoryFree(line); if (line != NULL) taosMemoryFree(line);
taosCloseFile(&pFile); taosCloseFile(&pFile);
if (code != 0) { if (code != 0 && (done & 1) == 0) {
TdFilePtr pFile1 = taosOpenFile("/proc/device-tree/model", TD_FILE_READ | TD_FILE_STREAM); TdFilePtr pFile1 = taosOpenFile("/proc/device-tree/model", TD_FILE_READ | TD_FILE_STREAM);
if (pFile1 == NULL) return code; if (pFile1 == NULL) return code;
taosGetsFile(pFile1, maxLen, cpuModel); taosGetsFile(pFile1, maxLen, cpuModel);
...@@ -407,6 +407,16 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { ...@@ -407,6 +407,16 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) {
done |= 1; done |= 1;
} }
if (code != 0 && (done & 1) == 0) {
TdCmdPtr pCmd = taosOpenCmd("uname -a");
if (pCmd == NULL) return code;
if (taosGetsCmd(pCmd, maxLen, cpuModel) > 0) {
code = 0;
done |= 1;
}
taosCloseCmd(&pCmd);
}
if ((done & 2) == 0) { if ((done & 2) == 0) {
*numOfCores = coreCount; *numOfCores = coreCount;
done |= 2; done |= 2;
......
...@@ -248,6 +248,16 @@ TdCmdPtr taosOpenCmd(const char* cmd) { ...@@ -248,6 +248,16 @@ TdCmdPtr taosOpenCmd(const char* cmd) {
#endif #endif
} }
int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char *__restrict buf) {
if (pCmd == NULL || buf == NULL) {
return -1;
}
if (fgets(buf, maxSize, (FILE*)pCmd) == NULL) {
return -1;
}
return strlen(buf);
}
int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf) { int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf) {
if (pCmd == NULL || ptrBuf == NULL) { if (pCmd == NULL || ptrBuf == NULL) {
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册