gethostid(3) Library Functions Manual gethostid(3) gethostid, sethostid - LIBRARY Standard C library (libc, -lc) #include long gethostid(void); int sethostid(long hostid); glibc (. feature_test_macros(7)): gethostid(): Since glibc 2.20: _DEFAULT_SOURCE || _XOPEN_SOURCE >= 500 Up to and including glibc 2.19: _BSD_SOURCE || _XOPEN_SOURCE >= 500 sethostid(): glibc 2.21: _DEFAULT_SOURCE glibc 2.19 2.20: _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) glibc 2.19, : _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) gethostid() and sethostid() respectively get or set a unique 32-bit identifier for the current machine. The 32-bit identifier was intended to be unique among all UNIX systems in existence. This normally resembles the Internet address for the local machine, as returned by gethostbyname(3), and thus usually never needs to be set. sethostid(). gethostid() 32- , sethostid(). sethostid() 0; -- -1, errno . sethostid() : EACCES , ID . EPERM . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |gethostid() | | MT-Safe hostid env | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ |sethostid() | | MT-Unsafe const:hostid | +----------------------------+----------------------------------------------------------+--------------------------+ In the glibc implementation, the hostid is stored in the file /etc/hostid. (Before glibc 2.2, the file /var/adm/hostid was used.) glibc, gethostid() , ID , gethostname(2), gethostbyname_r(3) IPv4 , , IPv4 ( ). gethostid() POSIX.1-2008. sethostid() None. 4.2BSD; dropped in 4.4BSD. SVr4 and POSIX.1-2001 include gethostid() but not sethostid(). , . . hostid(1), gethostbyname(3) Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . gethostid(3)