Logo AND Algorithmique Numérique Distribuée

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