[Devel] Contribution to OpenSER
Anatoly Pidruchny
apidruchny at newxt.com
Tue Mar 27 18:33:18 CEST 2007
Dear OpenSER developers,
we would like to contribute some changes to OpenSER that should be
useful to all of the OpenSER community.
The first small but useful change that we want is the ability to run
OpenSER in "no-daemon" mode. We need to do this to run OpenSER under
daemontools. There is a -D option already that means "Do not fork into
daemon mode". But the problem with this option is that it really means
more then just "Do not fork into daemon mode". It really means do not
fork at all, i.e. do not create any child OpenSER processes. The patch
below adds a variable no_daemon in main.c, makes -D option only change
the no_daemon variable and makes the variable no_daemon only control
whether OpenSER daemonizes itself or not. Yes, this patch means that -D
option will no longer change the value of dont_fork variable. Well, we
think a new option has to be added that will turn on the dont_fork
variable. This patch does not add such a new option.
Please let me know what should I do contribute this patch. I can also
add an additional option to control the dont_fork variable, if you
suggest so. Below is the proposed patch.
*** main.c.old Tue Mar 27 11:52:28 2007
--- main.c.new Tue Mar 27 11:54:56 2007
***************
*** 227,232 ****
--- 227,233 ----
int sig_flag = 0; /* last signal received */
int debug = L_NOTICE;
int dont_fork = 0;
+ int no_daemon = 0;
int log_stderr = 0;
/* log facility (see syslog(3)) */
int log_facility = LOG_DAEMON;
***************
*** 1070,1076 ****
debug++;
break;
case 'D':
! dont_fork=1;
break;
case 'E':
log_stderr=1;
--- 1071,1077 ----
debug++;
break;
case 'D':
! no_daemon=1;
break;
case 'E':
log_stderr=1;
***************
*** 1327,1333 ****
#endif /* USE_TLS */
#endif /* USE_TCP */
/* init_daemon? */
! if (!dont_fork){
if ( daemonize((log_name==0)?argv[0]:log_name) <0 ) goto
error;
}
if (install_sigs() != 0){
--- 1328,1334 ----
#endif /* USE_TLS */
#endif /* USE_TCP */
/* init_daemon? */
! if (!no_daemon){
if ( daemonize((log_name==0)?argv[0]:log_name) <0 ) goto
error;
}
if (install_sigs() != 0){
Best regards,
Anatoly Pidruchny.
NewCross Technologies.
More information about the Devel
mailing list