Socket module

CMSG_SIZE

procedure · 1 overloadSource

The buffer space one control message with a size-byte payload needs: the aligned header plus the aligned payload. Use it for msg_controllen and for sizing the buffer. Fails an assertion for a negative size or one that does not fit.

Example
assert(CMSG_SIZE(0) >= cast(u32) size_of(cmsghdr));
assert(CMSG_SIZE(size_of(s32)) >= CMSG_LEN(size_of(s32)));

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

CMSG_SIZE :: (size: int) -> u32

The buffer space one control message with a size-byte payload needs: the aligned header plus the aligned payload. Use it for msg_controllen and for sizing the buffer. Fails an assertion for a negative size or one that does not fit.

Parameters

size: int

Returns

u32
Example
assert(CMSG_SIZE(0) >= cast(u32) size_of(cmsghdr));
assert(CMSG_SIZE(size_of(s32)) >= CMSG_LEN(size_of(s32)));

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

See also