- Fix helgrind/tests/tc18_semabuse.c on glibc 2.7 (RedHat 8).
- Fixed a glibc 2.7 specific assertion failure in exp-drd, namely one
that was triggered when sem_post()'s return value is not zero.
- exp-drd/test/matinv.c compiles now also on RedHat 7.3.
Note: more work will be required to get exp-drd working correctly on
RedHat 7.3.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7354
break;
case VG_USERREQ__POST_SEM_POST:
- drd_semaphore_post_post(thread_get_running_tid(), arg[1], arg[2]);
+ drd_semaphore_post_post(thread_get_running_tid(), arg[1], arg[2], arg[3]);
break;
case VG_USERREQ__BARRIER_INIT:
/* args: Addr sem, SizeT sem_size */
/* To notify the drd tool after a sem_post call. */
VG_USERREQ__POST_SEM_POST,
- /* args: Addr sem, SizeT sem_size */
+ /* args: Addr sem, SizeT sem_size, Bool waited */
/* To notify the drd tool of a pthread_barrier_init call. */
VG_USERREQ__BARRIER_INIT,
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_POST,
sem, sizeof(*sem), 0, 0, 0);
CALL_FN_W_W(ret, fn, sem);
- assert(ret == 0);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SEM_POST,
- sem, sizeof(*sem), 0, 0, 0);
- }
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SEM_POST,
+ sem, sizeof(*sem), ret == 0, 0, 0);
return ret;
}
}
void drd_semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
- const SizeT size)
+ const SizeT size, const Bool waited)
{
- semaphore_post_post(tid, semaphore, size);
+ semaphore_post_post(tid, semaphore, size, waited);
}
/** Called after sem_post() finished successfully. */
void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
- const SizeT size)
+ const SizeT size, const Bool waited)
{
- struct semaphore_info* p;
+ if (waited)
+ {
+ struct semaphore_info* p;
- p = semaphore_get_or_allocate(semaphore, size);
- thread_new_segment(tid);
- vc_copy(&p->vc, thread_get_vc(tid));
+ p = semaphore_get_or_allocate(semaphore, size);
+ thread_new_segment(tid);
+ vc_copy(&p->vc, thread_get_vc(tid));
+ }
}
void semaphore_thread_delete(const DrdThreadId threadid)
void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore,
const SizeT size);
void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
- const SizeT size);
+ const SizeT size, const Bool waited);
void semaphore_thread_delete(const DrdThreadId tid);
void semaphore_stop_using_mem(const Addr a1, const Addr a2);
void drd_semaphore_pre_post(const DrdThreadId tid, const Addr semaphore,
const SizeT size);
void drd_semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
- const SizeT size);
+ const SizeT size, const Bool waited);
void drd_barrier_init(const Addr barrier, const SizeT size, const Word count);
void drd_barrier_destroy(const Addr barrier);
/* Include directives. */
/***********************/
+#define _GNU_SOURCE
+
#include <assert.h>
#include <math.h>
#include <pthread.h>
memset(&s1, 0x55, sizeof(s1));
r= sem_wait(&s1); /* assert(r != 0); */
- /* this really ought to fail, but it doesn't. */
- r= sem_post(&s1); assert(!r);
+ /* this only fails with glibc 2.7 and later. */
+ r= sem_post(&s1);
sem_destroy(&s1);