Open System Services System Calls Reference Manual (G06.27+, H06.04+)

System Functions (f - i) gethostname(2)
NAME
gethostname - Gets the name of the local host
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <netdb.h>
int gethostname(
char *address,
int address_len);
PARAMETERS
address Returns the address of an array of bytes where the host name is stored. If
sufcient space is provided, the returned address parameter is NULL terminated.
address_len Species the length of the array pointed to by the address parameter.
DESCRIPTION
The gethostname() function retrieves the standard host name of the local host. The name
returned corresponds to the host name returned in the Subsystem Command Facility (SCF) com-
mand INFO PROCESS for the TCP subsystem.
RETURN VALUES
Upon successful completion, the gethostname() function returns a value of 0 (zero). Otherwise,
a value of -1 is returned, and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the gethostname() function sets errno to the
corresponding value:
[EINVAL] The address parameter or address_len parameter refers to an invalid address in
the users address space.
RELATED INFORMATION
Functions: gethostid(2).
527186-004 Hewlett-Packard Company 339