From 586b73bef123fb671a62987f6214e7bd4288ba8b Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 30 Dec 2022 15:56:37 +0800 Subject: [PATCH] fix: windows compile issue --- source/client/src/clientEnv.c | 6 +++++- source/dnode/mgmt/exe/dmMain.c | 6 +++++- source/util/src/tlog.c | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index b1e74b8089..d88ca4ce19 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -393,8 +393,10 @@ void taosClientCrash(int signum, void *sigInfo, void *context) { taosIgnSignal(SIGHUP); taosIgnSignal(SIGINT); taosIgnSignal(SIGBREAK); - + +#if !defined(WINDOWS) taosIgnSignal(SIGBUS); +#endif taosIgnSignal(SIGABRT); taosIgnSignal(SIGFPE); taosIgnSignal(SIGSEGV); @@ -504,7 +506,9 @@ void tscStopCrashReport() { } static void tscSetSignalHandle() { +#if !defined(WINDOWS) taosSetSignal(SIGBUS, taosClientCrash); +#endif taosSetSignal(SIGABRT, taosClientCrash); taosSetSignal(SIGFPE, taosClientCrash); taosSetSignal(SIGSEGV, taosClientCrash); diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 61ca3f6b6e..006610fb69 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -73,8 +73,10 @@ void dmLogCrash(int signum, void *sigInfo, void *context) { taosIgnSignal(SIGHUP); taosIgnSignal(SIGINT); taosIgnSignal(SIGBREAK); - + +#ifndef WINDOWS taosIgnSignal(SIGBUS); +#endif taosIgnSignal(SIGABRT); taosIgnSignal(SIGFPE); taosIgnSignal(SIGSEGV); @@ -111,7 +113,9 @@ static void dmSetSignalHandle() { taosSetSignal(SIGQUIT, dmStopDnode); #endif +#ifndef WINDOWS taosSetSignal(SIGBUS, dmLogCrash); +#endif taosSetSignal(SIGABRT, dmLogCrash); taosSetSignal(SIGFPE, dmLogCrash); taosSetSignal(SIGSEGV, dmLogCrash); diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 663451a89c..9374a39ef8 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -899,7 +899,7 @@ void taosLogCrashInfo(char* nodeType, char* pMsg, int64_t msgLen, int signum, vo int64_t writeSize = taosWriteFile(pFile, &msgLen, sizeof(msgLen)); if (sizeof(msgLen) != writeSize) { taosUnLockFile(pFile); - taosPrintLog(flags, level, dflag, "failed to write len to file:%s,%p wlen:%" PRId64 " tlen:%" PRId64 " since %s", + taosPrintLog(flags, level, dflag, "failed to write len to file:%s,%p wlen:%" PRId64 " tlen:%lu since %s", filepath, pFile, writeSize, sizeof(msgLen), terrstr()); goto _return; } @@ -977,7 +977,7 @@ void taosReadCrashInfo(char* filepath, char** pMsg, int64_t* pMsgLen, TdFilePtr* if (sizeof(msgLen) != readSize) { truncateFile = true; if (readSize < 0) { - taosPrintLog(flags, level, dflag, "failed to read len from file:%s,%p wlen:%" PRId64 " tlen:%" PRId64 " since %s", + taosPrintLog(flags, level, dflag, "failed to read len from file:%s,%p wlen:%" PRId64 " tlen:%lu since %s", filepath, pFile, readSize, sizeof(msgLen), terrstr()); } goto _return;