fix: windows compile issue

This commit is contained in:
dapan1121 2022-12-30 15:56:37 +08:00
parent 8ff3b2fda3
commit 586b73bef1
3 changed files with 12 additions and 4 deletions

View File

@ -393,8 +393,10 @@ void taosClientCrash(int signum, void *sigInfo, void *context) {
taosIgnSignal(SIGHUP); taosIgnSignal(SIGHUP);
taosIgnSignal(SIGINT); taosIgnSignal(SIGINT);
taosIgnSignal(SIGBREAK); taosIgnSignal(SIGBREAK);
#if !defined(WINDOWS)
taosIgnSignal(SIGBUS); taosIgnSignal(SIGBUS);
#endif
taosIgnSignal(SIGABRT); taosIgnSignal(SIGABRT);
taosIgnSignal(SIGFPE); taosIgnSignal(SIGFPE);
taosIgnSignal(SIGSEGV); taosIgnSignal(SIGSEGV);
@ -504,7 +506,9 @@ void tscStopCrashReport() {
} }
static void tscSetSignalHandle() { static void tscSetSignalHandle() {
#if !defined(WINDOWS)
taosSetSignal(SIGBUS, taosClientCrash); taosSetSignal(SIGBUS, taosClientCrash);
#endif
taosSetSignal(SIGABRT, taosClientCrash); taosSetSignal(SIGABRT, taosClientCrash);
taosSetSignal(SIGFPE, taosClientCrash); taosSetSignal(SIGFPE, taosClientCrash);
taosSetSignal(SIGSEGV, taosClientCrash); taosSetSignal(SIGSEGV, taosClientCrash);

View File

@ -73,8 +73,10 @@ void dmLogCrash(int signum, void *sigInfo, void *context) {
taosIgnSignal(SIGHUP); taosIgnSignal(SIGHUP);
taosIgnSignal(SIGINT); taosIgnSignal(SIGINT);
taosIgnSignal(SIGBREAK); taosIgnSignal(SIGBREAK);
#ifndef WINDOWS
taosIgnSignal(SIGBUS); taosIgnSignal(SIGBUS);
#endif
taosIgnSignal(SIGABRT); taosIgnSignal(SIGABRT);
taosIgnSignal(SIGFPE); taosIgnSignal(SIGFPE);
taosIgnSignal(SIGSEGV); taosIgnSignal(SIGSEGV);
@ -111,7 +113,9 @@ static void dmSetSignalHandle() {
taosSetSignal(SIGQUIT, dmStopDnode); taosSetSignal(SIGQUIT, dmStopDnode);
#endif #endif
#ifndef WINDOWS
taosSetSignal(SIGBUS, dmLogCrash); taosSetSignal(SIGBUS, dmLogCrash);
#endif
taosSetSignal(SIGABRT, dmLogCrash); taosSetSignal(SIGABRT, dmLogCrash);
taosSetSignal(SIGFPE, dmLogCrash); taosSetSignal(SIGFPE, dmLogCrash);
taosSetSignal(SIGSEGV, dmLogCrash); taosSetSignal(SIGSEGV, dmLogCrash);

View File

@ -899,7 +899,7 @@ void taosLogCrashInfo(char* nodeType, char* pMsg, int64_t msgLen, int signum, vo
int64_t writeSize = taosWriteFile(pFile, &msgLen, sizeof(msgLen)); int64_t writeSize = taosWriteFile(pFile, &msgLen, sizeof(msgLen));
if (sizeof(msgLen) != writeSize) { if (sizeof(msgLen) != writeSize) {
taosUnLockFile(pFile); 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()); filepath, pFile, writeSize, sizeof(msgLen), terrstr());
goto _return; goto _return;
} }
@ -977,7 +977,7 @@ void taosReadCrashInfo(char* filepath, char** pMsg, int64_t* pMsgLen, TdFilePtr*
if (sizeof(msgLen) != readSize) { if (sizeof(msgLen) != readSize) {
truncateFile = true; truncateFile = true;
if (readSize < 0) { 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()); filepath, pFile, readSize, sizeof(msgLen), terrstr());
} }
goto _return; goto _return;