Skip to content

Commit b464f9b

Browse files
committed
Comment cmsg_align.
1 parent a92ca5f commit b464f9b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sys/socket/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ pub enum ControlMessage<'a> {
392392
#[doc(hidden)]
393393
pub struct UnknownCmsg<'a>(&'a cmsghdr, &'a [u8]);
394394

395+
// Round `len` up to meet the platform's required alignment for
396+
// `cmsghdr`s and trailing `cmsghdr` data. This should match the
397+
// behaviour of CMSG_ALIGN from the Linux headers and do the correct
398+
// thing on other platforms that don't usually provide CMSG_ALIGN.
395399
#[inline]
396400
fn cmsg_align(len: usize) -> usize {
397401
let align_bytes = mem::size_of::<align_of_cmsg_data>() - 1;

0 commit comments

Comments
 (0)