Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
msg_as_t -> msg_netzone_t
[simgrid.git] / include / simgrid / msg.h
1 /* Copyright (c) 2004-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef MSG_H
8 #define MSG_H
9
10 #include "xbt.h"
11 #include "xbt/lib.h"
12 #include "simgrid/forward.h"
13 #include "simgrid/simix.h"
14
15 SG_BEGIN_DECL()
16
17 /* *************************** Network Zones ******************************** */
18 #define msg_as_t msg_netzone_t /* portability macro */
19 typedef simgrid_NetZone* msg_netzone_t;
20
21 /* ******************************** Host ************************************ */
22
23 /** @brief Host datatype.
24     @ingroup m_host_management
25
26     A <em>location</em> (or <em>host</em>) is any possible place where
27     a process may run. Thus it is represented as a <em>physical
28     resource with computing capabilities</em>, some <em>mailboxes</em>
29     to enable running process to communicate with remote ones, and
30     some <em>private data</em> that can be only accessed by local
31     process.
32  */
33 typedef sg_host_t msg_host_t;
34
35
36 XBT_PUBLIC_DATA(int) sg_storage_max_file_descriptors;
37 /* ******************************** Task ************************************ */
38
39 typedef struct simdata_task *simdata_task_t;
40
41 typedef struct msg_task {
42   char *name;                   /**< @brief task name if any */
43   simdata_task_t simdata;       /**< @brief simulator data */
44   void *data;                   /**< @brief user data */
45   long long int counter;        /* task unique identifier for instrumentation */
46   char *category;               /* task category for instrumentation */
47 } s_msg_task_t;
48
49 /** @brief Task datatype.
50     @ingroup m_task_management
51
52     A <em>task</em> may then be defined by a <em>computing
53     amount</em>, a <em>message size</em> and some <em>private
54     data</em>.
55  */
56 typedef struct msg_task *msg_task_t;
57
58 /* ******************************** VM ************************************* */
59 typedef msg_host_t msg_vm_t;
60
61 /* ******************************** File ************************************ */
62
63 /** @brief Opaque object describing a File in MSG.
64  *  @ingroup msg_file */
65 typedef xbt_dictelm_t msg_file_t;
66
67 extern int MSG_FILE_LEVEL;
68 typedef struct simdata_file *simdata_file_t;
69
70 struct msg_file_priv  {
71   char *fullpath;
72   sg_size_t size;
73   char* mount_point;
74   char* storageId;
75   char* storage_type;
76   char* content_type;
77   int desc_id;
78   void *data;
79   simdata_file_t simdata;
80 };
81
82 typedef struct msg_file_priv s_msg_file_priv_t;
83 typedef struct msg_file_priv* msg_file_priv_t;
84
85 static inline msg_file_priv_t MSG_file_priv(msg_file_t file){
86   return (msg_file_priv_t )xbt_lib_get_level(file, MSG_FILE_LEVEL);
87 }
88
89 /* ******************************** Storage ************************************ */
90 /* TODO: PV: to comment */
91
92 extern int MSG_STORAGE_LEVEL;
93
94 /** @brief Storage datatype.
95  *  @ingroup msg_storage_management
96  *
97  *  You should consider this as an opaque object.
98  */
99 typedef xbt_dictelm_t msg_storage_t;
100
101 struct msg_storage_priv  {
102   const char *hostname;
103   void *data;
104 };
105 typedef struct msg_storage_priv  s_msg_storage_priv_t;
106 typedef struct msg_storage_priv* msg_storage_priv_t;
107
108 static inline msg_storage_priv_t MSG_storage_priv(msg_storage_t storage){
109   return (msg_storage_priv_t )xbt_lib_get_level(storage, MSG_STORAGE_LEVEL);
110 }
111
112 /**
113  * \brief @brief Communication action.
114  * \ingroup msg_task_usage
115  *
116  * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
117  */
118 typedef struct msg_comm *msg_comm_t;
119
120 /** \brief Default value for an uninitialized #msg_task_t.
121     \ingroup m_task_management
122 */
123 #define MSG_TASK_UNINITIALIZED NULL
124
125 /* ****************************** Process *********************************** */
126
127 /** @brief Process datatype.
128     @ingroup m_process_management
129
130     A process may be defined as a <em>code</em>, with some
131     <em>private data</em>, executing in a <em>location</em>.
132
133     You should not access directly to the fields of the pointed
134     structure, but always use the provided API to interact with
135     processes.
136  */
137 typedef smx_actor_t msg_process_t;
138
139 /** @brief Return code of most MSG functions
140     @ingroup msg_simulation
141     @{ */
142 /* Keep these code as binary values: java bindings manipulate | of these values */
143 typedef enum {
144   MSG_OK = 0,                 /**< @brief Everything is right. Keep on going this way ! */
145   MSG_TIMEOUT = 1,            /**< @brief nothing good happened before the timer you provided elapsed */
146   MSG_TRANSFER_FAILURE = 2,   /**< @brief There has been a problem during you task
147       transfer. Either the network is down or the remote host has been
148       shutdown. */
149   MSG_HOST_FAILURE = 4,       /**< @brief System shutdown. The host on which you are
150       running has just been rebooted. Free your datastructures and
151       return now !*/
152   MSG_TASK_CANCELED = 8      /**< @brief Canceled task. This task has been canceled by somebody!*/
153 } msg_error_t;
154 /** @} */
155
156 /************************** Global ******************************************/
157 XBT_PUBLIC(void) MSG_config(const char *key, const char *value);
158 /** \ingroup msg_simulation
159  *  \brief Initialize the MSG internal data.
160  *  \hideinitializer
161  *
162  *  It also check that the link-time and compile-time versions of SimGrid do
163  *  match, so you should use this version instead of the #MSG_init_nocheck
164  *  function that does the same initializations, but without this check.
165  *
166  *  We allow to link against compiled versions that differ in the patch level.
167  */
168 #define MSG_init(argc,argv)  do {                                                          \
169   sg_version_check(SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH);\
170     MSG_init_nocheck(argc,argv);                                                        \
171   } while (0)
172
173 XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
174 XBT_PUBLIC(msg_error_t) MSG_main();;
175 XBT_PUBLIC(void) MSG_function_register(const char *name,
176                                        xbt_main_func_t code);
177 XBT_PUBLIC(void) MSG_function_register_default(xbt_main_func_t code);
178 XBT_PUBLIC(void) MSG_launch_application(const char *file);
179 /*Bypass the parser */
180 XBT_PUBLIC(void) MSG_set_function(const char *host_id,
181                                   const char *function_name,
182                                   xbt_dynar_t arguments);
183
184 XBT_PUBLIC(double) MSG_get_clock();
185 XBT_PUBLIC(unsigned long int) MSG_get_sent_msg();
186
187 /************************** Environment ***********************************/
188 XBT_PUBLIC(msg_netzone_t) MSG_environment_get_routing_root();
189 XBT_PUBLIC(const char*) MSG_environment_as_get_name(msg_netzone_t as);
190 XBT_PUBLIC(msg_netzone_t) MSG_environment_as_get_by_name(const char* name);
191 XBT_PUBLIC(xbt_dict_t) MSG_environment_as_get_routing_sons(msg_netzone_t as);
192 XBT_PUBLIC(const char*) MSG_environment_as_get_property_value(msg_netzone_t as, const char* name);
193 XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_netzone_t as);
194
195 /************************** File handling ***********************************/
196 XBT_PUBLIC(sg_size_t) MSG_file_read(msg_file_t fd, sg_size_t size);
197 XBT_PUBLIC(sg_size_t) MSG_file_write(msg_file_t fd, sg_size_t size);
198 XBT_PUBLIC(msg_file_t) MSG_file_open(const char* fullpath, void* data);
199 XBT_PUBLIC(void*) MSG_file_get_data(msg_file_t fd);
200 XBT_PUBLIC(msg_error_t) MSG_file_set_data(msg_file_t fd, void * data);
201 XBT_PUBLIC(int) MSG_file_close(msg_file_t fd);
202 XBT_PUBLIC(sg_size_t) MSG_file_get_size(msg_file_t fd);
203 XBT_PUBLIC(void) MSG_file_dump(msg_file_t fd);
204 XBT_PUBLIC(msg_error_t) MSG_file_unlink(msg_file_t fd);
205 XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_offset_t offset, int origin);
206 XBT_PUBLIC(sg_size_t) MSG_file_tell (msg_file_t fd);
207 XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd);
208 XBT_PUBLIC(void) __MSG_file_priv_free(msg_file_priv_t priv);
209 XBT_PUBLIC(const char *) MSG_file_get_name(msg_file_t file);
210 XBT_PUBLIC(msg_error_t) MSG_file_move(msg_file_t fd, const char* fullpath);
211 XBT_PUBLIC(msg_error_t) MSG_file_rcopy(msg_file_t fd, msg_host_t host, const char* fullpath);
212 XBT_PUBLIC(msg_error_t) MSG_file_rmove(msg_file_t fd, msg_host_t host, const char* fullpath);
213 /************************** Storage handling ***********************************/
214 XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage);
215 XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(msg_storage_t storage);
216 XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(msg_storage_t storage);
217 XBT_PUBLIC(msg_storage_t) MSG_storage_get_by_name(const char *name);
218 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
219 XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char* name, char* value);
220 XBT_PUBLIC(const char *)MSG_storage_get_property_value(msg_storage_t storage, const char *name);
221 XBT_PUBLIC(xbt_dynar_t) MSG_storages_as_dynar();
222 XBT_PUBLIC(msg_error_t) MSG_storage_set_data(msg_storage_t host, void *data);
223 XBT_PUBLIC(void *) MSG_storage_get_data(msg_storage_t storage);
224 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage);
225 XBT_PUBLIC(sg_size_t) MSG_storage_get_size(msg_storage_t storage);
226 XBT_PUBLIC(msg_error_t) MSG_storage_file_move(msg_file_t fd, msg_host_t dest, char* mount, char* fullname);
227 XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
228 /************************** AS Router handling ************************************/
229 XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name);
230 XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr);
231 XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char* name, char* value);
232
233 /************************** Host handling ***********************************/
234 XBT_PUBLIC(msg_host_t) MSG_host_by_name(const char *name);
235 #define MSG_get_host_by_name(n) MSG_host_by_name(n) /* Rewrite the old name into the new one transparently */
236 XBT_PUBLIC(msg_error_t) MSG_host_set_data(msg_host_t host, void *data);
237 XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
238 /** \ingroup m_host_management
239  *
240  * \brief Return the name of the #msg_host_t. */
241 #define MSG_host_get_name(host) sg_host_get_name(host)
242 XBT_PUBLIC(void) MSG_host_on(msg_host_t host);
243 XBT_PUBLIC(void) MSG_host_off(msg_host_t host);
244 XBT_PUBLIC(msg_host_t) MSG_host_self();
245 XBT_PUBLIC(double) MSG_host_get_speed(msg_host_t h);
246 XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h);
247 XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h);
248 XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
249 XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
250
251 // deprecated
252 XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
253
254
255 XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
256 XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h);
257 XBT_PUBLIC(int)    MSG_host_get_nb_pstates(msg_host_t h);
258 #define MSG_host_get_pstate(h)         sg_host_get_pstate(h)
259 #define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate)
260 XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar();
261 XBT_PUBLIC(int) MSG_get_host_number();
262 XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
263 XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
264 XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
265
266 /*property handlers*/
267 XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
268 XBT_PUBLIC(const char *) MSG_host_get_property_value(msg_host_t host,
269                                                      const char *name);
270 XBT_PUBLIC(void) MSG_host_set_property_value(msg_host_t host, const char* name, char* value);
271
272 XBT_PUBLIC(void) MSG_create_environment(const char *file);
273
274 /************************** Process handling *********************************/
275 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
276                                            xbt_main_func_t code,
277                                            void *data, msg_host_t host);
278 XBT_PUBLIC(msg_process_t) MSG_process_create_with_arguments(const char *name,
279                                                           xbt_main_func_t
280                                                           code, void *data,
281                                                           msg_host_t host,
282                                                           int argc,
283                                                           char **argv);
284 XBT_PUBLIC(msg_process_t) MSG_process_create_with_environment(const char
285                                                             *name,
286                                                             xbt_main_func_t
287                                                             code,
288                                                             void *data,
289                                                             msg_host_t host,
290                                                             int argc,
291                                                             char **argv,
292                                                             xbt_dict_t
293                                                             properties);
294 XBT_PUBLIC(msg_process_t) MSG_process_attach(
295   const char *name, void *data,
296   msg_host_t host, xbt_dict_t properties);
297 XBT_PUBLIC(void) MSG_process_detach();
298
299 XBT_PUBLIC(void) MSG_process_kill(msg_process_t process);
300 XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
301 XBT_PUBLIC(msg_error_t) MSG_process_migrate(msg_process_t process, msg_host_t host);
302
303 XBT_PUBLIC(void *) MSG_process_get_data(msg_process_t process);
304 XBT_PUBLIC(msg_error_t) MSG_process_set_data(msg_process_t process,
305                                              void *data);
306 XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
307 XBT_PUBLIC(msg_host_t) MSG_process_get_host(msg_process_t process);
308 XBT_PUBLIC(msg_process_t) MSG_process_from_PID(int PID);
309 XBT_PUBLIC(int) MSG_process_get_PID(msg_process_t process);
310 XBT_PUBLIC(int) MSG_process_get_PPID(msg_process_t process);
311 XBT_PUBLIC(const char *) MSG_process_get_name(msg_process_t process);
312 XBT_PUBLIC(int) MSG_process_self_PID();
313 XBT_PUBLIC(int) MSG_process_self_PPID();
314 XBT_PUBLIC(msg_process_t) MSG_process_self();
315 XBT_PUBLIC(xbt_dynar_t) MSG_processes_as_dynar();
316 XBT_PUBLIC(int) MSG_process_get_number();
317
318 XBT_PUBLIC(msg_error_t) MSG_process_set_kill_time(msg_process_t process, double kill_time);
319
320 /*property handlers*/
321 XBT_PUBLIC(xbt_dict_t) MSG_process_get_properties(msg_process_t process);
322 XBT_PUBLIC(const char *) MSG_process_get_property_value(msg_process_t
323                                                         process,
324                                                         const char *name);
325
326 XBT_PUBLIC(msg_error_t) MSG_process_suspend(msg_process_t process);
327 XBT_PUBLIC(msg_error_t) MSG_process_resume(msg_process_t process);
328 XBT_PUBLIC(int) MSG_process_is_suspended(msg_process_t process);
329 XBT_PUBLIC(void) MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data);
330 XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
331
332 XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process);
333
334 /************************** Task handling ************************************/
335 XBT_PUBLIC(msg_task_t) MSG_task_create(const char *name,
336                                      double flops_amount,
337                                      double bytes_amount, void *data);
338 XBT_PUBLIC(msg_task_t) MSG_parallel_task_create(const char *name,
339                                               int host_nb,
340                                               const msg_host_t * host_list,
341                                               double *flops_amount,
342                                               double *bytes_amount,
343                                               void *data);
344 XBT_PUBLIC(void *) MSG_task_get_data(msg_task_t task);
345 XBT_PUBLIC(void) MSG_task_set_data(msg_task_t task, void *data);
346 XBT_PUBLIC(void) MSG_task_set_copy_callback(void (*callback) (
347     msg_task_t task, msg_process_t src, msg_process_t dst));
348 XBT_PUBLIC(msg_process_t) MSG_task_get_sender(msg_task_t task);
349 XBT_PUBLIC(msg_host_t) MSG_task_get_source(msg_task_t task);
350 XBT_PUBLIC(const char *) MSG_task_get_name(msg_task_t task);
351 XBT_PUBLIC(void) MSG_task_set_name(msg_task_t task, const char *name);
352 XBT_PUBLIC(msg_error_t) MSG_task_cancel(msg_task_t task);
353 XBT_PUBLIC(msg_error_t) MSG_task_destroy(msg_task_t task);
354
355 XBT_PUBLIC(msg_error_t) MSG_task_execute(msg_task_t task);
356 XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute(msg_task_t task);
357 XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeout);
358 XBT_PUBLIC(void) MSG_task_set_priority(msg_task_t task, double priority);
359 XBT_PUBLIC(void) MSG_task_set_bound(msg_task_t task, double bound);
360
361 XBT_PUBLIC(msg_error_t) MSG_process_join(msg_process_t process, double timeout);
362 XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec);
363
364 XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task,
365                                                double flops_amount);
366 XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task);
367 XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task,
368                                         double bytes_amount);
369
370 XBT_PUBLIC(double) MSG_task_get_remaining_communication(msg_task_t task);
371 XBT_PUBLIC(int) MSG_task_is_latency_bounded(msg_task_t task);
372 XBT_PUBLIC(double) MSG_task_get_bytes_amount(msg_task_t task);
373
374
375 XBT_PUBLIC(msg_error_t)
376     MSG_task_receive_ext(msg_task_t * task, const char *alias, double timeout,
377                      msg_host_t host);
378
379 XBT_PUBLIC(msg_error_t)
380     MSG_task_receive_with_timeout(msg_task_t * task, const char *alias,
381                               double timeout);
382
383 XBT_PUBLIC(msg_error_t)
384     MSG_task_receive(msg_task_t * task, const char *alias);
385 #define MSG_task_recv(t,a) MSG_task_receive(t,a)
386
387
388
389 XBT_PUBLIC(msg_error_t)
390     MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, double timeout,
391                      msg_host_t host, double rate);
392
393 XBT_PUBLIC(msg_error_t) MSG_task_receive_with_timeout_bounded(msg_task_t * task, const char *alias,  double timeout, double rate);
394 XBT_PUBLIC(msg_error_t) MSG_task_receive_bounded(msg_task_t * task, const char *alias,double rate);
395 #define MSG_task_recv_bounded(t,a,r) MSG_task_receive_bounded(t,a,r)
396
397 XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias);
398 XBT_PUBLIC(msg_comm_t) MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate);
399 XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task, const char *alias,
400     int (*match_fun)(void*,void*, smx_activity_t), void *match_data);
401
402 XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup);
403 XBT_PUBLIC(void) MSG_task_dsend_bounded(msg_task_t task, const char *alias, void_f_pvoid_t cleanup, double maxrate);
404 XBT_PUBLIC(msg_comm_t) MSG_task_irecv(msg_task_t * task, const char *alias);
405 XBT_PUBLIC(msg_comm_t) MSG_task_irecv_bounded(msg_task_t * task, const char *alias, double rate);
406 XBT_PUBLIC(int) MSG_comm_test(msg_comm_t comm);
407 XBT_PUBLIC(int) MSG_comm_testany(xbt_dynar_t comms);
408 XBT_PUBLIC(void) MSG_comm_destroy(msg_comm_t comm);
409 XBT_PUBLIC(msg_error_t) MSG_comm_wait(msg_comm_t comm, double timeout);
410 XBT_PUBLIC(void) MSG_comm_waitall(msg_comm_t * comm, int nb_elem, double timeout);
411 XBT_PUBLIC(int) MSG_comm_waitany(xbt_dynar_t comms);
412 XBT_PUBLIC(msg_task_t) MSG_comm_get_task(msg_comm_t comm);
413 XBT_PUBLIC(msg_error_t) MSG_comm_get_status(msg_comm_t comm);
414
415 XBT_PUBLIC(int) MSG_task_listen(const char *alias);
416 XBT_PUBLIC(msg_error_t) MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout);
417 XBT_PUBLIC(msg_error_t) MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alias, double timeout, double maxrate);
418 XBT_PUBLIC(msg_error_t) MSG_task_send(msg_task_t task, const char *alias);
419 XBT_PUBLIC(msg_error_t) MSG_task_send_bounded(msg_task_t task, const char *alias, double rate);
420 XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
421 XBT_PUBLIC(void) MSG_task_set_category (msg_task_t task, const char *category);
422 XBT_PUBLIC(const char *) MSG_task_get_category (msg_task_t task);
423
424 /************************** Mailbox handling ************************************/
425
426 /* @brief MSG_mailbox_set_async - set a mailbox as eager
427  * Sets the mailbox to a permanent receiver mode. Messages sent to this mailbox will then be sent just after the send
428  * is issued, without waiting for the corresponding receive.
429  * This call should be done before issuing any receive, and on the receiver's side only
430  * @param alias    The alias of the mailbox to modify.
431  */
432 XBT_PUBLIC(void) MSG_mailbox_set_async(const char *alias);
433
434 /************************** Action handling **********************************/
435 XBT_PUBLIC(msg_error_t) MSG_action_trace_run(char *path);
436 XBT_PUBLIC(void) MSG_action_init();
437 XBT_PUBLIC(void) MSG_action_exit();
438
439 /** @brief Opaque type representing a semaphore
440  *  @ingroup msg_synchro
441  *  @hideinitializer
442  */
443 typedef struct s_smx_sem *msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be declared here
444 XBT_PUBLIC(msg_sem_t) MSG_sem_init(int initial_value);
445 XBT_PUBLIC(void) MSG_sem_acquire(msg_sem_t sem);
446 XBT_PUBLIC(msg_error_t) MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
447 XBT_PUBLIC(void) MSG_sem_release(msg_sem_t sem);
448 XBT_PUBLIC(int) MSG_sem_get_capacity(msg_sem_t sem);
449 XBT_PUBLIC(void) MSG_sem_destroy(msg_sem_t sem);
450 XBT_PUBLIC(int) MSG_sem_would_block(msg_sem_t sem);
451
452 /** @brief Opaque type representing a barrier identifier
453  *  @ingroup msg_synchro
454  *  @hideinitializer
455  */
456
457 #define MSG_BARRIER_SERIAL_PROCESS -1
458 typedef struct s_msg_bar* msg_bar_t;
459 XBT_PUBLIC(msg_bar_t) MSG_barrier_init( unsigned int count);
460 XBT_PUBLIC(void) MSG_barrier_destroy(msg_bar_t bar);
461 XBT_PUBLIC(int) MSG_barrier_wait(msg_bar_t bar);
462
463 /** @brief Opaque type describing a Virtual Machine.
464  *  @ingroup msg_VMs
465  *
466  * All this is highly experimental and the interface will probably change in the future.
467  * Please don't depend on this yet (although testing is welcomed if you feel so).
468  * Usual lack of guaranty of any kind applies here, and is even increased.
469  *
470  */
471
472 XBT_PUBLIC(int) MSG_vm_is_created(msg_vm_t vm);
473 XBT_PUBLIC(int) MSG_vm_is_running(msg_vm_t vm);
474 XBT_PUBLIC(int) MSG_vm_is_migrating(msg_vm_t vm);
475
476 XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t vm);
477 XBT_PUBLIC(int) MSG_vm_is_saving(msg_vm_t vm);
478 XBT_PUBLIC(int) MSG_vm_is_saved(msg_vm_t vm);
479 XBT_PUBLIC(int) MSG_vm_is_restoring(msg_vm_t vm);
480
481 #define MSG_vm_get_name(vm) MSG_host_get_name(vm)
482
483 XBT_PUBLIC(void) MSG_vm_get_params(msg_vm_t vm, vm_params_t params);
484 XBT_PUBLIC(void) MSG_vm_set_params(msg_vm_t vm, vm_params_t params);
485
486 // TODO add VDI later
487 XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
488 XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t ind_pm, const char *name,
489     int core_nb, int mem_cap, int net_cap, char *disk_path, int disk_size, int mig_netspeed, int dp_intensity);
490
491 XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm);
492
493 XBT_PUBLIC(void) MSG_vm_start(msg_vm_t vm);
494
495 /* Shutdown the guest operating system. */
496 XBT_PUBLIC(void) MSG_vm_shutdown(msg_vm_t vm);
497
498 XBT_PUBLIC(void) MSG_vm_migrate(msg_vm_t vm, msg_host_t destination);
499
500 /* Suspend the execution of the VM, but keep its state on memory. */
501 XBT_PUBLIC(void) MSG_vm_suspend(msg_vm_t vm);
502 XBT_PUBLIC(void) MSG_vm_resume(msg_vm_t vm);
503
504 /* Save the VM state to a disk. */
505 XBT_PUBLIC(void) MSG_vm_save(msg_vm_t vm);
506 XBT_PUBLIC(void) MSG_vm_restore(msg_vm_t vm);
507
508 XBT_PUBLIC(msg_host_t) MSG_vm_get_pm(msg_vm_t vm);
509 XBT_PUBLIC(void) MSG_vm_set_bound(msg_vm_t vm, double bound);
510
511
512 #include "simgrid/instr.h"
513
514 /* ****************************************************************************************** */
515 /* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
516 XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process);
517
518
519 /* Functions renamed in 3.14 */
520 #define MSG_mailbox_get_head(m) MSG_mailbox_front(m)
521
522
523 SG_END_DECL()
524 #endif