GETHOSTID(2) — UNIX Programmer’s Manual
NAME
gethostid − get unique identifier of current host
SYNOPSIS
hostid = gethostid()
long hostid;
DESCRIPTION
Gethostid returns a 32-bit identifier for the current processor. The value is obtained from the lowest 32 bits of the 48-bit Ethernet network hardware address, for the first Ethernet interface found attached to the system. If no Ethernet hardware is fitted to the machine, the call will return 0.
SEE ALSO
NOTES
The 48-bit address is globally unique across all Ethernet hardware interfaces (of any registered make, on any host), but since the top 16 bits are lost, the result is not guaranteed to be unique across all possible host processors. However for Acorn-supplied Ethernet hardware interfaces, the identifier will be unique in the lowest 24 (and hence the lowest 32) bits.
Older systems use the 32-bit DARPA Internet Protocol (logical) network address of the host as the identifier. This may conflict with a 32-bit hardware-derived address, since there is no particular relation between the logical and hardware addresses for a given Ethernet interface.
The old related call sethostid(2) is no longer supported.
4.2 Berkeley Distribution — Revision 1.3 of 14/11/90