Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cmsg_space! usable in const contexts. #889

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

sunfishcode
Copy link
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
43 checks passed
@sunfishcode sunfishcode deleted the sunfishcode/const-cmsg-size branch October 22, 2023 22:04
@sunfishcode
Copy link
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