hostid
Prints a hexidecimal number globally unique to your host.
In linux (and AIX and Tru64) based on the IP address of the host. In Solaris based on the MAC address of the host and stored in the PROM. Solaris doesn't guarantee uniqueness. With NAT'ing Linux can't either anymore...
SuSE Linux had it as part of the util-linux rpm. Looking at the HISTORY for that package hostid had been removed in 1997. Hmmm... Check the source, best resort of a linux geek, and yes, it's not there. Grab a Redhat SRC rpm for util-linux. It's not there either, but it does at least have a note that it had been moved to sh-utils. AhHA! Jump to gnu.org... sh-utils has been combined into core-utils, grab the source. Yes! It's there... but wait, hostid is pretty much a syscall to gethostid.
gethostid(2) is in unistd.h, rpm -q tells me it is in glibc, grab the glibc source. And I have it, buried five directories down is the source for gethostid. It uses the IP address of the system but splits it into two pieces and then flips each piece; so 192.168.10.1 gets changed to 168.192.1.10 before having each piece changed to hex. reading the source though, if it can't find the IP address of the system, it generates a random number...
This all came up b/c I tried to set my hexidecimal hostid to 0xDEADBEEF. The AIX freshly allocated pointer value. I also notice that while the Linux version of this command outputs hex, it requires decimal to be input on the command line. The AIX and Tru64 versions allow an ip address to be input, a much more friendly way of doing it, espcially since it uses the IP address anyway.
That was my hostid fun for yesterday.
dzc
PS. I also re-arranged my computer room some.