getdomainname, setdomainname - get/set NIS domain name
#include <unistd.h>
int getdomainname(char *name, size_t len);
int setdomainname(const char *name, size_t len);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
These functions are used to access or to change the NIS domain name of the host system. More precisely, they operate on the NIS domain name associated with the calling process's UTS namespace.
setdomainname() sets the domain name to the value
given in the character array name
. The len
argument
specifies the number of bytes in name
. (Thus, name
does not require a terminating null byte.)
getdomainname() returns the null-terminated domain
name in the character array name
, which has a length of
len
bytes. If the null-terminated domain name requires more
than len
bytes, getdomainname() returns the
first len
bytes (glibc) or gives an error (libc).
On success, zero is returned. On error, -1 is returned, and
errno
is set to indicate the error.
gethostname(2), sethostname(2), uname(2), uts_namespaces(7)