Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

gethostname(2) OSS System Calls Reference Manual
NAME
gethostname - Gets the name of the local host
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll
SYNOPSIS
#include <netdb.h>
int gethostname(
char *address,
int address_len);
PARAMETERS
address Returns the address of an array of bytes where the hostname is stored. If
sufficient space is provided, the returned address parameter is NULL terminated.
address_len Specifies the length of the array pointed to by the address parameter.
DESCRIPTION
The gethostname() function retrieves the standard hostname of the local host. The name
returned corresponds to the hostname 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 these conditions occur, 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).
374 Hewlett-Packard Company 527186-023