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

Function mod_init

modules/cfgutils/cfgutils.c:622–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622static int mod_init(void)
623{
624 if (init_shvars() != 0) {
625 LM_ERR("failed to initialize shared vars\n");
626 return -1;
627 }
628
629 if (!hash_file) {
630 LM_INFO("no hash_file given, disable hash functionality\n");
631 } else {
632 if (MD5File(config_hash, hash_file) != 0) {
633 LM_ERR("could not hash the config file\n");
634 return -1;
635 }
636 LM_DBG("config file hash is %.*s", MD5_LEN, config_hash);
637 }
638
639 if (initial > 100) {
640 LM_ERR("invalid probability <%d>\n", initial);
641 return -1;
642 }
643 LM_DBG("initial probability %d percent\n", initial);
644
645 probability=(int *) shm_malloc(sizeof(int));
646
647 if (!probability) {
648 LM_ERR("no shmem available\n");
649 return -1;
650 }
651 *probability = initial;
652
653 if (lock_pool_size < 1) {
654 LM_ERR("Invalid lock size parameter (%d)!\n", lock_pool_size);
655 return -1;
656 }
657
658 if (create_dynamic_locks() != 0) {
659 LM_ERR("Failed to create dynamic locks\n");
660 return -1;
661 }
662
663 LM_INFO("module initialized, pid [%d]\n", getpid());
664
665 return 0;
666}
667
668
669static void mod_destroy(void)

Callers

nothing calls this directly

Calls 4

init_shvarsFunction · 0.85
MD5FileFunction · 0.85
shm_mallocFunction · 0.85
create_dynamic_locksFunction · 0.85

Tested by

no test coverage detected