@@ -102,6 +102,9 @@ impl MetadataExt {
102
102
#[ inline]
103
103
#[ allow( unused_comparisons) ] // NB: rust-lang/rust#115823 requires this here instead of on `st_dev` processing below
104
104
pub ( crate ) fn from_rustix ( stat : Stat ) -> Metadata {
105
+ #[ cfg( not( target_os = "wasi" ) ) ]
106
+ use rustix:: fs:: StatExt ;
107
+
105
108
Metadata {
106
109
file_type : ImplFileTypeExt :: from_raw_mode ( stat. st_mode as RawMode ) ,
107
110
len : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
@@ -112,12 +115,12 @@ impl MetadataExt {
112
115
113
116
#[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
114
117
modified : system_time_from_rustix (
115
- stat. st_mtime . try_into ( ) . unwrap ( ) ,
118
+ stat. mtime ( ) . try_into ( ) . unwrap ( ) ,
116
119
stat. st_mtime_nsec as _ ,
117
120
) ,
118
121
#[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
119
122
accessed : system_time_from_rustix (
120
- stat. st_atime . try_into ( ) . unwrap ( ) ,
123
+ stat. atime ( ) . try_into ( ) . unwrap ( ) ,
121
124
stat. st_atime_nsec as _ ,
122
125
) ,
123
126
@@ -191,19 +194,19 @@ impl MetadataExt {
191
194
rdev : u64:: try_from ( stat. st_rdev ) . unwrap ( ) ,
192
195
size : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
193
196
#[ cfg( not( target_os = "wasi" ) ) ]
194
- atime : i64:: try_from ( stat. st_atime ) . unwrap ( ) ,
197
+ atime : i64:: try_from ( stat. atime ( ) ) . unwrap ( ) ,
195
198
#[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
196
199
atime_nsec : stat. st_atime_nsec as _ ,
197
200
#[ cfg( target_os = "netbsd" ) ]
198
201
atime_nsec : stat. st_atimensec as _ ,
199
202
#[ cfg( not( target_os = "wasi" ) ) ]
200
- mtime : i64:: try_from ( stat. st_mtime ) . unwrap ( ) ,
203
+ mtime : i64:: try_from ( stat. mtime ( ) ) . unwrap ( ) ,
201
204
#[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
202
205
mtime_nsec : stat. st_mtime_nsec as _ ,
203
206
#[ cfg( target_os = "netbsd" ) ]
204
207
mtime_nsec : stat. st_mtimensec as _ ,
205
208
#[ cfg( not( target_os = "wasi" ) ) ]
206
- ctime : i64:: try_from ( stat. st_ctime ) . unwrap ( ) ,
209
+ ctime : i64:: try_from ( stat. ctime ( ) ) . unwrap ( ) ,
207
210
#[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
208
211
ctime_nsec : stat. st_ctime_nsec as _ ,
209
212
#[ cfg( target_os = "netbsd" ) ]
0 commit comments