Read the /etc/hostid file directly.

Deprecate the /usr/bin/hostid call by reading the /etc/hostid file
directly. Add the spl_hostid_path parameter to override the default
/etc/hostid path.

Rename the set_hostid() function to hostid_exec() to better reflect
actual behavior and complement the new hostid_read() function.

Use HW_INVALID_HOSTID as the spl_hostid sentinel value because
zero seems to be a valid gethostid() result on Linux.
This commit is contained in:
Darik Horn
2011-06-20 14:53:56 -05:00
committed by Brian Behlendorf
parent bf0c60c060
commit 0d54dcb566
2 changed files with 109 additions and 5 deletions
+4
View File
@@ -30,4 +30,8 @@
/* to hold a decimal or hex */
/* hostid string */
/* Supplemental definitions for Linux. */
#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */
#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */
#endif /* SPL_SYSTEMINFO_H */