diff options
| author | Michael Benfield <mbenfield@google.com> | 2022-12-06 20:58:33 +0000 | 
|---|---|---|
| committer | Michael Benfield <mbenfield@google.com> | 2022-12-07 19:58:04 +0000 | 
| commit | 27011b4185f5341e579d2a02cabd3dc7d7aa7149 (patch) | |
| tree | 0642739ee1b9c6315c2b7ae89c8f328bf1ca95f4 /library/std/src/sys/unix/thread.rs | |
| parent | 01fbc5ae789fc0c7a2da71d3cd908451f175e4eb (diff) | |
| download | rust-27011b4185f5341e579d2a02cabd3dc7d7aa7149.tar.gz rust-27011b4185f5341e579d2a02cabd3dc7d7aa7149.zip | |
Use more LFS functions.
On Linux, use mmap64, open64, openat64, and sendfile64 in place of their non-LFS counterparts. This is relevant to #94173. With these changes (together with rust-lang/backtrace-rs#501), the simple binaries I produce with rustc seem to have no non-LFS functions, so maybe #94173 is fixed. But I can't be sure if I've missed something and maybe some non-LFS functions could sneak in somehow.
Diffstat (limited to 'library/std/src/sys/unix/thread.rs')
| -rw-r--r-- | library/std/src/sys/unix/thread.rs | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index c1d30dd9d52..3f1568cbcc7 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -658,7 +658,10 @@ pub mod guard { ))] #[cfg_attr(test, allow(dead_code))] pub mod guard { - use libc::{mmap, mprotect}; + #[cfg(not(target_os = "linux"))] + use libc::{mmap as mmap64, mprotect}; + #[cfg(target_os = "linux")] + use libc::{mmap64, mprotect}; use libc::{MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE}; use crate::io; @@ -808,7 +811,7 @@ pub mod guard { // read/write permissions and only then mprotect() it to // no permissions at all. See issue #50313. let stackptr = get_stack_start_aligned()?; - let result = mmap( + let result = mmap64( stackptr, page_size, PROT_READ | PROT_WRITE, | 
