Bug 96207

Summary: Comments of a sockaddr_un structure could confuse one
Product: Documentation Reporter: Rostislav Krasny <rosti.bsd>
Component: DocumentationAssignee: freebsd-doc (Nobody) <doc>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Rostislav Krasny 2006-04-23 16:50:14 UTC
In RELENG_6 (and others) a sys/un.h has following definitions:

 * Definitions for UNIX IPC domain.
struct sockaddr_un {
        unsigned char   sun_len;        /* sockaddr len including null */
        sa_family_t     sun_family;     /* AF_UNIX */
        char    sun_path[104];          /* path name (gag) */

/* actual length of an initialized sockaddr_un */
#define SUN_LEN(su) \
        (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))

Comments of the sockaddr_un definition, together with the SUN_LEN(su)
definition, could confuse one. For example my first thought was that
there is a bug in the SUN_LEN(su) definition. About 9 years ago the
same confusion happened in the NetBSD project. Read a "SUN_LEN()
definition change" thread:


and commit logs of revisions 1.14 and 1.15:


Back to FreeBSD, I think the "/* sockaddr len including null */"
should be changed to "/* sockaddr_un len without NUL */"
and the "/* path name (gag) */" should be changed to
"/* NUL-terminated path name */". The unix(4) manual page already
gives the right information about that.


Already in the description
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:36 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped