You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a direct consequence of this rust's libc issue. In rust targeting 32 bits glibc, libc::off_t is 32 bits, which breaks this code if you are trying to map beyond 4 GB in a file:
let ptr = libc::mmap(
ptr::null_mut(),
map_len as libc::size_t,
prot,
flags,
file,
aligned_offset as libc::off_t,
);
I had a similar issue with nix crate, where posix_fallocate() also relied on libc::off_t for file sizes. The fix was to use rustix crate, that calls the system-call directly. Maybe a similar workaround could be applied here?
The text was updated successfully, but these errors were encountered:
Then I suggest at least doing aligned_offset.try_into().unwrap() instead of aligned_offset as libc::off_t, or an assert like assert!(aligned_offset <= libc::off_t::MAX);. That would have saved me a lot of debugging time.
This is a direct consequence of this rust's libc issue. In rust targeting 32 bits glibc,
libc::off_t
is 32 bits, which breaks this code if you are trying to map beyond 4 GB in a file:I had a similar issue with
nix
crate, whereposix_fallocate()
also relied onlibc::off_t
for file sizes. The fix was to userustix
crate, that calls the system-call directly. Maybe a similar workaround could be applied here?The text was updated successfully, but these errors were encountered: