@@ -226,7 +226,7 @@ i32 wasm_stat(u32 path_str_offset, i32 stat_offset) {
226
226
.st_blksize = stat .st_blksize ,
227
227
.st_blocks = stat .st_blocks ,
228
228
};
229
-
229
+ #ifdef __APPLE__
230
230
stat_ptr -> st_atim .tv_sec = stat .st_atimespec .tv_sec ;
231
231
stat_ptr -> st_atim .tv_nsec = stat .st_atimespec .tv_nsec ;
232
232
@@ -235,6 +235,16 @@ i32 wasm_stat(u32 path_str_offset, i32 stat_offset) {
235
235
236
236
stat_ptr -> st_ctim .tv_sec = stat .st_ctimespec .tv_sec ;
237
237
stat_ptr -> st_ctim .tv_nsec = stat .st_ctimespec .tv_nsec ;
238
+ #else
239
+ stat_ptr -> st_atim .tv_sec = stat .st_atim .tv_sec ;
240
+ stat_ptr -> st_atim .tv_nsec = stat .st_atim .tv_nsec ;
241
+
242
+ stat_ptr -> st_mtim .tv_sec = stat .st_mtim .tv_sec ;
243
+ stat_ptr -> st_mtim .tv_nsec = stat .st_mtim .tv_nsec ;
244
+
245
+ stat_ptr -> st_ctim .tv_sec = stat .st_ctim .tv_sec ;
246
+ stat_ptr -> st_ctim .tv_nsec = stat .st_ctim .tv_nsec ;
247
+ #endif
238
248
} else if (res == -1 ) {
239
249
return - errno ;
240
250
}
@@ -261,6 +271,7 @@ i32 wasm_fstat(i32 filedes, i32 stat_offset) {
261
271
.st_blksize = stat .st_blksize ,
262
272
.st_blocks = stat .st_blocks ,
263
273
};
274
+ #ifdef __APPLE__
264
275
stat_ptr -> st_atim .tv_sec = stat .st_atimespec .tv_sec ;
265
276
stat_ptr -> st_atim .tv_nsec = stat .st_atimespec .tv_nsec ;
266
277
@@ -269,6 +280,16 @@ i32 wasm_fstat(i32 filedes, i32 stat_offset) {
269
280
270
281
stat_ptr -> st_ctim .tv_sec = stat .st_ctimespec .tv_sec ;
271
282
stat_ptr -> st_ctim .tv_nsec = stat .st_ctimespec .tv_nsec ;
283
+ #else
284
+ stat_ptr -> st_atim .tv_sec = stat .st_atim .tv_sec ;
285
+ stat_ptr -> st_atim .tv_nsec = stat .st_atim .tv_nsec ;
286
+
287
+ stat_ptr -> st_mtim .tv_sec = stat .st_mtim .tv_sec ;
288
+ stat_ptr -> st_mtim .tv_nsec = stat .st_mtim .tv_nsec ;
289
+
290
+ stat_ptr -> st_ctim .tv_sec = stat .st_ctim .tv_sec ;
291
+ stat_ptr -> st_ctim .tv_nsec = stat .st_ctim .tv_nsec ;
292
+ #endif
272
293
} else if (res == -1 ) {
273
294
return - errno ;
274
295
}
@@ -296,6 +317,7 @@ i32 wasm_lstat(i32 path_str_offset, i32 stat_offset) {
296
317
.st_blksize = stat .st_blksize ,
297
318
.st_blocks = stat .st_blocks ,
298
319
};
320
+ #ifdef __APPLE__
299
321
stat_ptr -> st_atim .tv_sec = stat .st_atimespec .tv_sec ;
300
322
stat_ptr -> st_atim .tv_nsec = stat .st_atimespec .tv_nsec ;
301
323
@@ -304,6 +326,16 @@ i32 wasm_lstat(i32 path_str_offset, i32 stat_offset) {
304
326
305
327
stat_ptr -> st_ctim .tv_sec = stat .st_ctimespec .tv_sec ;
306
328
stat_ptr -> st_ctim .tv_nsec = stat .st_ctimespec .tv_nsec ;
329
+ #else
330
+ stat_ptr -> st_atim .tv_sec = stat .st_atim .tv_sec ;
331
+ stat_ptr -> st_atim .tv_nsec = stat .st_atim .tv_nsec ;
332
+
333
+ stat_ptr -> st_mtim .tv_sec = stat .st_mtim .tv_sec ;
334
+ stat_ptr -> st_mtim .tv_nsec = stat .st_mtim .tv_nsec ;
335
+
336
+ stat_ptr -> st_ctim .tv_sec = stat .st_ctim .tv_sec ;
337
+ stat_ptr -> st_ctim .tv_nsec = stat .st_ctim .tv_nsec ;
338
+ #endif
307
339
} else if (res == -1 ) {
308
340
return - errno ;
309
341
}
0 commit comments