@@ -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
@@ -531,6 +552,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
531
552
) -> InterpResult < ' tcx , i32 > {
532
553
let this = self . eval_context_mut ( ) ;
533
554
555
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
556
+ throw_unsup_format ! (
557
+ "`pthread_rwlock_tryrdlock` is not supported on {}" ,
558
+ this. tcx. sess. target. os
559
+ ) ;
560
+ }
561
+
534
562
let id = rwlock_get_id ( this, rwlock_op) ?;
535
563
let active_thread = this. get_active_thread ( ) ;
536
564
@@ -548,6 +576,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
548
576
) -> InterpResult < ' tcx , i32 > {
549
577
let this = self . eval_context_mut ( ) ;
550
578
579
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
580
+ throw_unsup_format ! (
581
+ "`pthread_rwlock_wrlock` is not supported on {}" ,
582
+ this. tcx. sess. target. os
583
+ ) ;
584
+ }
585
+
551
586
let id = rwlock_get_id ( this, rwlock_op) ?;
552
587
let active_thread = this. get_active_thread ( ) ;
553
588
@@ -578,6 +613,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
578
613
) -> InterpResult < ' tcx , i32 > {
579
614
let this = self . eval_context_mut ( ) ;
580
615
616
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
617
+ throw_unsup_format ! (
618
+ "`pthread_rwlock_trywrlock` is not supported on {}" ,
619
+ this. tcx. sess. target. os
620
+ ) ;
621
+ }
622
+
581
623
let id = rwlock_get_id ( this, rwlock_op) ?;
582
624
let active_thread = this. get_active_thread ( ) ;
583
625
@@ -595,6 +637,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
595
637
) -> InterpResult < ' tcx , i32 > {
596
638
let this = self . eval_context_mut ( ) ;
597
639
640
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
641
+ throw_unsup_format ! (
642
+ "`pthread_rwlock_unlock` is not supported on {}" ,
643
+ this. tcx. sess. target. os
644
+ ) ;
645
+ }
646
+
598
647
let id = rwlock_get_id ( this, rwlock_op) ?;
599
648
let active_thread = this. get_active_thread ( ) ;
600
649
@@ -614,6 +663,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
614
663
) -> InterpResult < ' tcx , i32 > {
615
664
let this = self . eval_context_mut ( ) ;
616
665
666
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
667
+ throw_unsup_format ! (
668
+ "`pthread_rwlock_destroy` is not supported on {}" ,
669
+ this. tcx. sess. target. os
670
+ ) ;
671
+ }
672
+
617
673
let id = rwlock_get_id ( this, rwlock_op) ?;
618
674
619
675
if this. rwlock_is_locked ( id) {
@@ -638,6 +694,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
638
694
) -> InterpResult < ' tcx , i32 > {
639
695
let this = self . eval_context_mut ( ) ;
640
696
697
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
698
+ throw_unsup_format ! (
699
+ "`pthread_condattr_init` is not supported on {}" ,
700
+ this. tcx. sess. target. os
701
+ ) ;
702
+ }
703
+
641
704
// The default value of the clock attribute shall refer to the system
642
705
// clock.
643
706
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_setclock.html
@@ -704,6 +767,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
704
767
) -> InterpResult < ' tcx , i32 > {
705
768
let this = self . eval_context_mut ( ) ;
706
769
770
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" ) {
771
+ throw_unsup_format ! (
772
+ "`pthread_cond_init` is not supported on {}" ,
773
+ this. tcx. sess. target. os
774
+ ) ;
775
+ }
776
+
707
777
let attr = this. read_pointer ( attr_op) ?;
708
778
let clock_id = if this. ptr_is_null ( attr) ? {
709
779
this. eval_libc_i32 ( "CLOCK_REALTIME" )
0 commit comments