Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-10] src/share/man/man3



Module Name:    src
Committed By:   martin
Date:           Wed Oct 21 18:39:05 UTC 2026

Modified Files:
        src/share/man/man3 [netbsd-10]: CMSG_DATA.3

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1368):

        share/man/man3/CMSG_DATA.3: revision 1.4
        share/man/man3/CMSG_DATA.3: revision 1.5
        share/man/man3/CMSG_DATA.3: revision 1.6

cmsg(3): Don't use malloc in example.

Since CMSG_SPACE (and CMSG_LEN) is required to expand to an integer
constant expression by POSIX, and it does in NetBSD as of 2012, there
is no reason to use malloc here -- we can just allocate the buffer on
the stack without tripping over variable-length arrays.

PR lib/59054: cmsg(3) uses malloc(3) unnecessarily

cmsg(3): Handle as many descriptors as the sender sends in example.

Due to a quirk of alignment, sizing the control buffer for
CMSG_SPACE(sizeof(int)) does not guarantee at most one file
descriptor fits in the buffer -- so if there is a chance the sender
may send more than one descriptor, the receiver has to loop over all
of them to avoid leaks.

Prompted by:
PR lib/59054: cmsg(3) uses malloc(3) unnecessarily

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.3 -r1.3.26.1 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.




Home | Main Index | Thread Index | Old Index