@@ -102,9 +102,6 @@ impl ImplMetadataExt {
102102 #[ inline]
103103 #[ allow( unused_comparisons) ] // NB: rust-lang/rust#115823 requires this here instead of on `st_dev` processing below
104104 pub ( crate ) fn from_rustix ( stat : Stat ) -> Metadata {
105- #[ cfg( not( target_os = "wasi" ) ) ]
106- use rustix:: fs:: StatExt ;
107-
108105 Metadata {
109106 file_type : ImplFileTypeExt :: from_raw_mode ( stat. st_mode as RawMode ) ,
110107 len : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
@@ -113,26 +110,15 @@ impl ImplMetadataExt {
113110 #[ cfg( target_os = "wasi" ) ]
114111 permissions : ImplPermissionsExt :: default ( ) ,
115112
116- #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
117- modified : system_time_from_rustix (
118- stat. mtime ( ) . try_into ( ) . unwrap ( ) ,
119- stat. st_mtime_nsec as _ ,
120- ) ,
121- #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
122- accessed : system_time_from_rustix (
123- stat. atime ( ) . try_into ( ) . unwrap ( ) ,
124- stat. st_atime_nsec as _ ,
125- ) ,
126-
127- #[ cfg( target_os = "netbsd" ) ]
113+ #[ cfg( not( target_os = "wasi" ) ) ]
128114 modified : system_time_from_rustix (
129115 stat. st_mtime . try_into ( ) . unwrap ( ) ,
130- stat. st_mtimensec as _ ,
116+ stat. st_mtime_nsec as _ ,
131117 ) ,
132- #[ cfg( target_os = "netbsd" ) ]
118+ #[ cfg( not ( target_os = "wasi" ) ) ]
133119 accessed : system_time_from_rustix (
134120 stat. st_atime . try_into ( ) . unwrap ( ) ,
135- stat. st_atimensec as _ ,
121+ stat. st_atime_nsec as _ ,
136122 ) ,
137123
138124 #[ cfg( target_os = "wasi" ) ]
@@ -143,6 +129,7 @@ impl ImplMetadataExt {
143129 #[ cfg( any(
144130 target_os = "freebsd" ,
145131 target_os = "openbsd" ,
132+ target_os = "netbsd" ,
146133 target_os = "macos" ,
147134 target_os = "ios" ,
148135 target_os = "tvos" ,
@@ -154,12 +141,6 @@ impl ImplMetadataExt {
154141 stat. st_birthtime_nsec as _ ,
155142 ) ,
156143
157- #[ cfg( target_os = "netbsd" ) ]
158- created : system_time_from_rustix (
159- stat. st_birthtime . try_into ( ) . unwrap ( ) ,
160- stat. st_birthtimensec as _ ,
161- ) ,
162-
163144 // `stat.st_ctime` is the latest status change; we want the creation.
164145 #[ cfg( not( any(
165146 target_os = "freebsd" ,
@@ -200,23 +181,17 @@ impl ImplMetadataExt {
200181 rdev : u64:: try_from ( stat. st_rdev ) . unwrap ( ) ,
201182 size : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
202183 #[ cfg( not( target_os = "wasi" ) ) ]
203- atime : i64:: try_from ( stat. atime ( ) ) . unwrap ( ) ,
204- #[ cfg( not( any ( target_os = "netbsd" , target_os = " wasi") ) ) ]
184+ atime : i64:: try_from ( stat. st_atime ) . unwrap ( ) ,
185+ #[ cfg( not( target_os = "wasi" ) ) ]
205186 atime_nsec : stat. st_atime_nsec as _ ,
206- #[ cfg( target_os = "netbsd" ) ]
207- atime_nsec : stat. st_atimensec as _ ,
208187 #[ cfg( not( target_os = "wasi" ) ) ]
209- mtime : i64:: try_from ( stat. mtime ( ) ) . unwrap ( ) ,
210- #[ cfg( not( any ( target_os = "netbsd" , target_os = " wasi") ) ) ]
188+ mtime : i64:: try_from ( stat. st_mtime ) . unwrap ( ) ,
189+ #[ cfg( not( target_os = "wasi" ) ) ]
211190 mtime_nsec : stat. st_mtime_nsec as _ ,
212- #[ cfg( target_os = "netbsd" ) ]
213- mtime_nsec : stat. st_mtimensec as _ ,
214191 #[ cfg( not( target_os = "wasi" ) ) ]
215- ctime : i64:: try_from ( stat. ctime ( ) ) . unwrap ( ) ,
216- #[ cfg( not( any ( target_os = "netbsd" , target_os = " wasi") ) ) ]
192+ ctime : i64:: try_from ( stat. st_ctime ) . unwrap ( ) ,
193+ #[ cfg( not( target_os = "wasi" ) ) ]
217194 ctime_nsec : stat. st_ctime_nsec as _ ,
218- #[ cfg( target_os = "netbsd" ) ]
219- ctime_nsec : stat. st_ctimensec as _ ,
220195 #[ cfg( not( target_os = "wasi" ) ) ]
221196 blksize : u64:: try_from ( stat. st_blksize ) . unwrap ( ) ,
222197 #[ cfg( not( target_os = "wasi" ) ) ]
0 commit comments