Uh oh!
There was an error while loading. Please reload this page.
Refactor util_libc - #765
Conversation
| res if res > 0 => { | ||
| let len = usize::try_from(res).map_err(|_| Error::UNEXPECTED)?; | ||
| let (l, r) = buf.split_at_mut_checked(len).ok_or(Error::UNEXPECTED)?; | ||
| unsafe { sanitizer::unpoison(l) }; |
There was a problem hiding this comment.
Note that it applies unpoison to all users of sys_fill_exact. It's redundant in some cases (e.g. when we read from /dev/urandom), but AFAIK it has no negative consequences (outside of outlandish scenarios of misbehaving libc), while allowing to simplify the code a fair bit.
| #[path = "../util_libc.rs"] | ||
| mod util_libc; | ||
| #[path = "../utils/get_errno.rs"] | ||
| mod utils; |
There was a problem hiding this comment.
We could move imports of errno_location for 4 targets which use this backends here, but I don't think it's worth the trouble since all 4 targets use different names.
dhardy
left a comment
There was a problem hiding this comment.
LGTM, esp. the changes to get_errno.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This PR refactors
util_libc,sanitizer, andlazymodules. The modules are moved into theutilsdirectory and "mounted" with#[path = ".."]. With this change all uses of#[path = ".."]point towards theutilsdirectory.