Unix to Windows Porting Dictionary for HPC

RSS

Links

Function List

gethostid


Unix

header file: unistd.h

long gethostid(void);

Windows

header file: N/A

Purpose

This function returns the current host's identifier, a 32 bit number uniquely identifying the machine.

Discussion

This function is designed to return a value that was intended to be unique among all Unix systems in existence; of course, the proliferation of computers means that a 32 bit number is too small to serve this function. Additionally, the Open Group does not define the specific domain for the return value. The curent man page of the BSD implementation for this function states, "This function has been deprecated. The hostid should be set or retrieved by use of sysctl(3)." Windows does not have a direct analog to this function; we suggest that if gethostid() is used in your code, the best solution is to revisit the reasoning behind the call, and investigate if there is a better solution for your application. Depending on needs, obtaining the MAC address of network hardware, the IP address of the machine, or other identifier may be appropiate.

blog comments powered by Disqus
Valid HTML 4.01 Transitional Valid CSS!