bart | 5f57be9 | 2008-07-01 08:48:56 +0000 | [diff] [blame^] | 1 | /* |
| 2 | This file is part of drd, a data race detector. |
| 3 | |
| 4 | Copyright (C) 2006-2008 Bart Van Assche |
| 5 | bart.vanassche@gmail.com |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU General Public License as |
| 9 | published by the Free Software Foundation; either version 2 of the |
| 10 | License, or (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, but |
| 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 20 | 02111-1307, USA. |
| 21 | |
| 22 | The GNU General Public License is contained in the file COPYING. |
| 23 | */ |
| 24 | |
| 25 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 26 | #ifndef __DRD_CLIENTREQ_H |
| 27 | #define __DRD_CLIENTREQ_H |
| 28 | |
| 29 | |
bart | 3c1e9d8 | 2008-06-30 17:10:29 +0000 | [diff] [blame] | 30 | #include "drd.h" |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 31 | |
| 32 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 33 | enum { |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 34 | /* Ask drd to suppress data race reports on all currently allocated stack */ |
| 35 | /* data of the current thread. */ |
bart | 3c1e9d8 | 2008-06-30 17:10:29 +0000 | [diff] [blame] | 36 | VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK = VG_USERREQ_TOOL_BASE('D', 'r'), |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 37 | /* args: none */ |
| 38 | /* To ask the drd tool to start a new segment in the specified thread. */ |
| 39 | VG_USERREQ__DRD_START_NEW_SEGMENT, |
| 40 | /* args: POSIX thread ID. */ |
bart | bf3a60c | 2008-04-04 19:10:21 +0000 | [diff] [blame] | 41 | /* Let the drd tool stop recording memory accesses in the calling thread. */ |
| 42 | VG_USERREQ__DRD_STOP_RECORDING, |
| 43 | /* args: none. */ |
| 44 | /* Let the drd tool start recording memory accesses in the calling thread. */ |
| 45 | VG_USERREQ__DRD_START_RECORDING, |
| 46 | /* args: none. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 47 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 48 | /* Tell the core the pthread_t of the running thread */ |
| 49 | VG_USERREQ__SET_PTHREADID, |
| 50 | /* args: pthread_t. */ |
| 51 | /* Ask the core that a the thread's state transition from */ |
| 52 | /* VgTs_Zombie to VgTs_Empty is delayed until */ |
| 53 | /* VG_USERREQ__POST_THREAD_JOIN is performed. */ |
| 54 | VG_USERREQ__SET_JOINABLE, |
| 55 | /* args: pthread_t, Bool */ |
| 56 | |
| 57 | /* To notify drd that a thread finished because */ |
| 58 | /* pthread_thread_join() was called on it. */ |
| 59 | VG_USERREQ__POST_THREAD_JOIN, |
| 60 | /* args: pthread_t (joinee) */ |
| 61 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 62 | /* to notify the drd tool of a pthread_mutex_init call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 63 | VG_USERREQ__PRE_MUTEX_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 64 | /* args: Addr, MutexT */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 65 | /* to notify the drd tool of a pthread_mutex_init call. */ |
| 66 | VG_USERREQ__POST_MUTEX_INIT, |
| 67 | /* args: Addr */ |
| 68 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
| 69 | VG_USERREQ__PRE_MUTEX_DESTROY, |
| 70 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 71 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 72 | VG_USERREQ__POST_MUTEX_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 73 | /* args: Addr, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 74 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 75 | VG_USERREQ__PRE_MUTEX_LOCK, |
bart | 2e3a3c1 | 2008-03-24 08:33:47 +0000 | [diff] [blame] | 76 | /* args: Addr, MutexT, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 77 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 78 | VG_USERREQ__POST_MUTEX_LOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 79 | /* args: Addr, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 80 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 81 | VG_USERREQ__PRE_MUTEX_UNLOCK, |
| 82 | /* args: Addr */ |
| 83 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
| 84 | VG_USERREQ__POST_MUTEX_UNLOCK, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 85 | /* args: Addr */ |
| 86 | VG_USERREQ__SPIN_INIT_OR_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 87 | /* args: Addr spinlock */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 88 | |
| 89 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 90 | /* to notify the drd tool of a pthread_cond_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 91 | VG_USERREQ__PRE_COND_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 92 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 93 | /* to notify the drd tool of a pthread_cond_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 94 | VG_USERREQ__POST_COND_DESTROY, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 95 | /* args: Addr cond */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 96 | VG_USERREQ__PRE_COND_WAIT, |
| 97 | /* args: Addr cond, Addr mutex, MutexT mt */ |
| 98 | VG_USERREQ__POST_COND_WAIT, |
| 99 | /* args: Addr cond, Addr mutex, Bool took_lock*/ |
| 100 | VG_USERREQ__PRE_COND_SIGNAL, |
| 101 | /* args: Addr cond */ |
| 102 | VG_USERREQ__PRE_COND_BROADCAST, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 103 | /* args: Addr cond */ |
| 104 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 105 | /* To notify the drd tool of a sem_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 106 | VG_USERREQ__PRE_SEM_INIT, |
| 107 | /* args: Addr sem, Word pshared, Word value */ |
| 108 | /* To notify the drd tool of a sem_init call. */ |
| 109 | VG_USERREQ__POST_SEM_INIT, |
| 110 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 111 | /* To notify the drd tool of a sem_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 112 | VG_USERREQ__PRE_SEM_DESTROY, |
| 113 | /* args: Addr sem */ |
| 114 | /* To notify the drd tool of a sem_destroy call. */ |
| 115 | VG_USERREQ__POST_SEM_DESTROY, |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 116 | /* args: Addr sem */ |
| 117 | /* To notify the drd tool of a sem_wait call. */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 118 | VG_USERREQ__PRE_SEM_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 119 | /* args: Addr sem */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 120 | /* To notify the drd tool of a sem_wait call. */ |
| 121 | VG_USERREQ__POST_SEM_WAIT, |
| 122 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 123 | /* To notify the drd tool before a sem_post call. */ |
| 124 | VG_USERREQ__PRE_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 125 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 126 | /* To notify the drd tool after a sem_post call. */ |
| 127 | VG_USERREQ__POST_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 128 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 129 | |
| 130 | /* To notify the drd tool of a pthread_barrier_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 131 | VG_USERREQ__PRE_BARRIER_INIT, |
| 132 | /* args: Addr barrier, BarrierT type, Word count, Bool reinit */ |
| 133 | /* To notify the drd tool of a pthread_barrier_init call. */ |
| 134 | VG_USERREQ__POST_BARRIER_INIT, |
| 135 | /* args: Addr barrier, BarrierT type */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 136 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 137 | VG_USERREQ__PRE_BARRIER_DESTROY, |
| 138 | /* args: Addr barrier, BarrierT type. */ |
| 139 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
| 140 | VG_USERREQ__POST_BARRIER_DESTROY, |
| 141 | /* args: Addr barrier, BarrierT type. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 142 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 143 | VG_USERREQ__PRE_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 144 | /* args: Addr barrier, BarrierT type. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 145 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 146 | VG_USERREQ__POST_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 147 | /* args: Addr barrier, BarrierT type, Word has_waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 148 | |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 149 | /* To notify the drd tool of a pthread_rwlock_init call. */ |
| 150 | VG_USERREQ__PRE_RWLOCK_INIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 151 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 152 | /* To notify the drd tool of a pthread_rwlock_destroy call. */ |
| 153 | VG_USERREQ__POST_RWLOCK_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 154 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 155 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 156 | VG_USERREQ__PRE_RWLOCK_RDLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 157 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 158 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 159 | VG_USERREQ__POST_RWLOCK_RDLOCK, |
| 160 | /* args: Addr rwlock, Bool took_lock */ |
| 161 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 162 | VG_USERREQ__PRE_RWLOCK_WRLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 163 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 164 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 165 | VG_USERREQ__POST_RWLOCK_WRLOCK, |
| 166 | /* args: Addr rwlock, Bool took_lock */ |
| 167 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
bart | 777f7fe | 2008-03-02 17:43:18 +0000 | [diff] [blame] | 168 | VG_USERREQ__PRE_RWLOCK_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 169 | /* args: Addr rwlock */ |
| 170 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 171 | VG_USERREQ__POST_RWLOCK_UNLOCK |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 172 | /* args: Addr rwlock, Bool unlocked */ |
| 173 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 174 | }; |
| 175 | |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 176 | typedef enum |
| 177 | { |
bart | 635cb16 | 2008-02-28 08:30:43 +0000 | [diff] [blame] | 178 | mutex_type_invalid_mutex = 0, |
bart | 5357fcb | 2008-02-27 15:46:00 +0000 | [diff] [blame] | 179 | mutex_type_recursive_mutex = 1, |
| 180 | mutex_type_errorcheck_mutex = 2, |
| 181 | mutex_type_default_mutex = 3, |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 182 | mutex_type_spinlock = 4 |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 183 | } MutexT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 184 | |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 185 | typedef enum |
| 186 | { |
| 187 | pthread_barrier = 1, |
bart | d00bd22 | 2008-03-30 08:40:49 +0000 | [diff] [blame] | 188 | gomp_barrier = 2 |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 189 | } BarrierT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 190 | |
bart | 5f57be9 | 2008-07-01 08:48:56 +0000 | [diff] [blame^] | 191 | void drd_clientreq_init(void); |
| 192 | |
bart | 3c1e9d8 | 2008-06-30 17:10:29 +0000 | [diff] [blame] | 193 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 194 | #endif // __DRD_CLIENTREQ_H |