sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 1 | #ifndef __DRD_CLIENTREQ_H |
| 2 | #define __DRD_CLIENTREQ_H |
| 3 | |
| 4 | |
| 5 | #include "valgrind.h" // VG_USERREQ_TOOL_BASE() |
| 6 | |
| 7 | |
| 8 | enum { |
| 9 | /* Ask the core the thread ID assigned by Valgrind. */ |
| 10 | VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D', 'R'), |
| 11 | /* args: none. */ |
| 12 | /* Set the name of the thread that performs this client request. */ |
| 13 | VG_USERREQ__SET_THREAD_NAME, |
| 14 | /* args: null-terminated character string. */ |
| 15 | |
| 16 | /* To tell the drd tool to suppress data race detection on the specified */ |
| 17 | /* address range. */ |
| 18 | VG_USERREQ__DRD_START_SUPPRESSION, |
bart | 5e85d26 | 2008-03-01 10:49:37 +0000 | [diff] [blame] | 19 | /* args: start address, end address */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 20 | /* To tell the drd tool no longer to suppress data race detection on the */ |
| 21 | /* specified address range. */ |
| 22 | VG_USERREQ__DRD_FINISH_SUPPRESSION, |
bart | 5e85d26 | 2008-03-01 10:49:37 +0000 | [diff] [blame] | 23 | /* args: start address, end address */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 24 | /* Ask drd to suppress data race reports on all currently allocated stack */ |
| 25 | /* data of the current thread. */ |
| 26 | VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK, |
| 27 | /* args: none */ |
| 28 | /* To ask the drd tool to start a new segment in the specified thread. */ |
| 29 | VG_USERREQ__DRD_START_NEW_SEGMENT, |
| 30 | /* args: POSIX thread ID. */ |
| 31 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 32 | /* Tell the core the pthread_t of the running thread */ |
| 33 | VG_USERREQ__SET_PTHREADID, |
| 34 | /* args: pthread_t. */ |
| 35 | /* Ask the core that a the thread's state transition from */ |
| 36 | /* VgTs_Zombie to VgTs_Empty is delayed until */ |
| 37 | /* VG_USERREQ__POST_THREAD_JOIN is performed. */ |
| 38 | VG_USERREQ__SET_JOINABLE, |
| 39 | /* args: pthread_t, Bool */ |
| 40 | |
| 41 | /* To notify drd that a thread finished because */ |
| 42 | /* pthread_thread_join() was called on it. */ |
| 43 | VG_USERREQ__POST_THREAD_JOIN, |
| 44 | /* args: pthread_t (joinee) */ |
| 45 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 46 | /* to notify the drd tool of a pthread_mutex_init call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 47 | VG_USERREQ__PRE_MUTEX_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 48 | /* args: Addr, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 49 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 50 | VG_USERREQ__POST_MUTEX_DESTROY, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 51 | /* args: Addr, SizeT, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 52 | /* to notify the drd tool of pthread_mutex_lock calls */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 53 | VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 54 | /* args: Addr, SizeT, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 55 | /* to notify the drd tool of pthread_mutex_lock calls */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 56 | VG_USERREQ__POST_PTHREAD_MUTEX_LOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame^] | 57 | /* args: Addr, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 58 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 59 | VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK, |
| 60 | /* args: Addr */ |
| 61 | VG_USERREQ__SPIN_INIT_OR_UNLOCK, |
| 62 | /* args: Addr spinlock, SizeT size */ |
| 63 | |
| 64 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 65 | /* to notify the drd tool of a pthread_cond_init call. */ |
bart | 72b751c | 2008-03-01 13:44:24 +0000 | [diff] [blame] | 66 | VG_USERREQ__PRE_PTHREAD_COND_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 67 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 68 | /* to notify the drd tool of a pthread_cond_destroy call. */ |
bart | 72b751c | 2008-03-01 13:44:24 +0000 | [diff] [blame] | 69 | VG_USERREQ__POST_PTHREAD_COND_DESTROY, |
bart | 3b1ee45 | 2008-02-29 19:28:15 +0000 | [diff] [blame] | 70 | /* args: Addr cond, SizeT cond_size, Addr mutex, SizeT mutex_size,MutexT mt*/ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 71 | VG_USERREQ__PRE_PTHREAD_COND_WAIT, |
bart | 5357fcb | 2008-02-27 15:46:00 +0000 | [diff] [blame] | 72 | /* args: Addr cond, SizeT cond_size, Addr mutex, MutexT mt */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 73 | VG_USERREQ__POST_PTHREAD_COND_WAIT, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame^] | 74 | /* args: Addr cond, Addr mutex, Bool took_lock*/ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 75 | VG_USERREQ__PRE_PTHREAD_COND_SIGNAL, |
| 76 | /* args: Addr cond */ |
| 77 | VG_USERREQ__PRE_PTHREAD_COND_BROADCAST, |
| 78 | /* args: Addr cond */ |
| 79 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 80 | /* To notify the drd tool of a sem_init call. */ |
| 81 | VG_USERREQ__SEM_INIT, |
| 82 | /* args: Addr sem, SizeT sem_size, Word pshared, Word value */ |
| 83 | /* To notify the drd tool of a sem_destroy call. */ |
| 84 | VG_USERREQ__SEM_DESTROY, |
| 85 | /* args: Addr sem */ |
| 86 | /* To notify the drd tool of a sem_wait call. */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 87 | VG_USERREQ__PRE_SEM_WAIT, |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 88 | /* args: Addr sem, SizeT sem_size */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 89 | /* To notify the drd tool of a sem_wait call. */ |
| 90 | VG_USERREQ__POST_SEM_WAIT, |
| 91 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 92 | /* To notify the drd tool before a sem_post call. */ |
| 93 | VG_USERREQ__PRE_SEM_POST, |
| 94 | /* args: Addr sem, SizeT sem_size */ |
| 95 | /* To notify the drd tool after a sem_post call. */ |
| 96 | VG_USERREQ__POST_SEM_POST, |
sewardj | e3b57aa | 2008-01-18 07:42:01 +0000 | [diff] [blame] | 97 | /* args: Addr sem, SizeT sem_size, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 98 | |
| 99 | /* To notify the drd tool of a pthread_barrier_init call. */ |
| 100 | VG_USERREQ__BARRIER_INIT, |
| 101 | /* args: Addr barrier, SizeT barrier_size, Word count */ |
| 102 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
| 103 | VG_USERREQ__BARRIER_DESTROY, |
| 104 | /* args: Addr barrier */ |
| 105 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 106 | VG_USERREQ__PRE_BARRIER_WAIT, |
| 107 | /* args: Addr barrier */ |
| 108 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 109 | VG_USERREQ__POST_BARRIER_WAIT, |
| 110 | /* args: Addr barrier, Word has_waited */ |
| 111 | |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame^] | 112 | /* To notify the drd tool of a pthread_rwlock_init call. */ |
| 113 | VG_USERREQ__PRE_RWLOCK_INIT, |
| 114 | /* args: Addr rwlock, SizeT size */ |
| 115 | /* To notify the drd tool of a pthread_rwlock_destroy call. */ |
| 116 | VG_USERREQ__POST_RWLOCK_DESTROY, |
| 117 | /* args: Addr rwlock, SizeT size */ |
| 118 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 119 | VG_USERREQ__PRE_RWLOCK_RDLOCK, |
| 120 | /* args: Addr rwlock, SizeT size */ |
| 121 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 122 | VG_USERREQ__POST_RWLOCK_RDLOCK, |
| 123 | /* args: Addr rwlock, Bool took_lock */ |
| 124 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 125 | VG_USERREQ__PRE_RWLOCK_WRLOCK, |
| 126 | /* args: Addr rwlock, SizeT size */ |
| 127 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 128 | VG_USERREQ__POST_RWLOCK_WRLOCK, |
| 129 | /* args: Addr rwlock, Bool took_lock */ |
| 130 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
| 131 | VG_USERREQ__POST_RWLOCK_UNLOCK, |
| 132 | /* args: Addr rwlock, Bool unlocked */ |
| 133 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 134 | }; |
| 135 | |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 136 | typedef enum |
| 137 | { |
bart | 635cb16 | 2008-02-28 08:30:43 +0000 | [diff] [blame] | 138 | mutex_type_invalid_mutex = 0, |
bart | 5357fcb | 2008-02-27 15:46:00 +0000 | [diff] [blame] | 139 | mutex_type_recursive_mutex = 1, |
| 140 | mutex_type_errorcheck_mutex = 2, |
| 141 | mutex_type_default_mutex = 3, |
| 142 | mutex_type_spinlock = 4, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 143 | } MutexT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 144 | |
| 145 | |
| 146 | #endif // __DRD_CLIENTREQ_H |