TD-1207
This commit is contained in:
parent
d997745d1a
commit
33228ee589
|
@ -20,9 +20,9 @@
|
||||||
#include "dnodeMain.h"
|
#include "dnodeMain.h"
|
||||||
|
|
||||||
static tsem_t exitSem;
|
static tsem_t exitSem;
|
||||||
static void siguser1Handler(int32_t signum);
|
static void siguser1Handler(int32_t signum, void *sigInfo, void *context);
|
||||||
static void siguser2Handler(int32_t signum);
|
static void siguser2Handler(int32_t signum, void *sigInfo, void *context);
|
||||||
static void sigintHandler(int32_t signum);
|
static void sigintHandler(int32_t signum, void *sigInfo, void *context);
|
||||||
|
|
||||||
int32_t main(int32_t argc, char *argv[]) {
|
int32_t main(int32_t argc, char *argv[]) {
|
||||||
int dump_config = 0;
|
int dump_config = 0;
|
||||||
|
@ -152,11 +152,11 @@ int32_t main(int32_t argc, char *argv[]) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void siguser1Handler(int32_t signum) { taosCfgDynamicOptions("debugFlag 143"); }
|
static void siguser1Handler(int32_t signum, void *sigInfo, void *context) { taosCfgDynamicOptions("debugFlag 143"); }
|
||||||
|
|
||||||
static void siguser2Handler(int32_t signum) { taosCfgDynamicOptions("resetlog"); }
|
static void siguser2Handler(int32_t signum, void *sigInfo, void *context) { taosCfgDynamicOptions("resetlog"); }
|
||||||
|
|
||||||
static void sigintHandler(int32_t signum) {
|
static void sigintHandler(int32_t signum, void *sigInfo, void *context) {
|
||||||
// protect the application from receive another signal
|
// protect the application from receive another signal
|
||||||
taosIgnSignal(SIGUSR1);
|
taosIgnSignal(SIGUSR1);
|
||||||
taosIgnSignal(SIGUSR2);
|
taosIgnSignal(SIGUSR2);
|
||||||
|
@ -169,6 +169,10 @@ static void sigintHandler(int32_t signum) {
|
||||||
// clean the system.
|
// clean the system.
|
||||||
dInfo("shut down signal is %d", signum);
|
dInfo("shut down signal is %d", signum);
|
||||||
|
|
||||||
|
#ifndef WINDOWS
|
||||||
|
dInfo("sender PID:%d cmdline:%s",((siginfo_t *)sigInfo)->si_pid, taosGetCmdlineByPID(sigInfo->si_pid));
|
||||||
|
#endif
|
||||||
|
|
||||||
syslog(LOG_INFO, "Shut down signal is %d", signum);
|
syslog(LOG_INFO, "Shut down signal is %d", signum);
|
||||||
syslog(LOG_INFO, "Shutting down TDengine service...");
|
syslog(LOG_INFO, "Shutting down TDengine service...");
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
pthread_t pid;
|
pthread_t pid;
|
||||||
static tsem_t cancelSem;
|
static tsem_t cancelSem;
|
||||||
|
|
||||||
void shellQueryInterruptHandler(int32_t signum) {
|
void shellQueryInterruptHandler(int32_t signum, void *sigInfo, void *context) {
|
||||||
tsem_post(&cancelSem);
|
tsem_post(&cancelSem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ extern "C" {
|
||||||
#define SIGBREAK 1234
|
#define SIGBREAK 1234
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void (*FSignalHandler)(int32_t signum);
|
typedef void (*FSignalHandler)(int32_t signum, void *sigInfo, void *context);
|
||||||
void taosSetSignal(int32_t signum, FSignalHandler sigfp);
|
void taosSetSignal(int32_t signum, FSignalHandler sigfp);
|
||||||
void taosIgnSignal(int32_t signum);
|
void taosIgnSignal(int32_t signum);
|
||||||
void taosDflSignal(int32_t signum);
|
void taosDflSignal(int32_t signum);
|
||||||
|
|
|
@ -20,10 +20,16 @@
|
||||||
#include "tulog.h"
|
#include "tulog.h"
|
||||||
|
|
||||||
#ifndef TAOS_OS_FUNC_SIGNAL
|
#ifndef TAOS_OS_FUNC_SIGNAL
|
||||||
|
typedef void (*FLinuxSignalHandler)(int32_t signum, siginfo_t *sigInfo, void *context);
|
||||||
|
|
||||||
void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
|
void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
|
||||||
struct sigaction act = {{0}};
|
struct sigaction act = {{0}};
|
||||||
|
#if 1
|
||||||
|
act.sa_flags = SA_SIGINFO;
|
||||||
|
act.sa_sigaction = (FLinuxSignalHandler)sigfp;
|
||||||
|
#else
|
||||||
act.sa_handler = sigfp;
|
act.sa_handler = sigfp;
|
||||||
|
#endif
|
||||||
sigaction(signum, &act, NULL);
|
sigaction(signum, &act, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
typedef void (*FWinSignalHandler)(int32_t signum);
|
||||||
|
|
||||||
void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
|
void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
|
||||||
if (signum == SIGUSR1) return;
|
if (signum == SIGUSR1) return;
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
|
||||||
if (signum == SIGHUP) {
|
if (signum == SIGHUP) {
|
||||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigfp, TRUE);
|
SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigfp, TRUE);
|
||||||
} else {
|
} else {
|
||||||
signal(signum, sigfp);
|
signal(signum, (FWinSignalHandler)sigfp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "syncInt.h"
|
#include "syncInt.h"
|
||||||
#include "syncTcp.h"
|
#include "syncTcp.h"
|
||||||
|
|
||||||
static void arbSignalHandler(int32_t signum);
|
static void arbSignalHandler(int32_t signum, void *sigInfo, void *context);
|
||||||
static void arbProcessIncommingConnection(int32_t connFd, uint32_t sourceIp);
|
static void arbProcessIncommingConnection(int32_t connFd, uint32_t sourceIp);
|
||||||
static void arbProcessBrokenLink(int64_t rid);
|
static void arbProcessBrokenLink(int64_t rid);
|
||||||
static int32_t arbProcessPeerMsg(int64_t rid, void *buffer);
|
static int32_t arbProcessPeerMsg(int64_t rid, void *buffer);
|
||||||
|
@ -170,7 +170,7 @@ static int32_t arbProcessPeerMsg(int64_t rid, void *buffer) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arbSignalHandler(int32_t signum) {
|
static void arbSignalHandler(int32_t signum, void *sigInfo, void *context) {
|
||||||
taosIgnSignal(SIGTERM);
|
taosIgnSignal(SIGTERM);
|
||||||
taosIgnSignal(SIGINT);
|
taosIgnSignal(SIGINT);
|
||||||
taosIgnSignal(SIGABRT);
|
taosIgnSignal(SIGABRT);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
bool simAsyncQuery = false;
|
bool simAsyncQuery = false;
|
||||||
bool simExecSuccess = false;
|
bool simExecSuccess = false;
|
||||||
|
|
||||||
void simHandleSignal(int32_t signo) {
|
void simHandleSignal(int32_t signo, void *sigInfo, void *context) {
|
||||||
simSystemCleanUp();
|
simSystemCleanUp();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue