看板 FB_doc 關於我們 聯絡資訊
>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: _______________________________________________ freebsd-doc@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-doc To unsubscribe, send any mail to "freebsd-doc-unsubscribe@freebsd.org"