1 /* libsmx.c - public interface to simix */
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) */
6 /* This is somehow the "libc" of SimGrid */
8 /* Copyright (c) 2010-2015. The SimGrid Team.
9 * All rights reserved. */
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. */
14 #include <cmath> /* std::isfinite() */
18 #include <xbt/functional.hpp>
20 #include <simgrid/simix/blocking_simcall.hpp>
22 #include "src/mc/mc_replay.h"
23 #include "smx_private.h"
24 #include "src/mc/mc_forward.hpp"
27 #include "src/simix/smx_host_private.h"
28 #include "src/kernel/activity/SynchroComm.hpp"
30 #include <simgrid/simix.hpp>
32 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
34 #include "popping_bodies.cpp"
36 void simcall_call(smx_actor_t process)
38 if (process != simix_global->maestro_process) {
39 XBT_DEBUG("Yield process '%s' on simcall %s (%d)", process->name.c_str(),
40 SIMIX_simcall_name(process->simcall.call), (int)process->simcall.call);
41 SIMIX_process_yield(process);
43 SIMIX_simcall_handle(&process->simcall, 0);
50 * \ingroup simix_host_management
51 * \brief Returns a dict of the properties assigned to a router or AS.
53 * \param name The name of the router or AS
54 * \return The properties
56 xbt_dict_t simcall_asr_get_properties(const char *name)
58 return simcall_BODY_asr_get_properties(name);
62 * \ingroup simix_process_management
63 * \brief Creates a synchro that executes some computation of an host.
65 * This function creates a SURF action and allocates the data necessary
66 * to create the SIMIX synchro. It can raise a host_error exception if the host crashed.
68 * \param name Name of the execution synchro to create
69 * \param flops_amount amount Computation amount (in flops)
70 * \param priority computation priority
72 * \return A new SIMIX execution synchronization
74 smx_activity_t simcall_execution_start(const char *name,
76 double priority, double bound)
78 /* checking for infinite values */
79 xbt_assert(std::isfinite(flops_amount), "flops_amount is not finite!");
80 xbt_assert(std::isfinite(priority), "priority is not finite!");
82 return simcall_BODY_execution_start(name, flops_amount, priority, bound);
86 * \ingroup simix_process_management
87 * \brief Creates a synchro that may involve parallel computation on
88 * several hosts and communication between them.
90 * \param name Name of the execution synchro to create
91 * \param host_nb Number of hosts where the synchro will be executed
92 * \param host_list Array (of size host_nb) of hosts where the synchro will be executed
93 * \param flops_amount Array (of size host_nb) of computation amount of hosts (in bytes)
94 * \param bytes_amount Array (of size host_nb * host_nb) representing the communication
95 * amount between each pair of hosts
96 * \param amount the SURF action amount
97 * \param rate the SURF action rate
98 * \return A new SIMIX execution synchronization
100 smx_activity_t simcall_execution_parallel_start(const char *name,
102 sg_host_t *host_list,
103 double *flops_amount,
104 double *bytes_amount,
109 /* checking for infinite values */
110 for (i = 0 ; i < host_nb ; ++i) {
111 xbt_assert(std::isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i);
112 if (bytes_amount != nullptr) {
113 for (j = 0 ; j < host_nb ; ++j) {
114 xbt_assert(std::isfinite(bytes_amount[i + host_nb * j]),
115 "bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j);
120 xbt_assert(std::isfinite(amount), "amount is not finite!");
121 xbt_assert(std::isfinite(rate), "rate is not finite!");
123 return simcall_BODY_execution_parallel_start(name, host_nb, host_list,
131 * \ingroup simix_process_management
132 * \brief Cancels an execution synchro.
134 * This functions stops the execution. It calls a surf function.
135 * \param execution The execution synchro to cancel
137 void simcall_execution_cancel(smx_activity_t execution)
139 simcall_BODY_execution_cancel(execution);
143 * \ingroup simix_process_management
144 * \brief Changes the priority of an execution synchro.
146 * This functions changes the priority only. It calls a surf function.
147 * \param execution The execution synchro
148 * \param priority The new priority
150 void simcall_execution_set_priority(smx_activity_t execution, double priority)
152 /* checking for infinite values */
153 xbt_assert(std::isfinite(priority), "priority is not finite!");
155 simcall_BODY_execution_set_priority(execution, priority);
159 * \ingroup simix_process_management
160 * \brief Changes the capping (the maximum CPU utilization) of an execution synchro.
162 * This functions changes the capping only. It calls a surf function.
163 * \param execution The execution synchro
164 * \param bound The new bound
166 void simcall_execution_set_bound(smx_activity_t execution, double bound)
168 simcall_BODY_execution_set_bound(execution, bound);
172 * \ingroup simix_host_management
173 * \brief Waits for the completion of an execution synchro and destroy it.
175 * \param execution The execution synchro
177 e_smx_state_t simcall_execution_wait(smx_activity_t execution)
179 return (e_smx_state_t) simcall_BODY_execution_wait(execution);
184 * \ingroup simix_vm_management
185 * \brief Create a VM on the given physical host.
187 * \param name VM name
188 * \param host Physical host
190 * \return The host object of the VM
192 void* simcall_vm_create(const char *name, sg_host_t phys_host)
194 return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_create, name, phys_host));
198 * \ingroup simix_vm_management
199 * \brief Start the given VM to the given physical host
203 void simcall_vm_start(sg_host_t vm)
205 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_start, vm));
209 * \ingroup simix_vm_management
210 * \brief Get the state of the given VM
213 * \return The state of the VM
215 int simcall_vm_get_state(sg_host_t vm)
217 return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_get_state, vm));
221 * \ingroup simix_vm_management
222 * \brief Get the name of the physical host on which the given VM runs.
225 * \return The name of the physical host
227 void *simcall_vm_get_pm(sg_host_t vm)
229 return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_get_pm, vm));
232 void simcall_vm_set_bound(sg_host_t vm, double bound)
234 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_set_bound, vm, bound));
238 * \ingroup simix_vm_management
239 * \brief Migrate the given VM to the given physical host
242 * \param host Destination physical host
244 void simcall_vm_migrate(sg_host_t vm, sg_host_t host)
246 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_migrate, vm, host));
250 * \ingroup simix_vm_management
251 * \brief Suspend the given VM
255 void simcall_vm_suspend(sg_host_t vm)
257 simcall_BODY_vm_suspend(vm);
261 * \ingroup simix_vm_management
262 * \brief Resume the given VM
266 void simcall_vm_resume(sg_host_t vm)
268 simcall_BODY_vm_resume(vm);
272 * \ingroup simix_vm_management
273 * \brief Save the given VM
277 void simcall_vm_save(sg_host_t vm)
279 simcall_BODY_vm_save(vm);
283 * \ingroup simix_vm_management
284 * \brief Restore the given VM
288 void simcall_vm_restore(sg_host_t vm)
290 simcall_BODY_vm_restore(vm);
294 * \ingroup simix_vm_management
295 * \brief Shutdown the given VM
299 void simcall_vm_shutdown(sg_host_t vm)
301 simcall_BODY_vm_shutdown(vm);
305 * \ingroup simix_vm_management
306 * \brief Destroy the given VM
310 void simcall_vm_destroy(sg_host_t vm)
312 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_destroy, vm));
316 * \ingroup simix_vm_management
317 * \brief Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration
318 * The simcall actually invokes the following calls:
319 * simcall_vm_migrate(vm, dst_pm);
320 * simcall_vm_resume(vm);
322 * It is called at the end of the migration_rx_fun function from msg/msg_vm.c
324 * \param vm VM to migrate
325 * \param src_pm Source physical host
326 * \param dst_pmt Destination physical host
328 void simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm)
330 simgrid::simix::kernelImmediate(std::bind(
331 SIMIX_vm_migratefrom_resumeto, vm, src_pm, dst_pm));
335 * \ingroup simix_process_management
336 * \brief Kills a SIMIX process.
338 * This function simply kills a process.
340 * \param process poor victim
342 void simcall_process_kill(smx_actor_t process)
344 simcall_BODY_process_kill(process);
348 * \ingroup simix_process_management
349 * \brief Kills all SIMIX processes.
351 void simcall_process_killall(int reset_pid)
353 simcall_BODY_process_killall(reset_pid);
357 * \ingroup simix_process_management
358 * \brief Cleans up a SIMIX process.
359 * \param process poor victim (must have already been killed)
361 void simcall_process_cleanup(smx_actor_t process)
363 simcall_BODY_process_cleanup(process);
367 * \ingroup simix_process_management
368 * \brief Migrates an agent to another location.
370 * This function changes the value of the host on which \a process is running.
372 * \param process the process to migrate
373 * \param dest name of the new host
375 void simcall_process_set_host(smx_actor_t process, sg_host_t dest)
377 simcall_BODY_process_set_host(process, dest);
380 void simcall_process_join(smx_actor_t process, double timeout)
382 simcall_BODY_process_join(process, timeout);
386 * \ingroup simix_process_management
387 * \brief Suspends a process.
389 * This function suspends the process by suspending the synchro
390 * it was waiting for completion.
392 * \param process a SIMIX process
394 void simcall_process_suspend(smx_actor_t process)
396 xbt_assert(process, "Invalid parameters");
398 simcall_BODY_process_suspend(process);
402 * \ingroup simix_process_management
403 * \brief Resumes a suspended process.
405 * This function resumes a suspended process by resuming the synchro
406 * it was waiting for completion.
408 * \param process a SIMIX process
410 void simcall_process_resume(smx_actor_t process)
412 simcall_BODY_process_resume(process);
416 * \ingroup simix_process_management
417 * \brief Returns the amount of SIMIX processes in the system
419 * Maestro internal process is not counted, only user code processes are
421 int simcall_process_count()
423 return simgrid::simix::kernelImmediate(SIMIX_process_count);
427 * \ingroup simix_process_management
428 * \brief Return the user data of a #smx_actor_t.
429 * \param process a SIMIX process
430 * \return the user data of this process
432 void* simcall_process_get_data(smx_actor_t process)
434 return SIMIX_process_get_data(process);
438 * \ingroup simix_process_management
439 * \brief Set the user data of a #smx_actor_t.
441 * This functions sets the user data associated to \a process.
442 * \param process SIMIX process
443 * \param data User data
445 void simcall_process_set_data(smx_actor_t process, void *data)
447 simgrid::simix::kernelImmediate(std::bind(SIMIX_process_set_data, process, data));
451 * \ingroup simix_process_management
452 * \brief Set the kill time of a process.
454 void simcall_process_set_kill_time(smx_actor_t process, double kill_time)
457 if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr)
459 XBT_DEBUG("Set kill time %f for process %s(%s)",
460 kill_time, process->name.c_str(), sg_host_get_name(process->host));
461 process->kill_timer = SIMIX_timer_set(kill_time, [=] {
462 simix_global->kill_process_function(process);
463 process->kill_timer=nullptr;
467 * \ingroup simix_process_management
468 * \brief Get the kill time of a process (or 0 if unset).
470 double simcall_process_get_kill_time(smx_actor_t process) {
471 return SIMIX_timer_get_date(process->kill_timer);
475 * \ingroup simix_process_management
476 * \brief Returns true if the process is suspended .
478 * This checks whether a process is suspended or not by inspecting the task on which it was waiting for the completion.
479 * \param process SIMIX process
480 * \return 1, if the process is suspended, else 0.
482 int simcall_process_is_suspended(smx_actor_t process)
484 return simcall_BODY_process_is_suspended(process);
488 * \ingroup simix_process_management
489 * \brief Return the properties
491 * This functions returns the properties associated with this process
493 xbt_dict_t simcall_process_get_properties(smx_actor_t process)
495 return SIMIX_process_get_properties(process);
498 * \ingroup simix_process_management
499 * \brief Add an on_exit function
500 * Add an on_exit function which will be executed when the process exits/is killed.
502 XBT_PUBLIC(void) simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data)
504 simcall_BODY_process_on_exit(process, fun, data);
507 * \ingroup simix_process_management
508 * \brief Sets the process to be auto-restarted or not by SIMIX when its host comes back up.
509 * Will restart the process when the host comes back up if auto_restart is set to 1.
512 XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_actor_t process, int auto_restart)
514 simcall_BODY_process_auto_restart_set(process, auto_restart);
518 * \ingroup simix_process_management
519 * \brief Restarts the process, killing it and starting it again from scratch.
521 XBT_PUBLIC(smx_actor_t) simcall_process_restart(smx_actor_t process)
523 return (smx_actor_t) simcall_BODY_process_restart(process);
526 * \ingroup simix_process_management
527 * \brief Creates a new sleep SIMIX synchro.
529 * This function creates a SURF action and allocates the data necessary
530 * to create the SIMIX synchro. It can raise a host_error exception if the
531 * host crashed. The default SIMIX name of the synchro is "sleep".
533 * \param duration Time duration of the sleep.
534 * \return A result telling whether the sleep was successful
536 e_smx_state_t simcall_process_sleep(double duration)
538 /* checking for infinite values */
539 xbt_assert(std::isfinite(duration), "duration is not finite!");
540 return (e_smx_state_t) simcall_BODY_process_sleep(duration);
544 * \ingroup simix_mbox_management
545 * \brief Creates a new rendez-vous point
546 * \param name The name of the rendez-vous point
547 * \return The created rendez-vous point
549 smx_mailbox_t simcall_mbox_create(const char *name)
551 return simcall_BODY_mbox_create(name);
554 void simcall_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t process)
556 simcall_BODY_mbox_set_receiver(mbox, process);
560 * \ingroup simix_comm_management
562 void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
563 void *src_buff, size_t src_buff_size,
564 int (*match_fun)(void *, void *, smx_activity_t),
565 void (*copy_data_fun)(smx_activity_t, void*, size_t), void *data,
568 /* checking for infinite values */
569 xbt_assert(std::isfinite(task_size), "task_size is not finite!");
570 xbt_assert(std::isfinite(rate), "rate is not finite!");
571 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
573 xbt_assert(mbox, "No rendez-vous point defined for send");
575 if (MC_is_active() || MC_record_replay_is_active()) {
576 /* the model-checker wants two separate simcalls */
577 smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
578 comm = simcall_comm_isend(sender, mbox, task_size, rate,
579 src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
580 simcall_comm_wait(comm, timeout);
584 simcall_BODY_comm_send(sender, mbox, task_size, rate, src_buff, src_buff_size,
585 match_fun, copy_data_fun, data, timeout);
590 * \ingroup simix_comm_management
592 smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
593 void *src_buff, size_t src_buff_size,
594 int (*match_fun)(void *, void *, smx_activity_t),
595 void (*clean_fun)(void *),
596 void (*copy_data_fun)(smx_activity_t, void*, size_t),
600 /* checking for infinite values */
601 xbt_assert(std::isfinite(task_size), "task_size is not finite!");
602 xbt_assert(std::isfinite(rate), "rate is not finite!");
604 xbt_assert(mbox, "No rendez-vous point defined for isend");
606 return simcall_BODY_comm_isend(sender, mbox, task_size, rate, src_buff,
607 src_buff_size, match_fun,
608 clean_fun, copy_data_fun, data, detached);
612 * \ingroup simix_comm_management
614 void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t * dst_buff_size,
615 int (*match_fun)(void *, void *, smx_activity_t),
616 void (*copy_data_fun)(smx_activity_t, void*, size_t),
617 void *data, double timeout, double rate)
619 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
620 xbt_assert(mbox, "No rendez-vous point defined for recv");
622 if (MC_is_active() || MC_record_replay_is_active()) {
623 /* the model-checker wants two separate simcalls */
624 smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
625 comm = simcall_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
626 match_fun, copy_data_fun, data, rate);
627 simcall_comm_wait(comm, timeout);
631 simcall_BODY_comm_recv(receiver, mbox, dst_buff, dst_buff_size,
632 match_fun, copy_data_fun, data, timeout, rate);
636 * \ingroup simix_comm_management
638 smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size,
639 int (*match_fun)(void *, void *, smx_activity_t),
640 void (*copy_data_fun)(smx_activity_t, void*, size_t),
641 void *data, double rate)
643 xbt_assert(mbox, "No rendez-vous point defined for irecv");
645 return simcall_BODY_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
646 match_fun, copy_data_fun, data, rate);
650 * \ingroup simix_comm_management
652 smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
653 int (*match_fun)(void *, void *, smx_activity_t), void *data)
655 xbt_assert(mbox, "No rendez-vous point defined for iprobe");
657 return simcall_BODY_comm_iprobe(mbox, type, src, tag, match_fun, data);
661 * \ingroup simix_comm_management
663 void simcall_comm_cancel(smx_activity_t synchro)
665 simgrid::simix::kernelImmediate([synchro]{
666 simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
672 * \ingroup simix_comm_management
674 unsigned int simcall_comm_waitany(xbt_dynar_t comms, double timeout)
676 return simcall_BODY_comm_waitany(comms, timeout);
680 * \ingroup simix_comm_management
682 int simcall_comm_testany(smx_activity_t* comms, size_t count)
686 return simcall_BODY_comm_testany(comms, count);
690 * \ingroup simix_comm_management
692 void simcall_comm_wait(smx_activity_t comm, double timeout)
694 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
695 simcall_BODY_comm_wait(comm, timeout);
699 * \brief Set the category of an synchro.
701 * This functions changes the category only. It calls a surf function.
702 * \param execution The execution synchro
703 * \param category The tracing category
705 void simcall_set_category(smx_activity_t synchro, const char *category)
707 if (category == nullptr) {
710 simcall_BODY_set_category(synchro, category);
714 * \ingroup simix_comm_management
717 int simcall_comm_test(smx_activity_t comm)
719 return simcall_BODY_comm_test(comm);
723 * \ingroup simix_synchro_management
726 smx_mutex_t simcall_mutex_init()
729 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
732 return simcall_BODY_mutex_init();
736 * \ingroup simix_synchro_management
739 void simcall_mutex_lock(smx_mutex_t mutex)
741 simcall_BODY_mutex_lock(mutex);
745 * \ingroup simix_synchro_management
748 int simcall_mutex_trylock(smx_mutex_t mutex)
750 return simcall_BODY_mutex_trylock(mutex);
754 * \ingroup simix_synchro_management
757 void simcall_mutex_unlock(smx_mutex_t mutex)
759 simcall_BODY_mutex_unlock(mutex);
763 * \ingroup simix_synchro_management
766 smx_cond_t simcall_cond_init()
768 return simcall_BODY_cond_init();
772 * \ingroup simix_synchro_management
775 void simcall_cond_signal(smx_cond_t cond)
777 simcall_BODY_cond_signal(cond);
781 * \ingroup simix_synchro_management
784 void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
786 simcall_BODY_cond_wait(cond, mutex);
790 * \ingroup simix_synchro_management
793 void simcall_cond_wait_timeout(smx_cond_t cond,
797 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
798 simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
802 * \ingroup simix_synchro_management
805 void simcall_cond_broadcast(smx_cond_t cond)
807 simcall_BODY_cond_broadcast(cond);
811 * \ingroup simix_synchro_management
814 smx_sem_t simcall_sem_init(int capacity)
816 return simcall_BODY_sem_init(capacity);
820 * \ingroup simix_synchro_management
823 void simcall_sem_release(smx_sem_t sem)
825 simcall_BODY_sem_release(sem);
829 * \ingroup simix_synchro_management
832 int simcall_sem_would_block(smx_sem_t sem)
834 return simcall_BODY_sem_would_block(sem);
838 * \ingroup simix_synchro_management
841 void simcall_sem_acquire(smx_sem_t sem)
843 simcall_BODY_sem_acquire(sem);
847 * \ingroup simix_synchro_management
850 void simcall_sem_acquire_timeout(smx_sem_t sem, double timeout)
852 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
853 simcall_BODY_sem_acquire_timeout(sem, timeout);
857 * \ingroup simix_synchro_management
860 int simcall_sem_get_capacity(smx_sem_t sem)
862 return simcall_BODY_sem_get_capacity(sem);
866 * \ingroup simix_file_management
869 sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
871 return simcall_BODY_file_read(fd, size, host);
875 * \ingroup simix_file_management
878 sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
880 return simcall_BODY_file_write(fd, size, host);
884 * \ingroup simix_file_management
887 smx_file_t simcall_file_open(const char* fullpath, sg_host_t host)
889 return simcall_BODY_file_open(fullpath, host);
893 * \ingroup simix_file_management
896 int simcall_file_close(smx_file_t fd, sg_host_t host)
898 return simcall_BODY_file_close(fd, host);
902 * \ingroup simix_file_management
905 int simcall_file_unlink(smx_file_t fd, sg_host_t host)
907 return simcall_BODY_file_unlink(fd, host);
911 * \ingroup simix_file_management
914 sg_size_t simcall_file_get_size(smx_file_t fd){
915 return simcall_BODY_file_get_size(fd);
919 * \ingroup simix_file_management
922 sg_size_t simcall_file_tell(smx_file_t fd){
923 return simcall_BODY_file_tell(fd);
927 * \ingroup simix_file_management
930 xbt_dynar_t simcall_file_get_info(smx_file_t fd)
932 return simcall_BODY_file_get_info(fd);
936 * \ingroup simix_file_management
939 int simcall_file_seek(smx_file_t fd, sg_offset_t offset, int origin){
940 return simcall_BODY_file_seek(fd, offset, origin);
944 * \ingroup simix_file_management
945 * \brief Move a file to another location on the *same mount point*.
948 int simcall_file_move(smx_file_t fd, const char* fullpath)
950 return simcall_BODY_file_move(fd, fullpath);
954 * \ingroup simix_storage_management
955 * \brief Returns the free space size on a given storage element.
956 * \param storage a storage
957 * \return Return the free space size on a given storage element (as sg_size_t)
959 sg_size_t simcall_storage_get_free_size (smx_storage_t storage){
960 return simcall_BODY_storage_get_free_size(storage);
964 * \ingroup simix_storage_management
965 * \brief Returns the used space size on a given storage element.
966 * \param storage a storage
967 * \return Return the used space size on a given storage element (as sg_size_t)
969 sg_size_t simcall_storage_get_used_size (smx_storage_t storage){
970 return simcall_BODY_storage_get_used_size(storage);
974 * \ingroup simix_storage_management
975 * \brief Returns a dict of the properties assigned to a storage element.
977 * \param storage A storage element
978 * \return The properties of this storage element
980 xbt_dict_t simcall_storage_get_properties(smx_storage_t storage)
982 return simcall_BODY_storage_get_properties(storage);
986 * \ingroup simix_storage_management
987 * \brief Returns a dict containing the content of a storage element.
989 * \param storage A storage element
990 * \return The content of this storage element as a dict (full path file => size)
992 xbt_dict_t simcall_storage_get_content(smx_storage_t storage)
994 return simcall_BODY_storage_get_content(storage);
997 void simcall_run_kernel(std::function<void()> const& code)
999 simcall_BODY_run_kernel(&code);
1002 void simcall_run_blocking(std::function<void()> const& code)
1004 simcall_BODY_run_blocking(&code);
1007 int simcall_mc_random(int min, int max) {
1008 return simcall_BODY_mc_random(min, max);
1011 /* ************************************************************************** */
1013 /** @brief returns a printable string representing a simcall */
1014 const char *SIMIX_simcall_name(e_smx_simcall_t kind) {
1015 return simcall_names[kind];
1021 void unblock(smx_actor_t process)
1023 xbt_assert(SIMIX_is_maestro());
1024 SIMIX_simcall_answer(&process->simcall);