man.bsd.lv manual page server

Manual Page Search Parameters

NSDISPATCH(3) Library Functions Manual NSDISPATCH(3)

nsdispatchname-service switch dispatcher routine

library “libc”

#include <sys/types.h>
#include <stdarg.h>
#include <nsswitch.h>

int
nsdispatch(void *retval, const ns_dtab dtab[], const char *database, const char *method_name, const ns_src defaults[], ...);

The () function invokes the methods specified in dtab in the order given by nsswitch.conf(5) for the database database until a successful entry is found.

retval is passed to each method to modify as necessary, to pass back results to the caller of ().

Each method has the function signature described by the typedef:

typedef int (*nss_method)(void *retval, void *mdata, va_list *ap);

While there is support for arbitrary sources, the following #defines for commonly implemented sources are available:

value
"files"
"dns"
"nis"
"compat"

Refer to nsswitch.conf(5) for a complete description of what each source type is.

The nss_method functions must return one of the following values depending upon status of the lookup:

Status code
success
notfound
unavail
tryagain
-none-

Refer to nsswitch.conf(5) for a complete description of each status code.

The () function returns the value of the method that caused the dispatcher to terminate, or NS_NOTFOUND otherwise.

DragonFly's library “libc” provides stubs for compatibility with NSS modules written for the GNU C Library nsswitch interface. However, these stubs only support the use of the “passwd” and “group” databases.

hesiod(3), stdarg(3), nsswitch.conf(5), yp(8)

The nsdispatch() function first appeared in DragonFly 2.1. It was imported from the FreeBSD Project, where it appeared first in FreeBSD 5.0.

Luke Mewburn <lukem@netbsd.org> wrote this freely-distributable name-service switch implementation, using ideas from the ULTRIX svc.conf(5) and Solaris nsswitch.conf(4) manual pages. The FreeBSD Project added the support for threads and NSS modules, and normalized the uses of nsdispatch() within the standard C library.

January 22, 2007 DragonFly-5.6.1