[erlang-questions] unix domain sockets with abstract namespace: can't use all 108 bytes

Raimo Niskanen raimo+erlang-questions@REDACTED
Tue Apr 25 16:14:04 CEST 2017


On Mon, Apr 24, 2017 at 11:09:34AM -0700, Kenneth Lakin wrote:
> On 04/24/2017 03:01 AM, Raimo Niskanen wrote:
> > So far no-one have had any good suggestion on how to handle this
> > in a platform independent way, nor any suggestion on how to detect
> > this misfeature with configure.
> 
> This _appears_ to be a useful feature that seems to make domain sockets
> work more like IP sockets. [0] Why do you consider it a misfeature?

Well, it is just because on all other Unix-like OS:es the address is
(loosly/de-facto) defined to be zero terminated, and there are macros to
calculate the address structure size that use strlen on the string.

Therefore the Linux way to use the address type contradicts the BSD:s and I
guess Solaris.  Nobody has so far found a way to figure out how to use
configure to detect if a size larger than the string length is OK or might
crash the program some day.

Other than that I am sure it is a useful feature, so maybe not a
misfeature, more an API abuse.

> 
> [0] https://utcc.utoronto.ca/~cks/space/blog/linux/SocketAbstractNamespace
> 
> 



-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list