Helgrind: add suppression for libnss from getaddrinfo
[valgrind.git] / drd / drd_clientreq.h
blobe87927d0d1f4bb6faab5f7109ab63df1d02c75c1
1 /*
2 This file is part of drd, a thread error detector.
4 Copyright (C) 2006-2020 Bart Van Assche <bvanassche@acm.org>.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
19 The GNU General Public License is contained in the file COPYING.
24 * This header file contains the tool-internal interface for the code that
25 * processes client requests.
29 #ifndef __DRD_CLIENTREQ_H
30 #define __DRD_CLIENTREQ_H
33 #include "drd.h"
34 #include "drd_basics.h" /* DRD_() */
38 * While the client requests defined in the header file "drd.h" define a
39 * public interface between client programs and the DRD tool, the client
40 * requests defined below are a tool-internal interface. These last client
41 * requests must only be used by the source code in the various *_intercepts.c
42 * source files.
44 enum {
45 /* Declare the address and size of a variable with value
46 * PTHREAD_COND_INITIALIZER.
48 VG_USERREQ_DRD_SET_PTHREAD_COND_INITIALIZER = VG_USERREQ_TOOL_BASE('D', 'r'),
49 /* args: address, size. */
51 /* To ask the drd tool to start a new segment in the specified thread. */
52 VG_USERREQ_DRD_START_NEW_SEGMENT,
53 /* args: POSIX thread ID. */
55 /* Tell drd the pthread_t of the running thread. */
56 VG_USERREQ_DRD_SET_PTHREADID,
57 /* args: pthread_t. */
58 /* Ask drd that a the thread's state transition from */
59 /* VgTs_Zombie to VgTs_Empty is delayed until */
60 /* VG_USERREQ__POST_THREAD_JOIN is performed. */
61 VG_USERREQ_DRD_SET_JOINABLE,
62 /* args: pthread_t, Bool */
64 /* Tell DRD that the calling thread is about to enter pthread_create(). */
65 VG_USERREQ_DRD_ENTERING_PTHREAD_CREATE,
66 /* args: (none) */
67 /* Tell DRD that the calling thread has left pthread_create(). */
68 VG_USERREQ_DRD_LEFT_PTHREAD_CREATE,
69 /* args: (none) */
71 /* To notify drd that a thread finished because */
72 /* pthread_thread_join() was called on it. */
73 VG_USERREQ_DRD_POST_THREAD_JOIN,
74 /* args: pthread_t (joinee) */
76 /* To notify drd before a pthread_cancel call. */
77 VG_USERREQ_DRD_PRE_THREAD_CANCEL,
78 /* args: pthread_t */
79 /* To notify drd after a pthread_cancel call. */
80 VG_USERREQ_DRD_POST_THREAD_CANCEL,
81 /* args: pthread_t, Bool */
83 /* to notify the drd tool of a pthread_mutex_init call. */
84 VG_USERREQ_DRD_PRE_MUTEX_INIT,
85 /* args: Addr, MutexT */
86 /* to notify the drd tool of a pthread_mutex_init call. */
87 VG_USERREQ_DRD_POST_MUTEX_INIT,
88 /* args: Addr */
89 /* to notify the drd tool of a pthread_mutex_destroy call. */
90 VG_USERREQ_DRD_PRE_MUTEX_DESTROY,
91 /* args: Addr */
92 /* to notify the drd tool of a pthread_mutex_destroy call. */
93 VG_USERREQ_DRD_POST_MUTEX_DESTROY,
94 /* args: Addr, MutexT */
95 /* to notify the drd tool of pthread_mutex_lock calls */
96 VG_USERREQ_DRD_PRE_MUTEX_LOCK,
97 /* args: Addr, MutexT, Bool */
98 /* to notify the drd tool of pthread_mutex_lock calls */
99 VG_USERREQ_DRD_POST_MUTEX_LOCK,
100 /* args: Addr, Bool */
101 /* to notify the drd tool of pthread_mutex_unlock calls */
102 VG_USERREQ_DRD_PRE_MUTEX_UNLOCK,
103 /* args: Addr */
104 /* to notify the drd tool of pthread_mutex_unlock calls */
105 VG_USERREQ_DRD_POST_MUTEX_UNLOCK,
106 /* args: Addr */
107 /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
108 VG_USERREQ_DRD_PRE_SPIN_INIT_OR_UNLOCK,
109 /* args: Addr */
110 /* to notify the drd tool of a pthread_spin_init/pthread_spin_unlock call */
111 VG_USERREQ_DRD_POST_SPIN_INIT_OR_UNLOCK,
112 /* args: Addr */
115 /* to notify the drd tool of a pthread_cond_init call. */
116 VG_USERREQ_DRD_PRE_COND_INIT,
117 /* args: Addr */
118 /* to notify the drd tool of a pthread_cond_init call. */
119 VG_USERREQ_DRD_POST_COND_INIT,
120 /* args: Addr */
121 /* to notify the drd tool of a pthread_cond_destroy call. */
122 VG_USERREQ_DRD_PRE_COND_DESTROY,
123 /* args: Addr */
124 /* to notify the drd tool of a pthread_cond_destroy call. */
125 VG_USERREQ_DRD_POST_COND_DESTROY,
126 /* args: Addr cond, Bool destroy_succeeded */
127 VG_USERREQ_DRD_PRE_COND_WAIT,
128 /* args: Addr cond, Addr mutex, MutexT mt */
129 VG_USERREQ_DRD_POST_COND_WAIT,
130 /* args: Addr cond, Addr mutex, Bool took_lock*/
131 VG_USERREQ_DRD_PRE_COND_SIGNAL,
132 /* args: Addr cond */
133 VG_USERREQ_DRD_POST_COND_SIGNAL,
134 /* args: Addr cond */
135 VG_USERREQ_DRD_PRE_COND_BROADCAST,
136 /* args: Addr cond */
137 VG_USERREQ_DRD_POST_COND_BROADCAST,
138 /* args: Addr cond */
140 /* To notify the drd tool of a sem_init call. */
141 VG_USERREQ_DRD_PRE_SEM_INIT,
142 /* args: Addr sem, Word pshared, Word value */
143 /* To notify the drd tool of a sem_init call. */
144 VG_USERREQ_DRD_POST_SEM_INIT,
145 /* args: Addr sem */
146 /* To notify the drd tool of a sem_destroy call. */
147 VG_USERREQ_DRD_PRE_SEM_DESTROY,
148 /* args: Addr sem */
149 /* To notify the drd tool of a sem_destroy call. */
150 VG_USERREQ_DRD_POST_SEM_DESTROY,
151 /* args: Addr sem */
152 /* To notify the drd tool of a sem_open call. */
153 VG_USERREQ_DRD_PRE_SEM_OPEN,
154 /* args: Addr name, Word oflag, Word mode, Word value */
155 /* To notify the drd tool of a sem_open call. */
156 VG_USERREQ_DRD_POST_SEM_OPEN,
157 /* args: Addr sem, Word oflag, Word mode, Word value */
158 /* To notify the drd tool of a sem_close call. */
159 VG_USERREQ_DRD_PRE_SEM_CLOSE,
160 /* args: Addr sem */
161 /* To notify the drd tool of a sem_close call. */
162 VG_USERREQ_DRD_POST_SEM_CLOSE,
163 /* args: Addr sem */
164 /* To notify the drd tool of a sem_wait call. */
165 VG_USERREQ_DRD_PRE_SEM_WAIT,
166 /* args: Addr sem */
167 /* To notify the drd tool of a sem_wait call. */
168 VG_USERREQ_DRD_POST_SEM_WAIT,
169 /* args: Addr sem, Bool waited */
170 /* To notify the drd tool before a sem_post call. */
171 VG_USERREQ_DRD_PRE_SEM_POST,
172 /* args: Addr sem */
173 /* To notify the drd tool after a sem_post call. */
174 VG_USERREQ_DRD_POST_SEM_POST,
175 /* args: Addr sem, Bool waited */
177 /* To notify the drd tool of a pthread_barrier_init call. */
178 VG_USERREQ_DRD_PRE_BARRIER_INIT,
179 /* args: Addr barrier, BarrierT type, Word count, Bool reinit */
180 /* To notify the drd tool of a pthread_barrier_init call. */
181 VG_USERREQ_DRD_POST_BARRIER_INIT,
182 /* args: Addr barrier, BarrierT type */
183 /* To notify the drd tool of a pthread_barrier_destroy call. */
184 VG_USERREQ_DRD_PRE_BARRIER_DESTROY,
185 /* args: Addr barrier, BarrierT type. */
186 /* To notify the drd tool of a pthread_barrier_destroy call. */
187 VG_USERREQ_DRD_POST_BARRIER_DESTROY,
188 /* args: Addr barrier, BarrierT type. */
189 /* To notify the drd tool of a pthread_barrier_wait call. */
190 VG_USERREQ_DRD_PRE_BARRIER_WAIT,
191 /* args: Addr barrier, BarrierT type. */
192 /* To notify the drd tool of a pthread_barrier_wait call. */
193 VG_USERREQ_DRD_POST_BARRIER_WAIT,
194 /* args: Addr barrier, BarrierT type, Word has_waited, Word serializing */
196 /* To notify the drd tool of a pthread_rwlock_init call. */
197 VG_USERREQ_DRD_PRE_RWLOCK_INIT,
198 /* args: Addr rwlock */
199 /* To notify the drd tool of a pthread_rwlock_init call. */
200 VG_USERREQ_DRD_POST_RWLOCK_INIT,
201 /* args: Addr rwlock */
202 /* To notify the drd tool of a pthread_rwlock_destroy call. */
203 VG_USERREQ_DRD_PRE_RWLOCK_DESTROY,
204 /* args: Addr rwlock, RwLockT */
205 /* To notify the drd tool of a pthread_rwlock_destroy call. */
206 VG_USERREQ_DRD_POST_RWLOCK_DESTROY,
207 /* args: Addr rwlock, RwLockT */
208 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
209 VG_USERREQ_DRD_PRE_RWLOCK_RDLOCK,
210 /* args: Addr rwlock, RwLockT */
211 /* To notify the drd tool of a pthread_rwlock_rdlock call. */
212 VG_USERREQ_DRD_POST_RWLOCK_RDLOCK,
213 /* args: Addr rwlock, RwLockT, Bool took_lock */
214 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
215 VG_USERREQ_DRD_PRE_RWLOCK_WRLOCK,
216 /* args: Addr rwlock, RwLockT */
217 /* To notify the drd tool of a pthread_rwlock_wrlock call. */
218 VG_USERREQ_DRD_POST_RWLOCK_WRLOCK,
219 /* args: Addr rwlock, RwLockT, Bool took_lock */
220 /* To notify the drd tool of a pthread_rwlock_unlock call. */
221 VG_USERREQ_DRD_PRE_RWLOCK_UNLOCK,
222 /* args: Addr rwlock, RwLockT */
223 /* To notify the drd tool of a pthread_rwlock_unlock call. */
224 VG_USERREQ_DRD_POST_RWLOCK_UNLOCK
225 /* args: Addr rwlock, RwLockT, Bool unlocked */
227 #if defined(VGO_solaris)
229 /* To notify the drd tool of a bind_guard call from runtime linker. */
230 VG_USERREQ_DRD_RTLD_BIND_GUARD,
231 /* args: Int flags */
232 /* To notify the drd tool of a bind_clear call from runtime linker. */
233 VG_USERREQ_DRD_RTLD_BIND_CLEAR
234 /* args: Int flags */
235 #endif /* VGO_solaris */
239 * Error checking on POSIX recursive mutexes, POSIX error checking mutexes,
240 * POSIX default mutexes and POSIX spinlocks happens the code in drd_mutex.c.
241 * The values defined below specify the mutex type.
243 typedef enum {
244 mutex_type_unknown = -1,
245 mutex_type_invalid_mutex = 0,
246 mutex_type_recursive_mutex = 1,
247 mutex_type_errorcheck_mutex = 2,
248 mutex_type_default_mutex = 3,
249 mutex_type_spinlock = 4,
250 mutex_type_cxa_guard = 5,
251 } MutexT;
254 * Error checking on POSIX reader/writer locks and user-defined reader/writer
255 * locks happens by the code in drd_rwlock.c. The values defined below specify
256 * the rwlock type.
258 typedef enum {
259 pthread_rwlock = 1,
260 user_rwlock = 2,
261 } RwLockT;
264 * Error checking on POSIX barriers and GOMP barriers happens by the same
265 * code. The integer values defined below specify the type of a barrier with
266 * a given client address.
268 typedef enum {
269 pthread_barrier = 1,
270 gomp_barrier = 2,
271 } BarrierT;
274 extern Bool DRD_(g_free_is_write);
276 void DRD_(clientreq_init)(void);
279 #endif // __DRD_CLIENTREQ_H