- safer to avoid conflicts with other libs
... | ... |
@@ -159,7 +159,7 @@ extern char *avp_db_url; /* db url used by user preferences (AVPs) */ |
159 | 159 |
|
160 | 160 |
extern int reply_to_via; |
161 | 161 |
|
162 |
-extern int is_main; |
|
162 |
+extern int _ksr_is_main; |
|
163 | 163 |
extern int fixup_complete; |
164 | 164 |
|
165 | 165 |
/* debugging level for dumping memory status */ |
... | ... |
@@ -262,7 +262,7 @@ int fork_process(int child_id, char *desc, int make_sock) |
262 | 262 |
#ifdef USE_TCP |
263 | 263 |
sockfd[0]=sockfd[1]=-1; |
264 | 264 |
if(make_sock && !tcp_disable){ |
265 |
- if (!is_main){ |
|
265 |
+ if (!_ksr_is_main){ |
|
266 | 266 |
LM_CRIT("called from a non " |
267 | 267 |
"\"main\" process! If forking from a module's " |
268 | 268 |
"child_init() fork only if rank==PROC_MAIN or" |
... | ... |
@@ -297,7 +297,7 @@ int fork_process(int child_id, char *desc, int make_sock) |
297 | 297 |
goto error; |
298 | 298 |
}else if (pid==0){ |
299 | 299 |
/* child */ |
300 |
- is_main=0; /* a forked process cannot be the "main" one */ |
|
300 |
+ _ksr_is_main=0; /* a forked process cannot be the "main" one */ |
|
301 | 301 |
process_no=child_process_no; |
302 | 302 |
daemon_status_on_fork_cleanup(); |
303 | 303 |
/* close tcp unix sockets if this is not tcp main */ |
... | ... |
@@ -401,8 +401,8 @@ int fork_tcp_process(int child_id, char *desc, int r, int *reader_fd_1) |
401 | 401 |
reader_fd[0]=reader_fd[1]=-1; |
402 | 402 |
ret=-1; |
403 | 403 |
|
404 |
- if (!is_main){ |
|
405 |
- LM_CRIT("called from a non \"main\" process\n"); |
|
404 |
+ if (!_ksr_is_main){ |
|
405 |
+ LM_CRIT("called from a non \"main\" process (%d)\n", _ksr_is_main); |
|
406 | 406 |
goto error; |
407 | 407 |
} |
408 | 408 |
if (tcp_main_pid){ |
... | ... |
@@ -441,7 +441,7 @@ int fork_tcp_process(int child_id, char *desc, int r, int *reader_fd_1) |
441 | 441 |
goto end; |
442 | 442 |
} |
443 | 443 |
if (pid==0){ |
444 |
- is_main=0; /* a forked process cannot be the "main" one */ |
|
444 |
+ _ksr_is_main=0; /* a forked process cannot be the "main" one */ |
|
445 | 445 |
process_no=child_process_no; |
446 | 446 |
/* close unneeded unix sockets */ |
447 | 447 |
close_extra_socks(child_id, process_no); |
... | ... |
@@ -508,7 +508,7 @@ extern FILE* yyin; |
508 | 508 |
extern int yyparse(void); |
509 | 509 |
|
510 | 510 |
|
511 |
-int is_main=1; /* flag = is this the "main" process? */ |
|
511 |
+int _ksr_is_main=1; /* flag = is this the "main" process? */ |
|
512 | 512 |
int fixup_complete=0; /* flag = is the fixup complete ? */ |
513 | 513 |
|
514 | 514 |
char* pid_file = 0; /* filename as asked by use */ |
... | ... |
@@ -649,7 +649,7 @@ static void kill_all_children(int signum) |
649 | 649 |
* (only main can add processes, so from main is safe not to lock |
650 | 650 |
* and moreover it avoids the lock-holding suicidal children problem) |
651 | 651 |
*/ |
652 |
- if (!is_main) lock_get(process_lock); |
|
652 |
+ if (!_ksr_is_main) lock_get(process_lock); |
|
653 | 653 |
for (r=1; r<*process_count; r++){ |
654 | 654 |
if (r==process_no) continue; /* try not to be suicidal */ |
655 | 655 |
if (pt[r].pid) { |
... | ... |
@@ -658,7 +658,7 @@ static void kill_all_children(int signum) |
658 | 658 |
else LM_CRIT("killing: %s > %d no pid!!!\n", |
659 | 659 |
pt[r].desc, pt[r].pid); |
660 | 660 |
} |
661 |
- if (!is_main) lock_release(process_lock); |
|
661 |
+ if (!_ksr_is_main) lock_release(process_lock); |
|
662 | 662 |
} |
663 | 663 |
} |
664 | 664 |
|
... | ... |
@@ -832,7 +832,7 @@ void sig_usr(int signo) |
832 | 832 |
#endif |
833 | 833 |
#endif |
834 | 834 |
|
835 |
- if (is_main){ |
|
835 |
+ if (_ksr_is_main){ |
|
836 | 836 |
if (sig_flag==0) sig_flag=signo; |
837 | 837 |
else /* previous sig. not processed yet, ignoring? */ |
838 | 838 |
return; ; |
... | ... |
@@ -3070,7 +3070,7 @@ try_again: |
3070 | 3070 |
if (ret < 0) |
3071 | 3071 |
goto error; |
3072 | 3072 |
/*kill everything*/ |
3073 |
- if (is_main) shutdown_children(SIGTERM, 0); |
|
3073 |
+ if (_ksr_is_main) shutdown_children(SIGTERM, 0); |
|
3074 | 3074 |
if (!dont_daemonize) { |
3075 | 3075 |
if (daemon_status_send(0) < 0) |
3076 | 3076 |
fprintf(stderr, "error sending exit status: %s [%d]\n", |
... | ... |
@@ -3081,7 +3081,7 @@ try_again: |
3081 | 3081 |
|
3082 | 3082 |
error: |
3083 | 3083 |
/*kill everything*/ |
3084 |
- if (is_main) shutdown_children(SIGTERM, 0); |
|
3084 |
+ if (_ksr_is_main) shutdown_children(SIGTERM, 0); |
|
3085 | 3085 |
if (!dont_daemonize) { |
3086 | 3086 |
if (daemon_status_send((char)-1) < 0) |
3087 | 3087 |
fprintf(stderr, "error sending exit status: %s [%d]\n", |