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

Thibault Langlois tl at di.fc.ul.pt
Mon Jun 25 22:49:16 UTC 2007


On 6/25/07, Erik Huelsmann <ehuels at gmail.com> wrote:
> 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.
>
>

Thanks for telling me about usocket.
The whole story is that I wanted to make cl-smtp work with ECL. The
CVS version of cl-smtp does not have code for ECL. I thought that it
would be easy to make it work since ECL has a socket package similar
to SBCL's. cl-smtp has implementation-specific code in files named
after each implementation. I started to copy sbcl.lisp to ecl.lisp and
then I noticed the use of (sb-unix:unix-gethostname). This is why I
sent my message in the  first place.
Now I saw in the change log that you recently made changes to usocket
with respect to cl-smtp:  "Add cl-smtp 'requirement': get-host-name
(ECL backend)."
So this is good news for me ! I guess I only have to tell cl-smtp to
use usocket isn't it ? How can I do that ?

Thibault

PS: I am not with my development machine right now so I did not tried
to use usocket yet.





-- 
Thibault Langlois
FCUL / DI




More information about the ecl-devel mailing list