Merged
Conversation
9793c7f to
e19ab7f
Compare
asomers
reviewed
Nov 20, 2022
Member
asomers
left a comment
There was a problem hiding this comment.
This increases the size of the argument. How about using Option<std::ptr::NonNull> instead? Or Option<std::num::NonZeroUsize>?
e19ab7f to
96fa1b8
Compare
Contributor
Author
|
Good point, updated to use |
699e482 to
7468c81
Compare
asomers
reviewed
Nov 20, 2022
CHANGELOG.md
Outdated
|
|
||
| - The MSRV is now 1.56.1 | ||
| ([#1792](https://github.com/nix-rust/nix/pull/1792)) | ||
| - Passes `addr` to `sys::mmap` as `Option<NonZeroUsize>` from `*mut c_void`. |
Member
There was a problem hiding this comment.
I find this wording confusing. How about this?
Suggested change
| - Passes `addr` to `sys::mmap` as `Option<NonZeroUsize>` from `*mut c_void`. | |
| - The `addr` argument to `sys::mman::mmap` is now of type `Option<NonZeroUsize>`. |
Contributor
Author
There was a problem hiding this comment.
Updated.
7468c81 to
d34696c
Compare
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses
Some<size_t>instead of*mut c_voidfor theaddrpassed tosys::mman::mmap.In this instance we are not usefully passing a pointer, it will never be dereferenced. We are passing a location which represents where to attach the shared memory to.
In this case
size_tbetter represents an address and not a pointer, andOption<size_t>better represents an optional argument thanNULLPTR.In C since there is no optional type this is a pointer as this allows it be null which is an alias here for
None.