MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / main

Function main

main.c:389–898  ·  view source on GitHub ↗

* Main routine, start of the program execution. * \param argc the number of arguments * \param argv pointer to the arguments array * \return don't return on sucess, -1 on error * \see main_loop */

Source from the content-addressed store, hash-verified

387 * \see main_loop
388 */
389int main(int argc, char** argv)
390{
391 int c, n;
392 char *tmp;
393 int tmp_len;
394 int port;
395 int proto;
396 int protos_no;
397 char *options;
398 int ret;
399 unsigned int seed;
400 int rfd;
401 int procs_no;
402
403 /*init*/
404 ret=-1;
405 my_argc=argc; my_argv=argv;
406
407 /* process pkg mem size from command line */
408 opterr=0;
409
410 options="A:f:cCm:M:b:l:n:N:irRvdDFVhw:t:u:g:p:P:G:W:o:a:k:s:"
411#ifdef UNIT_TESTS
412 "T:"
413#endif
414 ;
415
416 while((c=getopt(argc,argv,options))!=-1){
417 switch(c){
418 case 'M':
419 pkg_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024;
420 if (tmp &&(*tmp)){
421 LM_ERR("bad pkgmem size number: -m %s\n", optarg);
422 goto error00;
423 }
424 break;
425 case 'm':
426 shm_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024;
427 if (tmp &&(*tmp)){
428 LM_ERR("bad shmem size number: -m %s\n", optarg);
429 goto error00;
430 }
431 break;
432 case 'd':
433 *log_level = debug_mode ? L_DBG : (*log_level)+1;
434 break;
435 case 'u':
436 user=optarg;
437 break;
438 case 'g':
439 group=optarg;
440 break;
441 case 'a':
442 if (set_global_mm(optarg) < 0) {
443 LM_ERR("current build does not support "
444 "this allocator (-a %s)\n", optarg);
445 goto error00;
446 }

Callers

nothing calls this directly

Calls 15

set_global_mmFunction · 0.85
set_pkg_mmFunction · 0.85
set_shm_mmFunction · 0.85
set_rpm_mmFunction · 0.85
user2uidFunction · 0.85
group2gidFunction · 0.85
init_pkg_mallocsFunction · 0.85
new_sroutes_holderFunction · 0.85
parse_phostportFunction · 0.85
add_cmd_listening_socketFunction · 0.85
get_poll_typeFunction · 0.85
print_ct_constantsFunction · 0.85

Tested by

no test coverage detected