Go to the previous, next section.
int gethostname(char *name, size_t len);
int sethostname(const char *name, size_t
len);
name: (For gethostname) [out] points to a buffer
where to put the host name. (For sethostname) [in] points to the
new host name.
len: [in] the maximum length of name.
gethostname returns the host name of the current host and
sethostname sets it. Only the superuser may call
sethostname.
On success zero is returned. On error, -1 is returned and errno
is set to one of the following values:
In the case of gethostname: EINVAL: name
is NULL or the host name is longer than len.
In the case of sethostname:
EPERM: the caller is not superuser.
EINVAL: len is too long.