From nobody@FreeBSD.org  Sun Apr 23 15:41:45 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E0A2116A400
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 Apr 2006 15:41:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 94AA043D48
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 Apr 2006 15:41:45 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k3NFfj48080822
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 Apr 2006 15:41:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k3NFfjJ5080821;
	Sun, 23 Apr 2006 15:41:45 GMT
	(envelope-from nobody)
Message-Id: <200604231541.k3NFfjJ5080821@www.freebsd.org>
Date: Sun, 23 Apr 2006 15:41:45 GMT
From: Rostislav Krasny <rosti.bsd@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Comments of a sockaddr_un structure could confuse one
X-Send-Pr-Version: www-2.3

>Number:         96207
>Category:       docs
>Synopsis:       Comments of a sockaddr_un structure could confuse one
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 23 15:50:14 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Rostislav Krasny
>Release:        6.1-RC
>Organization:
>Environment:
FreeBSD saturn.lan 6.1-RC FreeBSD 6.1-RC #0: Sun Apr 23 15:36:02 IDT 2006     root@saturn.lan:/usr/obj/usr/src/sys/MYKERNEL  i386
>Description:
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:

http://mail-index.netbsd.org/tech-kern/1997/02/

and commit logs of revisions 1.14 and 1.15:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/un.h

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.
>How-To-Repeat:

>Fix:
Already in the description
>Release-Note:
>Audit-Trail:
>Unformatted:
