res_getservers()--Get Name Server Addresses
Syntax
#include <resolv.h>
int res_getservers(state* res,
union res_sockaddr_union *addresses,
int num_addresses)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The res_getservers() function gets the list of name server addresses
that will be used on resolver or network APIs that use the state
structure.
Parameters
- res
- (Input) The pointer to the state structure.
- addresses
- (Input/Output) A pointer to storage for the list of name server addresses to return.
The structure of each address entry is:
union res_sockaddr_union {
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
int64_t __align64; /* 64bit alignment */
char __space[128]; /* max size */
};
- num_addresses
- (Input) The number of addresses to return in the list.
The maximum number of addresses is MAXNS.
Authorities:
No authorization is required.
Return Value
- -1 (unsuccessful)
- n (successful, where n is the number
of addresses returned in the name server address list
Error Conditions
When the res_getservers() function returns an error,
errno will be set to one of the following:
- [EFAULT]
The system detected a pointer that was invalid
while attempting to access an input pointer.
- [EINVAL]
res appears to have been
previously initialized but the reserved field is not set to zeros.
Usage Notes
- If num_addresses is not large enough to contain the entire list,
it will be truncated without error.
Related Information
API introduced: V6R1
[ Back to top | UNIX-Type APIs | APIs by category ]