Socket module

CMSG_LEN

procedure · 1 overloadSource

The value for a control message's cmsg_len when its payload is size bytes: the aligned header plus size, without padding after the payload. Fails an assertion for a negative size or one that does not fit in a u32.

Example
// A descriptor-passing message carries one s32.
assert(CMSG_LEN(size_of(s32)) == cast(u32) (CMSG_ALIGN(size_of(cmsghdr)) + size_of(s32)));

Doesn't run in the browser (only on linux, macos).

CMSG_LEN :: (size: int) -> u32

The value for a control message's cmsg_len when its payload is size bytes: the aligned header plus size, without padding after the payload. Fails an assertion for a negative size or one that does not fit in a u32.

Parameters

size: int

Returns

u32
Example
// A descriptor-passing message carries one s32.
assert(CMSG_LEN(size_of(s32)) == cast(u32) (CMSG_ALIGN(size_of(cmsghdr)) + size_of(s32)));

Doesn't run in the browser (only on linux, macos).

See also