#include <sys/types.h>
#include <sys/socket.h>
int gethostid()
Service Program Name: QSOSRV1
Default Public Authority: *USE
nbsp;Threadsafe: Yes
The gethostid() function is used to retrieve a host's ID.
Authorities
No authorization is required.
Return Value
gethostid() returns an integer. Possible values are:
0 when a sethostid() has not been issued previously since the last
initial program load (IPL)
n (successful), where n is the number specified on a previously issued
sethostid() call
Usage Notes
When a process issues a sethostid(), the host_id can be
accessed by any process that issues a gethostid()
The host_id is reset to zero when an initial program load is
performed.
The host_id is a signed integer. Therefore, a -1 return value from
the gethostid() may not indicate an error, but rather that a previous
sethostid() was issued that specified a host_id of -1.
While many socket implementations refer to the host_id as the IP
address of the machine, this is not necessarily the case. Many machines that
support the TCP/IP protocol suite support multiple local IP addresses. The
value contained in host_id is not used by TCP in any
manner.