@@ -347,6 +347,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
347
347
) -> InterpResult < ' tcx , i32 > {
348
348
let this = self . eval_context_mut ( ) ;
349
349
this. check_no_isolation ( "stat" ) ?;
350
+ this. check_platform ( "macos" , "stat" ) ?;
350
351
// `stat` always follows symlinks.
351
352
this. stat_or_lstat ( true , path_op, buf_op)
352
353
}
@@ -359,6 +360,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
359
360
) -> InterpResult < ' tcx , i32 > {
360
361
let this = self . eval_context_mut ( ) ;
361
362
this. check_no_isolation ( "lstat" ) ?;
363
+ this. check_platform ( "macos" , "lstat" ) ?;
362
364
this. stat_or_lstat ( false , path_op, buf_op)
363
365
}
364
366
@@ -370,10 +372,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
370
372
let this = self . eval_context_mut ( ) ;
371
373
372
374
this. check_no_isolation ( "fstat" ) ?;
373
-
374
- if this. tcx . sess . target . target . target_os . to_lowercase ( ) != "macos" {
375
- throw_unsup_format ! ( "The `fstat` shim is only available for `macos` targets." )
376
- }
375
+ this. check_platform ( "macos" , "fstat" ) ?;
377
376
378
377
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
379
378
@@ -392,10 +391,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
392
391
) -> InterpResult < ' tcx , i32 > {
393
392
let this = self . eval_context_mut ( ) ;
394
393
395
- if this. tcx . sess . target . target . target_os . to_lowercase ( ) != "macos" {
396
- throw_unsup_format ! ( "The `stat` and `lstat` shims are only available for `macos` targets." )
397
- }
398
-
399
394
let path_scalar = this. read_scalar ( path_op) ?. not_undef ( ) ?;
400
395
let path: PathBuf = this. read_os_str_from_c_str ( path_scalar) ?. into ( ) ;
401
396
@@ -417,10 +412,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
417
412
let this = self . eval_context_mut ( ) ;
418
413
419
414
this. check_no_isolation ( "statx" ) ?;
420
-
421
- if this. tcx . sess . target . target . target_os . to_lowercase ( ) != "linux" {
422
- throw_unsup_format ! ( "The `statx` shim is only available for `linux` targets." )
423
- }
415
+ this. check_platform ( "linux" , "statx" ) ?;
424
416
425
417
let statxbuf_scalar = this. read_scalar ( statxbuf_op) ?. not_undef ( ) ?;
426
418
let pathname_scalar = this. read_scalar ( pathname_op) ?. not_undef ( ) ?;
0 commit comments