src/lib: Convert libc::rlim_t to u64 #6
Merged
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.
Previously a27a68d wrongly assumed
libc::rlim_tto be au64on allplatforms. Instead the following is the case:
There are different options in order to compile on all platforms:
Return
usize. Whileusizewould work for most platforms,i686-unknown-linux-muslis an exception. Thus casting would be neededwhich introduces yet another way to panic. In addition
usizeshould beused to index into collections, not so much to represent actual data.
Return
libc::rlim_t. This type is not present on all platforms. Inaddition exposing a
libctype in the public interface unnecessarilyties us to
libc.Return
u32. Would require a fallible cast on allu64platforms.Return
u64. Supported on all platforms. It is not the most spaceefficient option.
Given that memory efficiency (
u32vsu64) is irrelevant in thiscontext, compared to the involved system calls, this commit converts the
limit to
u64before returning for all platforms.Fixes #5.