MCPcopy Create free account
hub / github.com/apache/httpd / ap_add_module

Function ap_add_module

server/config.c:558–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556/* One-time setup for precompiled modules --- NOT to be done on restart */
557
558AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p,
559 const char *sym_name)
560{
561 ap_module_symbol_t *sym = ap_prelinked_module_symbols;
562
563 /* This could be called from a LoadModule httpd.conf command,
564 * after the file has been linked and the module structure within it
565 * teased out...
566 */
567
568 if (m->version != MODULE_MAGIC_NUMBER_MAJOR) {
569 return apr_psprintf(p, "Module \"%s\" is not compatible with this "
570 "version of Apache (found %d, need %d). Please "
571 "contact the vendor for the correct version.",
572 m->name, m->version, MODULE_MAGIC_NUMBER_MAJOR);
573 }
574
575 if (m->module_index == -1) {
576 if (dynamic_modules >= DYNAMIC_MODULE_LIMIT) {
577 return apr_psprintf(p, "Module \"%s\" could not be loaded, "
578 "because the dynamic module limit was "
579 "reached. Please increase "
580 "DYNAMIC_MODULE_LIMIT and recompile.", m->name);
581 }
582 /*
583 * If this fails some module forgot to call ap_reserve_module_slots*.
584 */
585 ap_assert(total_modules < conf_vector_length);
586
587 m->module_index = total_modules++;
588 dynamic_modules++;
589
590 }
591 else if (!sym_name) {
592 while (sym->modp != NULL) {
593 if (sym->modp == m) {
594 sym_name = sym->name;
595 break;
596 }
597 sym++;
598 }
599 }
600
601 if (m->next == NULL) {
602 m->next = ap_top_module;
603 ap_top_module = m;
604 }
605
606 if (sym_name) {
607 int len = strlen(sym_name);
608 int slen = strlen("_module");
609 if (len > slen && !strcmp(sym_name + len - slen, "_module")) {
610 len -= slen;
611 }
612
613 ap_module_short_names[m->module_index] = ap_malloc(len + 1);
614 memcpy(ap_module_short_names[m->module_index], sym_name, len);
615 ap_module_short_names[m->module_index][len] = '\0';

Callers 2

ap_add_loaded_moduleFunction · 0.85

Calls 4

ap_mallocFunction · 0.85
ap_strrchr_cFunction · 0.85
ap_add_module_commandsFunction · 0.85
ap_register_hooksFunction · 0.85

Tested by

no test coverage detected