Skip to content

Make cmsg_space! usable in const contexts.#889

Merged
sunfishcode merged 1 commit intomainfrom
sunfishcode/const-cmsg-size
Oct 22, 2023
Merged

Make cmsg_space! usable in const contexts.#889
sunfishcode merged 1 commit intomainfrom
sunfishcode/const-cmsg-size

Conversation

@sunfishcode
Copy link
Copy Markdown
Member

Make cmsg_space! usable in const contexts, so that it can be used as a buffer size argument, and add a version of tests/net/unix.rs that uses stack-allocated buffers instead of Vecs.

This exposes an alignment sublety, that buffers must be aligned to the needed alignment of cmsghdr; handle this by auto-aligning the provided buffer to the needed boundary.

Make `cmsg_space!` usable in const contexts, so that it can be used as a
buffer size argument, and add a version of tests/net/unix.rs that uses
stack-allocated buffers instead of `Vec`s.

This exposes an alignment sublety, that buffers must be aligned to the
needed alignment of `cmsghdr`; handle this by auto-aligning the provided
buffer to the needed boundary.
@sunfishcode sunfishcode merged commit ff9c7fb into main Oct 22, 2023
@sunfishcode sunfishcode deleted the sunfishcode/const-cmsg-size branch October 22, 2023 22:04
@sunfishcode
Copy link
Copy Markdown
Member Author

This is now released in rustix 0.38.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants