@@ -47,9 +47,13 @@ use libc::{c_int, mode_t};
4747 all( target_os = "linux" , target_env = "gnu" )
4848) ) ]
4949use libc:: c_char;
50- #[ cfg( any( target_os = "linux" , target_os = "emscripten" , target_os = "android" ) ) ]
50+ #[ cfg( any(
51+ all( target_os = "linux" , not( target_env = "musl" ) ) ,
52+ target_os = "emscripten" ,
53+ target_os = "android"
54+ ) ) ]
5155use libc:: dirfd;
52- #[ cfg( any( target_os = "linux" , target_os = "emscripten" ) ) ]
56+ #[ cfg( any( not ( target_env = "musl" ) , target_os = "emscripten" ) ) ]
5357use libc:: fstatat64;
5458#[ cfg( any(
5559 target_os = "android" ,
@@ -58,9 +62,10 @@ use libc::fstatat64;
5862 target_os = "redox" ,
5963 target_os = "illumos" ,
6064 target_os = "nto" ,
65+ target_env = "musl" ,
6166) ) ]
6267use libc:: readdir as readdir64;
63- #[ cfg( target_os = "linux" ) ]
68+ #[ cfg( all ( target_os = "linux" , not ( target_env = "musl" ) ) ) ]
6469use libc:: readdir64;
6570#[ cfg( any( target_os = "emscripten" , target_os = "l4re" ) ) ]
6671use libc:: readdir64_r;
@@ -81,7 +86,13 @@ use libc::{
8186 dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64,
8287 lstat as lstat64, off64_t, open as open64, stat as stat64,
8388} ;
89+ #[ cfg( target_env = "musl" ) ]
90+ use libc:: {
91+ dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64,
92+ lstat as lstat64, off_t as off64_t, open as open64, stat as stat64,
93+ } ;
8494#[ cfg( not( any(
95+ target_env = "musl" ,
8596 target_os = "linux" ,
8697 target_os = "emscripten" ,
8798 target_os = "l4re" ,
@@ -91,7 +102,7 @@ use libc::{
91102 dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64,
92103 lstat as lstat64, off_t as off64_t, open as open64, stat as stat64,
93104} ;
94- #[ cfg( any( target_os = "linux" , target_os = "emscripten" , target_os = "l4re" ) ) ]
105+ #[ cfg( any( not ( target_env = "musl" ) , target_os = "emscripten" , target_os = "l4re" ) ) ]
95106use libc:: { dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64} ;
96107
97108pub use crate :: sys_common:: fs:: try_exists;
@@ -278,6 +289,7 @@ unsafe impl Sync for Dir {}
278289#[ cfg( any(
279290 target_os = "android" ,
280291 target_os = "linux" ,
292+ not( target_env = "musl" ) ,
281293 target_os = "solaris" ,
282294 target_os = "illumos" ,
283295 target_os = "fuchsia" ,
@@ -312,6 +324,7 @@ struct dirent64_min {
312324}
313325
314326#[ cfg( not( any(
327+ target_env = "musl" ,
315328 target_os = "android" ,
316329 target_os = "linux" ,
317330 target_os = "solaris" ,
@@ -798,7 +811,7 @@ impl DirEntry {
798811 }
799812
800813 #[ cfg( all(
801- any( target_os = "linux" , target_os = "emscripten" , target_os = "android" ) ,
814+ any( not ( target_env = "musl" ) , target_os = "emscripten" , target_os = "android" ) ,
802815 not( miri)
803816 ) ) ]
804817 pub fn metadata ( & self ) -> io:: Result < FileAttr > {
@@ -822,7 +835,7 @@ impl DirEntry {
822835 }
823836
824837 #[ cfg( any(
825- not( any( target_os = "linux" , target_os = "emscripten" , target_os = "android" ) ) ,
838+ not( any( not ( target_env = "musl" ) , target_os = "emscripten" , target_os = "android" ) ) ,
826839 miri
827840 ) ) ]
828841 pub fn metadata ( & self ) -> io:: Result < FileAttr > {
0 commit comments