[OpenSIPS-Devel] About daemonizing of opensips

SAMEER KUMAR sameer.kasi200x at gmail.com
Wed Apr 22 13:44:56 CEST 2009


Dear Sir,

While running opensips I am facing a problem, I am using -D option but still
dont_fork variable is not set to 1. The switch case block that reads the
command line arguments sets the dont_fork in main.c to 1 but afterwards
before the if condition (where daemonize() call is made) it is changed to 0.
I have tried lot of debugging statements, I have got the result which I have
attached below:

Please can some one explain me why my opensips is always going to
dont_fork=0 mode, even if i specify -D as command line arg at the time of
starting opensips.

I am trying to add a multithreading capability in main_loop(). for testing
purpose I will pass an arguement 0 or 1 as argv[1], and it will be checked.
If argv[1]==1 it will go into the multithreading part. I guess if I am
creating one thread per port (on which opensips is supposed to listen), I
need not load modules in saperate process, I think I can keep rest of the
funcitonality similar as dont_fork mode and jus add the code to create a
thread per process as per the link list in si startng at udp_listen or
tcp_listen etc.


Kind guidance is invited.
*
[root at fbsd52 opensips-1.4.4-tls]# opensips 0 -l udp:10.1.10.86:5060 -D

 We will not be forking new daemons

After switch the dont_fork is 1

You have selected multithreaded mode

After loading config file the dont_fork is 1

After loading config stream the dont_fork is 1

After yyparse and cfg_error checks dont_fork is 0

After config_check and check_rls checks dont_fork is 0

After print_rl() call dont_fork is 0

After print_rl() call dont_fork is 0

Before initializing the child_no values dont_fork is 0

After initializing the dont_fork is 0

After initializing chil_no n tcp_child_no the dont_fork is 0
Listening on
             udp: 10.1.10.86 [10.1.10.86]:5060
Aliases:
             udp: fbsd52.example.net:5060


 Value of dont_fork jus before the if check: 0

 Unfortunately new daemons are being forked... and you can not help it
[root at fbsd52 opensips-1.4.4-tls]#
*

Regards,
Sameer Kumar
B.Tech, Computer Engineering
Institute of Technology,
Nirma University,
Ahmedabad, Gujarat
email: sameer.kasi200x at gmail.com
         05bce032 at nirmauni.ac.in
Phone: +919375220396
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20090422/4040fd80/attachment.htm 


More information about the Devel mailing list