// darwin: pthread_rwlock_init$UNIX2003
// Solaris: rwlock_init (pthread_rwlock_init is built atop of rwlock_init)
// FreeBSD: pthread_rwlock_init
+#if defined(VGO_solaris)
+__attribute__((noinline))
+static int pthread_rwlock_init_WRK(rwlock_t *rwlock,
+ int type, void *arg)
+{
+ int ret;
+ OrigFn fn;
+ VALGRIND_GET_ORIG_FN(fn);
+ if (TRACE_PTH_FNS) {
+ fprintf(stderr, "<< rwl_init %p", rwlock); fflush(stderr);
+ }
+
+ CALL_FN_W_WWW(ret, fn, rwlock, type, arg);
+
+ if (ret == 0 /*success*/) {
+ DO_CREQ_v_W(_VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST,
+ rwlock_t *, rwlock);
+ } else {
+ DO_PthAPIerror("rwlock_init", ret);
+ }
+
+ if (TRACE_PTH_FNS) {
+ fprintf(stderr, " :: rwl_init -> %d >>\n", ret);
+ }
+ return ret;
+}
+#else
__attribute__((noinline))
static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
pthread_rwlockattr_t* attr)
}
return ret;
}
+#endif
#if defined(VGO_linux)
PTH_FUNC(int, pthreadZurwlockZuinit, // pthread_rwlock_init
pthread_rwlock_t *rwl,
return pthread_rwlock_init_WRK(rwl, attr);
}
#elif defined(VGO_solaris)
-static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
- pthread_rwlockattr_t* attr)
- __attribute__((unused));
+ PTH_FUNC(int, rwlockZuinit, // rwlock_init
+ rwlock_t *rwlock, int type, void *arg) {
+ return pthread_rwlock_init_WRK(rwlock, type, arg);
+ }
#else
# error "Unsupported OS"
#endif
-#if defined(VGO_solaris)
-PTH_FUNC(int, rwlockZuinit, // rwlock_init
- rwlock_t *rwlock,
- int type,
- void *arg)
-{
- int ret;
- OrigFn fn;
- VALGRIND_GET_ORIG_FN(fn);
- if (TRACE_PTH_FNS) {
- fprintf(stderr, "<< rwl_init %p", rwlock); fflush(stderr);
- }
-
- CALL_FN_W_WWW(ret, fn, rwlock, type, arg);
-
- if (ret == 0 /*success*/) {
- DO_CREQ_v_W(_VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST,
- rwlock_t *, rwlock);
- } else {
- DO_PthAPIerror("rwlock_init", ret);
- }
-
- if (TRACE_PTH_FNS) {
- fprintf(stderr, " :: rwl_init -> %d >>\n", ret);
- }
- return ret;
-}
-#endif /* VGO_solaris */
-
//-----------------------------------------------------------
// glibc: pthread_rwlock_destroy
# We need to remove stack frames containing redundant function
# names from libc, for example
# by 0x........: pthread_mutex_init (in /...libc...)
-my $check = join "|", ('pthread_mutex_init', 'pthread_cond_wait', 'pthread_cond_timedwait');
+my $check = join "|", ('pthread_mutex_init', 'pthread_cond_wait', 'pthread_cond_timedwait', 'pthread_rwlock_init');
s/^\s*by 0x........: (?:$check) \(in \/...libc...\)\s*//;
# We also need to replace Solaris threading and sychronization function
...
by 0x........: main (tc20_verifywrap.c:194)
Lock at 0x........ was first observed
- at 0x........: pthread_rwlock_init (hg_intercepts.c:...)
- ...
+ at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
by 0x........: main (tc20_verifywrap.c:193)
Location 0x........ is 0 bytes inside rwl.__pthread_rwlock_readers,
declared at tc20_verifywrap.c:57, in frame #x of thread x
...
by 0x........: main (tc20_verifywrap.c:211)
Lock at 0x........ was first observed
- at 0x........: pthread_rwlock_init (hg_intercepts.c:...)
- ...
+ at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
by 0x........: main (tc20_verifywrap.c:201)
Location 0x........ is 0 bytes inside rwl2.__pthread_rwlock_readers,
declared at tc20_verifywrap.c:58, in frame #x of thread x
...
by 0x........: main (tc20_verifywrap.c:232)
Lock at 0x........ was first observed
- at 0x........: pthread_rwlock_init (hg_intercepts.c:...)
- ...
+ at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+ by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
by 0x........: main (tc20_verifywrap.c:201)
Location 0x........ is 0 bytes inside rwl2.__pthread_rwlock_readers,
declared at tc20_verifywrap.c:58, in frame #x of thread x