getdomainname -- get NIS domain name (DEPRECATED).


#include <unistd.h>

int getdomainname (char * name , size_t namelen );


If the Network Information System (NIS) is in use, getdomainname() shall copy the NIS domain name to the supplied buffer identified by name, with maximum length namelen. If the NIS domain name is not currently set, getdomainname() shall copy the string "(none)" to the name. If namelen is less than the length of the string to be copied, getdomainname() shall either truncate the string to namelen characters and place it in name (without a terminating null character), or shall fail with EINVAL.

Note: The NIS domain name is not the same as the domain portion of a fully qualified domain name (for example, in DNS).

The LSB does not include other NIS functions, nor does it specify how NIS may affect other database functions. No conforming application can make use of this information beyond noting whether or not the domain name has been set. If the name is set to a value other than the string "(none)", the application should not imply that NIS is in use. Similarly, if it is set to "(none)", the application should not assume that NIS is not in use, although NIS functionality may be restricted in this case.

Return Value

On success, getdomainname() shall return 0. Otherwise, it shall return -1 and set errno to indicate the error.



name is a null pointer.


The buffer identified by name and namelen is of insufficient size to store the NIS domain name string, and the implementation considers this an error.

Future Directions

The LSB does not include other NIS interfaces, and a future version of this specification may remove this interface. Application developers should avoid using this interface where possible.