Added machine readable exit reasons, INPUT_END trigger, OUTPUT_END trigger, and updated RECORDING_END trigger to include all of these.
This commit is contained in:
parent
a16d98b7b2
commit
b0d4422d27
47 changed files with 493 additions and 256 deletions
|
@ -42,19 +42,21 @@ bool Util::Config::is_restarting = false;
|
|||
static Socket::Server *serv_sock_pointer = 0;
|
||||
uint32_t Util::printDebugLevel = DEBUG;
|
||||
__thread char Util::streamName[256] = {0};
|
||||
__thread char Util::exitReason[256] ={0};
|
||||
|
||||
__thread char Util::exitReason[256] = {0};
|
||||
__thread char* Util::mRExitReason = (char*)ER_UNKNOWN;
|
||||
Util::binType Util::Config::binaryType = UNSET;
|
||||
|
||||
void Util::setStreamName(const std::string & sn){
|
||||
strncpy(Util::streamName, sn.c_str(), 256);
|
||||
}
|
||||
|
||||
void Util::logExitReason(const char *format, ...){
|
||||
void Util::logExitReason(const char* shortString, const char *format, ...){
|
||||
if (exitReason[0]){return;}
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(exitReason, 255, format, args);
|
||||
va_end(args);
|
||||
mRExitReason = (char*)shortString;
|
||||
}
|
||||
|
||||
std::string Util::listenInterface;
|
||||
|
@ -597,9 +599,9 @@ void Util::Config::signal_handler(int signum, siginfo_t *sigInfo, void *ignore){
|
|||
case SI_TIMER:
|
||||
case SI_ASYNCIO:
|
||||
case SI_MESGQ:
|
||||
logExitReason("signal %s (%d) from process %d", strsignal(signum), signum, sigInfo->si_pid);
|
||||
logExitReason(ER_CLEAN_SIGNAL, "signal %s (%d) from process %d", strsignal(signum), signum, sigInfo->si_pid);
|
||||
break;
|
||||
default: logExitReason("signal %s (%d)", strsignal(signum), signum);
|
||||
default: logExitReason(ER_CLEAN_SIGNAL, "signal %s (%d)", strsignal(signum), signum);
|
||||
}
|
||||
is_active = false;
|
||||
default:
|
||||
|
|
12
lib/config.h
12
lib/config.h
|
@ -17,7 +17,16 @@ namespace Util{
|
|||
extern __thread char streamName[256]; ///< Used by debug messages to identify the stream name
|
||||
void setStreamName(const std::string & sn);
|
||||
extern __thread char exitReason[256];
|
||||
void logExitReason(const char *format, ...);
|
||||
extern __thread char* mRExitReason;
|
||||
void logExitReason(const char* shortString, const char *format, ...);
|
||||
|
||||
enum binType {
|
||||
UNSET,
|
||||
INPUT,
|
||||
OUTPUT,
|
||||
PROCESS,
|
||||
CONTROLLER
|
||||
};
|
||||
|
||||
/// Deals with parsing configuration from commandline options.
|
||||
class Config{
|
||||
|
@ -30,6 +39,7 @@ namespace Util{
|
|||
// variables
|
||||
static bool is_active; ///< Set to true by activate(), set to false by the signal handler.
|
||||
static bool is_restarting; ///< Set to true when restarting, set to false on boot.
|
||||
static binType binaryType;
|
||||
// functions
|
||||
Config();
|
||||
Config(std::string cmd);
|
||||
|
|
|
@ -303,3 +303,27 @@ static inline void show_stackframe(){}
|
|||
#define SESS_HTTP_AS_UNSPECIFIED 4
|
||||
#define SESS_TKN_DEFAULT_MODE 15
|
||||
|
||||
#define ER_UNKNOWN "UNKNOWN"
|
||||
#define ER_CLEAN_LIVE_BUFFER_REQ "CLEAN_LIVE_BUFFER_REQ"
|
||||
#define ER_CLEAN_CONTROLLER_REQ "CLEAN_CONTROLLER_REQ"
|
||||
#define ER_CLEAN_INTENDED_STOP "CLEAN_INTENDED_STOP"
|
||||
#define ER_CLEAN_REMOTE_CLOSE "CLEAN_REMOTE_CLOSE"
|
||||
#define ER_CLEAN_INACTIVE "CLEAN_INACTIVE"
|
||||
#define ER_CLEAN_SIGNAL "CLEAN_SIGNAL"
|
||||
#define ER_CLEAN_EOF "CLEAN_EOF"
|
||||
#define ER_READ_START_FAILURE "READ_START_FAILURE"
|
||||
#define ER_PROCESS_SPECIFIC "PROCESS_SPECIFIC"
|
||||
#define ER_FORMAT_SPECIFIC "FORMAT_SPECIFIC"
|
||||
#define ER_INTERNAL_ERROR "INTERNAL_ERROR"
|
||||
#define ER_WRITE_FAILURE "WRITE_FAILURE"
|
||||
#define ER_EXEC_FAILURE "EXEC_FAILURE"
|
||||
#define ER_MEMORY "OUT_OF_MEMORY"
|
||||
#define ER_SHM_LOST "SHM_LOST"
|
||||
#define ER_UNSUPPORTED "UNSUPPORTED"
|
||||
#define ER_SEGFAULT "SEGFAULT"
|
||||
#define ER_TRIGGER "TRIGGER"
|
||||
#define ER_SIGTRAP "SIGTRAP"
|
||||
#define ER_SIGABRT "SIGABRT"
|
||||
#define ER_SIGILL "SIGILL"
|
||||
#define ER_SIGFPE "SIGFPE"
|
||||
#define ER_SIGBUS "SIGBUS"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue