[Ecls-list] gethostname, machine-instance & friends

Erik Huelsmann ehuels at gmail.com
Mon Jun 25 19:28:39 UTC 2007


On 6/25/07, Thibault Langlois <tl at di.fc.ul.pt> wrote:
> Hello,
>
> I would like to have access to the name of the machine, something like
> SBCL's (sb-unix:unix-gethostname). Is there an equivalent for ECL ?
>
> If there is one, maybe it could be used in the definition of the
> MACHINE-INSTANCE function.
>
> With a freshly build ECL we get:
>  CL-USER> (machine-instance)
> "x86_64"
> CL-USER> (machine-type)
> "X86_64"
> CL-USER> (machine-version)
> "unknown"
>
> A quick and dirty linux-only solution may be:
>
> (defun gethostname ()
>    (with-open-file (f "/proc/sys/kernel/hostname")
>         (read f nil nil))
>
> Any suggestion ?

Use usocket (http://common-lisp.net/project/usocket) and be done with
usocket::get-host-name on all supported implementations (including
ECL).

bye,

Erik.




More information about the ecl-devel mailing list