On 07/22/2012 04:44 AM, ? wrote:
> HI, guy,
> 
> Can you tell me how the "hostid" command work? or how can I control my 
> "hostid"?
> 
> Why my output from "hostid " switch around "0a799228", "0a799a28", "0a799328" 
> randomly?
> 
> Here are lists of my "hostid" information, if any other information needed, 
> please just mail me directly.
> 
> Hope to get you reply soon, thanks.
> 
> [lin@centos ~]$ hostid
> 0a799228
> [lin@centos ~]$ hostid
> 0a799a28
> [lin@centos ~]$ hostid
> 0a799328
> [lin@centos ~]$ rpm -q coreutils
> coreutils-8.4-19.el6.i686
> [lin@centos ~]$ rpm -q centos-release
> centos-release-6-3.el6.centos.9.i686
> [lin@centos ~]$ which hostid
> /usr/bin/hostid
> [lin@centos ~]$ ldd /usr/bin/hostid 
>     linux-gate.so.1 =>  (0x00dc0000)
>     libc.so.6 => /lib/libc.so.6 (0x00902000)
>     /lib/ld-linux.so.2 (0x008dc000)
> [lin@centos ~]$

hostid(1) is a thin wrapper around gethostid(3).
>From that man page we have:

In  the  glibc implementation, if gethostid() cannot open the file con?\
taining the host ID [/etc/hostid], then it obtains the hostname using 
gethostname(2),
passes  that  hostname  to  gethostbyname_r(3)  in  order to obtain the
host's IPv4 address, and returns a value obtained by bit-twiddling  the
IPv4 address.  (This value may not be unique.)

So I installed the following to reference that man page.

thanks,
P??draig.

commit f93d5985a2bc468f9f92f3bb8dedb0d3bf0807d8
Author: P??draig Brady <[email protected]>
Date:   Sun Jul 22 12:59:49 2012 +0100

    doc: mention gethostid(3) in hostid(1)

    * man/hostid.x: Add gethostid(3) to SEE ALSO section.
    Addresses http://bugs.gnu.org/12023

diff --git a/man/hostid.x b/man/hostid.x
index 1bba0a6..767a3e2 100644
--- a/man/hostid.x
+++ b/man/hostid.x
@@ -2,3 +2,5 @@
 hostid \- print the numeric identifier for the current host
 [DESCRIPTION]
 .\" Add any additional description here
+[SEE ALSO]
+gethostid(3)




Reply via email to