Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
beae4899
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
beae4899
编写于
2月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
os env
上级
ca634993
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
108 addition
and
103 deletion
+108
-103
include/common/tglobal.h
include/common/tglobal.h
+0
-1
include/os/osEnv.h
include/os/osEnv.h
+19
-15
source/client/src/clientCfg.c
source/client/src/clientCfg.c
+2
-2
source/common/src/tglobal.c
source/common/src/tglobal.c
+2
-2
source/common/src/ttszip.c
source/common/src/ttszip.c
+1
-1
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+7
-6
source/dnode/mgmt/daemon/src/dmnLog.c
source/dnode/mgmt/daemon/src/dmnLog.c
+4
-2
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+1
-1
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+1
-1
source/libs/config/src/config.c
source/libs/config/src/config.c
+4
-4
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+1
-1
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+1
-1
source/libs/index/test/fstUT.cc
source/libs/index/test/fstUT.cc
+1
-1
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+1
-1
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+1
-1
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+1
-1
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+1
-1
source/libs/transport/test/transUT.cc
source/libs/transport/test/transUT.cc
+1
-1
source/os/src/osEnv.c
source/os/src/osEnv.c
+46
-46
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+2
-2
source/util/src/tlog.c
source/util/src/tlog.c
+5
-6
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+3
-3
tools/shell/src/shellLinux.c
tools/shell/src/shellLinux.c
+2
-2
未找到文件。
include/common/tglobal.h
浏览文件 @
beae4899
...
...
@@ -27,7 +27,6 @@ extern int8_t tsDaylight;
extern
int32_t
tsCompressMsgSize
;
extern
int32_t
tsCompressColData
;
extern
int32_t
tsMaxNumOfDistinctResults
;
extern
char
tsTempDir
[];
extern
int
tsCompatibleModel
;
// 2.0 compatible model
extern
int8_t
tsEnableSlaveQuery
;
extern
int8_t
tsEnableAdjustMaster
;
...
...
include/os/osEnv.h
浏览文件 @
beae4899
...
...
@@ -16,28 +16,32 @@
#ifndef _TD_OS_ENV_H_
#define _TD_OS_ENV_H_
#include "osSysinfo.h"
#ifdef __cplusplus
extern
"C"
{
#endif
extern
char
tsOsName
[];
typedef
struct
SEnvVar
{
char
dataDir
[
PATH_MAX
];
char
logDir
[
PATH_MAX
];
char
tempDir
[
PATH_MAX
];
char
osName
[
16
];
SDiskSpace
dataSpace
;
SDiskSpace
logSpace
;
SDiskSpace
tempSpace
;
}
SEnvVar
;
extern
char
tsDataDir
[];
extern
char
tsLogDir
[];
extern
char
tsTempDir
[];
extern
char
configDir
[];
extern
struct
SDiskSpace
tsLogSpace
;
extern
struct
SDiskSpace
tsTempSpace
;
extern
struct
SDiskSpace
tsDataSpace
;
void
taosUpdateLogSpace
();
void
taosUpdateTempSpace
();
void
taosUpdateDataSpace
();
bool
taosLogSpaceAvailable
();
bool
taosTmpSpaceAvailable
();
bool
taosDataSpaceAvailable
();
void
taosUpdateAllSpace
();
void
osInit
();
SEnvVar
*
osEnv
();
void
osUpdate
();
bool
osLogSpaceAvailable
();
char
*
osLogDir
();
char
*
osTempDir
();
char
*
osDataDir
();
char
*
osName
();
#ifdef __cplusplus
}
...
...
source/client/src/clientCfg.c
浏览文件 @
beae4899
...
...
@@ -67,7 +67,7 @@ static int32_t tscAddLogCfg(SConfig *pCfg) {
}
static
int32_t
tscSetLogCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
tstrncpy
(
osLogDir
()
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
...
...
@@ -146,7 +146,7 @@ static int32_t tscAddCfg(SConfig *pCfg) {
// if (cfgAddString(pCfg, "gitinfo", gitinfo) != 0) return -1;
// if (cfgAddString(pCfg, "version", version) != 0) return -1;
// if (cfgAddDir(pCfg, "dataDir",
tsDataDir
) != 0) return -1;
// if (cfgAddDir(pCfg, "dataDir",
osDataDir()
) != 0) return -1;
if
(
cfgAddTimezone
(
pCfg
,
"timezone"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddLocale
(
pCfg
,
"locale"
,
""
)
!=
0
)
return
-
1
;
if
(
cfgAddCharset
(
pCfg
,
"charset"
,
""
)
!=
0
)
return
-
1
;
...
...
source/common/src/tglobal.c
浏览文件 @
beae4899
...
...
@@ -235,7 +235,7 @@ static void doInitGlobalConfig(void) {
cfg.option = "dataDir";
cfg.ptr =
tsDataDir
;
cfg.ptr =
osDataDir()
;
cfg.valType = TAOS_CFG_VTYPE_DATA_DIRCTORY;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG;
cfg.minValue = 0;
...
...
@@ -419,7 +419,7 @@ static void doInitGlobalConfig(void) {
taosAddConfigOption(cfg);
cfg.option = "tempDir";
cfg.ptr =
tsTempDir
;
cfg.ptr =
osTempDir()
;
cfg.valType = TAOS_CFG_VTYPE_STRING;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
cfg.minValue = 0;
...
...
source/common/src/ttszip.c
浏览文件 @
beae4899
...
...
@@ -23,7 +23,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
pTSBuf
->
autoDelete
=
autoDelete
;
taosGetTmpfilePath
(
tsTempDir
,
"join"
,
pTSBuf
->
path
);
taosGetTmpfilePath
(
osTempDir
()
,
"join"
,
pTSBuf
->
path
);
pTSBuf
->
f
=
fopen
(
pTSBuf
->
path
,
"wb+"
);
if
(
pTSBuf
->
f
==
NULL
)
{
free
(
pTSBuf
);
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
beae4899
...
...
@@ -40,18 +40,19 @@ static int32_t dmnAddEpCfg(SConfig *pCfg) {
}
static
int32_t
dmnAddDirCfg
(
SConfig
*
pCfg
)
{
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"tempDir"
,
tsTempDir
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
osDataDir
()
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"tempDir"
,
osTempDir
()
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalTempDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsDataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
PATH_MAX
);
tstrncpy
(
tsTempDir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
tsDataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
SEnvVar
*
pEnv
=
osEnv
();
tstrncpy
(
pEnv
->
dataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
PATH_MAX
);
tstrncpy
(
pEnv
->
tempDir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
pEnv
->
dataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
pEnv
->
tempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
return
0
;
}
...
...
source/dnode/mgmt/daemon/src/dmnLog.c
浏览文件 @
beae4899
...
...
@@ -41,8 +41,10 @@ int32_t dmnAddLogCfg(SConfig *pCfg) {
}
int32_t
dmnSetLogCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
tsLogSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
;
SEnvVar
*
pEnv
=
osEnv
();
tstrncpy
(
pEnv
->
logDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
pEnv
->
logSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
beae4899
...
...
@@ -33,7 +33,7 @@ void Testbase::InitLog(const char* path) {
taosRemoveDir
(
path
);
taosMkDir
(
path
);
tstrncpy
(
tsLogDir
,
path
,
PATH_MAX
);
tstrncpy
(
osLogDir
()
,
path
,
PATH_MAX
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
}
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
beae4899
...
...
@@ -132,7 +132,7 @@ void ctgTestInitLogFile() {
ctgDbgEnableDebug
(
"api"
);
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
}
}
...
...
source/libs/config/src/config.c
浏览文件 @
beae4899
...
...
@@ -593,16 +593,16 @@ void cfgDumpCfg(SConfig *pCfg) {
// pItem = cfgGetItem(pCfg, "dataDir");
// if (pItem != NULL) {
// tstrncpy(
tsDataDir
, pItem->str, PATH_MAX);
// tstrncpy(
osDataDir()
, pItem->str, PATH_MAX);
// }
// if (tsDiskCfgNum <= 0) {
// taosAddDataDir(0,
tsDataDir
, 0, 1);
// taosAddDataDir(0,
osDataDir()
, 0, 1);
// tsDiskCfgNum = 1;
// uTrace("dataDir:%s, level:0 primary:1 is configured by default",
tsDataDir
);
// uTrace("dataDir:%s, level:0 primary:1 is configured by default",
osDataDir()
);
// }
// if (taosDirExist(
tsTempDir
) != 0) {
// if (taosDirExist(
osTempDir()
) != 0) {
// return -1;
// }
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
beae4899
...
...
@@ -4629,7 +4629,7 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
getIntermediateBufInfo
(
pRuntimeEnv
,
&
ps
,
&
pQueryAttr
->
intermediateResultRowSize
);
int32_t
TENMB
=
1024
*
1024
*
10
;
int32_t
code
=
createDiskbasedBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
->
qId
,
tsTempDir
);
int32_t
code
=
createDiskbasedBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
->
qId
,
osTempDir
()
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
beae4899
...
...
@@ -254,7 +254,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
resetSlotInfo
(
pBucket
);
int32_t
ret
=
createDiskbasedBuffer
(
&
pBucket
->
pBuffer
,
pBucket
->
bufPageSize
,
pBucket
->
bufPageSize
*
512
,
1
,
tsTempDir
);
int32_t
ret
=
createDiskbasedBuffer
(
&
pBucket
->
pBuffer
,
pBucket
->
bufPageSize
,
pBucket
->
bufPageSize
*
512
,
1
,
osTempDir
()
);
if
(
ret
!=
0
)
{
tMemBucketDestroy
(
pBucket
);
return
NULL
;
...
...
source/libs/function/src/tudf.c
浏览文件 @
beae4899
...
...
@@ -55,7 +55,7 @@ int32_t initUdfInfo(SUdfInfo* pUdfInfo) {
} else {
char path[PATH_MAX] = {0};
taosGetTmpfilePath("script", path,
tsTempDir
);
taosGetTmpfilePath("script", path,
osTempDir()
);
FILE* file = fopen(path, "w+");
...
...
source/libs/index/test/fstUT.cc
浏览文件 @
beae4899
...
...
@@ -30,7 +30,7 @@ static void EnvInit() {
taosRemoveDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
// init log file
tstrncpy
(
tsLogDir
,
path
.
c_str
(),
PATH_MAX
);
tstrncpy
(
osLogDir
()
,
path
.
c_str
(),
PATH_MAX
);
if
(
taosInitLog
(
"tindex.idx"
,
1
)
!=
0
)
{
printf
(
"failed to init log"
);
}
...
...
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
beae4899
...
...
@@ -102,7 +102,7 @@ void qwtInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
}
}
...
...
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
beae4899
...
...
@@ -53,7 +53,7 @@ void flttInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
}
}
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
beae4899
...
...
@@ -52,7 +52,7 @@ void scltInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
}
}
...
...
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
beae4899
...
...
@@ -67,7 +67,7 @@ void schtInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
}
}
...
...
source/libs/transport/test/transUT.cc
浏览文件 @
beae4899
...
...
@@ -155,7 +155,7 @@ class TransObj {
taosRemoveDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
tstrncpy
(
tsLogDir
,
path
.
c_str
(),
PATH_MAX
);
tstrncpy
(
osLogDir
()
,
path
.
c_str
(),
PATH_MAX
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
}
...
...
source/os/src/osEnv.c
浏览文件 @
beae4899
...
...
@@ -13,77 +13,77 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "osEnv.h"
#include "os.h"
#include "osSysinfo.h"
SDiskSpace
tsLogSpace
;
SDiskSpace
tsTempSpace
;
SDiskSpace
tsDataSpace
;
void
taosUpdateLogSpace
()
{
taosGetDiskSize
(
tsLogDir
,
&
tsLogSpace
.
size
);
}
void
taosUpdateTempSpace
()
{
taosGetDiskSize
(
tsTempDir
,
&
tsTempSpace
.
size
);
}
void
taosUpdateDataSpace
()
{
taosGetDiskSize
(
tsDataDir
,
&
tsDataSpace
.
size
);
}
bool
taosLogSpaceAvailable
()
{
return
tsLogSpace
.
reserved
<
tsLogSpace
.
size
.
avail
;
}
bool
taosTempSpaceAvailable
()
{
return
tsTempSpace
.
reserved
<
tsTempSpace
.
size
.
avail
;
}
bool
taosDataSpaceAvailable
()
{
return
tsDataSpace
.
reserved
<
tsDataSpace
.
size
.
avail
;
}
void
taosUpdateAllSpace
()
{
taosUpdateLogSpace
();
taosUpdateTempSpace
();
taosUpdateDataSpace
();
}
SEnvVar
env
=
{
0
};
char
configDir
[
PATH_MAX
]
=
{
0
};
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
char
tsOsName
[
10
]
=
"Windows"
;
char
configDir
[
PATH_MAX
]
=
"C:/TDengine/cfg"
;
char
tsDataDir
[
PATH_MAX
]
=
"C:/TDengine/data"
;
char
tsLogDir
[
PATH_MAX
]
=
"C:/TDengine/log"
;
char
tsTempDir
[
PATH_MAX
]
=
"C:
\\
Windows
\\
Temp"
;
extern
taosWinSocketInit
();
void
osInit
()
{
srand
(
taosSafeRand
());
taosWinSocketInit
();
const
char
*
tmpDir
=
getenv
(
"tmp"
);
if
(
tmpDir
==
NULL
)
{
tmpDir
=
getenv
(
"temp"
);
}
if
(
tmpDir
!=
NULL
)
{
strcpy
(
tsT
empDir
,
tmpDir
);
strcpy
(
env
.
t
empDir
,
tmpDir
);
}
strcpy
(
configDir
,
"C:
\\
TDengine
\\
cfg"
);
strcpy
(
env
.
dataDir
,
"C:
\\
TDengine
\\
data"
);
strcpy
(
env
.
logDir
,
"C:
\\
TDengine
\\
log"
);
strcpy
(
env
.
tempDir
,
"C:
\\
Windows
\\
Temp"
);
strcpy
(
env
.
osName
,
"Windows"
);
}
#elif defined(_TD_DARWIN_64)
char
tsOsName
[
10
]
=
"Darwin"
;
char
configDir
[
PATH_MAX
]
=
"/usr/local/etc/taos"
;
char
tsDataDir
[
PATH_MAX
]
=
"/usr/local/var/lib/taos"
;
char
tsLogDir
[
PATH_MAX
]
=
"/usr/local/var/log/taos"
;
char
tsTempDir
[
PATH_MAX
]
=
"/tmp/taosd"
;
void
osInit
()
{}
void
osInit
()
{
srand
(
taosSafeRand
())
;
strcpy
(
configDir
,
"/tmp/taosd"
)
;
strcpy
(
env
.
dataDir
,
"/usr/local/var/lib/taos"
)
;
strcpy
(
env
.
logDir
,
"/usr/local/var/log/taos"
)
;
strcpy
(
env
.
tempDir
,
"/usr/local/etc/taos"
);
strcpy
(
env
.
osName
,
"Darwin"
);
}
#else
char
tsOsName
[
10
]
=
"Linux"
;
char
configDir
[
PATH_MAX
]
=
"/etc/taos"
;
char
tsDataDir
[
PATH_MAX
]
=
"/var/lib/taos"
;
char
tsLogDir
[
PATH_MAX
]
=
"/var/log/taos"
;
char
tsTempDir
[
PATH_MAX
]
=
"/tmp/"
;
void
osInit
()
{
srand
(
taosSafeRand
());
srand
(
taosSafeRand
());
strcpy
(
configDir
,
"/etc/taos"
);
strcpy
(
env
.
dataDir
,
"/var/lib/taos"
);
strcpy
(
env
.
logDir
,
"/var/log/taos"
);
strcpy
(
env
.
tempDir
,
"/tmp"
);
strcpy
(
env
.
osName
,
"Linux"
);
}
#endif
SEnvVar
*
osEnv
()
{
return
&
env
;
}
void
osUpdate
()
{
if
(
env
.
logDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
env
.
logDir
,
&
env
.
logSpace
.
size
);
}
if
(
env
.
dataDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
env
.
dataDir
,
&
env
.
dataSpace
.
size
);
}
if
(
env
.
tempDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
env
.
tempDir
,
&
env
.
tempSpace
.
size
);
}
}
bool
osLogSpaceAvailable
()
{
return
env
.
logSpace
.
reserved
<
env
.
logSpace
.
size
.
avail
;
}
char
*
osLogDir
()
{
return
env
.
logDir
;
}
char
*
osTempDir
()
{
return
env
.
tempDir
;
}
char
*
osDataDir
()
{
return
env
.
dataDir
;
}
char
*
osName
()
{
return
env
.
osName
;
}
source/os/src/osSysinfo.c
浏览文件 @
beae4899
...
...
@@ -134,7 +134,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
diskSize
->
used
=
(
int64_t
)(
i64TotalBytes
-
i64FreeBytes
);
return
0
;
}
else
{
//printf("failed to get disk size, dataDir:%s errno:%s",
tsDataDir
, strerror(errno));
//printf("failed to get disk size, dataDir:%s errno:%s",
osDataDir()
, strerror(errno));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
...
...
@@ -441,7 +441,7 @@ void taosSetCoreDump() {}
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SDiskSize
*
diskSize
)
{
struct
statvfs
info
;
if
(
statvfs
(
dataDir
,
&
info
))
{
//printf("failed to get disk size, dataDir:%s errno:%s",
tsDataDir
, strerror(errno));
//printf("failed to get disk size, dataDir:%s errno:%s",
osDataDir()
, strerror(errno));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
else
{
...
...
source/util/src/tlog.c
浏览文件 @
beae4899
...
...
@@ -118,10 +118,9 @@ static int32_t taosStartLog() {
int32_t
taosInitLog
(
const
char
*
logName
,
int
maxFiles
)
{
if
(
tsLogInited
)
return
0
;
taosUpdateLogSpace
();
char
fullName
[
PATH_MAX
]
=
{
0
};
snprintf
(
fullName
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
tsLogDir
,
logName
);
snprintf
(
fullName
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
osLogDir
()
,
logName
);
tsLogObj
.
logHandle
=
taosLogBuffNew
(
TSDB_DEFAULT_LOG_BUF_SIZE
);
if
(
tsLogObj
.
logHandle
==
NULL
)
return
-
1
;
...
...
@@ -187,7 +186,7 @@ static void taosKeepOldLog(char *oldName) {
}
}
taosRemoveOldFiles
(
tsLogDir
,
TABS
(
tsLogKeepDays
));
taosRemoveOldFiles
(
osLogDir
()
,
TABS
(
tsLogKeepDays
));
}
static
void
*
taosThreadToOpenNewFile
(
void
*
param
)
{
...
...
@@ -380,7 +379,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
}
void
taosPrintLog
(
const
char
*
flags
,
int32_t
dflag
,
const
char
*
format
,
...)
{
if
(
!
ta
osLogSpaceAvailable
())
return
;
if
(
!
osLogSpaceAvailable
())
return
;
va_list
argpointer
;
char
buffer
[
MAX_LOGLINE_BUFFER_SIZE
]
=
{
0
};
...
...
@@ -434,7 +433,7 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
}
void
taosDumpData
(
unsigned
char
*
msg
,
int32_t
len
)
{
if
(
!
ta
osLogSpaceAvailable
())
return
;
if
(
!
osLogSpaceAvailable
())
return
;
char
temp
[
256
];
int32_t
i
,
pos
=
0
,
c
=
0
;
...
...
@@ -457,7 +456,7 @@ void taosDumpData(unsigned char *msg, int32_t len) {
}
void
taosPrintLongString
(
const
char
*
flags
,
int32_t
dflag
,
const
char
*
format
,
...)
{
if
(
!
ta
osLogSpaceAvailable
())
return
;
if
(
!
osLogSpaceAvailable
())
return
;
va_list
argpointer
;
char
buffer
[
MAX_LOGLINE_DUMP_BUFFER_SIZE
];
...
...
tools/shell/src/shellEngine.c
浏览文件 @
beae4899
...
...
@@ -68,11 +68,11 @@ TAOS *shellInit(SShellArguments *_args) {
printf
(
"
\n
"
);
if
(
!
_args
->
is_use_passwd
)
{
#ifdef TD_WINDOWS
strcpy
(
tsOsName
,
"Windows"
);
strcpy
(
osName
()
,
"Windows"
);
#elif defined(TD_DARWIN)
strcpy
(
tsOsName
,
"Darwin"
);
strcpy
(
osName
()
,
"Darwin"
);
#endif
printf
(
CLIENT_VERSION
,
tsOsName
,
taos_get_client_info
());
printf
(
CLIENT_VERSION
,
osName
()
,
taos_get_client_info
());
}
fflush
(
stdout
);
...
...
tools/shell/src/shellLinux.c
浏览文件 @
beae4899
...
...
@@ -184,8 +184,8 @@ static void parse_args(
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
((
strncmp
(
argv
[
i
],
"-p"
,
2
)
==
0
)
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
strcpy
(
tsOsName
,
"Linux"
);
printf
(
LINUXCLIENT_VERSION
,
tsOsName
,
taos_get_client_info
());
strcpy
(
osName
()
,
"Linux"
);
printf
(
LINUXCLIENT_VERSION
,
osName
()
,
taos_get_client_info
());
if
((
strlen
(
argv
[
i
])
==
2
)
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
printf
(
"Enter password: "
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录