Subject: Re: getaddrinfo() and PF_LOCAL
To: Assar Westerlund <>
From: Stig Venaas <>
List: tech-net
Date: 08/01/2001 15:07:23
On Wed, Aug 01, 2001 at 02:57:27PM +0200, Assar Westerlund wrote:
> Stig Venaas <> writes:
> > My conclusion then, is that PF_UNSPEC isn't of much value, so maybe
> > we should limit it to the PF_LOCAL case as you say. We could perhaps
> > also do it if servname starts with a /, but the former is fine.
> I think handling ai_family == PF_LOCAL is good.

Yes, so maybe just this could be enabled now? No side effects on
existing applications.

> > Also if servname is NULL one could perhaps use tempnam().
> I think glibc used to do that, which I fail to see the point of.  What
> would a nodename mean for a PF_LOCAL address?  I can see nodename =
> NULL, servname = foobar -> "/tmp/foobar".  But nodename = "something",
> serername = NULL and nodename = servname = NULL seem rather undefined
> to me.

If nodename is NULL or points to the local host (current hostname,
localhost,, etc.) I think it's okay, else we don't care about
PF_LOCAL. I think servname NULL -> tempnam could be useful, but it's
just as well that the application calls tempnam() before calling
getaddrinfo() I suppose.

Personally if I were to use domain sockets, I think I would have a
directory only for the applications socket, and then call getaddrinfo()
with the absolute path, ai_family == PF_LOCAL and nodename == NULL.