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

Sam Steingold <[email protected]> Fri, 31 Mar 2017 09:44:29 -0400
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
> * Jean Louis <[email protected]> [2017-03-31 00:43:03 +0300]:
>
> 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.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://mideasttruth.com
http://jij.org http://no2bds.org http://iris.org.il
Ph.D. stands for "Phony Doctor"  - Isaak Asimov, Ph.D.

------------------------------------------------------------------------------
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