]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/drd/drd_clientreq.h
f059c6683959de9c99f729155ac4fa1974280342
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / drd / drd_clientreq.h
1 /* -*- mode: C; c-basic-offset: 3; -*- */
2 /*
3   This file is part of drd, a thread error detector.
4
5   Copyright (C) 2006-2010 Bart Van Assche <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
26 /*
27  * This header file contains the tool-internal interface for the code that
28  * processes client requests.
29  */
30
31
32 #ifndef __DRD_CLIENTREQ_H
33 #define __DRD_CLIENTREQ_H
34
35
36 #include "drd.h"
37 #include "drd_basics.h" /* DRD_() */
38
39
40 /*
41  * While the client requests defined in the header file "drd.h" define a
42  * public interface between client programs and the DRD tool, the client
43  * requests defined below are a tool-internal interface. These last client
44  * requests must only be used by the source code in the various *_intercepts.c
45  * source files.
46  */
47 enum {
48    /* To ask the drd tool to start a new segment in the specified thread. */
49    VG_USERREQ__DRD_START_NEW_SEGMENT = VG_USERREQ_TOOL_BASE('D', 'r'),
50    /* args: POSIX thread ID. */
51
52    /* Tell drd the pthread_t of the running thread. */
53    VG_USERREQ__SET_PTHREADID,
54    /* args: pthread_t. */
55    /* Ask drd that a the thread's state transition from */
56    /* VgTs_Zombie to VgTs_Empty is delayed until */
57    /* VG_USERREQ__POST_THREAD_JOIN is performed. */
58    VG_USERREQ__SET_JOINABLE,
59    /* args: pthread_t, Bool */
60
61    /* Tell DRD that the calling thread is about to enter pthread_create(). */
62    VG_USERREQ__ENTERING_PTHREAD_CREATE,
63    /* args: (none) */
64    /* Tell DRD that the calling thread has left pthread_create(). */
65    VG_USERREQ__LEFT_PTHREAD_CREATE,
66    /* args: (none) */
67
68    /* To notify drd that a thread finished because */
69    /* pthread_thread_join() was called on it. */
70    VG_USERREQ__POST_THREAD_JOIN,
71    /* args: pthread_t (joinee) */
72
73    /* To notify drd before a pthread_cancel call. */
74    VG_USERREQ__PRE_THREAD_CANCEL,
75    /* args: pthread_t */
76    /* To notify drd after a pthread_cancel call. */
77    VG_USERREQ__POST_THREAD_CANCEL,
78    /* args: pthread_t, Bool */
79
80    /* to notify the drd tool of a pthread_mutex_init call. */
81    VG_USERREQ__PRE_MUTEX_INIT,
82    /* args: Addr, MutexT */
83    /* to notify the drd tool of a pthread_mutex_init call. */
84    VG_USERREQ__POST_MUTEX_INIT,
85    /* args: Addr */
86    /* to notify the drd tool of a pthread_mutex_destroy call. */
87    VG_USERREQ__PRE_MUTEX_DESTROY,
88    /* args: Addr */
89    /* to notify the drd tool of a pthread_mutex_destroy call. */
90    VG_USERREQ__POST_MUTEX_DESTROY,
91    /* args: Addr, MutexT */
92    /* to notify the drd tool of pthread_mutex_lock calls */
93    VG_USERREQ__PRE_MUTEX_LOCK,
94    /* args: Addr, MutexT, Bool */
95    /* to notify the drd tool of pthread_mutex_lock calls */
96    VG_USERREQ__POST_MUTEX_LOCK,
97    /* args: Addr, Bool */
98    /* to notify the drd tool of pthread_mutex_unlock calls */
99    VG_USERREQ__PRE_MUTEX_UNLOCK,
100    /* args: Addr */
101    /* to notify the drd tool of pthread_mutex_unlock calls */
102    VG_USERREQ__POST_MUTEX_UNLOCK,
103    /* args: Addr */
104    /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
105    VG_USERREQ__PRE_SPIN_INIT_OR_UNLOCK,
106    /* args: Addr */
107    /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
108    VG_USERREQ__POST_SPIN_INIT_OR_UNLOCK,
109    /* args: Addr */
110
111
112    /* to notify the drd tool of a pthread_cond_init call. */
113    VG_USERREQ__PRE_COND_INIT,
114    /* args: Addr */
115    /* to notify the drd tool of a pthread_cond_init call. */
116    VG_USERREQ__POST_COND_INIT,
117    /* args: Addr */
118    /* to notify the drd tool of a pthread_cond_destroy call. */
119    VG_USERREQ__PRE_COND_DESTROY,
120    /* args: Addr */
121    /* to notify the drd tool of a pthread_cond_destroy call. */
122    VG_USERREQ__POST_COND_DESTROY,
123    /* args: Addr */
124    VG_USERREQ__PRE_COND_WAIT,
125    /* args: Addr cond, Addr mutex, MutexT mt */
126    VG_USERREQ__POST_COND_WAIT,
127    /* args: Addr cond, Addr mutex, Bool took_lock*/
128    VG_USERREQ__PRE_COND_SIGNAL,
129    /* args: Addr cond */
130    VG_USERREQ__POST_COND_SIGNAL,
131    /* args: Addr cond */
132    VG_USERREQ__PRE_COND_BROADCAST,
133    /* args: Addr cond */
134    VG_USERREQ__POST_COND_BROADCAST,
135    /* args: Addr cond */
136
137    /* To notify the drd tool of a sem_init call. */
138    VG_USERREQ__PRE_SEM_INIT,
139    /* args: Addr sem, Word pshared, Word value */
140    /* To notify the drd tool of a sem_init call. */
141    VG_USERREQ__POST_SEM_INIT,
142    /* args: Addr sem */
143    /* To notify the drd tool of a sem_destroy call. */
144    VG_USERREQ__PRE_SEM_DESTROY,
145    /* args: Addr sem */
146    /* To notify the drd tool of a sem_destroy call. */
147    VG_USERREQ__POST_SEM_DESTROY,
148    /* args: Addr sem */
149    /* To notify the drd tool of a sem_open call. */
150    VG_USERREQ__PRE_SEM_OPEN,
151    /* args: Addr name, Word oflag, Word mode, Word value */
152    /* To notify the drd tool of a sem_open call. */
153    VG_USERREQ__POST_SEM_OPEN,
154    /* args: Addr sem, Word oflag, Word mode, Word value */
155    /* To notify the drd tool of a sem_close call. */
156    VG_USERREQ__PRE_SEM_CLOSE,
157    /* args: Addr sem */
158    /* To notify the drd tool of a sem_close call. */
159    VG_USERREQ__POST_SEM_CLOSE,
160    /* args: Addr sem */
161    /* To notify the drd tool of a sem_wait call. */
162    VG_USERREQ__PRE_SEM_WAIT,
163    /* args: Addr sem */
164    /* To notify the drd tool of a sem_wait call. */
165    VG_USERREQ__POST_SEM_WAIT,
166    /* args: Addr sem, Bool waited */
167    /* To notify the drd tool before a sem_post call. */
168    VG_USERREQ__PRE_SEM_POST,
169    /* args: Addr sem */
170    /* To notify the drd tool after a sem_post call. */
171    VG_USERREQ__POST_SEM_POST,
172    /* args: Addr sem, Bool waited */
173
174    /* To notify the drd tool of a pthread_barrier_init call. */
175    VG_USERREQ__PRE_BARRIER_INIT,
176    /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
177    /* To notify the drd tool of a pthread_barrier_init call. */
178    VG_USERREQ__POST_BARRIER_INIT,
179    /* args: Addr barrier, BarrierT type */
180    /* To notify the drd tool of a pthread_barrier_destroy call. */
181    VG_USERREQ__PRE_BARRIER_DESTROY,
182    /* args: Addr barrier, BarrierT type. */
183    /* To notify the drd tool of a pthread_barrier_destroy call. */
184    VG_USERREQ__POST_BARRIER_DESTROY,
185    /* args: Addr barrier, BarrierT type. */
186    /* To notify the drd tool of a pthread_barrier_wait call. */
187    VG_USERREQ__PRE_BARRIER_WAIT,
188    /* args: Addr barrier, BarrierT type. */
189    /* To notify the drd tool of a pthread_barrier_wait call. */
190    VG_USERREQ__POST_BARRIER_WAIT,
191    /* args: Addr barrier, BarrierT type, Word has_waited, Word serializing */
192
193    /* To notify the drd tool of a pthread_rwlock_init call. */
194    VG_USERREQ__PRE_RWLOCK_INIT,
195    /* args: Addr rwlock, RwLockT */
196    /* To notify the drd tool of a pthread_rwlock_destroy call. */
197    VG_USERREQ__POST_RWLOCK_DESTROY,
198    /* args: Addr rwlock, RwLockT */
199    /* To notify the drd tool of a pthread_rwlock_rdlock call. */
200    VG_USERREQ__PRE_RWLOCK_RDLOCK,
201    /* args: Addr rwlock, RwLockT */
202    /* To notify the drd tool of a pthread_rwlock_rdlock call. */
203    VG_USERREQ__POST_RWLOCK_RDLOCK,
204    /* args: Addr rwlock, RwLockT, Bool took_lock */
205    /* To notify the drd tool of a pthread_rwlock_wrlock call. */
206    VG_USERREQ__PRE_RWLOCK_WRLOCK,
207    /* args: Addr rwlock, RwLockT */
208    /* To notify the drd tool of a pthread_rwlock_wrlock call. */
209    VG_USERREQ__POST_RWLOCK_WRLOCK,
210    /* args: Addr rwlock, RwLockT, Bool took_lock */
211    /* To notify the drd tool of a pthread_rwlock_unlock call. */
212    VG_USERREQ__PRE_RWLOCK_UNLOCK,
213    /* args: Addr rwlock, RwLockT */
214    /* To notify the drd tool of a pthread_rwlock_unlock call. */
215    VG_USERREQ__POST_RWLOCK_UNLOCK
216    /* args: Addr rwlock, RwLockT, Bool unlocked */
217
218 };
219
220 /**
221  * Error checking on POSIX recursive mutexes, POSIX error checking mutexes,
222  * POSIX default mutexes and POSIX spinlocks happens the code in drd_mutex.c.
223  * The values defined below specify the mutex type.
224  */
225 typedef enum {
226    mutex_type_unknown          = -1,
227    mutex_type_invalid_mutex    = 0,
228    mutex_type_recursive_mutex  = 1,
229    mutex_type_errorcheck_mutex = 2,
230    mutex_type_default_mutex    = 3,
231    mutex_type_spinlock         = 4,
232 } MutexT;
233
234 /**
235  * Error checking on POSIX reader/writer locks and user-defined reader/writer
236  * locks happens by the code in drd_rwlock.c. The values defined below specify
237  * the rwlock type.
238  */
239 typedef enum {
240    pthread_rwlock = 1,
241    user_rwlock    = 2,
242 } RwLockT;
243
244 /*
245  * Error checking on POSIX barriers and GOMP barriers happens by the same
246  * code. The integer values defined below specify the type of a barrier with
247  * a given client address.
248  */
249 typedef enum {
250    pthread_barrier = 1,
251    gomp_barrier    = 2,
252 } BarrierT;
253
254
255 void DRD_(clientreq_init)(void);
256
257
258 #endif //  __DRD_CLIENTREQ_H