Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94d0aa19
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
94d0aa19
编写于
8月 12, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1057 set crash in windows
上级
f790a124
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
26 deletion
+61
-26
src/os/src/windows/w64Env.c
src/os/src/windows/w64Env.c
+1
-0
src/os/src/windows/w64Sysinfo.c
src/os/src/windows/w64Sysinfo.c
+60
-26
未找到文件。
src/os/src/windows/w64Env.c
浏览文件 @
94d0aa19
...
...
@@ -21,6 +21,7 @@
extern
void
taosWinSocketInit
();
void
osInit
()
{
taosSetCoreDump
();
if
(
configDir
[
0
]
==
0
)
{
strcpy
(
configDir
,
"C:/TDengine/cfg"
);
}
...
...
src/os/src/windows/w64Sysinfo.c
浏览文件 @
94d0aa19
...
...
@@ -16,21 +16,23 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "taosdef.h"
#include "tglobal.h"
#include "tconfig.h"
#include "tglobal.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#if (_WIN64)
#include <windows.h>
#include <iphlpapi.h>
#include <psapi.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <mswsock.h>
#include <psapi.h>
#include <stdio.h>
#include <windows.h>
#include <ws2tcpip.h>
#pragma comment(lib, "Mswsock.lib ")
#endif
#include <DbgHelp.h>
static
void
taosGetSystemTimezone
()
{
// get and set default timezone
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
...
...
@@ -52,7 +54,7 @@ static void taosGetSystemLocale() {
if
(
cfg_locale
&&
cfg_locale
->
cfgStatus
<
TAOS_CFG_CSTATUS_DEFAULT
)
{
char
*
locale
=
setlocale
(
LC_CTYPE
,
"chs"
);
if
(
locale
!=
NULL
)
{
tstrncpy
(
tsLocale
,
locale
,
TSDB_LOCALE_LEN
);
;
tstrncpy
(
tsLocale
,
locale
,
TSDB_LOCALE_LEN
);
cfg_locale
->
cfgStatus
=
TAOS_CFG_CSTATUS_DEFAULT
;
uInfo
(
"locale not configured, set to default:%s"
,
tsLocale
);
}
...
...
@@ -79,7 +81,7 @@ void taosGetSystemInfo() {
}
bool
taosGetDisk
()
{
const
double
unit
=
1024
*
1024
*
1024
;
const
double
unit
=
1024
*
1024
*
1024
;
BOOL
fResult
;
unsigned
_int64
i64FreeBytesToCaller
;
unsigned
_int64
i64TotalBytes
;
...
...
@@ -88,15 +90,15 @@ bool taosGetDisk() {
int
drive_type
;
if
(
tscEmbedded
)
{
drive_type
=
GetDriveTypeA
(
dir
);
drive_type
=
GetDriveTypeA
(
dir
);
if
(
drive_type
==
DRIVE_FIXED
)
{
fResult
=
GetDiskFreeSpaceExA
(
dir
,
(
PULARGE_INTEGER
)
&
i64FreeBytesToCaller
,
(
PULARGE_INTEGER
)
&
i64TotalBytes
,
(
PULARGE_INTEGER
)
&
i64FreeBytes
);
if
(
fResult
)
{
tsTotalDataDirGB
=
tsTotalLogDirGB
=
tsTotalTmpDirGB
=
(
float
)(
i64TotalBytes
/
unit
);
tsAvailDataDirGB
=
tsAvailLogDirGB
=
tsAvailTmpDirectorySpace
=
(
float
)(
i64FreeBytes
/
unit
);
}
}
fResult
=
GetDiskFreeSpaceExA
(
dir
,
(
PULARGE_INTEGER
)
&
i64FreeBytesToCaller
,
(
PULARGE_INTEGER
)
&
i64TotalBytes
,
(
PULARGE_INTEGER
)
&
i64FreeBytes
);
if
(
fResult
)
{
tsTotalDataDirGB
=
tsTotalLogDirGB
=
tsTotalTmpDirGB
=
(
float
)(
i64TotalBytes
/
unit
);
tsAvailDataDirGB
=
tsAvailLogDirGB
=
tsAvailTmpDirectorySpace
=
(
float
)(
i64FreeBytes
/
unit
);
}
}
}
return
true
;
}
...
...
@@ -172,10 +174,12 @@ bool taosGetSysMemory(float *memoryUsedMB) {
float
nMemTotal
;
memsStat
.
dwLength
=
sizeof
(
memsStat
);
if
(
!
GlobalMemoryStatusEx
(
&
memsStat
))
{
return
false
;
}
if
(
!
GlobalMemoryStatusEx
(
&
memsStat
))
{
return
false
;
}
nMemFree
=
memsStat
.
ullAvailPhys
/
(
1024
.
0
f
*
1024
.
0
f
);
nMemTotal
=
memsStat
.
ullTotalPhys
/
(
1024
.
0
f
*
1024
.
0
f
);
*
memoryUsedMB
=
nMemTotal
-
nMemFree
;
*
memoryUsedMB
=
nMemTotal
-
nMemFree
;
return
true
;
}
...
...
@@ -184,16 +188,46 @@ int taosSystem(const char *cmd) {
return
-
1
;
}
int
flock
(
int
fd
,
int
option
)
{
return
0
;
}
int
flock
(
int
fd
,
int
option
)
{
return
0
;
}
int
fsync
(
int
filedes
)
{
return
0
;
}
int
fsync
(
int
filedes
)
{
return
0
;
}
int
sigaction
(
int
sig
,
struct
sigaction
*
d
,
void
*
p
)
{
return
0
;
}
LONG
WINAPI
FlCrashDump
(
PEXCEPTION_POINTERS
ep
)
{
typedef
BOOL
(
WINAPI
*
FxMiniDumpWriteDump
)(
IN
HANDLE
hProcess
,
IN
DWORD
ProcessId
,
IN
HANDLE
hFile
,
IN
MINIDUMP_TYPE
DumpType
,
IN
CONST
PMINIDUMP_EXCEPTION_INFORMATION
ExceptionParam
,
IN
CONST
PMINIDUMP_USER_STREAM_INFORMATION
UserStreamParam
,
IN
CONST
PMINIDUMP_CALLBACK_INFORMATION
CallbackParam
);
HMODULE
dll
=
LoadLibrary
(
"dbghelp.dll"
);
if
(
dll
==
NULL
)
return
EXCEPTION_CONTINUE_SEARCH
;
FxMiniDumpWriteDump
mdwd
=
(
FxMiniDumpWriteDump
)(
GetProcAddress
(
dll
,
"MiniDumpWriteDump"
));
if
(
mdwd
==
NULL
)
{
FreeLibrary
(
dll
);
return
EXCEPTION_CONTINUE_SEARCH
;
}
TCHAR
path
[
MAX_PATH
];
DWORD
len
=
GetModuleFileName
(
NULL
,
path
,
_countof
(
path
));
path
[
len
-
3
]
=
'd'
;
path
[
len
-
2
]
=
'm'
;
path
[
len
-
1
]
=
'p'
;
HANDLE
file
=
CreateFile
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
MINIDUMP_EXCEPTION_INFORMATION
mei
;
mei
.
ThreadId
=
GetCurrentThreadId
();
mei
.
ExceptionPointers
=
ep
;
mei
.
ClientPointers
=
FALSE
;
(
*
mdwd
)(
GetCurrentProcess
(),
GetCurrentProcessId
(),
file
,
MiniDumpWithHandleData
,
&
mei
,
NULL
,
NULL
);
CloseHandle
(
file
);
FreeLibrary
(
dll
);
int
sigaction
(
int
sig
,
struct
sigaction
*
d
,
void
*
p
)
{
return
0
;
return
EXCEPTION_CONTINUE_SEARCH
;
}
void
taosSetCoreDump
()
{}
\ No newline at end of file
void
taosSetCoreDump
()
{
SetUnhandledExceptionFilter
(
&
FlCrashDump
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录