blob: 1a569f6927cba4c54e5b3dc5a31a30db1bf25bc0 [file] [log] [blame]
sewardjaf44c822007-11-25 14:01:38 +00001#ifndef __DRD_CLIENTREQ_H
2#define __DRD_CLIENTREQ_H
3
4
5#include "valgrind.h" // VG_USERREQ_TOOL_BASE()
6
7
8enum {
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,
bart5e85d262008-03-01 10:49:37 +000019 /* args: start address, end address */
sewardjaf44c822007-11-25 14:01:38 +000020 /* To tell the drd tool no longer to suppress data race detection on the */
21 /* specified address range. */
22 VG_USERREQ__DRD_FINISH_SUPPRESSION,
bart5e85d262008-03-01 10:49:37 +000023 /* args: start address, end address */
sewardjaf44c822007-11-25 14:01:38 +000024 /* 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. */
bart5bd9f2d2008-03-03 20:31:58 +000031 /* To ask the drd tool to trace all accesses to the specified address. */
32 VG_USERREQ__DRD_TRACE_ADDR,
33 /* args: Addr. */
sewardjaf44c822007-11-25 14:01:38 +000034
sewardjaf44c822007-11-25 14:01:38 +000035 /* Tell the core the pthread_t of the running thread */
36 VG_USERREQ__SET_PTHREADID,
37 /* args: pthread_t. */
38 /* Ask the core that a the thread's state transition from */
39 /* VgTs_Zombie to VgTs_Empty is delayed until */
40 /* VG_USERREQ__POST_THREAD_JOIN is performed. */
41 VG_USERREQ__SET_JOINABLE,
42 /* args: pthread_t, Bool */
43
44 /* To notify drd that a thread finished because */
45 /* pthread_thread_join() was called on it. */
46 VG_USERREQ__POST_THREAD_JOIN,
47 /* args: pthread_t (joinee) */
48
sewardj85642922008-01-14 11:54:56 +000049 /* to notify the drd tool of a pthread_mutex_init call. */
sewardjaf44c822007-11-25 14:01:38 +000050 VG_USERREQ__PRE_MUTEX_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000051 /* args: Addr, MutexT */
sewardj85642922008-01-14 11:54:56 +000052 /* to notify the drd tool of a pthread_mutex_destroy call. */
sewardjaf44c822007-11-25 14:01:38 +000053 VG_USERREQ__POST_MUTEX_DESTROY,
sewardj721ad7b2007-11-30 08:30:29 +000054 /* args: Addr, SizeT, MutexT */
sewardj85642922008-01-14 11:54:56 +000055 /* to notify the drd tool of pthread_mutex_lock calls */
sewardjaf44c822007-11-25 14:01:38 +000056 VG_USERREQ__PRE_PTHREAD_MUTEX_LOCK,
sewardj721ad7b2007-11-30 08:30:29 +000057 /* args: Addr, SizeT, MutexT */
sewardj85642922008-01-14 11:54:56 +000058 /* to notify the drd tool of pthread_mutex_lock calls */
sewardjaf44c822007-11-25 14:01:38 +000059 VG_USERREQ__POST_PTHREAD_MUTEX_LOCK,
bart00344642008-03-01 15:27:41 +000060 /* args: Addr, Bool */
sewardj85642922008-01-14 11:54:56 +000061 /* to notify the drd tool of pthread_mutex_unlock calls */
sewardjaf44c822007-11-25 14:01:38 +000062 VG_USERREQ__PRE_PTHREAD_MUTEX_UNLOCK,
63 /* args: Addr */
64 VG_USERREQ__SPIN_INIT_OR_UNLOCK,
65 /* args: Addr spinlock, SizeT size */
66
67
sewardj85642922008-01-14 11:54:56 +000068 /* to notify the drd tool of a pthread_cond_init call. */
bart72b751c2008-03-01 13:44:24 +000069 VG_USERREQ__PRE_PTHREAD_COND_INIT,
sewardj721ad7b2007-11-30 08:30:29 +000070 /* args: Addr */
sewardj85642922008-01-14 11:54:56 +000071 /* to notify the drd tool of a pthread_cond_destroy call. */
bart72b751c2008-03-01 13:44:24 +000072 VG_USERREQ__POST_PTHREAD_COND_DESTROY,
bart3b1ee452008-02-29 19:28:15 +000073 /* args: Addr cond, SizeT cond_size, Addr mutex, SizeT mutex_size,MutexT mt*/
sewardjaf44c822007-11-25 14:01:38 +000074 VG_USERREQ__PRE_PTHREAD_COND_WAIT,
bart5357fcb2008-02-27 15:46:00 +000075 /* args: Addr cond, SizeT cond_size, Addr mutex, MutexT mt */
sewardjaf44c822007-11-25 14:01:38 +000076 VG_USERREQ__POST_PTHREAD_COND_WAIT,
bart00344642008-03-01 15:27:41 +000077 /* args: Addr cond, Addr mutex, Bool took_lock*/
sewardjaf44c822007-11-25 14:01:38 +000078 VG_USERREQ__PRE_PTHREAD_COND_SIGNAL,
79 /* args: Addr cond */
80 VG_USERREQ__PRE_PTHREAD_COND_BROADCAST,
81 /* args: Addr cond */
82
sewardj85642922008-01-14 11:54:56 +000083 /* To notify the drd tool of a sem_init call. */
84 VG_USERREQ__SEM_INIT,
85 /* args: Addr sem, SizeT sem_size, Word pshared, Word value */
86 /* To notify the drd tool of a sem_destroy call. */
87 VG_USERREQ__SEM_DESTROY,
88 /* args: Addr sem */
89 /* To notify the drd tool of a sem_wait call. */
bart28230a32008-02-29 17:27:03 +000090 VG_USERREQ__PRE_SEM_WAIT,
sewardj85642922008-01-14 11:54:56 +000091 /* args: Addr sem, SizeT sem_size */
bart28230a32008-02-29 17:27:03 +000092 /* To notify the drd tool of a sem_wait call. */
93 VG_USERREQ__POST_SEM_WAIT,
94 /* args: Addr sem, Bool waited */
sewardj85642922008-01-14 11:54:56 +000095 /* To notify the drd tool before a sem_post call. */
96 VG_USERREQ__PRE_SEM_POST,
97 /* args: Addr sem, SizeT sem_size */
98 /* To notify the drd tool after a sem_post call. */
99 VG_USERREQ__POST_SEM_POST,
sewardje3b57aa2008-01-18 07:42:01 +0000100 /* args: Addr sem, SizeT sem_size, Bool waited */
sewardj85642922008-01-14 11:54:56 +0000101
102 /* To notify the drd tool of a pthread_barrier_init call. */
103 VG_USERREQ__BARRIER_INIT,
104 /* args: Addr barrier, SizeT barrier_size, Word count */
105 /* To notify the drd tool of a pthread_barrier_destroy call. */
106 VG_USERREQ__BARRIER_DESTROY,
107 /* args: Addr barrier */
108 /* To notify the drd tool of a pthread_barrier_wait call. */
109 VG_USERREQ__PRE_BARRIER_WAIT,
110 /* args: Addr barrier */
111 /* To notify the drd tool of a pthread_barrier_wait call. */
112 VG_USERREQ__POST_BARRIER_WAIT,
113 /* args: Addr barrier, Word has_waited */
114
bart00344642008-03-01 15:27:41 +0000115 /* To notify the drd tool of a pthread_rwlock_init call. */
116 VG_USERREQ__PRE_RWLOCK_INIT,
117 /* args: Addr rwlock, SizeT size */
118 /* To notify the drd tool of a pthread_rwlock_destroy call. */
119 VG_USERREQ__POST_RWLOCK_DESTROY,
120 /* args: Addr rwlock, SizeT size */
121 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
122 VG_USERREQ__PRE_RWLOCK_RDLOCK,
123 /* args: Addr rwlock, SizeT size */
124 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
125 VG_USERREQ__POST_RWLOCK_RDLOCK,
126 /* args: Addr rwlock, Bool took_lock */
127 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
128 VG_USERREQ__PRE_RWLOCK_WRLOCK,
129 /* args: Addr rwlock, SizeT size */
130 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
131 VG_USERREQ__POST_RWLOCK_WRLOCK,
132 /* args: Addr rwlock, Bool took_lock */
133 /* To notify the drd tool of a pthread_rwlock_unlock call. */
bart777f7fe2008-03-02 17:43:18 +0000134 VG_USERREQ__PRE_RWLOCK_UNLOCK,
bart00344642008-03-01 15:27:41 +0000135 /* args: Addr rwlock, Bool unlocked */
136
sewardjaf44c822007-11-25 14:01:38 +0000137};
138
sewardj721ad7b2007-11-30 08:30:29 +0000139typedef enum
140{
bart635cb162008-02-28 08:30:43 +0000141 mutex_type_invalid_mutex = 0,
bart5357fcb2008-02-27 15:46:00 +0000142 mutex_type_recursive_mutex = 1,
143 mutex_type_errorcheck_mutex = 2,
144 mutex_type_default_mutex = 3,
145 mutex_type_spinlock = 4,
sewardj721ad7b2007-11-30 08:30:29 +0000146} MutexT;
sewardjaf44c822007-11-25 14:01:38 +0000147
148
149#endif // __DRD_CLIENTREQ_H