@@ -47,9 +47,13 @@ use libc::{c_int, mode_t};
47
47
all( target_os = "linux" , target_env = "gnu" )
48
48
) ) ]
49
49
use 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
+ ) ) ]
51
55
use libc:: dirfd;
52
- #[ cfg( any( target_os = "linux" , target_os = "emscripten" ) ) ]
56
+ #[ cfg( any( not ( target_env = "musl" ) , target_os = "emscripten" ) ) ]
53
57
use libc:: fstatat64;
54
58
#[ cfg( any(
55
59
target_os = "android" ,
@@ -58,9 +62,10 @@ use libc::fstatat64;
58
62
target_os = "redox" ,
59
63
target_os = "illumos" ,
60
64
target_os = "nto" ,
65
+ target_env = "musl" ,
61
66
) ) ]
62
67
use libc:: readdir as readdir64;
63
- #[ cfg( target_os = "linux" ) ]
68
+ #[ cfg( all ( target_os = "linux" , not ( target_env = "musl" ) ) ) ]
64
69
use libc:: readdir64;
65
70
#[ cfg( any( target_os = "emscripten" , target_os = "l4re" ) ) ]
66
71
use libc:: readdir64_r;
@@ -81,7 +86,13 @@ use libc::{
81
86
dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64,
82
87
lstat as lstat64, off64_t, open as open64, stat as stat64,
83
88
} ;
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
+ } ;
84
94
#[ cfg( not( any(
95
+ target_env = "musl" ,
85
96
target_os = "linux" ,
86
97
target_os = "emscripten" ,
87
98
target_os = "l4re" ,
@@ -91,7 +102,7 @@ use libc::{
91
102
dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64,
92
103
lstat as lstat64, off_t as off64_t, open as open64, stat as stat64,
93
104
} ;
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" ) ) ]
95
106
use libc:: { dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64} ;
96
107
97
108
pub use crate :: sys_common:: fs:: try_exists;
@@ -278,6 +289,7 @@ unsafe impl Sync for Dir {}
278
289
#[ cfg( any(
279
290
target_os = "android" ,
280
291
target_os = "linux" ,
292
+ not( target_env = "musl" ) ,
281
293
target_os = "solaris" ,
282
294
target_os = "illumos" ,
283
295
target_os = "fuchsia" ,
@@ -312,6 +324,7 @@ struct dirent64_min {
312
324
}
313
325
314
326
#[ cfg( not( any(
327
+ target_env = "musl" ,
315
328
target_os = "android" ,
316
329
target_os = "linux" ,
317
330
target_os = "solaris" ,
@@ -798,7 +811,7 @@ impl DirEntry {
798
811
}
799
812
800
813
#[ 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" ) ,
802
815
not( miri)
803
816
) ) ]
804
817
pub fn metadata ( & self ) -> io:: Result < FileAttr > {
@@ -822,7 +835,7 @@ impl DirEntry {
822
835
}
823
836
824
837
#[ 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" ) ) ,
826
839
miri
827
840
) ) ]
828
841
pub fn metadata ( & self ) -> io:: Result < FileAttr > {
0 commit comments