tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Level for Unix-domain socket options



On Thu, Aug 05, 2021 at 22:55:12 +0200, Rhialto wrote:

> On Thu 05 Aug 2021 at 13:22:55 +0000, nia wrote:
> > The unix(4) man page incorrectly states:
> > 
> > "A UNIX-domain socket supports two socket-level options for use with
> > setsockopt(2) and getsockopt(2): [...]"
> > 
> > In reality, the protocol level when using these socket options
> > must be 0, which is a magic number not really documented anywhere
> > except the test suite.
> 
> and getsockopt(2) says
> 
> DESCRIPTION
>      getsockopt(), setsockopt() and getsockopt2() manipulate the options
>      associated with a socket.  Options may exist at multiple protocol levels;
>      they are always present at the uppermost "socket" level.
> 
> which I interpret to mean that even if you use SOL_SOCKET for these
> options, it should work. Do I read that as intended?

Was that perhaps an artifact of an old implementation?

POSIX says

  The getsockopt() function shall fail if:

  [EINVAL]
      The specified option is invalid at the specified socket level.
  [ENOPROTOOPT]
      The option is not supported by the protocol.

while our man page only has

     [ENOPROTOOPT]      The option is unknown at the level indicated.

which might actually be problematic, but I will leave the exegetic
exercise to someone more skilled.


-uwe


Home | Main Index | Thread Index | Old Index