Module Name: src Committed By: riastradh Date: Wed Mar 26 14:12:16 UTC 2025
Modified Files: src/share/man/man3: CMSG_DATA.3 Log Message: cmsg(3): Clarify guarantees about CMSG_SPACE/LEN constancy. Add some line breaks while here to break up walls of text so it's easier to compare the two paragraphs and see how CMSG_SPACE is meant for struct msghdr::msg_controllen and CMSG_LEN is meant for struct cmsghdr::cmsg_len. PR lib/59054: cmsg(3) uses malloc(3) unnecessarily To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/share/man/man3/CMSG_DATA.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man3/CMSG_DATA.3 diff -u src/share/man/man3/CMSG_DATA.3:1.5 src/share/man/man3/CMSG_DATA.3:1.6 --- src/share/man/man3/CMSG_DATA.3:1.5 Sat Feb 8 13:30:42 2025 +++ src/share/man/man3/CMSG_DATA.3 Wed Mar 26 14:12:16 2025 @@ -1,4 +1,4 @@ -.\" $NetBSD: CMSG_DATA.3,v 1.5 2025/02/08 13:30:42 riastradh Exp $ +.\" $NetBSD: CMSG_DATA.3,v 1.6 2025/03/26 14:12:16 riastradh Exp $ .\" $OpenBSD: CMSG_DATA.3,v 1.5 2008/03/24 16:11:07 deraadt Exp $ .\" Written by Jared Yanovich <jar...@openbsd.org> .\" Public domain, July 3, 2005 @@ -64,12 +64,19 @@ This routine determines the size in byte which includes the control message header. .Fa len specifies the length of the data held by the control message. +.Pp This value is what is normally stored in the .Fa cmsg_len of each control message. +.Pp This routine accounts for any alignment constraints on the beginning of ancillary data. -This macro might not evaluate to a compile-time constant. +.Pp +If +.Fa len +is an integer constant expression, then +.Fn CMSG_LEN len +is an integer constant expression. .It Fn CMSG_NXTHDR mhdr cmsg This routine returns the location of the control message following .Fa cmsg @@ -84,11 +91,18 @@ This routine determines the size in byte message and its contents of length .Fa len , which includes the control message header. +.Pp This value is what is normally stored in .Fa msg_msgcontrollen . +.Pp This routine accounts for any alignment constraints on the beginning of ancillary data as well as any needed to pad the next control message. -This macro might not evaluate to a compile-time constant. +.Pp +If +.Fa len +is an integer constant expression, then +.Fn CMSG_SPACE len +is an integer constant expression. .El .Sh EXAMPLES The following example constructs a control message containing a file