GETDOMAINNAME(2)

NAME
getdomainname, setdomainname - get/set domain name

SYNOPSIS
#include <unistd.h>

int getdomainname(char *name, size_t len);
int setdomainname(const char *name, size_t len);

DESCRIPTION
These functions are used to access or to change the domain name of the current processor.

RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

EINVAL
    For getdomainname, name points to NULL or name is longer than len.

EPERM
    For setdomainname, the caller was not the superuser.

EINVAL
    For setdomainname, len was too long.

CONFORMING TO
POSIX does not specify these calls.

BUGS
getdomainname is not compliant with other implementations, since they always return len bytes, even if name is longer. Linux, however, returns EINVAL in this case (as of DLL 4.4.1 libraries).

NOTES
Under Linux, getdomainname is implemented at the library level by calling uname(2).

SEE ALSO
gethostname(2), sethostname(2), uname(2)