GETHOSTNAME(2)
NAME
gethostname, sethostname − get/set name of current host
USAGE
gethostname(name, namelen) char *name; int namelen;
sethostname(name, namelen) char *name; int namelen;
DESCRIPTION
Gethostname returns the standard host name for the current processor, as previously set by sethostname. The parameter namelen specifies the size of the name array. The returned name is null-terminated, unless insufficient space is provided in namelen.
Sethostname sets the name of the host machine to be name, which has length namelen. Use of sethostname is restricted to the super-user. It is typically used only when the system is booted.
NOTES
On some systems, host names are limited to 255 characters. DOMAIN/IX has no such limitation.
RETURN VALUE
A successful call returns zero. A failed call returns -1 and sets errno as indicated below.
ERRORS
These calls may return one or more of the following errors:
[EFAULT] The name or namelen parameter gave an invalid address.
[EPERM] The caller was not the super-user.