* 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 */
| 387 | * \see main_loop |
| 388 | */ |
| 389 | int 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 | } |
nothing calls this directly
no test coverage detected