[erlang-questions] unix domain sockets with abstract namespace: can't use all 108 bytes
Bekes, Andras G
Andras.Bekes@REDACTED
Tue Mar 28 09:52:06 CEST 2017
Thank you very much for the heads up. I am happy with a non-portable implementation. I only need to target Linux.
I suspect the below holds for unix domain specific paths in general.
The abstract namespace feature seems to be Linux-specific.
-----Original Message-----
From: Richard A. O'Keefe [mailto:ok@REDACTED]
Sent: Monday, March 27, 2017 11:12 PM
To: Bekes, Andras G (IST)
Cc: erlang-questions@REDACTED
Subject: Re: [erlang-questions] unix domain sockets with abstract namespace: can't use all 108 bytes
> On 28/03/2017, at 5:03 AM, Bekes, Andras G <Andras.Bekes@REDACTED> wrote:
> I need to communicate with unix domain sockets using the abstract namespace and the server (which is not under my control) opens the port with all 108 bytes of the path used.
Be careful there. OSX 10.11.3 manual page:
UNIX-domain addresses are variable-length filesystem pathnames
of at most 104 characters.
The Single Unix Specification, version 4, section un.h, says
The size of sun_path has intentionally been left undefined.
This is because different implementations use different sizes.
For example, 4.3 BSD uses a size of 108, and 4.4 BSD uses a size of 104.
Since most implementations originate from BSD versions, the size is
typically in the range 92 to 108.
Applications should not assume a particular length for sun_path
or assume that it can hold {_POSIX_PATH_MAX} bytes (256).
Expect the last byte to be used for the NUL terminator of a C string, so the length of the actual name could be limited to 91..107.
--------------------------------------------------------------------------------
More information about the erlang-questions
mailing list