From: Jean L. <bu...@gn...> - 2017-03-31 16:24:37
|
On Fri, Mar 31, 2017 at 09:44:29AM -0400, Sam Steingold wrote: > > I don't know why and how is this happening as (hostid) is sometimes > > not evaluating, > > what does "not evaluating" mean? > > > and sometimes it gives 0 > > > > [1]> (hostid) > > 0 > > > > I don't know why. It was giving me a long number, and suddenly > > no. Does it check for Internet connection? > > CLISP returns whatever gethostid() returns. > > Please review > http://opengroup.org/onlinepubs/9699919799/functions/gethostid.html > > RETURN VALUE > Upon successful completion, gethostid() shall return an identifier for > the current host. > > APPLICATION USAGE > This volume of POSIX.1-2008 does not define the domain in which the > return value is unique. > > > IOW: returning 0 is always legit. > It just means that the value is unique across the domain of 1 host. > > The common practice is to return the (somewhat mangled) IP address (see > the comments around > https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/syscalls/calls.c#l1907). > > E.g., I am connected to the internet (LAN, WAN &c), but I still get 0 > from gethostid on MacOSX. Now I know. Thank you. It was giving me always 18446744073463937428 and then suddenly 0, so it is not static, like I was thinking. I was using it, by thinking it will be unique on each machine, so that program does different action depending on which machine it is located. So I am leave that one, and simply using directory and file recognition on different machines. Jean |