|
@@ -660,7 +660,7 @@ static void kill_all_children(int signum)
|
|
|
if (pt[r].pid) {
|
|
|
kill(pt[r].pid, signum);
|
|
|
}
|
|
|
- else LOG(L_CRIT, "BUG: killing: %s > %d no pid!!!\n",
|
|
|
+ else LM_CRIT("killing: %s > %d no pid!!!\n",
|
|
|
pt[r].desc, pt[r].pid);
|
|
|
}
|
|
|
if (!is_main) lock_release(process_lock);
|
|
@@ -686,7 +686,7 @@ static void sig_alarm_kill(int signo)
|
|
|
static void sig_alarm_abort(int signo)
|
|
|
{
|
|
|
/* LOG is not signal safe, but who cares, we are abort-ing anyway :-) */
|
|
|
- LOG(L_CRIT, "BUG: shutdown timeout triggered, dying...");
|
|
|
+ LM_CRIT("shutdown timeout triggered, dying...");
|
|
|
abort();
|
|
|
}
|
|
|
|
|
@@ -696,7 +696,7 @@ static void shutdown_children(int sig, int show_status)
|
|
|
{
|
|
|
kill_all_children(sig);
|
|
|
if (set_sig_h(SIGALRM, sig_alarm_kill) == SIG_ERR ) {
|
|
|
- LOG(L_ERR, "ERROR: shutdown: could not install SIGALARM handler\n");
|
|
|
+ LM_ERR("could not install SIGALARM handler\n");
|
|
|
/* continue, the process will die anyway if no
|
|
|
* alarm is installed which is exactly what we want */
|
|
|
}
|
|
@@ -723,7 +723,7 @@ void handle_sigs(void)
|
|
|
/* SIGPIPE might be rarely received on use of
|
|
|
exec module; simply ignore it
|
|
|
*/
|
|
|
- LOG(L_WARN, "WARNING: SIGPIPE received and ignored\n");
|
|
|
+ LM_WARN("SIGPIPE received and ignored\n");
|
|
|
break;
|
|
|
case SIGINT:
|
|
|
case SIGTERM:
|
|
@@ -732,7 +732,7 @@ void handle_sigs(void)
|
|
|
DBG("INT received, program terminates\n");
|
|
|
else
|
|
|
DBG("SIGTERM received, program terminates\n");
|
|
|
- LOG(L_NOTICE, "Thank you for flying " NAME "!!!\n");
|
|
|
+ LM_NOTICE("Thank you for flying " NAME "!!!\n");
|
|
|
/* shutdown/kill all the children */
|
|
|
shutdown_children(SIGTERM, 1);
|
|
|
exit(0);
|
|
@@ -772,27 +772,27 @@ void handle_sigs(void)
|
|
|
case SIGCHLD:
|
|
|
while ((chld=waitpid( -1, &chld_status, WNOHANG ))>0) {
|
|
|
if (WIFEXITED(chld_status))
|
|
|
- LOG(L_ALERT, "child process %ld exited normally,"
|
|
|
+ LM_ALERT("child process %ld exited normally,"
|
|
|
" status=%d\n", (long)chld,
|
|
|
WEXITSTATUS(chld_status));
|
|
|
else if (WIFSIGNALED(chld_status)) {
|
|
|
- LOG(L_ALERT, "child process %ld exited by a signal"
|
|
|
+ LM_ALERT("child process %ld exited by a signal"
|
|
|
" %d\n", (long)chld, WTERMSIG(chld_status));
|
|
|
#ifdef WCOREDUMP
|
|
|
- LOG(L_ALERT, "core was %sgenerated\n",
|
|
|
+ LM_ALERT("core was %sgenerated\n",
|
|
|
WCOREDUMP(chld_status) ? "" : "not " );
|
|
|
#endif
|
|
|
}else if (WIFSTOPPED(chld_status))
|
|
|
- LOG(L_ALERT, "child process %ld stopped by a"
|
|
|
+ LM_ALERT("child process %ld stopped by a"
|
|
|
" signal %d\n", (long)chld,
|
|
|
WSTOPSIG(chld_status));
|
|
|
}
|
|
|
#ifndef STOP_JIRIS_CHANGES
|
|
|
if (dont_fork) {
|
|
|
- LOG(L_INFO, "INFO: dont_fork turned on, living on\n");
|
|
|
+ LM_INFO("dont_fork turned on, living on\n");
|
|
|
break;
|
|
|
}
|
|
|
- LOG(L_INFO, "INFO: terminating due to SIGCHLD\n");
|
|
|
+ LM_INFO("terminating due to SIGCHLD\n");
|
|
|
#endif
|
|
|
/* exit */
|
|
|
shutdown_children(SIGTERM, 1);
|
|
@@ -804,7 +804,7 @@ void handle_sigs(void)
|
|
|
DBG("SIGHUP received, ignoring it\n");
|
|
|
break;
|
|
|
default:
|
|
|
- LOG(L_CRIT, "WARNING: unhandled signal %d\n", sig_flag);
|
|
|
+ LM_CRIT("unhandled signal %d\n", sig_flag);
|
|
|
}
|
|
|
sig_flag=0;
|
|
|
}
|
|
@@ -837,13 +837,13 @@ void sig_usr(int signo)
|
|
|
switch(signo){
|
|
|
case SIGPIPE:
|
|
|
#ifdef SIG_DEBUG /* signal unsafe stuff follows */
|
|
|
- LOG(L_INFO, "INFO: signal %d received\n", signo);
|
|
|
+ LM_INFO("signal %d received\n", signo);
|
|
|
#endif
|
|
|
break;
|
|
|
case SIGINT:
|
|
|
case SIGTERM:
|
|
|
#ifdef SIG_DEBUG /* signal unsafe stuff follows */
|
|
|
- LOG(L_INFO, "INFO: signal %d received\n", signo);
|
|
|
+ LM_INFO("signal %d received\n", signo);
|
|
|
/* print memory stats for non-main too */
|
|
|
#ifdef PKG_MALLOC
|
|
|
/* make sure we have current cfg values, but update only
|
|
@@ -1170,16 +1170,16 @@ int parse_phostport(char* s, char** host, int* hlen,
|
|
|
end:
|
|
|
return 0;
|
|
|
error_brackets:
|
|
|
- LOG(L_ERR, "ERROR: parse_phostport: too many brackets in %s\n", s);
|
|
|
+ LM_ERR("too many brackets in %s\n", s);
|
|
|
return -1;
|
|
|
error_colons:
|
|
|
- LOG(L_ERR, "ERROR: parse_phostport: too many colons in %s\n", s);
|
|
|
+ LM_ERR("too many colons in %s\n", s);
|
|
|
return -1;
|
|
|
error_proto:
|
|
|
- LOG(L_ERR, "ERROR: parse_phostport: bad protocol in %s\n", s);
|
|
|
+ LM_ERR("bad protocol in %s\n", s);
|
|
|
return -1;
|
|
|
error_port:
|
|
|
- LOG(L_ERR, "ERROR: parse_phostport: bad port number in %s\n", s);
|
|
|
+ LM_ERR("bad port number in %s\n", s);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -1277,7 +1277,7 @@ int main_loop(void)
|
|
|
setstats( 0 );
|
|
|
#endif
|
|
|
if (udp_listen==0){
|
|
|
- LOG(L_ERR, "ERROR: no fork mode requires at least one"
|
|
|
+ LM_ERR("no fork mode requires at least one"
|
|
|
" udp listen address, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
@@ -1322,8 +1322,7 @@ int main_loop(void)
|
|
|
} else
|
|
|
sendipv6=bind_address;
|
|
|
if (udp_listen->next){
|
|
|
- LOG(L_WARN, "WARNING: using only the first listen address"
|
|
|
- " (no fork)\n");
|
|
|
+ LM_WARN("using only the first listen address (no fork)\n");
|
|
|
}
|
|
|
|
|
|
/* delay cfg_shmize to the last moment (it must be called _before_
|
|
@@ -1331,7 +1330,7 @@ int main_loop(void)
|
|
|
ignored.
|
|
|
*/
|
|
|
if (cfg_shmize() < 0) {
|
|
|
- LOG(L_CRIT, "could not initialize shared configuration\n");
|
|
|
+ LM_CRIT("could not initialize shared configuration\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -1365,8 +1364,7 @@ int main_loop(void)
|
|
|
* for the "main" process with rank PROC_MAIN (make sure things are
|
|
|
* not initialized twice)*/
|
|
|
if (init_child(PROC_INIT) < 0) {
|
|
|
- LOG(L_ERR, "ERROR: main_dontfork: init_child(PROC_INT) --"
|
|
|
- " exiting\n");
|
|
|
+ LM_ERR("init_child(PROC_INT) -- exiting\n");
|
|
|
cfg_main_reset_local();
|
|
|
goto error;
|
|
|
}
|
|
@@ -1377,7 +1375,7 @@ int main_loop(void)
|
|
|
/* we need another process to act as the "slow" timer*/
|
|
|
pid = fork_process(PROC_TIMER, "slow timer", 0);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "ERROR: main_loop: Cannot fork\n");
|
|
|
+ LM_CRIT("Cannot fork\n");
|
|
|
goto error;
|
|
|
}
|
|
|
if (pid==0){
|
|
@@ -1396,7 +1394,7 @@ int main_loop(void)
|
|
|
/* we need another process to act as the "main" timer*/
|
|
|
pid = fork_process(PROC_TIMER, "timer", 0);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "ERROR: main_loop: Cannot fork\n");
|
|
|
+ LM_CRIT("Cannot fork\n");
|
|
|
goto error;
|
|
|
}
|
|
|
if (pid==0){
|
|
@@ -1420,8 +1418,7 @@ int main_loop(void)
|
|
|
/* call it also w/ PROC_MAIN to make sure modules that init things
|
|
|
* only in PROC_MAIN get a chance to run */
|
|
|
if (init_child(PROC_MAIN) < 0) {
|
|
|
- LOG(L_ERR, "ERROR: main_dontfork: init_child(PROC_MAIN) "
|
|
|
- "-- exiting\n");
|
|
|
+ LM_ERR("init_child(PROC_MAIN) -- exiting\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -1431,7 +1428,7 @@ int main_loop(void)
|
|
|
*/
|
|
|
|
|
|
if (init_child(PROC_SIPINIT) < 0) {
|
|
|
- LOG(L_ERR, "main_dontfork: init_child failed\n");
|
|
|
+ LM_ERR("init_child failed\n");
|
|
|
goto error;
|
|
|
}
|
|
|
return udp_rcv_loop();
|
|
@@ -1561,7 +1558,7 @@ int main_loop(void)
|
|
|
ignored (cfg_shmize() will copy the default cfgs into shmem).
|
|
|
*/
|
|
|
if (cfg_shmize() < 0) {
|
|
|
- LOG(L_CRIT, "could not initialize shared configuration\n");
|
|
|
+ LM_CRIT("could not initialize shared configuration\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -1581,8 +1578,7 @@ int main_loop(void)
|
|
|
* for the "main" process with rank PROC_MAIN (make sure things are
|
|
|
* not initialized twice)*/
|
|
|
if (init_child(PROC_INIT) < 0) {
|
|
|
- LOG(L_ERR, "ERROR: main: error in init_child(PROC_INT) --"
|
|
|
- " exiting\n");
|
|
|
+ LM_ERR("error in init_child(PROC_INT) -- exiting\n");
|
|
|
cfg_main_reset_local();
|
|
|
goto error;
|
|
|
}
|
|
@@ -1618,7 +1614,7 @@ int main_loop(void)
|
|
|
child_rank++;
|
|
|
pid = fork_process(child_rank, si_desc, 1);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "main_loop: Cannot fork\n");
|
|
|
+ LM_CRIT("Cannot fork\n");
|
|
|
goto error;
|
|
|
}else if (pid==0){
|
|
|
/* child */
|
|
@@ -1650,7 +1646,7 @@ int main_loop(void)
|
|
|
child_rank++;
|
|
|
pid = fork_process(child_rank, si_desc, 1);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "main_loop: Cannot fork\n");
|
|
|
+ LM_CRIT("Cannot fork\n");
|
|
|
goto error;
|
|
|
}else if (pid==0){
|
|
|
/* child */
|
|
@@ -1674,7 +1670,7 @@ int main_loop(void)
|
|
|
/* fork again for the "slow" timer process*/
|
|
|
pid = fork_process(PROC_TIMER, "slow timer", 1);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "main_loop: cannot fork \"slow\" timer process\n");
|
|
|
+ LM_CRIT("cannot fork \"slow\" timer process\n");
|
|
|
goto error;
|
|
|
}else if (pid==0){
|
|
|
/* child */
|
|
@@ -1690,7 +1686,7 @@ int main_loop(void)
|
|
|
/* fork again for the "main" timer process*/
|
|
|
pid = fork_process(PROC_TIMER, "timer", 1);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "main_loop: cannot fork timer process\n");
|
|
|
+ LM_CRIT("cannot fork timer process\n");
|
|
|
goto error;
|
|
|
}else if (pid==0){
|
|
|
/* child */
|
|
@@ -1704,7 +1700,7 @@ int main_loop(void)
|
|
|
* to fork a tcp capable process, the corresponding tcp. comm. fds in
|
|
|
* pt[] must be set before calling tcp_main_loop()) */
|
|
|
if (init_child(PROC_MAIN) < 0) {
|
|
|
- LOG(L_ERR, "ERROR: main: error in init_child\n");
|
|
|
+ LM_ERR("error in init_child\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -1715,8 +1711,7 @@ int main_loop(void)
|
|
|
/* start tcp+tls master proc */
|
|
|
pid = fork_process(PROC_TCP_MAIN, "tcp main process", 0);
|
|
|
if (pid<0){
|
|
|
- LOG(L_CRIT, "main_loop: cannot fork tcp main process: %s\n",
|
|
|
- strerror(errno));
|
|
|
+ LM_CRIT("cannot fork tcp main process: %s\n", strerror(errno));
|
|
|
goto error;
|
|
|
}else if (pid==0){
|
|
|
/* child */
|
|
@@ -1910,8 +1905,7 @@ int main(int argc, char** argv)
|
|
|
|
|
|
/*init pkg mallocs (before parsing cfg or the rest of the cmd line !)*/
|
|
|
if (pkg_mem_size)
|
|
|
- LOG(L_INFO, " private (per process) memory: %ld bytes\n",
|
|
|
- pkg_mem_size );
|
|
|
+ LM_INFO("private (per process) memory: %ld bytes\n", pkg_mem_size );
|
|
|
if (init_pkg_mallocs()==-1)
|
|
|
goto error;
|
|
|
|
|
@@ -1949,8 +1943,7 @@ int main(int argc, char** argv)
|
|
|
optarg);
|
|
|
goto error;
|
|
|
};
|
|
|
- LOG(L_INFO, "ser: shared memory: %ld bytes\n",
|
|
|
- shm_mem_size );
|
|
|
+ LM_INFO("shared memory: %ld bytes\n", shm_mem_size );
|
|
|
break;
|
|
|
case 'M':
|
|
|
/* ignore it, it was parsed immediately after startup,
|
|
@@ -2087,13 +2080,12 @@ int main(int argc, char** argv)
|
|
|
try_again:
|
|
|
if (read(rfd, (void*)&seed, sizeof(seed))==-1){
|
|
|
if (errno==EINTR) goto try_again; /* interrupted by signal */
|
|
|
- LOG(L_WARN, "WARNING: could not read from /dev/urandom (%d)\n",
|
|
|
- errno);
|
|
|
+ LM_WARN("could not read from /dev/urandom (%d)\n", errno);
|
|
|
}
|
|
|
DBG("read %u from /dev/urandom\n", seed);
|
|
|
close(rfd);
|
|
|
}else{
|
|
|
- LOG(L_WARN, "WARNING: could not open /dev/urandom (%d)\n", errno);
|
|
|
+ LM_WARN("could not open /dev/urandom (%d)\n", errno);
|
|
|
}
|
|
|
seed+=getpid()+time(0);
|
|
|
DBG("seeding PRNG with %u\n", seed);
|
|
@@ -2409,53 +2401,53 @@ try_again:
|
|
|
if (init_atomic_ops()==-1)
|
|
|
goto error;
|
|
|
if (init_basex() != 0){
|
|
|
- LOG(L_CRIT, "could not initialize base* framework\n");
|
|
|
+ LM_CRIT("could not initialize base* framework\n");
|
|
|
goto error;
|
|
|
}
|
|
|
if (sr_cfg_init() < 0) {
|
|
|
- LOG(L_CRIT, "could not initialize configuration framework\n");
|
|
|
+ LM_CRIT("could not initialize configuration framework\n");
|
|
|
goto error;
|
|
|
}
|
|
|
/* declare the core cfg before the module configs */
|
|
|
if (cfg_declare("core", core_cfg_def, &default_core_cfg, cfg_sizeof(core),
|
|
|
&core_cfg)
|
|
|
) {
|
|
|
- LOG(L_CRIT, "could not declare the core configuration\n");
|
|
|
+ LM_CRIT("could not declare the core configuration\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#ifdef USE_TCP
|
|
|
if (tcp_register_cfg()){
|
|
|
- LOG(L_CRIT, "could not register the tcp configuration\n");
|
|
|
+ LM_CRIT("could not register the tcp configuration\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#endif /* USE_TCP */
|
|
|
/*init timer, before parsing the cfg!*/
|
|
|
if (init_timer()<0){
|
|
|
- LOG(L_CRIT, "could not initialize timer, exiting...\n");
|
|
|
+ LM_CRIT("could not initialize timer, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#ifdef USE_DNS_CACHE
|
|
|
if (init_dns_cache()<0){
|
|
|
- LOG(L_CRIT, "could not initialize the dns cache, exiting...\n");
|
|
|
+ LM_CRIT("could not initialize the dns cache, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#ifdef USE_DNS_CACHE_STATS
|
|
|
/* preinitializing before the nubmer of processes is determined */
|
|
|
if (init_dns_cache_stats(1)<0){
|
|
|
- LOG(L_CRIT, "could not initialize the dns cache measurement\n");
|
|
|
+ LM_CRIT("could not initialize the dns cache measurement\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#endif /* USE_DNS_CACHE_STATS */
|
|
|
#endif
|
|
|
#ifdef USE_DST_BLACKLIST
|
|
|
if (init_dst_blacklist()<0){
|
|
|
- LOG(L_CRIT, "could not initialize the dst blacklist, exiting...\n");
|
|
|
+ LM_CRIT("could not initialize the dst blacklist, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#ifdef USE_DST_BLACKLIST_STATS
|
|
|
/* preinitializing before the number of processes is determined */
|
|
|
if (init_dst_blacklist_stats(1)<0){
|
|
|
- LOG(L_CRIT, "could not initialize the dst blacklist measurement\n");
|
|
|
+ LM_CRIT("could not initialize the dst blacklist measurement\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#endif /* USE_DST_BLACKLIST_STATS */
|
|
@@ -2467,7 +2459,7 @@ try_again:
|
|
|
if (!tcp_disable){
|
|
|
/*init tcp*/
|
|
|
if (init_tcp()<0){
|
|
|
- LOG(L_CRIT, "could not initialize tcp, exiting...\n");
|
|
|
+ LM_CRIT("could not initialize tcp, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
|
}
|
|
@@ -2475,7 +2467,7 @@ try_again:
|
|
|
#ifdef USE_SCTP
|
|
|
if (!sctp_disable){
|
|
|
if (sctp_core_init()<0){
|
|
|
- LOG(L_CRIT, "Could not initialize sctp, exiting...\n");
|
|
|
+ LM_CRIT("Could not initialize sctp, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
|
}
|
|
@@ -2516,14 +2508,14 @@ try_again:
|
|
|
#ifdef USE_TLS
|
|
|
if (!tls_disable){
|
|
|
if (!tls_loaded()){
|
|
|
- LOG(L_WARN, "WARNING: tls support enabled, but no tls engine "
|
|
|
+ LM_WARN("tls support enabled, but no tls engine "
|
|
|
" available (forgot to load the tls module?)\n");
|
|
|
- LOG(L_WARN, "WARNING: disabling tls...\n");
|
|
|
+ LM_WARN("disabling tls...\n");
|
|
|
tls_disable=1;
|
|
|
}
|
|
|
/* init tls*/
|
|
|
if (init_tls()<0){
|
|
|
- LOG(L_CRIT, "could not initialize tls, exiting...\n");
|
|
|
+ LM_CRIT("could not initialize tls, exiting...\n");
|
|
|
goto error;
|
|
|
}
|
|
|
}
|
|
@@ -2539,13 +2531,13 @@ try_again:
|
|
|
|
|
|
#if defined USE_DNS_CACHE && defined USE_DNS_CACHE_STATS
|
|
|
if (init_dns_cache_stats(get_max_procs())<0){
|
|
|
- LOG(L_CRIT, "could not initialize the dns cache measurement\n");
|
|
|
+ LM_CRIT("could not initialize the dns cache measurement\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#endif
|
|
|
#if defined USE_DST_BLACKLIST && defined USE_DST_BLACKLIST_STATS
|
|
|
if (init_dst_blacklist_stats(get_max_procs())<0){
|
|
|
- LOG(L_CRIT, "could not initialize the dst blacklist measurement\n");
|
|
|
+ LM_CRIT("could not initialize the dst blacklist measurement\n");
|
|
|
goto error;
|
|
|
}
|
|
|
#endif
|