Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f79637f5
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看板
提交
f79637f5
编写于
7月 29, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
os: add win service and crashdump
上级
61ea780d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
123 addition
and
97 deletion
+123
-97
cmake/cmake.options
cmake/cmake.options
+13
-7
cmake/crashdump_CMakeLists.txt.in
cmake/crashdump_CMakeLists.txt.in
+12
-0
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+15
-0
packaging/tools/make_install.bat
packaging/tools/make_install.bat
+3
-2
source/client/CMakeLists.txt
source/client/CMakeLists.txt
+0
-5
source/client/src/taos.def
source/client/src/taos.def
+0
-81
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+19
-0
source/os/CMakeLists.txt
source/os/CMakeLists.txt
+1
-1
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+3
-1
source/os/src/osSystem.c
source/os/src/osSystem.c
+57
-0
未找到文件。
cmake/cmake.options
浏览文件 @
f79637f5
...
...
@@ -47,15 +47,21 @@ IF(${TD_WINDOWS})
)
option(
BUILD_TEST
"If build unit tests using googletest"
ON
)
BUILD_TEST
"If build unit tests using googletest"
ON
)
option(
TDENGINE_3
"TDengine 3.x"
ON
TDENGINE_3
"TDengine 3.x for taos-tools"
ON
)
option(
BUILD_CRASHDUMP
"If build crashdump on Windows"
ON
)
ELSEIF (TD_DARWIN_64)
...
...
cmake/crashdump_CMakeLists.txt.in
0 → 100644
浏览文件 @
f79637f5
# crashdump
ExternalProject_Add(crashdump
GIT_REPOSITORY https://github.com/Arnavion/crashdump.git
GIT_TAG master
SOURCE_DIR "${TD_CONTRIB_DIR}/crashdump"
BINARY_DIR "${TD_CONTRIB_DIR}/crashdump"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
contrib/CMakeLists.txt
浏览文件 @
f79637f5
...
...
@@ -120,6 +120,11 @@ if(${BUILD_WITH_NURAFT})
cat
(
"
${
TD_SUPPORT_DIR
}
/nuraft_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
endif
(
${
BUILD_WITH_NURAFT
}
)
# crashdump
if
(
${
BUILD_CRASHDUMP
}
)
cat
(
"
${
TD_SUPPORT_DIR
}
/crashdump_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
endif
(
${
BUILD_CRASHDUMP
}
)
# addr2line
if
(
${
BUILD_ADDR2LINE
}
)
if
(
NOT
${
TD_WINDOWS
}
)
...
...
@@ -257,6 +262,16 @@ if(${BUILD_PTHREAD})
target_link_libraries
(
pthread INTERFACE libpthreadVC3
)
endif
()
# crashdump
if
(
${
BUILD_CRASHDUMP
}
)
add_executable
(
dumper
"crashdump/dumper/dumper.c"
)
target_link_libraries
(
dumper User32.lib dbghelp.lib
)
file
(
READ
"crashdump/crasher/crasher.c"
CRASHDUMP_CONTENT
)
string
(
REPLACE
"main("
"main_crashdump("
CRASHDUMP_CONTENT
"
${
CRASHDUMP_CONTENT
}
"
)
file
(
WRITE
"crashdump/crasher/crasher.c"
"
${
CRASHDUMP_CONTENT
}
"
)
add_library
(
crashdump STATIC
"crashdump/crasher/crasher.c"
)
endif
()
# iconv
if
(
${
BUILD_WITH_ICONV
}
)
add_library
(
iconv STATIC iconv/win_iconv.c
)
...
...
packaging/tools/make_install.bat
浏览文件 @
f79637f5
@echo
off
goto
%
1
:needAdmin
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&
goto
:eof
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&
&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
:hasAdmin
cp
-f
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
\ No newline at end of file
cp
-f
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
source/client/CMakeLists.txt
浏览文件 @
f79637f5
...
...
@@ -20,11 +20,6 @@ target_link_libraries(
)
if
(
TD_WINDOWS
)
set_target_properties
(
taos
PROPERTIES
LINK_FLAGS
/DEF:
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/taos.def
)
INCLUDE_DIRECTORIES
(
jni/windows
)
INCLUDE_DIRECTORIES
(
jni/windows/win32
)
INCLUDE_DIRECTORIES
(
jni/windows/win32/bridge
)
...
...
source/client/src/taos.def
已删除
100644 → 0
浏览文件 @
61ea780d
taos_cleanup
taos_options
taos_set_config
taos_init
taos_connect
taos_connect_l
taos_connect_auth
taos_close
taos_data_type
taos_stmt_init
taos_stmt_prepare
taos_stmt_set_tbname_tags
taos_stmt_set_tbname
taos_stmt_set_sub_tbname
taos_stmt_is_insert
taos_stmt_num_params
taos_stmt_get_param
taos_stmt_bind_param
taos_stmt_bind_param_batch
taos_stmt_bind_single_param_batch
taos_stmt_add_batch
taos_stmt_execute
taos_stmt_use_result
taos_stmt_close
taos_stmt_errstr
taos_stmt_affected_rows
taos_stmt_affected_rows_once
taos_query
taos_query_l
taos_fetch_row
taos_result_precision
taos_free_result
taos_field_count
taos_num_fields
taos_affected_rows
taos_fetch_fields
taos_select_db
taos_print_row
taos_stop_query
taos_is_null
taos_is_update_query
taos_fetch_block
taos_fetch_block_s
taos_fetch_raw_block
taos_get_column_data_offset
taos_validate_sql
taos_reset_current_db
taos_fetch_lengths
taos_result_block
taos_get_server_info
taos_get_client_info
taos_errstr
taos_errno
taos_query_a
taos_fetch_rows_a
taos_subscribe
taos_consume
taos_unsubscribe
taos_load_table_info
taos_schemaless_insert
tmq_list_new
tmq_list_append
tmq_list_destroy
tmq_list_get_size
tmq_list_to_c_array
tmq_consumer_new
tmq_err2str
tmq_subscribe
tmq_unsubscribe
tmq_subscription
tmq_consumer_poll
tmq_consumer_close
tmq_commit
tmq_conf_new
tmq_conf_set
tmq_conf_destroy
tmq_conf_set_offset_commit_cb
tmq_get_topic_name
tmq_get_vgroup_id
tmq_create_stream
taos_check_server_status
\ No newline at end of file
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
f79637f5
...
...
@@ -27,6 +27,9 @@
#define DM_VERSION "Print program version."
#define DM_EMAIL "<support@taosdata.com>"
static
struct
{
#ifdef WINDOWS
bool
winServiceMode
;
#endif
bool
dumpConfig
;
bool
generateGrant
;
bool
printAuth
;
...
...
@@ -93,6 +96,10 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
global
.
dumpConfig
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)
{
global
.
printVersion
=
true
;
#ifdef WINDOWS
}
else
if
(
strcmp
(
argv
[
i
],
"--win_service"
)
==
0
)
{
global
.
winServiceMode
=
true
;
#endif
}
else
if
(
strcmp
(
argv
[
i
],
"-e"
)
==
0
)
{
global
.
envCmd
[
cmdEnvIndex
]
=
argv
[
++
i
];
cmdEnvIndex
++
;
...
...
@@ -169,6 +176,18 @@ int main(int argc, char const *argv[]) {
return
-
1
;
}
#ifdef WINDOWS
int
mainWindows
(
int
argc
,
char
**
argv
);
if
(
global
.
winServiceMode
)
{
stratWindowsService
(
mainWindows
);
}
else
{
return
mainWindows
(
argc
,
argv
);
}
return
0
;
}
int
mainWindows
(
int
argc
,
char
**
argv
)
{
#endif
if
(
global
.
generateGrant
)
{
dmGenerateGrant
();
taosCleanupArgs
();
...
...
source/os/CMakeLists.txt
浏览文件 @
f79637f5
...
...
@@ -41,7 +41,7 @@ target_link_libraries(
)
if
(
TD_WINDOWS
)
target_link_libraries
(
os PUBLIC ws2_32 iconv msvcregex wcwidth winmm
os PUBLIC ws2_32 iconv msvcregex wcwidth winmm
crashdump
)
elseif
(
TD_DARWIN_64
)
target_link_libraries
(
...
...
source/os/src/osSysinfo.c
浏览文件 @
f79637f5
...
...
@@ -91,6 +91,7 @@ LONG WINAPI FlCrashDump(PEXCEPTION_POINTERS ep) {
return
EXCEPTION_CONTINUE_SEARCH
;
}
LONG
WINAPI
exceptionHandler
(
LPEXCEPTION_POINTERS
exception
);
#elif defined(_TD_DARWIN_64)
...
...
@@ -841,7 +842,8 @@ char *taosGetCmdlineByPID(int pid) {
void
taosSetCoreDump
(
bool
enable
)
{
#ifdef WINDOWS
SetUnhandledExceptionFilter
(
&
FlCrashDump
);
SetUnhandledExceptionFilter
(
exceptionHandler
);
// SetUnhandledExceptionFilter(&FlCrashDump);
#elif defined(_TD_DARWIN_64)
#else
if
(
!
enable
)
return
;
...
...
source/os/src/osSystem.c
浏览文件 @
f79637f5
...
...
@@ -18,6 +18,63 @@
#include "os.h"
#if defined(WINDOWS)
typedef
void
(
*
MainWindows
)(
int
argc
,
char
**
argv
);
MainWindows
mainWindowsFunc
=
NULL
;
SERVICE_STATUS
ServiceStatus
;
SERVICE_STATUS_HANDLE
hServiceStatusHandle
;
void
WINAPI
windowsServiceCtrlHandle
(
DWORD
request
)
{
switch
(
request
)
{
case
SERVICE_CONTROL_STOP
:
case
SERVICE_CONTROL_SHUTDOWN
:
raise
(
SIGINT
);
ServiceStatus
.
dwCurrentState
=
SERVICE_STOP_PENDING
;
if
(
!
SetServiceStatus
(
hServiceStatusHandle
,
&
ServiceStatus
))
{
DWORD
nError
=
GetLastError
();
printf
(
"failed to send stopped status to windows service: %d"
,
nError
);
}
break
;
default:
return
;
}
}
void
WINAPI
mainWindowsService
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
ServiceStatus
.
dwServiceType
=
SERVICE_WIN32
;
ServiceStatus
.
dwControlsAccepted
=
SERVICE_ACCEPT_PAUSE_CONTINUE
|
SERVICE_ACCEPT_STOP
|
SERVICE_ACCEPT_SHUTDOWN
;
ServiceStatus
.
dwCurrentState
=
SERVICE_START_PENDING
;
ServiceStatus
.
dwWin32ExitCode
=
0
;
ServiceStatus
.
dwCheckPoint
=
0
;
ServiceStatus
.
dwWaitHint
=
0
;
ServiceStatus
.
dwServiceSpecificExitCode
=
0
;
hServiceStatusHandle
=
RegisterServiceCtrlHandler
(
"taosd"
,
&
windowsServiceCtrlHandle
);
if
(
hServiceStatusHandle
==
0
)
{
DWORD
nError
=
GetLastError
();
printf
(
"failed to register windows service ctrl handler: %d"
,
nError
);
}
ServiceStatus
.
dwCurrentState
=
SERVICE_RUNNING
;
if
(
SetServiceStatus
(
hServiceStatusHandle
,
&
ServiceStatus
))
{
DWORD
nError
=
GetLastError
();
printf
(
"failed to send running status to windows service: %d"
,
nError
);
}
if
(
mainWindowsFunc
!=
NULL
)
mainWindowsFunc
(
argc
,
argv
);
ServiceStatus
.
dwCurrentState
=
SERVICE_STOPPED
;
if
(
!
SetServiceStatus
(
hServiceStatusHandle
,
&
ServiceStatus
))
{
DWORD
nError
=
GetLastError
();
printf
(
"failed to send stopped status to windows service: %d"
,
nError
);
}
}
void
stratWindowsService
(
MainWindows
mainWindows
)
{
mainWindowsFunc
=
mainWindows
;
SERVICE_TABLE_ENTRY
ServiceTable
[
2
];
ServiceTable
[
0
].
lpServiceName
=
"taosd"
;
ServiceTable
[
0
].
lpServiceProc
=
(
LPSERVICE_MAIN_FUNCTION
)
mainWindowsService
;
ServiceTable
[
1
].
lpServiceName
=
NULL
;
ServiceTable
[
1
].
lpServiceProc
=
NULL
;
StartServiceCtrlDispatcher
(
ServiceTable
);
}
#elif defined(_TD_DARWIN_64)
#else
#include <dlfcn.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录