Skip to content

Commit

Permalink
std: only use LFS function on glibc
Browse files Browse the repository at this point in the history
see rust-lang#94173 and commit 27011b4.
  • Loading branch information
mochaaP authored and smaeul committed Sep 1, 2023
1 parent 3f00e65 commit cd4b437
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions library/std/src/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,11 +1744,11 @@ mod remove_dir_impl {
use crate::sys::{cvt, cvt_r};

#[cfg(not(any(
target_os = "linux",
all(target_os = "linux", target_env = "gnu"),
all(target_os = "macos", not(target_arch = "aarch64"))
)))]
use libc::{fdopendir, openat, unlinkat};
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::{fdopendir, openat64 as openat, unlinkat};
#[cfg(all(target_os = "macos", not(target_arch = "aarch64")))]
use macos_weak::{fdopendir, openat, unlinkat};
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/unix/kernel_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ use crate::ptr;
use crate::sync::atomic::{AtomicBool, AtomicU8, Ordering};
use crate::sys::cvt;
use crate::sys::weak::syscall;
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
use libc::sendfile as sendfile64;
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::sendfile64;
use libc::{EBADF, EINVAL, ENOSYS, EOPNOTSUPP, EOVERFLOW, EPERM, EXDEV};

Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
)))]
'poll: {
use crate::sys::os::errno;
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
use libc::open as open64;
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::open64;
let pfds: &mut [_] = &mut [
libc::pollfd { fd: 0, events: 0, revents: 0 },
Expand Down Expand Up @@ -143,9 +143,9 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
)))]
{
use crate::sys::os::errno;
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
use libc::open as open64;
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::open64;
for fd in 0..3 {
if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF {
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/unix/stack_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ mod imp {
use crate::thread;

use libc::MAP_FAILED;
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
use libc::{mmap as mmap64, munmap};
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::{mmap64, munmap};
use libc::{sigaction, sighandler_t, SA_ONSTACK, SA_SIGINFO, SIGBUS, SIG_DFL};
use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE};
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,9 @@ pub mod guard {
))]
#[cfg_attr(test, allow(dead_code))]
pub mod guard {
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
use libc::{mmap as mmap64, mprotect};
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::{mmap64, mprotect};
use libc::{MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE};

Expand Down

0 comments on commit cd4b437

Please sign in to comment.