Lines Matching refs:mod
484 ns_mod mod; in nss_load_module() local
487 memset(&mod, 0, sizeof(mod)); in nss_load_module()
488 mod.name = strdup(source); in nss_load_module()
489 if (mod.name == NULL) { in nss_load_module()
497 mod.handle = nss_builtin_handle; in nss_load_module()
512 if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name, in nss_load_module()
515 mod.handle = libc_dlopen(buf, RTLD_LOCAL|RTLD_LAZY); in nss_load_module()
516 if (mod.handle == NULL) { in nss_load_module()
521 nss_log(LOG_DEBUG, "%s, %s", mod.name, dlerror()); in nss_load_module()
525 fn = (nss_module_register_fn)dlfunc(mod.handle, in nss_load_module()
528 (void)dlclose(mod.handle); in nss_load_module()
529 mod.handle = NULL; in nss_load_module()
530 nss_log(LOG_ERR, "%s, %s", mod.name, dlerror()); in nss_load_module()
534 mod.mtab = fn(mod.name, &mod.mtabsize, &mod.unregister); in nss_load_module()
535 if (mod.mtab == NULL || mod.mtabsize == 0) { in nss_load_module()
536 if (mod.handle != nss_builtin_handle) in nss_load_module()
537 (void)dlclose(mod.handle); in nss_load_module()
538 mod.handle = NULL; in nss_load_module()
539 nss_log(LOG_ERR, "%s, registration failed", mod.name); in nss_load_module()
542 if (mod.mtabsize > 1) in nss_load_module()
543 qsort(mod.mtab, mod.mtabsize, sizeof(mod.mtab[0]), in nss_load_module()
546 _nsmod = vector_append(&mod, _nsmod, &_nsmodsize, sizeof(*_nsmod)); in nss_load_module()
553 ns_mod_free(ns_mod *mod) in ns_mod_free() argument
556 free(mod->name); in ns_mod_free()
557 if (mod->handle == NULL) in ns_mod_free()
559 if (mod->unregister != NULL) in ns_mod_free()
560 mod->unregister(mod->mtab, mod->mtabsize); in ns_mod_free()
561 if (mod->handle != nss_builtin_handle && !exiting) in ns_mod_free()
562 (void)dlclose(mod->handle); in ns_mod_free()
592 ns_mod *mod; in nss_method_lookup() local
602 mod = vector_search(&source, _nsmod, _nsmodsize, sizeof(*_nsmod), in nss_method_lookup()
604 if (mod != NULL && mod->handle != NULL) { in nss_method_lookup()
607 match = bsearch(&key, mod->mtab, mod->mtabsize, in nss_method_lookup()
608 sizeof(mod->mtab[0]), mtab_compare); in nss_method_lookup()