If NIS is in use, set the NIS domain name. Note that this is not the same as the domain name which provides the domain portion of a fully qualified domain name (for example, in DNS). If NIS is not in use, this function may set the domain name anyway, or it may fail.
This call shall fail unless the caller has appropriate privileges.
namelen shall be the length of the string pointed to by name.
setdomainname returns 0 if successful; -1 if not (in which case errno is set to indicate the error).