Skip to content

Commit cd4b437

Browse files
mochaaPsmaeul
authored andcommitted
std: only use LFS function on glibc
see rust-lang#94173 and commit 27011b4.
1 parent 3f00e65 commit cd4b437

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

library/std/src/sys/unix/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1744,11 +1744,11 @@ mod remove_dir_impl {
17441744
use crate::sys::{cvt, cvt_r};
17451745

17461746
#[cfg(not(any(
1747-
target_os = "linux",
1747+
all(target_os = "linux", target_env = "gnu"),
17481748
all(target_os = "macos", not(target_arch = "aarch64"))
17491749
)))]
17501750
use libc::{fdopendir, openat, unlinkat};
1751-
#[cfg(target_os = "linux")]
1751+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
17521752
use libc::{fdopendir, openat64 as openat, unlinkat};
17531753
#[cfg(all(target_os = "macos", not(target_arch = "aarch64")))]
17541754
use macos_weak::{fdopendir, openat, unlinkat};

library/std/src/sys/unix/kernel_copy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ use crate::ptr;
6161
use crate::sync::atomic::{AtomicBool, AtomicU8, Ordering};
6262
use crate::sys::cvt;
6363
use crate::sys::weak::syscall;
64-
#[cfg(not(target_os = "linux"))]
64+
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
6565
use libc::sendfile as sendfile64;
66-
#[cfg(target_os = "linux")]
66+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
6767
use libc::sendfile64;
6868
use libc::{EBADF, EINVAL, ENOSYS, EOPNOTSUPP, EOVERFLOW, EPERM, EXDEV};
6969

library/std/src/sys/unix/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
9595
)))]
9696
'poll: {
9797
use crate::sys::os::errno;
98-
#[cfg(not(target_os = "linux"))]
98+
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
9999
use libc::open as open64;
100-
#[cfg(target_os = "linux")]
100+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
101101
use libc::open64;
102102
let pfds: &mut [_] = &mut [
103103
libc::pollfd { fd: 0, events: 0, revents: 0 },
@@ -143,9 +143,9 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
143143
)))]
144144
{
145145
use crate::sys::os::errno;
146-
#[cfg(not(target_os = "linux"))]
146+
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
147147
use libc::open as open64;
148-
#[cfg(target_os = "linux")]
148+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
149149
use libc::open64;
150150
for fd in 0..3 {
151151
if libc::fcntl(fd, libc::F_GETFD) == -1 && errno() == libc::EBADF {

library/std/src/sys/unix/stack_overflow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ mod imp {
4545
use crate::thread;
4646

4747
use libc::MAP_FAILED;
48-
#[cfg(not(target_os = "linux"))]
48+
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
4949
use libc::{mmap as mmap64, munmap};
50-
#[cfg(target_os = "linux")]
50+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
5151
use libc::{mmap64, munmap};
5252
use libc::{sigaction, sighandler_t, SA_ONSTACK, SA_SIGINFO, SIGBUS, SIG_DFL};
5353
use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE};

library/std/src/sys/unix/thread.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,9 @@ pub mod guard {
658658
))]
659659
#[cfg_attr(test, allow(dead_code))]
660660
pub mod guard {
661-
#[cfg(not(target_os = "linux"))]
661+
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
662662
use libc::{mmap as mmap64, mprotect};
663-
#[cfg(target_os = "linux")]
663+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
664664
use libc::{mmap64, mprotect};
665665
use libc::{MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE};
666666

0 commit comments

Comments
 (0)