Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please codacy: use long form of negation in C++
[simgrid.git] / src / simix / libsmx.cpp
1 /* libsmx.c - public interface to simix                                       */
2 /* --------                                                                   */
3 /* These functions are the only ones that are visible from the higher levels  */
4 /* (most of them simply add some documentation to the generated simcall body) */
5 /*                                                                            */
6 /* This is somehow the "libc" of SimGrid                                      */
7
8 /* Copyright (c) 2010-2015. The SimGrid Team.
9  * All rights reserved.                                                     */
10
11 /* This program is free software; you can redistribute it and/or modify it
12  * under the terms of the license (GNU LGPL) which comes with this package. */
13
14 #include <cmath>         /* std::isfinite() */
15
16 #include <functional>
17
18 #include <xbt/functional.hpp>
19
20 #include <simgrid/s4u/VirtualMachine.hpp>
21 #include <simgrid/simix/blocking_simcall.hpp>
22
23 #include "mc/mc.h"
24 #include "smx_private.h"
25 #include "src/kernel/activity/SynchroComm.hpp"
26 #include "src/mc/mc_forward.hpp"
27 #include "src/mc/mc_replay.h"
28 #include "src/plugins/vm/VirtualMachineImpl.hpp"
29 #include "src/simix/smx_host_private.h"
30 #include "xbt/ex.h"
31
32 #include <simgrid/simix.hpp>
33
34 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
35
36 #include "popping_bodies.cpp"
37
38 void simcall_call(smx_actor_t actor)
39 {
40   if (actor != simix_global->maestro_process) {
41     XBT_DEBUG("Yield actor '%s' on simcall %s (%d)", actor->cname(), SIMIX_simcall_name(actor->simcall.call),
42               (int)actor->simcall.call);
43     SIMIX_process_yield(actor);
44   } else {
45     SIMIX_simcall_handle(&actor->simcall, 0);
46   }
47 }
48
49 /**
50  * \ingroup simix_process_management
51  * \brief Creates a synchro that executes some computation of an host.
52  *
53  * This function creates a SURF action and allocates the data necessary
54  * to create the SIMIX synchro. It can raise a host_error exception if the host crashed.
55  *
56  * \param name Name of the execution synchro to create
57  * \param flops_amount amount Computation amount (in flops)
58  * \param priority computation priority
59  * \param bound
60  * \return A new SIMIX execution synchronization
61  */
62 smx_activity_t simcall_execution_start(const char *name,
63                                     double flops_amount,
64                                     double priority, double bound)
65 {
66   /* checking for infinite values */
67   xbt_assert(std::isfinite(flops_amount), "flops_amount is not finite!");
68   xbt_assert(std::isfinite(priority), "priority is not finite!");
69
70   return simcall_BODY_execution_start(name, flops_amount, priority, bound);
71 }
72
73 /**
74  * \ingroup simix_process_management
75  * \brief Creates a synchro that may involve parallel computation on
76  * several hosts and communication between them.
77  *
78  * \param name Name of the execution synchro to create
79  * \param host_nb Number of hosts where the synchro will be executed
80  * \param host_list Array (of size host_nb) of hosts where the synchro will be executed
81  * \param flops_amount Array (of size host_nb) of computation amount of hosts (in bytes)
82  * \param bytes_amount Array (of size host_nb * host_nb) representing the communication
83  * amount between each pair of hosts
84  * \param amount the SURF action amount
85  * \param rate the SURF action rate
86  * \param timeout timeout
87  * \return A new SIMIX execution synchronization
88  */
89 smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list,
90                                                 double* flops_amount, double* bytes_amount, double amount, double rate,
91                                                 double timeout)
92 {
93   /* checking for infinite values */
94   for (int i = 0 ; i < host_nb ; ++i) {
95     xbt_assert(std::isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i);
96     if (bytes_amount != nullptr) {
97       for (int j = 0 ; j < host_nb ; ++j) {
98         xbt_assert(std::isfinite(bytes_amount[i + host_nb * j]),
99                    "bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j);
100       }
101     }
102   }
103
104   xbt_assert(std::isfinite(amount), "amount is not finite!");
105   xbt_assert(std::isfinite(rate), "rate is not finite!");
106
107   return simcall_BODY_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate,
108                                                timeout);
109 }
110
111 /**
112  * \ingroup simix_process_management
113  * \brief Cancels an execution synchro.
114  *
115  * This functions stops the execution. It calls a surf function.
116  * \param execution The execution synchro to cancel
117  */
118 void simcall_execution_cancel(smx_activity_t execution)
119 {
120   simcall_BODY_execution_cancel(execution);
121 }
122
123 /**
124  * \ingroup simix_process_management
125  * \brief Changes the priority of an execution synchro.
126  *
127  * This functions changes the priority only. It calls a surf function.
128  * \param execution The execution synchro
129  * \param priority The new priority
130  */
131 void simcall_execution_set_priority(smx_activity_t execution, double priority)
132 {
133   /* checking for infinite values */
134   xbt_assert(std::isfinite(priority), "priority is not finite!");
135
136   simcall_BODY_execution_set_priority(execution, priority);
137 }
138
139 /**
140  * \ingroup simix_process_management
141  * \brief Changes the capping (the maximum CPU utilization) of an execution synchro.
142  *
143  * This functions changes the capping only. It calls a surf function.
144  * \param execution The execution synchro
145  * \param bound The new bound
146  */
147 void simcall_execution_set_bound(smx_activity_t execution, double bound)
148 {
149   simcall_BODY_execution_set_bound(execution, bound);
150 }
151
152 /**
153  * \ingroup simix_host_management
154  * \brief Waits for the completion of an execution synchro and destroy it.
155  *
156  * \param execution The execution synchro
157  */
158 e_smx_state_t simcall_execution_wait(smx_activity_t execution)
159 {
160   return (e_smx_state_t) simcall_BODY_execution_wait(execution);
161 }
162
163 /**
164  * \ingroup simix_process_management
165  * \brief Kills a SIMIX process.
166  *
167  * This function simply kills a  process.
168  *
169  * \param process poor victim
170  */
171 void simcall_process_kill(smx_actor_t process)
172 {
173   simcall_BODY_process_kill(process);
174 }
175
176 /**
177  * \ingroup simix_process_management
178  * \brief Kills all SIMIX processes.
179  */
180 void simcall_process_killall(int reset_pid)
181 {
182   simcall_BODY_process_killall(reset_pid);
183 }
184
185 /**
186  * \ingroup simix_process_management
187  * \brief Cleans up a SIMIX process.
188  * \param process poor victim (must have already been killed)
189  */
190 void simcall_process_cleanup(smx_actor_t process)
191 {
192   simcall_BODY_process_cleanup(process);
193 }
194
195 /**
196  * \ingroup simix_process_management
197  * \brief Migrates an agent to another location.
198  *
199  * This function changes the value of the host on which \a process is running.
200  *
201  * \param process the process to migrate
202  * \param dest name of the new host
203  */
204 void simcall_process_set_host(smx_actor_t process, sg_host_t dest)
205 {
206   simcall_BODY_process_set_host(process, dest);
207 }
208
209 void simcall_process_join(smx_actor_t process, double timeout)
210 {
211   simcall_BODY_process_join(process, timeout);
212 }
213
214 /**
215  * \ingroup simix_process_management
216  * \brief Suspends a process.
217  *
218  * This function suspends the process by suspending the synchro
219  * it was waiting for completion.
220  *
221  * \param process a SIMIX process
222  */
223 void simcall_process_suspend(smx_actor_t process)
224 {
225   simcall_BODY_process_suspend(process);
226 }
227
228 /**
229  * \ingroup simix_process_management
230  * \brief Resumes a suspended process.
231  *
232  * This function resumes a suspended process by resuming the synchro
233  * it was waiting for completion.
234  *
235  * \param process a SIMIX process
236  */
237 void simcall_process_resume(smx_actor_t process)
238 {
239   simcall_BODY_process_resume(process);
240 }
241
242 /**
243  * \ingroup simix_process_management
244  * \brief Returns the amount of SIMIX processes in the system
245  *
246  * Maestro internal process is not counted, only user code processes are
247  */
248 int simcall_process_count()
249 {
250   return simgrid::simix::kernelImmediate(SIMIX_process_count);
251 }
252
253 /**
254  * \ingroup simix_process_management
255  * \brief Set the user data of a #smx_actor_t.
256  *
257  * This functions sets the user data associated to \a process.
258  * \param process SIMIX process
259  * \param data User data
260  */
261 void simcall_process_set_data(smx_actor_t process, void *data)
262 {
263   simgrid::simix::kernelImmediate(std::bind(SIMIX_process_set_data, process, data));
264 }
265
266 /**
267  * \ingroup simix_process_management
268  * \brief Set the kill time of a process.
269  */
270 void simcall_process_set_kill_time(smx_actor_t process, double kill_time)
271 {
272
273   if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr)
274     return;
275   XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, process->cname(), process->host->cname());
276   process->kill_timer = SIMIX_timer_set(kill_time, [=] {
277     simix_global->kill_process_function(process);
278     process->kill_timer=nullptr;
279   });
280 }
281 /**
282  * \ingroup simix_process_management
283  * \brief Get the kill time of a process (or 0 if unset).
284  */
285 double simcall_process_get_kill_time(smx_actor_t process) {
286   return SIMIX_timer_get_date(process->kill_timer);
287 }
288
289 /**
290  * \ingroup simix_process_management
291  * \brief Returns true if the process is suspended .
292  *
293  * This checks whether a process is suspended or not by inspecting the task on which it was waiting for the completion.
294  * \param process SIMIX process
295  * \return 1, if the process is suspended, else 0.
296  */
297 int simcall_process_is_suspended(smx_actor_t process)
298 {
299   return simcall_BODY_process_is_suspended(process);
300 }
301
302 /**
303  * \ingroup simix_process_management
304  * \brief Return the properties
305  *
306  * This functions returns the properties associated with this process
307  */
308 xbt_dict_t simcall_process_get_properties(smx_actor_t process)
309 {
310   return SIMIX_process_get_properties(process);
311 }
312 /**
313  * \ingroup simix_process_management
314  * \brief Add an on_exit function
315  * Add an on_exit function which will be executed when the process exits/is killed.
316  */
317 XBT_PUBLIC(void) simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data)
318 {
319   simcall_BODY_process_on_exit(process, fun, data);
320 }
321 /**
322  * \ingroup simix_process_management
323  * \brief Sets the process to be auto-restarted or not by SIMIX when its host comes back up.
324  * Will restart the process when the host comes back up if auto_restart is set to 1.
325  */
326
327 XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_actor_t process, int auto_restart)
328 {
329   simcall_BODY_process_auto_restart_set(process, auto_restart);
330 }
331
332 /**
333  * \ingroup simix_process_management
334  * \brief Restarts the process, killing it and starting it again from scratch.
335  */
336 XBT_PUBLIC(smx_actor_t) simcall_process_restart(smx_actor_t process)
337 {
338   return (smx_actor_t) simcall_BODY_process_restart(process);
339 }
340 /**
341  * \ingroup simix_process_management
342  * \brief Creates a new sleep SIMIX synchro.
343  *
344  * This function creates a SURF action and allocates the data necessary
345  * to create the SIMIX synchro. It can raise a host_error exception if the
346  * host crashed. The default SIMIX name of the synchro is "sleep".
347  *
348  *   \param duration Time duration of the sleep.
349  *   \return A result telling whether the sleep was successful
350  */
351 e_smx_state_t simcall_process_sleep(double duration)
352 {
353   /* checking for infinite values */
354   xbt_assert(std::isfinite(duration), "duration is not finite!");
355   return (e_smx_state_t) simcall_BODY_process_sleep(duration);
356 }
357
358 /**
359  * \ingroup simix_comm_management
360  */
361 void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
362                          void *src_buff, size_t src_buff_size,
363                          int (*match_fun)(void *, void *, smx_activity_t),
364                          void (*copy_data_fun)(smx_activity_t, void*, size_t), void *data,
365                          double timeout)
366 {
367   /* checking for infinite values */
368   xbt_assert(std::isfinite(task_size), "task_size is not finite!");
369   xbt_assert(std::isfinite(rate), "rate is not finite!");
370   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
371
372   xbt_assert(mbox, "No rendez-vous point defined for send");
373
374   if (MC_is_active() || MC_record_replay_is_active()) {
375     /* the model-checker wants two separate simcalls */
376     smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
377     comm = simcall_comm_isend(sender, mbox, task_size, rate,
378         src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
379     simcall_comm_wait(comm, timeout);
380     comm = nullptr;
381   }
382   else {
383     simcall_BODY_comm_send(sender, mbox, task_size, rate, src_buff, src_buff_size,
384                          match_fun, copy_data_fun, data, timeout);
385   }
386 }
387
388 /**
389  * \ingroup simix_comm_management
390  */
391 smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
392                               void *src_buff, size_t src_buff_size,
393                               int (*match_fun)(void *, void *, smx_activity_t),
394                               void (*clean_fun)(void *),
395                               void (*copy_data_fun)(smx_activity_t, void*, size_t),
396                               void *data,
397                               int detached)
398 {
399   /* checking for infinite values */
400   xbt_assert(std::isfinite(task_size), "task_size is not finite!");
401   xbt_assert(std::isfinite(rate), "rate is not finite!");
402
403   xbt_assert(mbox, "No rendez-vous point defined for isend");
404
405   return simcall_BODY_comm_isend(sender, mbox, task_size, rate, src_buff,
406                                  src_buff_size, match_fun,
407                                  clean_fun, copy_data_fun, data, detached);
408 }
409
410 /**
411  * \ingroup simix_comm_management
412  */
413 void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t * dst_buff_size,
414                        int (*match_fun)(void *, void *, smx_activity_t),
415                        void (*copy_data_fun)(smx_activity_t, void*, size_t),
416                        void *data, double timeout, double rate)
417 {
418   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
419   xbt_assert(mbox, "No rendez-vous point defined for recv");
420
421   if (MC_is_active() || MC_record_replay_is_active()) {
422     /* the model-checker wants two separate simcalls */
423     smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
424     comm = simcall_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
425                               match_fun, copy_data_fun, data, rate);
426     simcall_comm_wait(comm, timeout);
427     comm = nullptr;
428   }
429   else {
430     simcall_BODY_comm_recv(receiver, mbox, dst_buff, dst_buff_size,
431                            match_fun, copy_data_fun, data, timeout, rate);
432   }
433 }
434 /**
435  * \ingroup simix_comm_management
436  */
437 smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size,
438                                 int (*match_fun)(void *, void *, smx_activity_t),
439                                 void (*copy_data_fun)(smx_activity_t, void*, size_t),
440                                 void *data, double rate)
441 {
442   xbt_assert(mbox, "No rendez-vous point defined for irecv");
443
444   return simcall_BODY_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
445                                  match_fun, copy_data_fun, data, rate);
446 }
447
448 /**
449  * \ingroup simix_comm_management
450  */
451 smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
452                                 int (*match_fun)(void *, void *, smx_activity_t), void *data)
453 {
454   xbt_assert(mbox, "No rendez-vous point defined for iprobe");
455
456   return simcall_BODY_comm_iprobe(mbox, type, src, tag, match_fun, data);
457 }
458
459 /**
460  * \ingroup simix_comm_management
461  */
462 void simcall_comm_cancel(smx_activity_t synchro)
463 {
464   simgrid::simix::kernelImmediate([synchro]{
465     simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
466     comm->cancel();
467   });
468 }
469
470 /**
471  * \ingroup simix_comm_management
472  */
473 unsigned int simcall_comm_waitany(xbt_dynar_t comms, double timeout)
474 {
475   return simcall_BODY_comm_waitany(comms, timeout);
476 }
477
478 /**
479  * \ingroup simix_comm_management
480  */
481 int simcall_comm_testany(smx_activity_t* comms, size_t count)
482 {
483   if (count == 0)
484     return -1;
485   return simcall_BODY_comm_testany(comms, count);
486 }
487
488 /**
489  * \ingroup simix_comm_management
490  */
491 void simcall_comm_wait(smx_activity_t comm, double timeout)
492 {
493   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
494   simcall_BODY_comm_wait(comm, timeout);
495 }
496
497 /**
498  * \brief Set the category of an synchro.
499  *
500  * This functions changes the category only. It calls a surf function.
501  * \param synchro The execution synchro
502  * \param category The tracing category
503  */
504 void simcall_set_category(smx_activity_t synchro, const char *category)
505 {
506   if (category == nullptr) {
507     return;
508   }
509   simcall_BODY_set_category(synchro, category);
510 }
511
512 /**
513  * \ingroup simix_comm_management
514  *
515  */
516 int simcall_comm_test(smx_activity_t comm)
517 {
518   return simcall_BODY_comm_test(comm);
519 }
520
521 /**
522  * \ingroup simix_synchro_management
523  *
524  */
525 smx_mutex_t simcall_mutex_init()
526 {
527   if (not simix_global) {
528     fprintf(stderr,"You must run MSG_init before using MSG\n"); // We can't use xbt_die since we may get there before the initialization
529     xbt_abort();
530   }
531   return simcall_BODY_mutex_init();
532 }
533
534 /**
535  * \ingroup simix_synchro_management
536  *
537  */
538 void simcall_mutex_lock(smx_mutex_t mutex)
539 {
540   simcall_BODY_mutex_lock(mutex);
541 }
542
543 /**
544  * \ingroup simix_synchro_management
545  *
546  */
547 int simcall_mutex_trylock(smx_mutex_t mutex)
548 {
549   return simcall_BODY_mutex_trylock(mutex);
550 }
551
552 /**
553  * \ingroup simix_synchro_management
554  *
555  */
556 void simcall_mutex_unlock(smx_mutex_t mutex)
557 {
558   simcall_BODY_mutex_unlock(mutex);
559 }
560
561 /**
562  * \ingroup simix_synchro_management
563  *
564  */
565 smx_cond_t simcall_cond_init()
566 {
567   return simcall_BODY_cond_init();
568 }
569
570 /**
571  * \ingroup simix_synchro_management
572  *
573  */
574 void simcall_cond_signal(smx_cond_t cond)
575 {
576   simcall_BODY_cond_signal(cond);
577 }
578
579 /**
580  * \ingroup simix_synchro_management
581  *
582  */
583 void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
584 {
585   simcall_BODY_cond_wait(cond, mutex);
586 }
587
588 /**
589  * \ingroup simix_synchro_management
590  *
591  */
592 void simcall_cond_wait_timeout(smx_cond_t cond,
593                                  smx_mutex_t mutex,
594                                  double timeout)
595 {
596   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
597   simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
598 }
599
600 /**
601  * \ingroup simix_synchro_management
602  *
603  */
604 void simcall_cond_broadcast(smx_cond_t cond)
605 {
606   simcall_BODY_cond_broadcast(cond);
607 }
608
609 /**
610  * \ingroup simix_synchro_management
611  *
612  */
613 smx_sem_t simcall_sem_init(int capacity)
614 {
615   return simcall_BODY_sem_init(capacity);
616 }
617
618 /**
619  * \ingroup simix_synchro_management
620  *
621  */
622 void simcall_sem_release(smx_sem_t sem)
623 {
624   simcall_BODY_sem_release(sem);
625 }
626
627 /**
628  * \ingroup simix_synchro_management
629  *
630  */
631 int simcall_sem_would_block(smx_sem_t sem)
632 {
633   return simcall_BODY_sem_would_block(sem);
634 }
635
636 /**
637  * \ingroup simix_synchro_management
638  *
639  */
640 void simcall_sem_acquire(smx_sem_t sem)
641 {
642   simcall_BODY_sem_acquire(sem);
643 }
644
645 /**
646  * \ingroup simix_synchro_management
647  *
648  */
649 void simcall_sem_acquire_timeout(smx_sem_t sem, double timeout)
650 {
651   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
652   simcall_BODY_sem_acquire_timeout(sem, timeout);
653 }
654
655 /**
656  * \ingroup simix_synchro_management
657  *
658  */
659 int simcall_sem_get_capacity(smx_sem_t sem)
660 {
661   return simcall_BODY_sem_get_capacity(sem);
662 }
663
664 /**
665  * \ingroup simix_file_management
666  *
667  */
668 sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
669 {
670   return simcall_BODY_file_read(fd, size, host);
671 }
672
673 /**
674  * \ingroup simix_file_management
675  *
676  */
677 sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
678 {
679   return simcall_BODY_file_write(fd, size, host);
680 }
681
682 /**
683  * \ingroup simix_file_management
684  * \brief
685  */
686 smx_file_t simcall_file_open(const char* fullpath, sg_host_t host)
687 {
688   return simcall_BODY_file_open(fullpath, host);
689 }
690
691 /**
692  * \ingroup simix_file_management
693  *
694  */
695 int simcall_file_close(smx_file_t fd, sg_host_t host)
696 {
697   return simcall_BODY_file_close(fd, host);
698 }
699
700 /**
701  * \ingroup simix_file_management
702  *
703  */
704 int simcall_file_unlink(smx_file_t fd, sg_host_t host)
705 {
706   return simcall_BODY_file_unlink(fd, host);
707 }
708
709 /**
710  * \ingroup simix_file_management
711  *
712  */
713 sg_size_t simcall_file_get_size(smx_file_t fd){
714   return simcall_BODY_file_get_size(fd);
715 }
716
717 /**
718  * \ingroup simix_file_management
719  *
720  */
721 sg_size_t simcall_file_tell(smx_file_t fd){
722   return simcall_BODY_file_tell(fd);
723 }
724
725 /**
726  * \ingroup simix_file_management
727  *
728  */
729 xbt_dynar_t simcall_file_get_info(smx_file_t fd)
730 {
731   return simcall_BODY_file_get_info(fd);
732 }
733
734 /**
735  * \ingroup simix_file_management
736  *
737  */
738 int simcall_file_seek(smx_file_t fd, sg_offset_t offset, int origin){
739   return simcall_BODY_file_seek(fd, offset, origin);
740 }
741
742 /**
743  * \ingroup simix_file_management
744  * \brief Move a file to another location on the *same mount point*.
745  *
746  */
747 int simcall_file_move(smx_file_t fd, const char* fullpath)
748 {
749   return simcall_BODY_file_move(fd, fullpath);
750 }
751
752 /**
753  * \ingroup simix_storage_management
754  * \brief Returns a dict of the properties assigned to a storage element.
755  *
756  * \param storage A storage element
757  * \return The properties of this storage element
758  */
759 xbt_dict_t simcall_storage_get_properties(smx_storage_t storage)
760 {
761   return simcall_BODY_storage_get_properties(storage);
762 }
763
764 void simcall_run_kernel(std::function<void()> const& code)
765 {
766   simcall_BODY_run_kernel(&code);
767 }
768
769 void simcall_run_blocking(std::function<void()> const& code)
770 {
771   simcall_BODY_run_blocking(&code);
772 }
773
774 int simcall_mc_random(int min, int max) {
775   return simcall_BODY_mc_random(min, max);
776 }
777
778 /* ************************************************************************** */
779
780 /** @brief returns a printable string representing a simcall */
781 const char *SIMIX_simcall_name(e_smx_simcall_t kind) {
782   return simcall_names[kind];
783 }
784
785 namespace simgrid {
786 namespace simix {
787
788 void unblock(smx_actor_t process)
789 {
790   xbt_assert(SIMIX_is_maestro());
791   SIMIX_simcall_answer(&process->simcall);
792 }
793
794 }
795 }