Sortix volatile manual
This manual documents Sortix volatile, a development build that has not been officially released. You can instead view this document in the latest official manual.
| GETDNSCOFIG(2) | System Calls Manual | GETDNSCOFIG(2) | 
NAME
getdnsconfig,
    setdnsconfig — get and set
    the kernel DNS resolver list
SYNOPSIS
#include
    <sys/dnsconfig.h>
#define DNSCONFIG_MAX_SERVERS 3
int
  
  getdnsconfig(struct
    dnsconfig *cfg);
int
  
  getdnsconfig(const
    struct dnsconfig *cfg);
DESCRIPTION
getdnsconfig()
    gets and
    setdnsconfig()
    sets the kernel DNS resolver list.
cfg points to a struct
    dnsconfig structure. The servers array can
    contain up to DNSCONFIG_MAX_SERVERS DNS resolvers.
    The servers_count field marks how many of the entries
    in servers are populated.
struct dnsconfig {
	size_t servers_count;
	struct dnsconfig_server servers[DNSCONFIG_MAX_SERVERS];
}
Each DNS resolver in the servers array is described by a struct dnsconfig_server structure. The resolver can be defined by either an IPv4 or an IPv6 address.
For an IPv4 address family is
    AF_INET, addrsize is
    sizeof(struct
    in_addr), and the address is stored in the in
    field of the addr union.
For an IPv6 address family is
    AF_INET6, addrsize is
    sizeof(struct
    in_addr6), and the address is stored in the in6
    field of the addr union.
union dnsconfig_server_union {
	struct in_addr in;
	struct in6_addr in6;
}
struct dnsconfig_server {
	sa_family_t family;
	size_t addrsize;
	union dnsconfig_server_union addr;
}
RETURN VALUES
On success 0 is returned. On error -1 is returned, and errno is set appropriately.
ERRORS
getdnsconfig() and
    setdnsconfig() will fail if:
- EFAULT
- cfg points to an invalid address.
setdnsconfig() will additionally fail
  if:
- EAFNOSUPPORT
- family is set to an address family other than
      AF_INETorAF_INET6.
- EINVAL
- servers_count is larger than
      DNSCONFIG_MAX_SERVERS.
- EINVAL
- addrsize does not match the size of the address corresponding to family.
SEE ALSO
HISTORY
The getdnsconfig() and
    setdnsconfig() system calls originally appeared in
    Sortix 1.1.
| December 13, 2021 | Sortix 1.1.0-dev | 
