Don't call dlopen(3) for built-in NSS types - "cache", "compat",
"dns", "files", "db", and "nis". It saves some path lookups during binary startup. Reviewed by: markj Approved by: re (gjb, kib) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17557
This commit is contained in:
parent
118dce4d6b
commit
d03a843143
@ -32,7 +32,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 4, 2010
|
.Dd October 15, 2018
|
||||||
.Dt NSDISPATCH 3
|
.Dt NSDISPATCH 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -112,10 +112,7 @@ which case they are selected using the
|
|||||||
and
|
and
|
||||||
.Fa method_name
|
.Fa method_name
|
||||||
arguments along with the configured source.
|
arguments along with the configured source.
|
||||||
(The methods supplied via
|
Modules must use source names different from the built-in ones.
|
||||||
.Fa dtab
|
|
||||||
take priority over those implemented in NSS modules in the event
|
|
||||||
of a conflict.)
|
|
||||||
.Pp
|
.Pp
|
||||||
.Va defaults
|
.Va defaults
|
||||||
contains a list of default sources to try if
|
contains a list of default sources to try if
|
||||||
|
@ -486,9 +486,19 @@ nss_load_module(const char *source, nss_module_register_fn reg_fn)
|
|||||||
*/
|
*/
|
||||||
mod.handle = nss_builtin_handle;
|
mod.handle = nss_builtin_handle;
|
||||||
fn = reg_fn;
|
fn = reg_fn;
|
||||||
} else if (!is_dynamic())
|
} else if (!is_dynamic()) {
|
||||||
goto fin;
|
goto fin;
|
||||||
else {
|
} else if (strcmp(source, NSSRC_CACHE) == 0 ||
|
||||||
|
strcmp(source, NSSRC_COMPAT) == 0 ||
|
||||||
|
strcmp(source, NSSRC_DB) == 0 ||
|
||||||
|
strcmp(source, NSSRC_DNS) == 0 ||
|
||||||
|
strcmp(source, NSSRC_FILES) == 0 ||
|
||||||
|
strcmp(source, NSSRC_NIS) == 0) {
|
||||||
|
/*
|
||||||
|
* Avoid calling dlopen(3) for built-in modules.
|
||||||
|
*/
|
||||||
|
goto fin;
|
||||||
|
} else {
|
||||||
if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name,
|
if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name,
|
||||||
NSS_MODULE_INTERFACE_VERSION) >= (int)sizeof(buf))
|
NSS_MODULE_INTERFACE_VERSION) >= (int)sizeof(buf))
|
||||||
goto fin;
|
goto fin;
|
||||||
|
Loading…
Reference in New Issue
Block a user