Is AF_UNIX really deprecated?
Erik Trulsson
Erik.Trulsson.1013 at student.uu.se
Thu Jun 19 12:25:02 UTC 2014
Quoting Kevin Lo <kevlo at FreeBSD.org>:
> Hi,
>
> IEEE Std 1003.1g-2000 and later POSIX standards [1] do not include
> AF_LOCAL and mention only AF_UNIX, but according to socket(2) man page it
> mentions AF_UNIX is deprecated, use AF_LOCAL instead.
>
> I'd like to add support -f local to netstat(1), I'm wondering if AF_UNIX
> is really deprecated.
>
> [1]
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
>
> Thanks,
> Kevin
From what I can see the socket(2) manpage does not say anything at
all about AF_UNIX - it talks about PF_UNIX and PF_LOCAL - which happen
to have the same values as the corresponding AF_ defines.
(It is also worth mentioning that AF_UNIX and AF_LOCAL have the same
value, so on FreeBSD (and Linux for that matter) it does not matter
which of those four you use - they all have the same numerical value.)
Historically there seems to have been quite a bit of confusion over
which variant to use (with the _LOCAL variant probably being older
than _UNIX) but as you note the latest POSIX standard only mentions
AF_UNIX so I suggest you use that one.
(It is also perhaps worth mentioning that the socket(2) manpage has
preferred PF_LOCAL over PF_UNIX for more than a decade now. I suspect
neither is going away any time soon.)
More information about the freebsd-standards
mailing list