-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
std: use more LFS functions on Linux #31668
Conversation
This follows the pattern already used for stat functions from rust-lang#31551. Now `ftruncate`, `lseek`, and `readdir_r` use their explicit 64-bit variants for LFS support, using wider `off_t` and `dirent` types. This also updates to `open64`, which uses no different types but implies the `O_LARGEFILE` flag. Non-Linux platforms just map their normal functions to the 64-bit names. r? @alexcrichton
What happens if someone writes the following on a 32bit platform? let file = File::from_raw_fd(libc::open(...)); // non LFS open
file.set_len(u32::MAX + 1); I assume (hope) this fails gracefully (or succeeds) but doesn't do anything weird. |
@Stebalien good question -- assuming you do cast that We'll also assume your file wasn't already >=2GB, or that AFAICT Rust doesn't care at all, so it's up to the kernel's behavior. System call Actually, the old behavior would have been the "weird" one, silently taking |
This follows the pattern already used for stat functions from #31551. Now `ftruncate`, `lseek`, and `readdir_r` use their explicit 64-bit variants for LFS support, using wider `off_t` and `dirent` types. This also updates to `open64`, which uses no different types but implies the `O_LARGEFILE` flag. Non-Linux platforms just map their normal functions to the 64-bit names. r? @alexcrichton
@cuviper Thanks. I just wanted to make sure that mixing and matching LFS/non LFS syscalls wouldn't' cause any problems (for backwards comparability). |
This follows the pattern already used for stat functions from #31551. Now
ftruncate
,lseek
, andreaddir_r
use their explicit 64-bit variants forLFS support, using wider
off_t
anddirent
types. This also updates toopen64
, which uses no different types but implies theO_LARGEFILE
flag.Non-Linux platforms just map their normal functions to the 64-bit names.
r? @alexcrichton