Skip to content

Commit 3e35b39

Browse files
committed
std: only use LFS function on glibc
see #94173 and commit 27011b4.
1 parent 8574880 commit 3e35b39

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
@@ -1754,11 +1754,11 @@ mod remove_dir_impl {
17541754
use crate::sys::{cvt, cvt_r};
17551755

17561756
#[cfg(not(any(
1757-
target_os = "linux",
1757+
all(target_os = "linux", target_env = "gnu"),
17581758
all(target_os = "macos", not(target_arch = "aarch64"))
17591759
)))]
17601760
use libc::{fdopendir, openat, unlinkat};
1761-
#[cfg(target_os = "linux")]
1761+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
17621762
use libc::{fdopendir, openat64 as openat, unlinkat};
17631763
#[cfg(all(target_os = "macos", not(target_arch = "aarch64")))]
17641764
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
@@ -653,9 +653,9 @@ pub mod guard {
653653
))]
654654
#[cfg_attr(test, allow(dead_code))]
655655
pub mod guard {
656-
#[cfg(not(target_os = "linux"))]
656+
#[cfg(not(all(target_os = "linux", target_env = "gnu")))]
657657
use libc::{mmap as mmap64, mprotect};
658-
#[cfg(target_os = "linux")]
658+
#[cfg(all(target_os = "linux", target_env = "gnu"))]
659659
use libc::{mmap64, mprotect};
660660
use libc::{MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE};
661661

0 commit comments

Comments
 (0)