#include #include #include #include "stellar/stellar.h" #include "stellar_core.h" struct stellar *st = NULL; static void signal_handler(int signo) { if (signo == SIGINT) { printf("SIGINT received, notify threads to exit\n"); stellar_loopbreak(st); } if (signo == SIGQUIT) { printf("SIGQUIT received, notify threads to exit\n"); stellar_loopbreak(st); } if (signo == SIGTERM) { printf("SIGTERM received, notify threads to exit\n"); stellar_loopbreak(st); } if (signo == SIGHUP) { printf("SIGHUP received, reload log level\n"); stellar_reload_log_level(st); } } int main(int argc __attribute__((__unused__)), char **argv __attribute__((__unused__))) { const char *stellar_cfg_file = "./conf/stellar.toml"; const char *plugin_cfg_file = "./plugin/spec.toml"; const char *log_cfg_file = "./conf/log.toml"; signal(SIGINT, signal_handler); signal(SIGQUIT, signal_handler); signal(SIGTERM, signal_handler); signal(SIGHUP, signal_handler); st = stellar_new(stellar_cfg_file, plugin_cfg_file, log_cfg_file); if (st == NULL) { return 0; } stellar_run(st); stellar_free(st); return 0; }