Subject: Re: Use of sun_len in AF_UNIX socket addresses
To: None <tech-net@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: tech-net
Date: 10/11/2006 22:13:47
Antti Kantee wrote:
> On Wed Oct 11 2006 at 20:01:37 +0200, Christian Biere wrote:
> > With respect to userland I for one would prefer if sun_len disappeared. Many
> > other systems e.g., IRIX, Solaris don't have it and a lot software (maybe most)
> > ignores it.
 
> You can't get rid of it since the kernel uses the same memory layout for
> the structure.  Of course you could play games, but that's not really
> a thing I want to see just to hide the field.  You can't set it wrong,
> so does it really matter?

A simple way to get rid of it would be renaming "sun_len".

The primary issue is the missing documentation. Something like "The structure member
'sun_len' is historic and should be ignored. Neither 'sun_len' nor SUN_LEN() are
part of POSIX." would be useful. Likewise, the malloc() "trick" to extend the path
and the pathname length limit should be mentioned.

Off-topic: It would be great to have SO_REUSEADDR for AF_UNIX/AF_LOCAL, so that dead
sockets don't have be unlink()ed which is always subject to a race-condition. Even
if that were a NetBSD extension for now, I'm sure other's would pick it up fairly
soon.

-- 
Christian