gethostid, sethostid
Purpose
Gets or sets the unique identifier of the current host.
Library
Sockets Library (libsock.a)
Syntax
int gethostid ( ) int sethostid (hostid)
int hostid;
Description
The gethostid subroutine returns the 32-bit identifier
for the current host, as set by sethostid.
The sethostid subroutine establishes a 32-bit identifier
for the current host that is intended to be unique.
Often, this is a DARPA Internet address for the local
machine.
This subroutine can only be used by processes with an
effective user ID of superuser. In the AIX Operating
System, the host ID is usually set by the netconfig
portion of the Interface Program for use with TCP/IP,
using the /etc/net configuration file.
Return Value
Upon successful completion, the gethostid subroutine
returns the identifier for the current host, and the
sethostid subroutine returns a value of 0. If the
gethostid or sethostid subroutine fails, a value of -1 is
returned, and errno is set to indicate the error.
Diagnostics
The gethostid or sethostid subroutine fails if the fol-
lowing is true:
EINVAL There are no IP interfaces available.
IBM RT PC Interface Program for use
with TCP/IP is not installed on this
system.
The sethostid subroutine also fails if the following is
true:
EPERM The calling process did not have an
effective user ID of superuser.
Related Information
In this book: "getsockname."
The hostname command in Interface Program for use with
TCP/IP.