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

Erik Huelsmann ehuels at gmail.com
Tue Jun 26 06:13:01 UTC 2007


On 6/26/07, Thibault Langlois <tl at di.fc.ul.pt> wrote:
> 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 ?

You don't need to, I already provided a patch to the author of
cl-smtp. I'll forward it as soon as I get to work.

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

bye,

Erik.




More information about the ecl-devel mailing list