SETHOSTNAME(2)

NAME
sethostname - sethostname

SYNOPSIS
#include <unistd.h>
int sethostname (const char *name, int len)

DESCRIPTION
sethostname() sets hostname of length len to name. Note that only the super user may sethostname(). 0 is returned on success, a negative value on error.

ERRORS
-EINVAL is returned if len is greater than MAXHOSTNAMELEN which is defined in /usr/include/sys/param.h, and can easily be overridden.

-EPERM is returned if a non-root user attempts to set hostname.

FILES
linux/kernel/sys.c
/usr/include/linux/sys.h
/usr/include/unistd.h

SEE ALSO
uname(2)