Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make SimGrid compile again :)
[simgrid.git] / src / simix / smx_smurf.c
1 #include "smx_private.h"
2 #include "xbt/fifo.h"
3 #include "xbt/xbt_os_thread.h"
4 #include "../mc/mc_private.h"
5
6 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_smurf, simix,
7                                 "Logging specific to SIMIX (SMURF)");
8
9 XBT_INLINE smx_simcall_t SIMIX_simcall_mine()
10 {
11   smx_process_t issuer = SIMIX_process_self();
12   return &issuer->simcall;
13 }
14
15 /**
16  * \brief Makes the current process do a simcall to the kernel and yields
17  * until completion. If the current thread is maestro, we don't yield and
18  * execute the simcall directly.
19  * \param self the current process
20  */
21 void SIMIX_simcall_push(smx_process_t self)
22 {
23   if (self != simix_global->maestro_process) {
24     XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
25               SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
26     SIMIX_process_yield(self);
27   } else {
28     XBT_DEBUG("I'm the maestro, execute the simcall directly");
29     SIMIX_simcall_pre(&self->simcall, 0);
30   }
31 }
32
33 void SIMIX_simcall_answer(smx_simcall_t simcall)
34 {
35   if (simcall->issuer != simix_global->maestro_process){
36     XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call,
37         simcall->issuer->name, simcall->issuer);
38     simcall->issuer->simcall.call = SIMCALL_NONE;
39 /*    This check should be useless and slows everyone. Reactivate if you see something
40  *    weird in process scheduling.
41  */
42 /*    if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer))) */
43     xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer);
44 /*    else DIE_IMPOSSIBLE; */
45   }
46 }
47
48 void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
49 {
50   XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
51
52   switch (simcall->call) {
53     case SIMCALL_COMM_TEST:
54       SIMIX_pre_comm_test(simcall);
55       break;
56
57     case SIMCALL_COMM_TESTANY:
58       SIMIX_pre_comm_testany(simcall, value);
59       break;
60
61     case SIMCALL_COMM_WAIT:
62       SIMIX_pre_comm_wait(simcall,
63           simcall->comm_wait.comm,
64           simcall->comm_wait.timeout,
65           value);
66       break;
67
68     case SIMCALL_COMM_WAITANY:
69       SIMIX_pre_comm_waitany(simcall, value);
70       break;
71
72     case SIMCALL_COMM_SEND:
73     {
74       smx_action_t comm = SIMIX_comm_isend(
75           simcall->issuer,
76           simcall->comm_send.rdv,
77           simcall->comm_send.task_size,
78           simcall->comm_send.rate,
79           simcall->comm_send.src_buff,
80           simcall->comm_send.src_buff_size,
81           simcall->comm_send.match_fun,
82           NULL, /* no clean function since it's not detached */
83           simcall->comm_send.data,
84           0);
85       SIMIX_pre_comm_wait(simcall, comm, simcall->comm_send.timeout, 0);
86       break;
87     }
88
89     case SIMCALL_COMM_ISEND:
90       simcall->comm_isend.result = SIMIX_comm_isend(
91           simcall->issuer,
92           simcall->comm_isend.rdv,
93           simcall->comm_isend.task_size,
94           simcall->comm_isend.rate,
95           simcall->comm_isend.src_buff,
96           simcall->comm_isend.src_buff_size,
97           simcall->comm_isend.match_fun,
98           simcall->comm_isend.clean_fun,
99           simcall->comm_isend.data,
100           simcall->comm_isend.detached);
101       SIMIX_simcall_answer(simcall);
102       break;
103
104     case SIMCALL_COMM_RECV:
105     {
106       smx_action_t comm = SIMIX_comm_irecv(
107           simcall->issuer,
108           simcall->comm_recv.rdv,
109           simcall->comm_recv.dst_buff,
110           simcall->comm_recv.dst_buff_size,
111           simcall->comm_recv.match_fun,
112           simcall->comm_recv.data);
113       SIMIX_pre_comm_wait(simcall, comm, simcall->comm_recv.timeout, 0);
114       break;
115     }
116
117     case SIMCALL_COMM_IRECV:
118       simcall->comm_irecv.result = SIMIX_comm_irecv(
119           simcall->issuer,
120           simcall->comm_irecv.rdv,
121           simcall->comm_irecv.dst_buff,
122           simcall->comm_irecv.dst_buff_size,
123           simcall->comm_irecv.match_fun,
124           simcall->comm_irecv.data);
125       SIMIX_simcall_answer(simcall);
126       break;
127
128     case SIMCALL_COMM_IPROBE:
129       simcall->comm_iprobe.result = SIMIX_comm_iprobe(
130           simcall->issuer,
131           simcall->comm_iprobe.rdv,
132           simcall->comm_iprobe.src,
133           simcall->comm_iprobe.tag,
134           simcall->comm_iprobe.match_fun,
135           simcall->comm_iprobe.data);
136       SIMIX_simcall_answer(simcall);
137       break;
138
139     case SIMCALL_COMM_DESTROY:
140       SIMIX_comm_destroy(simcall->comm_destroy.comm);
141       SIMIX_simcall_answer(simcall);
142       break;
143
144     case SIMCALL_COMM_CANCEL:
145       SIMIX_comm_cancel(simcall->comm_cancel.comm);
146       SIMIX_simcall_answer(simcall);
147       break;
148
149     case SIMCALL_COMM_GET_REMAINS:
150       simcall->comm_get_remains.result =
151           SIMIX_comm_get_remains(simcall->comm_get_remains.comm);
152       SIMIX_simcall_answer(simcall);
153       break;
154
155     case SIMCALL_COMM_GET_STATE:
156       simcall->comm_get_state.result =
157           SIMIX_comm_get_state(simcall->comm_get_state.comm);
158       SIMIX_simcall_answer(simcall);
159       break;
160
161     case SIMCALL_COMM_GET_SRC_DATA:
162       simcall->comm_get_src_data.result = SIMIX_comm_get_src_data(simcall->comm_get_src_data.comm);
163       SIMIX_simcall_answer(simcall);
164       break;
165
166     case SIMCALL_COMM_GET_DST_DATA:
167       simcall->comm_get_dst_data.result = SIMIX_comm_get_dst_data(simcall->comm_get_dst_data.comm);
168       SIMIX_simcall_answer(simcall);
169       break;
170
171     case SIMCALL_COMM_GET_SRC_PROC:
172       simcall->comm_get_src_proc.result =
173           SIMIX_comm_get_src_proc(simcall->comm_get_src_proc.comm);
174       SIMIX_simcall_answer(simcall);
175       break;
176
177     case SIMCALL_COMM_GET_DST_PROC:
178       simcall->comm_get_dst_proc.result =
179           SIMIX_comm_get_dst_proc(simcall->comm_get_dst_proc.comm);
180       SIMIX_simcall_answer(simcall);
181       break;
182
183 #ifdef HAVE_LATENCY_BOUND_TRACKING
184     case SIMCALL_COMM_IS_LATENCY_BOUNDED:
185       simcall->comm_is_latency_bounded.result =
186           SIMIX_comm_is_latency_bounded(simcall->comm_is_latency_bounded.comm);
187       SIMIX_simcall_answer(simcall);
188       break;
189 #endif
190
191     case SIMCALL_RDV_CREATE:
192       simcall->rdv_create.result = SIMIX_rdv_create(simcall->rdv_create.name);
193       SIMIX_simcall_answer(simcall);
194       break;
195
196     case SIMCALL_RDV_DESTROY:
197       SIMIX_rdv_destroy(simcall->rdv_destroy.rdv);
198       SIMIX_simcall_answer(simcall);
199       break;
200
201     case SIMCALL_RDV_GET_BY_NAME:
202       simcall->rdv_get_by_name.result =
203         SIMIX_rdv_get_by_name(simcall->rdv_get_by_name.name);
204       SIMIX_simcall_answer(simcall);
205       break;
206
207     case SIMCALL_RDV_COMM_COUNT_BY_HOST:
208       simcall->rdv_comm_count_by_host.result = SIMIX_rdv_comm_count_by_host(
209           simcall->rdv_comm_count_by_host.rdv,
210           simcall->rdv_comm_count_by_host.host);
211       SIMIX_simcall_answer(simcall);
212       break;
213
214     case SIMCALL_RDV_GET_HEAD:
215       simcall->rdv_get_head.result = SIMIX_rdv_get_head(simcall->rdv_get_head.rdv);
216       SIMIX_simcall_answer(simcall);
217       break;
218
219     case SIMCALL_RDV_SET_RECV:
220       SIMIX_rdv_set_receiver(simcall->rdv_set_rcv_proc.rdv, simcall->rdv_set_rcv_proc.receiver);
221       SIMIX_simcall_answer(simcall);
222       break;
223
224     case SIMCALL_RDV_GET_RECV:
225       simcall->rdv_get_rcv_proc.result = SIMIX_rdv_get_receiver(simcall->rdv_set_rcv_proc.rdv);
226       SIMIX_simcall_answer(simcall);
227       break;
228
229     case SIMCALL_HOST_GET_BY_NAME:
230       simcall->host_get_by_name.result =
231         SIMIX_host_get_by_name(simcall->args);
232       SIMIX_simcall_answer(simcall);
233       break;
234
235     case SIMCALL_HOST_GET_NAME:
236       simcall->host_get_name.result =  SIMIX_host_get_name(simcall->args);
237       SIMIX_simcall_answer(simcall);
238       break;
239
240     case SIMCALL_HOST_GET_PROPERTIES:
241       simcall->host_get_properties.result =
242         SIMIX_host_get_properties(simcall->args);
243       SIMIX_simcall_answer(simcall);
244       break;
245
246     case SIMCALL_HOST_GET_SPEED:
247       simcall->host_get_speed.result = 
248         SIMIX_host_get_speed(simcall->args);
249       SIMIX_simcall_answer(simcall);
250       break;
251
252     case SIMCALL_HOST_GET_AVAILABLE_SPEED:
253       simcall->host_get_available_speed.result =
254         SIMIX_host_get_available_speed(simcall->args);
255       SIMIX_simcall_answer(simcall);
256       break;
257
258     case SIMCALL_HOST_GET_STATE:
259       simcall->host_get_state.result = 
260         SIMIX_host_get_state(simcall->args);
261       SIMIX_simcall_answer(simcall);
262       break;
263
264     case SIMCALL_HOST_GET_DATA:
265       simcall->host_get_data.result =  SIMIX_host_get_data(simcall->args);
266       SIMIX_simcall_answer(simcall);
267       break;
268
269     case SIMCALL_HOST_SET_DATA:
270       SIMIX_host_set_data(SIMIX_pack_args(PTR(simcall->host_set_data.host), PTR(simcall->host_set_data.data)));
271       SIMIX_simcall_answer(simcall);
272       break;
273
274     case SIMCALL_HOST_EXECUTE:
275       simcall->host_execute.result = simcall_table[simcall->call](simcall->args);
276       SIMIX_simcall_answer(simcall);
277       break;
278
279     case SIMCALL_HOST_PARALLEL_EXECUTE:
280       simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(simcall->args);
281       SIMIX_simcall_answer(simcall);
282       break;
283
284     case SIMCALL_HOST_EXECUTION_DESTROY:
285       SIMIX_host_execution_destroy(simcall->args);
286       SIMIX_simcall_answer(simcall);
287       break;
288
289     case SIMCALL_HOST_EXECUTION_CANCEL:
290       SIMIX_host_execution_cancel(simcall->args);
291       SIMIX_simcall_answer(simcall);
292       break;
293
294     case SIMCALL_HOST_EXECUTION_GET_REMAINS:
295       simcall->host_execution_get_remains.result =
296         SIMIX_host_execution_get_remains(simcall->args);
297       SIMIX_simcall_answer(simcall);
298       break;
299
300     case SIMCALL_HOST_EXECUTION_GET_STATE:
301       simcall->host_execution_get_state.result =
302         SIMIX_host_execution_get_state(simcall->args);
303       SIMIX_simcall_answer(simcall);
304       break;
305
306     case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
307       SIMIX_host_execution_set_priority(simcall->args);
308       SIMIX_simcall_answer(simcall);
309       break;
310
311     case SIMCALL_HOST_EXECUTION_WAIT:
312       SIMIX_pre_host_execution_wait(simcall->args);
313       break;
314
315     case SIMCALL_PROCESS_CREATE:
316       SIMIX_process_create(
317           simcall->process_create.process,
318     simcall->process_create.name,
319     simcall->process_create.code,
320     simcall->process_create.data,
321     simcall->process_create.hostname,
322     simcall->process_create.kill_time,
323     simcall->process_create.argc,
324     simcall->process_create.argv,
325     simcall->process_create.properties,
326     simcall->process_create.auto_restart);
327       SIMIX_simcall_answer(simcall);
328       break;
329
330     case SIMCALL_PROCESS_KILL:
331       SIMIX_process_kill(simcall->process_kill.process,simcall->issuer);
332       SIMIX_simcall_answer(simcall);
333       break;
334
335     case SIMCALL_PROCESS_KILLALL:
336       SIMIX_process_killall(simcall->issuer);
337       SIMIX_simcall_answer(simcall);
338       break;
339
340     case SIMCALL_PROCESS_CLEANUP:
341       SIMIX_process_cleanup(simcall->process_cleanup.process);
342       SIMIX_simcall_answer(simcall);
343       break;
344
345     case SIMCALL_PROCESS_CHANGE_HOST:
346       SIMIX_pre_process_change_host(
347           simcall->process_change_host.process,
348           simcall->process_change_host.dest);
349       SIMIX_simcall_answer(simcall);
350       break;
351
352     case SIMCALL_PROCESS_SUSPEND:
353       SIMIX_pre_process_suspend(simcall);
354       break;
355
356     case SIMCALL_PROCESS_RESUME:
357       SIMIX_process_resume(simcall->process_resume.process, simcall->issuer);
358       SIMIX_simcall_answer(simcall);
359       break;
360
361     case SIMCALL_PROCESS_COUNT:
362       simcall->process_count.result = SIMIX_process_count();
363       SIMIX_simcall_answer(simcall);
364       break;
365
366     case SIMCALL_PROCESS_GET_DATA:
367       simcall->process_get_data.result =
368         SIMIX_process_get_data(simcall->process_get_data.process);
369       SIMIX_simcall_answer(simcall);
370       break;
371     case SIMCALL_PROCESS_ON_EXIT:
372       SIMIX_process_on_exit(simcall->process_on_exit.process,
373                             simcall->process_on_exit.fun,
374                             simcall->process_on_exit.data);
375       SIMIX_simcall_answer(simcall);
376     break;
377     case SIMCALL_PROCESS_RESTART:
378       simcall->process_restart.result = SIMIX_process_restart(simcall->process_restart.process, simcall->issuer);
379       SIMIX_simcall_answer(simcall);
380     break;
381     case SIMCALL_PROCESS_AUTO_RESTART_SET:
382       SIMIX_process_auto_restart_set(simcall->process_auto_restart.process,simcall->process_auto_restart.auto_restart);
383       SIMIX_simcall_answer(simcall);
384     break;
385     case SIMCALL_PROCESS_SET_DATA:
386       SIMIX_process_set_data(
387     simcall->process_set_data.process,
388     simcall->process_set_data.data);
389       SIMIX_simcall_answer(simcall);
390       break;
391
392     case SIMCALL_PROCESS_GET_HOST:
393       simcall->process_get_host.result = SIMIX_process_get_host(simcall->process_get_host.process);
394       SIMIX_simcall_answer(simcall);
395       break;
396
397     case SIMCALL_PROCESS_GET_NAME:
398       simcall->process_get_name.result = SIMIX_process_get_name(simcall->process_get_name.process);
399       SIMIX_simcall_answer(simcall);
400       break;
401
402     case SIMCALL_PROCESS_IS_SUSPENDED:
403       simcall->process_is_suspended.result =
404         SIMIX_process_is_suspended(simcall->process_is_suspended.process);
405       SIMIX_simcall_answer(simcall);
406       break;
407
408     case SIMCALL_PROCESS_GET_PROPERTIES:
409       simcall->process_get_properties.result =
410         SIMIX_process_get_properties(simcall->process_get_properties.process);
411       SIMIX_simcall_answer(simcall);
412       break;
413
414     case SIMCALL_PROCESS_SLEEP:
415       SIMIX_pre_process_sleep(simcall);
416       break;
417
418 #ifdef HAVE_TRACING
419     case SIMCALL_SET_CATEGORY:
420       SIMIX_set_category(
421           simcall->set_category.action,
422           simcall->set_category.category);
423       SIMIX_simcall_answer(simcall);
424       break;
425 #endif
426
427     case SIMCALL_MUTEX_INIT:
428       simcall->mutex_init.result = SIMIX_mutex_init();
429       SIMIX_simcall_answer(simcall);
430       break;
431
432     case SIMCALL_MUTEX_DESTROY:
433       SIMIX_mutex_destroy(simcall->mutex_destroy.mutex);
434       SIMIX_simcall_answer(simcall);
435       break;
436
437     case SIMCALL_MUTEX_LOCK:
438       SIMIX_pre_mutex_lock(simcall);
439       break;
440
441     case SIMCALL_MUTEX_TRYLOCK:
442       simcall->mutex_trylock.result =
443         SIMIX_mutex_trylock(simcall->mutex_trylock.mutex, simcall->issuer);
444       SIMIX_simcall_answer(simcall);
445       break;
446
447     case SIMCALL_MUTEX_UNLOCK:
448       SIMIX_mutex_unlock(simcall->mutex_unlock.mutex, simcall->issuer);
449       SIMIX_simcall_answer(simcall);
450       break;
451
452     case SIMCALL_COND_INIT:
453       simcall->cond_init.result = SIMIX_cond_init();
454       SIMIX_simcall_answer(simcall);
455       break;
456
457     case SIMCALL_COND_DESTROY:
458       SIMIX_cond_destroy(simcall->cond_destroy.cond);
459       SIMIX_simcall_answer(simcall);
460       break;
461
462     case SIMCALL_COND_SIGNAL:
463       SIMIX_cond_signal(simcall->cond_signal.cond);
464       SIMIX_simcall_answer(simcall);
465       break;
466
467     case SIMCALL_COND_WAIT:
468       SIMIX_pre_cond_wait(simcall);
469       break;
470
471     case SIMCALL_COND_WAIT_TIMEOUT:
472       SIMIX_pre_cond_wait_timeout(simcall);
473       break;
474
475     case SIMCALL_COND_BROADCAST:
476       SIMIX_cond_broadcast(simcall->cond_broadcast.cond);
477       SIMIX_simcall_answer(simcall);
478       break;
479
480     case SIMCALL_SEM_INIT:
481       simcall->sem_init.result = SIMIX_sem_init(simcall->sem_init.capacity);
482       SIMIX_simcall_answer(simcall);
483       break;
484
485     case SIMCALL_SEM_DESTROY:
486       SIMIX_sem_destroy(simcall->sem_destroy.sem);
487       SIMIX_simcall_answer(simcall);
488       break;
489
490     case SIMCALL_SEM_RELEASE:
491       SIMIX_sem_release(simcall->sem_release.sem);
492       SIMIX_simcall_answer(simcall);
493       break;
494
495     case SIMCALL_SEM_WOULD_BLOCK:
496       simcall->sem_would_block.result =
497         SIMIX_sem_would_block(simcall->sem_would_block.sem);
498       SIMIX_simcall_answer(simcall);
499       break;
500
501     case SIMCALL_SEM_ACQUIRE:
502       SIMIX_pre_sem_acquire(simcall);
503       break;
504
505     case SIMCALL_SEM_ACQUIRE_TIMEOUT:
506       SIMIX_pre_sem_acquire_timeout(simcall);
507       break;
508
509     case SIMCALL_SEM_GET_CAPACITY:
510       simcall->sem_get_capacity.result = 
511         SIMIX_sem_get_capacity(simcall->sem_get_capacity.sem);
512       SIMIX_simcall_answer(simcall);
513       break;
514
515     case SIMCALL_FILE_READ:
516       SIMIX_pre_file_read(simcall);
517       break;
518
519     case SIMCALL_FILE_WRITE:
520       SIMIX_pre_file_write(simcall);
521       break;
522
523     case SIMCALL_FILE_OPEN:
524       SIMIX_pre_file_open(simcall);
525       break;
526
527     case SIMCALL_FILE_CLOSE:
528       SIMIX_pre_file_close(simcall);
529       break;
530
531     case SIMCALL_FILE_STAT:
532       SIMIX_pre_file_stat(simcall);
533       break;
534
535     case SIMCALL_FILE_UNLINK:
536       SIMIX_pre_file_unlink(simcall);
537       break;
538
539     case SIMCALL_FILE_LS:
540       SIMIX_pre_file_ls(simcall);
541       break;
542
543     case SIMCALL_ASR_GET_PROPERTIES:
544       simcall->asr_get_properties.result =
545         SIMIX_asr_get_properties(simcall->asr_get_properties.name);
546       SIMIX_simcall_answer(simcall);
547       break;
548
549 #ifdef HAVE_MC
550     case SIMCALL_MC_SNAPSHOT:
551       simcall->mc_snapshot.s = MC_take_snapshot();
552       SIMIX_simcall_answer(simcall);
553       break;
554
555     case SIMCALL_MC_COMPARE_SNAPSHOTS:
556       simcall->mc_compare_snapshots.result =
557         snapshot_compare(simcall->mc_compare_snapshots.snapshot1, simcall->mc_compare_snapshots.snapshot2, NULL, NULL);
558       SIMIX_simcall_answer(simcall);
559       break;
560 #endif /* HAVE_MC */
561
562     case SIMCALL_NONE:
563       THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
564           SIMIX_process_get_name(simcall->issuer),
565           SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))
566           );
567       break;
568
569     /* ****************************************************************************************** */
570     /* TUTORIAL: New API                                                                        */
571     /* ****************************************************************************************** */
572     case SIMCALL_NEW_API_INIT:
573       SIMIX_pre_new_api_fct(simcall);
574       break;
575   }
576 }
577
578 void SIMIX_simcall_post(smx_action_t action)
579 {
580   switch (action->type) {
581
582     case SIMIX_ACTION_EXECUTE:
583     case SIMIX_ACTION_PARALLEL_EXECUTE:
584       SIMIX_post_host_execute(action);
585       break;
586
587     case SIMIX_ACTION_COMMUNICATE:
588       SIMIX_post_comm(action);
589       break;
590
591     case SIMIX_ACTION_SLEEP:
592       SIMIX_post_process_sleep(action);
593       break;
594
595     case SIMIX_ACTION_SYNCHRO:
596       SIMIX_post_synchro(action);
597       break;
598
599     case SIMIX_ACTION_IO:
600       SIMIX_post_io(action);
601       break;
602
603     /* ****************************************************************************************** */
604     /* TUTORIAL: New API                                                                        */
605     /* ****************************************************************************************** */
606     case SIMIX_ACTION_NEW_API:
607       SIMIX_post_new_api(action);
608       break;
609   }
610 }
611
612 /* New Simcal interface */
613
614 /* FIXME: add types for every simcall */
615 const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" };
616
617 simcall_handler_t simcall_table[NUM_SIMCALLS] = {
618 #undef SIMCALL_ENUM_ELEMENT
619 #define SIMCALL_ENUM_ELEMENT(x,y) &y /* generate strings from the enumeration values */
620 SIMCALL_LIST
621 #undef SIMCALL_ENUM_ELEMENT
622 };
623
624
625 void SIMIX_simcall_typecheck(const char *fmt, ...)
626 {
627   return;
628 }
629
630 void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args)
631 {
632   smx_process_t self = SIMIX_process_self();
633   self->simcall.call = simcall_id;
634   self->simcall.args = args;
635
636   if (self != simix_global->maestro_process) {
637     XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
638               SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
639
640     SIMIX_process_yield(self);
641   } else {
642
643     SIMIX_simcall_pre(&self->simcall, 0);
644   }
645 }
646
647 /* New Simcal interface */
648
649 /* FIXME: add types for every simcall */
650 const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p", [SIMCALL_HOST_EXECUTION_WAIT] = "%p%p" };
651
652
653 simcall_handler_t simcall_table[NUM_SIMCALLS] = {
654 #undef SIMCALL_ENUM_ELEMENT
655 #define SIMCALL_ENUM_ELEMENT(x,y) &y /* generate strings from the enumeration values */
656 SIMCALL_LIST
657 #undef SIMCALL_ENUM_ELEMENT
658 };
659
660
661 void SIMIX_simcall_typecheck(const char *fmt, ...)
662 {
663   return;
664 }
665
666 void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args)
667 {
668   smx_process_t self = SIMIX_process_self();
669   self->simcall.call = simcall_id;
670   self->simcall.args = args;
671
672   if (self != simix_global->maestro_process) {
673     XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
674               SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
675
676     SIMIX_process_yield(self);
677   } else {
678
679     SIMIX_simcall_pre(&self->simcall, 0);
680   }
681 }