提交 f26a6972 authored 作者: Anthony Minessale's avatar Anthony Minessale

FSCORE-652

上级 6fe6e675
...@@ -272,6 +272,7 @@ int main(int argc, char *argv[]) ...@@ -272,6 +272,7 @@ int main(int argc, char *argv[])
const char *err = NULL; /* error value for return from freeswitch initialization */ const char *err = NULL; /* error value for return from freeswitch initialization */
#ifndef WIN32 #ifndef WIN32
int nf = 0; /* TRUE if we are running in nofork mode */ int nf = 0; /* TRUE if we are running in nofork mode */
int bf = 0;
char *runas_user = NULL; char *runas_user = NULL;
char *runas_group = NULL; char *runas_group = NULL;
#else #else
...@@ -328,6 +329,7 @@ int main(int argc, char *argv[]) ...@@ -328,6 +329,7 @@ int main(int argc, char *argv[])
"\t-monotonic-clock -- use monotonic clock as timer source\n" "\t-monotonic-clock -- use monotonic clock as timer source\n"
#else #else
"\t-nf -- no forking\n" "\t-nf -- no forking\n"
"\t-bf -- block until fully started, then fork\n"
"\t-u [user] -- specify user to switch to\n" "\t-g [group] -- specify group to switch to\n" "\t-u [user] -- specify user to switch to\n" "\t-g [group] -- specify group to switch to\n"
#endif #endif
"\t-help -- this message\n" "\t-version -- print the version and exit\n" "\t-help -- this message\n" "\t-version -- print the version and exit\n"
...@@ -461,6 +463,11 @@ int main(int argc, char *argv[]) ...@@ -461,6 +463,11 @@ int main(int argc, char *argv[])
known_opt++; known_opt++;
} }
if (local_argv[x] && !strcmp(local_argv[x], "-bf")) {
bf++;
known_opt++;
}
if (local_argv[x] && !strcmp(local_argv[x], "-version")) { if (local_argv[x] && !strcmp(local_argv[x], "-version")) {
fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL); fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL);
return 0; return 0;
...@@ -523,8 +530,14 @@ int main(int argc, char *argv[]) ...@@ -523,8 +530,14 @@ int main(int argc, char *argv[])
} }
if (local_argv[x] && !strcmp(local_argv[x], "-nc")) { if (local_argv[x] && !strcmp(local_argv[x], "-nc")) {
if (!nf) {
nc++; nc++;
known_opt++; known_opt++;
} else {
/* The flags -nc and -nf are mutually exclusive. Ignoring -nc. */
nc = 0;
known_opt++;
}
} }
if (local_argv[x] && !strcmp(local_argv[x], "-c")) { if (local_argv[x] && !strcmp(local_argv[x], "-c")) {
...@@ -685,7 +698,7 @@ int main(int argc, char *argv[]) ...@@ -685,7 +698,7 @@ int main(int argc, char *argv[])
#ifdef WIN32 #ifdef WIN32
FreeConsole(); FreeConsole();
#else #else
if (!nf) { if (!nf && !bf) {
daemonize(); daemonize();
} }
#endif #endif
...@@ -800,6 +813,10 @@ int main(int argc, char *argv[]) ...@@ -800,6 +813,10 @@ int main(int argc, char *argv[])
return 255; return 255;
} }
if(bf) {
daemonize();
}
switch_core_runtime_loop(nc); switch_core_runtime_loop(nc);
destroy_status = switch_core_destroy(); destroy_status = switch_core_destroy();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论