SOL_LOCAL define

Steve Wills swills at FreeBSD.org
Mon Aug 3 16:19:56 UTC 2020


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?

Steve


More information about the freebsd-hackers mailing list