|
|
|
|
@ -49,6 +49,7 @@ static int syslog_level_map[] = {
|
|
|
|
|
|
|
|
|
|
static ast_mutex_t msglist_lock = AST_MUTEX_INITIALIZER;
|
|
|
|
|
static ast_mutex_t loglock = AST_MUTEX_INITIALIZER;
|
|
|
|
|
static int pending_logger_reload = 0;
|
|
|
|
|
|
|
|
|
|
static struct msglist {
|
|
|
|
|
char *msg;
|
|
|
|
|
@ -265,7 +266,6 @@ int reload_logger(int rotate)
|
|
|
|
|
FILE *myf;
|
|
|
|
|
|
|
|
|
|
int x;
|
|
|
|
|
|
|
|
|
|
ast_mutex_lock(&loglock);
|
|
|
|
|
if (eventlog)
|
|
|
|
|
fclose(eventlog);
|
|
|
|
|
@ -334,6 +334,7 @@ int reload_logger(int rotate)
|
|
|
|
|
} else
|
|
|
|
|
ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
|
|
|
|
|
init_logger_chain();
|
|
|
|
|
pending_logger_reload = 0;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -384,10 +385,8 @@ static struct ast_cli_entry rotate_logger_cli =
|
|
|
|
|
logger_rotate_help };
|
|
|
|
|
|
|
|
|
|
static int handle_SIGXFSZ(int sig) {
|
|
|
|
|
reload_logger(1);
|
|
|
|
|
ast_log(LOG_EVENT,"Rotated Logs Per SIGXFSZ\n");
|
|
|
|
|
if (option_verbose)
|
|
|
|
|
ast_verbose("Rotated Logs Per SIGXFSZ\n");
|
|
|
|
|
/* Indicate need to reload */
|
|
|
|
|
pending_logger_reload = 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -535,6 +534,12 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|
|
|
|
|
|
|
|
|
ast_mutex_unlock(&loglock);
|
|
|
|
|
/* end critical section */
|
|
|
|
|
if (pending_logger_reload) {
|
|
|
|
|
reload_logger(1);
|
|
|
|
|
ast_log(LOG_EVENT,"Rotated Logs Per SIGXFSZ\n");
|
|
|
|
|
if (option_verbose)
|
|
|
|
|
ast_verbose("Rotated Logs Per SIGXFSZ\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern void ast_verbose(const char *fmt, ...)
|
|
|
|
|
|