Re: How is this? (hostid) => 0

Jean Louis <[email protected]> Fri, 31 Mar 2017 19:20:55 +0300
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list