Content-type: text/html Man page of sethostname

sethostname

Section: System Calls (2)
Index Return to Main Contents
 

NAME

sethostname - Sets the name of the current host  

SYNOPSIS

int sethostname (        char *name,
       int name_len );
 

PARAMETERS

Points to an array of bytes where the hostname is stored. Specifies the length of the array pointed to by the name parameter.  

DESCRIPTION

The sethostname() function allows a calling process with root user authority to set the internal hostname of a machine on a network.

System hostnames are limited to MAXHOSTNAMELEN as defined in the /usr/include/sys/param.h file.

The sethostid() function fails if the calling process does not have superuser privilege.  

RETURN VALUES

Upon successful completion, the system returns a value of 0 (zero). If the sethostname() function fails, -1 is returned and errno is set to indicate the error.  

ERRORS

If the sethostname() function fails, errno may be set to one of the following values: The name parameter or the name_len parameter gives an address that is not valid. The calling process does not have appropriate privilege.  

RELATED INFORMATION

Functions: gethostid(2), sethostid(2), gethostname(2) delim off


 

Index

NAME
SYNOPSIS
PARAMETERS
DESCRIPTION
RETURN VALUES
ERRORS
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:14 GMT, October 02, 2010