sethostname

Name

sethostname -- set host name

Synopsis

#include <unistd.h>

int sethostname(const char *name, size_t len);

Description

sethostname changes the host name of the current processor.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EINVAL

len is negative or larger than the maximum allowed size.

EPERM

the caller was not the superuser.

EFAULT

name is an invalid address.

Notes

The Single UNIX Specification, Version 2 guarantees that:

Host names are limited to 255 bytes.