[Ecls-list] sockets.lisp FIXME hostent comment

Matthew Mondor mm_lists at pulsar-zone.net
Tue Jul 28 07:51:48 UTC 2009


Hello,

I've noticed a FIXME comment in the contrib/sockets/sockets.lisp code
asking if the hostent structure should be freed.

I just wanted to confirm that gethostbyname(2)/gethostbyaddr(2) return
a pointer to static storage, which means they indeed don't need to be
freed, but it also means that they're not thread-safe.  The
getnameinfo(2)/getaddrinfo(2) interface deprecates the older interface
and uses supplied pointers instead of returning them (and more easily
supports more address families transparently).

The comment can therefore safely be removed.  About the thread safety
issue, it'd be possible for thread-enabled builds to wrap the call
around a mutex and copy the returned data, but this might keep the
mutex locked for an arbitrary length of time...

Thanks,
-- 
Matt




More information about the ecl-devel mailing list