ns_lookup(3C)
ns_lookup, ns_list - lookup interface to name service daemon
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME ns_lookup, ns_list - lookup interface to name service daemon SYNOPSIS #include <ns_api.h> int ns_lookup(ns_map_t *map, char *domain, char *table, const char *key, char *library, char *buf, size_t len); FILE *ns_list(ns_map_t *map, char *domain, char *table, char *library); extern int _getXbyY_no_stat; DESCRIPTION ns_lookup and ns_list are part of the public interface to the UNS name service daemon, nsd(1M). Ordinarily they are called through name service library routines such as getpwnam(3C) and gethostbyname(3N). When ns_lookup is called with a particular domain, table and key, it first will mmap in a global shared cache database corresponding to the table name and attempt to look up the key. The mdbm database cache information is stored in the passed map structure. If the lookup fails then the routine will open a file associated with the key, table and domain, and parse the data, in a similar way to flat configuration files. The file opened is generated on the fly by the cache miss daemon nsd(1M). The daemon will determein the resolve order for the request then call routines in shared libraries for each of the protocols supported to answer the request. Once the data is found it is stored in the global shared cache database and a file is generated in memory using the format of the flat text file. The value, if found is returned in buf. Request result types can be found in ns_api.h. The map structure contains state for the cache file. The structure is defined as: typedef struct { time_t m_version; int m_flags; MDBM *m_map; int m_stayopen; } ns_map_t; The m_version field contains a timestamp; any cache record older than this will be ignored. The m_flags field contains state for ns_lookup and should be set to zero on first call. The m_map field contains a pointer to the map file state and should be null on first call. The m_stayopen field is unused by ns_lookup. ns_list will return a file handle to an NFS mounted file containing a list of all entries for a given domain and table. Each of the name service API routines call stat(2) on the local files and ignore anything in the cache older than these files. Since the stat call is quite expensive this may be skipped by setting the global integer _getXbyY_no_stat to a non-zero value. FILES /usr/include/ns_api.h SEE ALSO nsd(1M), networks(4) DIAGNOSTICS The ns_lookup routine returns an integer result code which is one of: NS_SUCCESS, NS_NOTFOUND, NS_UNAVAIL, NS_TRYAGAIN, NS_BADREQ and NS_FATAL. The ns_list routine will return a FILE pointer which is null on failure with errno set.