Yet another small self-loader fix.
[wine/multimedia.git] / server / trace.c
blob0850fd5a4ae6de94a80aabaef9512f7543f35905
1 /* File generated automatically by tools/make_requests; DO NOT EDIT!! */
3 #include <stdio.h>
4 #include <sys/types.h>
5 #include <sys/uio.h>
6 #include "server.h"
7 #include "server/thread.h"
9 static void dump_new_thread_request( struct new_thread_request *req )
11 printf( " pid=%p", req->pid );
14 static void dump_new_thread_reply( struct new_thread_reply *req )
16 printf( " tid=%p,", req->tid );
17 printf( " thandle=%d,", req->thandle );
18 printf( " pid=%p,", req->pid );
19 printf( " phandle=%d", req->phandle );
22 static void dump_init_thread_request( struct init_thread_request *req )
24 printf( " unix_pid=%d", req->unix_pid );
27 static void dump_terminate_process_request( struct terminate_process_request *req )
29 printf( " handle=%d,", req->handle );
30 printf( " exit_code=%d", req->exit_code );
33 static void dump_terminate_thread_request( struct terminate_thread_request *req )
35 printf( " handle=%d,", req->handle );
36 printf( " exit_code=%d", req->exit_code );
39 static void dump_get_process_info_request( struct get_process_info_request *req )
41 printf( " handle=%d", req->handle );
44 static void dump_get_process_info_reply( struct get_process_info_reply *req )
46 printf( " pid=%p,", req->pid );
47 printf( " exit_code=%d", req->exit_code );
50 static void dump_get_thread_info_request( struct get_thread_info_request *req )
52 printf( " handle=%d", req->handle );
55 static void dump_get_thread_info_reply( struct get_thread_info_reply *req )
57 printf( " pid=%p,", req->pid );
58 printf( " exit_code=%d", req->exit_code );
61 static void dump_close_handle_request( struct close_handle_request *req )
63 printf( " handle=%d", req->handle );
66 static void dump_dup_handle_request( struct dup_handle_request *req )
68 printf( " src_process=%d,", req->src_process );
69 printf( " src_handle=%d,", req->src_handle );
70 printf( " dst_process=%d,", req->dst_process );
71 printf( " dst_handle=%d,", req->dst_handle );
72 printf( " access=%08x,", req->access );
73 printf( " inherit=%d,", req->inherit );
74 printf( " options=%d", req->options );
77 static void dump_dup_handle_reply( struct dup_handle_reply *req )
79 printf( " handle=%d", req->handle );
82 static void dump_open_process_request( struct open_process_request *req )
84 printf( " pid=%p,", req->pid );
85 printf( " access=%08x,", req->access );
86 printf( " inherit=%d", req->inherit );
89 static void dump_open_process_reply( struct open_process_reply *req )
91 printf( " handle=%d", req->handle );
94 static void dump_select_request( struct select_request *req )
96 printf( " count=%d,", req->count );
97 printf( " flags=%d,", req->flags );
98 printf( " timeout=%d", req->timeout );
101 static void dump_select_reply( struct select_reply *req )
103 printf( " signaled=%d", req->signaled );
106 static void dump_create_event_request( struct create_event_request *req )
108 printf( " manual_reset=%d,", req->manual_reset );
109 printf( " initial_state=%d,", req->initial_state );
110 printf( " inherit=%d", req->inherit );
113 static void dump_create_event_reply( struct create_event_reply *req )
115 printf( " handle=%d", req->handle );
118 static void dump_event_op_request( struct event_op_request *req )
120 printf( " handle=%d,", req->handle );
121 printf( " op=%d", req->op );
124 static void dump_create_mutex_request( struct create_mutex_request *req )
126 printf( " owned=%d,", req->owned );
127 printf( " inherit=%d", req->inherit );
130 static void dump_create_mutex_reply( struct create_mutex_reply *req )
132 printf( " handle=%d", req->handle );
135 static void dump_release_mutex_request( struct release_mutex_request *req )
137 printf( " handle=%d", req->handle );
140 static void dump_create_semaphore_request( struct create_semaphore_request *req )
142 printf( " initial=%08x,", req->initial );
143 printf( " max=%08x,", req->max );
144 printf( " inherit=%d", req->inherit );
147 static void dump_create_semaphore_reply( struct create_semaphore_reply *req )
149 printf( " handle=%d", req->handle );
152 static void dump_release_semaphore_request( struct release_semaphore_request *req )
154 printf( " handle=%d,", req->handle );
155 printf( " count=%08x", req->count );
158 static void dump_release_semaphore_reply( struct release_semaphore_reply *req )
160 printf( " prev_count=%08x", req->prev_count );
163 static void dump_open_named_obj_request( struct open_named_obj_request *req )
165 printf( " type=%d,", req->type );
166 printf( " access=%08x,", req->access );
167 printf( " inherit=%d", req->inherit );
170 static void dump_open_named_obj_reply( struct open_named_obj_reply *req )
172 printf( " handle=%d", req->handle );
175 struct dumper
177 void (*dump_req)();
178 void (*dump_reply)();
179 unsigned int size;
182 static const struct dumper dumpers[REQ_NB_REQUESTS] =
184 { (void(*)())dump_new_thread_request,
185 (void(*)())dump_new_thread_reply,
186 sizeof(struct new_thread_request) },
187 { (void(*)())dump_init_thread_request,
188 (void(*)())0,
189 sizeof(struct init_thread_request) },
190 { (void(*)())dump_terminate_process_request,
191 (void(*)())0,
192 sizeof(struct terminate_process_request) },
193 { (void(*)())dump_terminate_thread_request,
194 (void(*)())0,
195 sizeof(struct terminate_thread_request) },
196 { (void(*)())dump_get_process_info_request,
197 (void(*)())dump_get_process_info_reply,
198 sizeof(struct get_process_info_request) },
199 { (void(*)())dump_get_thread_info_request,
200 (void(*)())dump_get_thread_info_reply,
201 sizeof(struct get_thread_info_request) },
202 { (void(*)())dump_close_handle_request,
203 (void(*)())0,
204 sizeof(struct close_handle_request) },
205 { (void(*)())dump_dup_handle_request,
206 (void(*)())dump_dup_handle_reply,
207 sizeof(struct dup_handle_request) },
208 { (void(*)())dump_open_process_request,
209 (void(*)())dump_open_process_reply,
210 sizeof(struct open_process_request) },
211 { (void(*)())dump_select_request,
212 (void(*)())dump_select_reply,
213 sizeof(struct select_request) },
214 { (void(*)())dump_create_event_request,
215 (void(*)())dump_create_event_reply,
216 sizeof(struct create_event_request) },
217 { (void(*)())dump_event_op_request,
218 (void(*)())0,
219 sizeof(struct event_op_request) },
220 { (void(*)())dump_create_mutex_request,
221 (void(*)())dump_create_mutex_reply,
222 sizeof(struct create_mutex_request) },
223 { (void(*)())dump_release_mutex_request,
224 (void(*)())0,
225 sizeof(struct release_mutex_request) },
226 { (void(*)())dump_create_semaphore_request,
227 (void(*)())dump_create_semaphore_reply,
228 sizeof(struct create_semaphore_request) },
229 { (void(*)())dump_release_semaphore_request,
230 (void(*)())dump_release_semaphore_reply,
231 sizeof(struct release_semaphore_request) },
232 { (void(*)())dump_open_named_obj_request,
233 (void(*)())dump_open_named_obj_reply,
234 sizeof(struct open_named_obj_request) },
237 static const char * const req_names[REQ_NB_REQUESTS] =
239 "new_thread",
240 "init_thread",
241 "terminate_process",
242 "terminate_thread",
243 "get_process_info",
244 "get_thread_info",
245 "close_handle",
246 "dup_handle",
247 "open_process",
248 "select",
249 "create_event",
250 "event_op",
251 "create_mutex",
252 "release_mutex",
253 "create_semaphore",
254 "release_semaphore",
255 "open_named_obj",
258 void trace_request( enum request req, void *data, int len, int fd )
260 current->last_req = req;
261 printf( "%08x: %s(", (unsigned int)current, req_names[req] );
262 dumpers[req].dump_req( data );
263 if (len > dumpers[req].size)
265 unsigned char *ptr = (unsigned char *)data + dumpers[req].size;
266 len -= dumpers[req].size;
267 while (len--) printf( ", %02x", *ptr++ );
269 if (fd != -1) printf( " ) fd=%d\n", fd );
270 else printf( " )\n" );
273 void trace_timeout(void)
275 printf( "%08x: *timeout*\n", (unsigned int)current );
278 void trace_kill( int exit_code )
280 printf( "%08x: *killed* exit_code=%d\n",
281 (unsigned int)current, exit_code );
284 void trace_reply( struct thread *thread, int type, int pass_fd,
285 struct iovec *vec, int veclen )
287 if (!thread) return;
288 printf( "%08x: %s() = %d",
289 (unsigned int)thread, req_names[thread->last_req], type );
290 if (veclen)
292 printf( " {" );
293 if (dumpers[thread->last_req].dump_reply)
295 dumpers[thread->last_req].dump_reply( vec->iov_base );
296 vec++;
297 veclen--;
299 for (; veclen; veclen--, vec++)
301 unsigned char *ptr = vec->iov_base;
302 int len = vec->iov_len;
303 while (len--) printf( ", %02x", *ptr++ );
305 printf( " }" );
307 if (pass_fd != -1) printf( " fd=%d\n", pass_fd );
308 else printf( "\n" );