SOL_LOCAL define

Konstantin Belousov kostikbel at gmail.com
Mon Aug 3 17:11:36 UTC 2020


On Mon, Aug 03, 2020 at 12:19:42PM -0400, Steve Wills wrote:
> Hi,
> 
> I ran into a case where some code I was building expected SOL_LOCAL to be
> defined since LOCAL_PEERCRED was defined. See:
> 
> https://github.com/nanomsg/nng/pull/1272
> 
> for details. And looking at getpeereid.c:
> 
> https://svnweb.freebsd.org/base/head/lib/libc/gen/getpeereid.c?view=markup#l50
> 
> I see:
> 
>         error = _getsockopt(s, 0, LOCAL_PEERCRED, &xuc, &xuclen);
> 
> I wonder if something like a:
> 
> #define SOL_LOCAL 0
> 
> in sys/sys/un.h and a change to the above to:
> 
>         error = _getsockopt(s, SOL_LOCAL, LOCAL_PEERCRED, &xuc, &xuclen);
> 
> might be useful for compatibility and clarity? Any opinions?

This is something added by MacOS X 10.8 it seems.
I see no negative effects of the addition, so why not.
https://reviews.freebsd.org/D25933


More information about the freebsd-hackers mailing list