Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostname(2) — SunOS 0.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gethostid(2)

GETHOSTNAME(2)  —  System Interface Manual — System Calls

NAME

gethostname, sethostname − get/set name of current host

SYNOPSIS

gethostname(name, namelen)
char ∗name;
int ∗namelen;

sethostname(name, namelen)
char ∗name;
int namelen;

DESCRIPTION

Gethostname returns the standard host name for the current processor, as previously set by sethostname. The parameter namelen specifies the size of the name array.  The name is null-terminated. 

Sethostname sets the name of the host machine to be name, which has length namelen. This is normally executed when the system is bootstrapped.

RETURN VALUE

If the call succeeds a value of 0 is returned.  If the call fails, then a value of −1 is returned and an error code is placed int the global location errno. 

ERRORS

The following errors may be returned by these calls:

[EFAULT] The name parameter gave an invalid address. 

SEE ALSO

gethostid(2)

BUGS

Host names are limited to 255 characters. 

Sun System Release 0.3  —  25 April 1983

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026