~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to helgrind/hg_intercepts.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-06-19 09:57:35 UTC
  • mfrom: (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20080619095735-0w0fyjp7znob3pek
Tags: upstream-3.3.1
ImportĀ upstreamĀ versionĀ 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
790
790
}
791
791
 
792
792
 
 
793
// pthread_rwlock_wrlock
793
794
PTH_FUNC(int, pthreadZurwlockZuwrlock, // pthread_rwlock_wrlock
794
795
         pthread_rwlock_t* rwlock)
795
796
{
800
801
      fprintf(stderr, "<< pthread_rwl_wlk %p", rwlock); fflush(stderr);
801
802
   }
802
803
 
803
 
   DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
804
 
                pthread_rwlock_t*,rwlock, long,1/*isW*/);
 
804
   DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
 
805
                 pthread_rwlock_t*,rwlock, 
 
806
                 long,1/*isW*/, long,0/*!isTryLock*/);
805
807
 
806
808
   CALL_FN_W_W(ret, fn, rwlock);
807
809
 
819
821
}
820
822
 
821
823
 
 
824
// pthread_rwlock_rdlock
822
825
PTH_FUNC(int, pthreadZurwlockZurdlock, // pthread_rwlock_rdlock
823
826
         pthread_rwlock_t* rwlock)
824
827
{
829
832
      fprintf(stderr, "<< pthread_rwl_rlk %p", rwlock); fflush(stderr);
830
833
   }
831
834
 
832
 
   DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
833
 
                pthread_rwlock_t*,rwlock, long,0/*!isW*/);
 
835
   DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
 
836
                 pthread_rwlock_t*,rwlock,
 
837
                 long,0/*!isW*/, long,0/*!isTryLock*/);
834
838
 
835
839
   CALL_FN_W_W(ret, fn, rwlock);
836
840
 
848
852
}
849
853
 
850
854
 
 
855
// pthread_rwlock_trywrlock
 
856
PTH_FUNC(int, pthreadZurwlockZutrywrlock, // pthread_rwlock_trywrlock
 
857
         pthread_rwlock_t* rwlock)
 
858
{
 
859
   int    ret;
 
860
   OrigFn fn;
 
861
   VALGRIND_GET_ORIG_FN(fn);
 
862
   if (TRACE_PTH_FNS) {
 
863
      fprintf(stderr, "<< pthread_rwl_trywlk %p", rwlock); fflush(stderr);
 
864
   }
 
865
 
 
866
   DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
 
867
                 pthread_rwlock_t*,rwlock, 
 
868
                 long,1/*isW*/, long,1/*isTryLock*/);
 
869
 
 
870
   CALL_FN_W_W(ret, fn, rwlock);
 
871
 
 
872
   /* There's a hole here: libpthread now knows the lock is locked,
 
873
      but the tool doesn't, so some other thread could run and detect
 
874
      that the lock has been acquired by someone (this thread).  Does
 
875
      this matter?  Not sure, but I don't think so. */
 
876
 
 
877
   if (ret == 0 /*success*/) {
 
878
      DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST,
 
879
                   pthread_rwlock_t*,rwlock, long,1/*isW*/);
 
880
   } else { 
 
881
      if (ret != EBUSY)
 
882
         DO_PthAPIerror( "pthread_rwlock_trywrlock", ret );
 
883
   }
 
884
 
 
885
   if (TRACE_PTH_FNS) {
 
886
      fprintf(stderr, " :: rwl_trywlk -> %d >>\n", ret);
 
887
   }
 
888
   return ret;
 
889
}
 
890
 
 
891
 
 
892
// pthread_rwlock_tryrdlock
 
893
PTH_FUNC(int, pthreadZurwlockZutryrdlock, // pthread_rwlock_tryrdlock
 
894
         pthread_rwlock_t* rwlock)
 
895
{
 
896
   int    ret;
 
897
   OrigFn fn;
 
898
   VALGRIND_GET_ORIG_FN(fn);
 
899
   if (TRACE_PTH_FNS) {
 
900
      fprintf(stderr, "<< pthread_rwl_tryrlk %p", rwlock); fflush(stderr);
 
901
   }
 
902
 
 
903
   DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
 
904
                 pthread_rwlock_t*,rwlock, 
 
905
                 long,0/*!isW*/, long,1/*isTryLock*/);
 
906
 
 
907
   CALL_FN_W_W(ret, fn, rwlock);
 
908
 
 
909
   /* There's a hole here: libpthread now knows the lock is locked,
 
910
      but the tool doesn't, so some other thread could run and detect
 
911
      that the lock has been acquired by someone (this thread).  Does
 
912
      this matter?  Not sure, but I don't think so. */
 
913
 
 
914
   if (ret == 0 /*success*/) {
 
915
      DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST,
 
916
                   pthread_rwlock_t*,rwlock, long,0/*!isW*/);
 
917
   } else { 
 
918
      if (ret != EBUSY)
 
919
         DO_PthAPIerror( "pthread_rwlock_tryrdlock", ret );
 
920
   }
 
921
 
 
922
   if (TRACE_PTH_FNS) {
 
923
      fprintf(stderr, " :: rwl_tryrlk -> %d >>\n", ret);
 
924
   }
 
925
   return ret;
 
926
}
 
927
 
 
928
 
 
929
// pthread_rwlock_unlock
851
930
PTH_FUNC(int, pthreadZurwlockZuunlock, // pthread_rwlock_unlock
852
931
         pthread_rwlock_t* rwlock)
853
932
{
1155
1234
      fflush(stderr);
1156
1235
   }
1157
1236
 
1158
 
   DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
1159
 
                void*,self, long,0/*!isW*/);
 
1237
   DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
 
1238
                 void*,self,
 
1239
                 long,0/*!isW*/, long,0/*!isTryLock*/);
1160
1240
 
1161
1241
   CALL_FN_v_W(fn, self);
1162
1242
 
1181
1261
      fflush(stderr);
1182
1262
   }
1183
1263
 
1184
 
   DO_CREQ_v_WW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
1185
 
                void*,self, long,1/*isW*/);
 
1264
   DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE,
 
1265
                 void*,self,
 
1266
                 long,1/*isW*/, long,0/*!isTryLock*/);
1186
1267
 
1187
1268
   CALL_FN_v_W(fn, self);
1188
1269