sethostname(2)
NAME
sethostname − set name of host cpu
SYNOPSIS
#include <unistd.h>
int sethostname(const char *name, size_t namelen);
DESCRIPTION
sethostname() sets the name of the host processor to name, which has a length of namelen characters. sethostname() is normally executed by hostname (see hostname(1)) in the /etc/rc script at system boot time. Host names are limited to MAXHOSTNAMELEN characters, as defined in <sys/param.h>.
RETURN VALUE
Upon successful completion, sethostname() returns 0; otherwise it returns −1 and sets errno to indicate the error.
ERRORS
sethostname() fails if any of the following conditions are encountered:
[EPERM] It is not executed by a user having appropriate privileges.
[EFAULT] name points to an illegal address. The reliable detection of this error is implementation dependent.
AUTHOR
sethostname() was developed by the University of California, Berkeley.
SEE ALSO
hostname(1), uname(1), gethostname(2), uname(2), privilege(5).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992