@@ -277,6 +277,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
277
277
) -> InterpResult < ' tcx , i32 > {
278
278
let this = self . eval_context_mut ( ) ;
279
279
280
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
281
+ throw_unsup_format ! (
282
+ "`pthread_mutexattr_init` is not supported on {}" ,
283
+ this. tcx. sess. target. os
284
+ ) ;
285
+ }
286
+
280
287
let default_kind = this. eval_libc_i32 ( "PTHREAD_MUTEX_DEFAULT" ) ;
281
288
mutexattr_set_kind ( this, attr_op, default_kind) ?;
282
289
@@ -359,6 +366,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
359
366
) -> InterpResult < ' tcx , i32 > {
360
367
let this = self . eval_context_mut ( ) ;
361
368
369
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
370
+ throw_unsup_format ! (
371
+ "`pthread_mutex_init` is not supported on {}" ,
372
+ this. tcx. sess. target. os
373
+ ) ;
374
+ }
375
+
362
376
let attr = this. read_pointer ( attr_op) ?;
363
377
let kind = if this. ptr_is_null ( attr) ? {
364
378
this. eval_libc_i32 ( "PTHREAD_MUTEX_DEFAULT" )
@@ -513,6 +527,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
513
527
) -> InterpResult < ' tcx , i32 > {
514
528
let this = self . eval_context_mut ( ) ;
515
529
530
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
531
+ throw_unsup_format ! (
532
+ "`pthread_rwlock_rdlock` is not supported on {}" ,
533
+ this. tcx. sess. target. os
534
+ ) ;
535
+ }
536
+
516
537
let id = rwlock_get_id ( this, rwlock_op) ?;
517
538
let active_thread = this. get_active_thread ( ) ;
518
539
@@ -548,6 +569,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
548
569
) -> InterpResult < ' tcx , i32 > {
549
570
let this = self . eval_context_mut ( ) ;
550
571
572
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
573
+ throw_unsup_format ! (
574
+ "`pthread_rwlock_wrlock` is not supported on {}" ,
575
+ this. tcx. sess. target. os
576
+ ) ;
577
+ }
578
+
551
579
let id = rwlock_get_id ( this, rwlock_op) ?;
552
580
let active_thread = this. get_active_thread ( ) ;
553
581
@@ -638,6 +666,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
638
666
) -> InterpResult < ' tcx , i32 > {
639
667
let this = self . eval_context_mut ( ) ;
640
668
669
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
670
+ throw_unsup_format ! (
671
+ "`pthread_condattr_init` is not supported on {}" ,
672
+ this. tcx. sess. target. os
673
+ ) ;
674
+ }
675
+
641
676
// The default value of the clock attribute shall refer to the system
642
677
// clock.
643
678
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_setclock.html
@@ -704,6 +739,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
704
739
) -> InterpResult < ' tcx , i32 > {
705
740
let this = self . eval_context_mut ( ) ;
706
741
742
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
743
+ throw_unsup_format ! (
744
+ "`pthread_cond_init` is not supported on {}" ,
745
+ this. tcx. sess. target. os
746
+ ) ;
747
+ }
748
+
707
749
let attr = this. read_pointer ( attr_op) ?;
708
750
let clock_id = if this. ptr_is_null ( attr) ? {
709
751
this. eval_libc_i32 ( "CLOCK_REALTIME" )
0 commit comments