sethostname

Name

sethostname -- set host name

Synopsis

#include <unistd.h>

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

Description

This function is used to change the host name of the current processor.

Return Value

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

Errors

EINVAL

len is negative or len is larger than the maximum allowed size.

EPERM

the caller was not the superuser.

EFAULT

name is an invalid address.

Notes

SUSv2 guarantees that Host names are limited to 255 bytes.