Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2f51412d995294cbbe5a0f8baa82797f9b2049fa
[simgrid.git] / include / simgrid / simix.h
1 /* Copyright (c) 2007, 2008, 2009, 2010. 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 _SIMIX_SIMIX_H
8 #define _SIMIX_SIMIX_H
9
10 #include "xbt/misc.h"
11 #include "xbt/fifo.h"
12 #include "xbt/dict.h"
13 #include "xbt/function_types.h"
14 #include "xbt/parmap.h"
15 #include "xbt/swag.h"
16
17 SG_BEGIN_DECL()
18
19 /**************************** Scalar Values **********************************/
20
21 typedef union u_smx_scalar u_smx_scalar_t;
22
23 /* ******************************** Host ************************************ */
24 /** @brief Host datatype
25     @ingroup simix_host_management
26
27     A <em>location</em> (or <em>host</em>) is any possible place where
28     a process may run. Thus it is represented as a <em>physical
29     resource with computing capabilities</em>, some <em>mailboxes</em>
30     to enable running process to communicate with remote ones, and
31     some <em>private data</em> that can be only accessed by local
32     process.
33
34     \see m_host_management
35   @{ */
36 typedef xbt_dictelm_t smx_host_t;
37 typedef struct s_smx_host_priv *smx_host_priv_t;
38 typedef enum {
39   SIMIX_WAITING,
40   SIMIX_READY,
41   SIMIX_RUNNING,
42   SIMIX_DONE,
43   SIMIX_CANCELED,
44   SIMIX_FAILED,
45   SIMIX_SRC_HOST_FAILURE,
46   SIMIX_DST_HOST_FAILURE,
47   SIMIX_SRC_TIMEOUT,
48   SIMIX_DST_TIMEOUT,
49   SIMIX_LINK_FAILURE
50 } e_smx_state_t;
51 /** @} */
52
53
54 typedef struct s_smx_timer* smx_timer_t;
55
56 /* ******************************** Synchro ************************************ */
57 /**
58  * \ingroup simix_synchro_management
59  */
60 typedef struct s_smx_mutex *smx_mutex_t;
61 /**
62  * \ingroup simix_synchro_management
63  */
64 typedef struct s_smx_cond *smx_cond_t;
65 /**
66  * \ingroup simix_synchro_management
67  */
68 typedef struct s_smx_sem *smx_sem_t;
69
70 /********************************** File *************************************/
71 typedef struct s_smx_file *smx_file_t;
72
73 /********************************** Storage *************************************/
74 typedef struct s_smx_storage *smx_storage_t;
75
76 /********************************** Action *************************************/
77 typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */
78
79
80
81 /* ****************************** Process *********************************** */
82 /** @brief Process datatype
83     @ingroup simix_process_management
84
85     A processt may be defined as a <em>code</em>, with some <em>private
86     data</em>, executing in a <em>location</em>.
87     \see m_process_management
88   @{ */
89 typedef struct s_smx_process *smx_process_t;
90 /** @} */
91
92
93 /*
94  * Type of function that creates a process.
95  * The function must accept the following parameters:
96  * void* process: the process created will be stored there
97  * const char *name: a name for the object. It is for user-level information and can be NULL
98  * xbt_main_func_t code: is a function describing the behavior of the process
99  * void *data: data a pointer to any data one may want to attach to the new object.
100  * smx_host_t host: the location where the new process is executed
101  * int argc, char **argv: parameters passed to code
102  * xbt_dict_t pros: properties
103  */
104 typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*,
105                                       /* name */ const char*,
106                                       /* code */ xbt_main_func_t,
107                                       /* userdata */ void*,
108                                       /* hostname */ const char*,
109                                       /* kill_time */ double,
110                                       /* argc */ int,
111                                       /* argv */ char**,
112                                       /* props */ xbt_dict_t,
113                                       /* auto_restart */ int);
114
115
116 /******************************* Networking ***********************************/
117 /**
118  * \ingroup simix_rdv_management
119  */
120 typedef struct s_smx_rvpoint *smx_rdv_t;
121
122 XBT_PUBLIC(void*) SIMIX_comm_get_src_data(smx_action_t action);
123 XBT_PUBLIC(void*) SIMIX_comm_get_dst_data(smx_action_t action);
124
125 /******************************** Context *************************************/
126 typedef struct s_smx_context *smx_context_t;
127 typedef struct s_smx_context_factory *smx_context_factory_t;
128
129 /* Process creation/destruction callbacks */
130 typedef void (*void_pfn_smxprocess_t) (smx_process_t);
131 /* Process kill */
132 typedef void (*void_pfn_smxprocess_t_smxprocess_t) (smx_process_t, smx_process_t);
133 /* for auto-restart function */
134 typedef void (*void_pfn_smxhost_t) (smx_host_t);
135
136 /* The following function pointer types describe the interface that any context
137    factory should implement */
138
139
140 typedef smx_context_t(*smx_pfn_context_factory_create_context_t)
141   (xbt_main_func_t, int, char **, void_pfn_smxprocess_t, void* data);
142 typedef int (*smx_pfn_context_factory_finalize_t) (smx_context_factory_t*);
143 typedef void (*smx_pfn_context_free_t) (smx_context_t);
144 typedef void (*smx_pfn_context_start_t) (smx_context_t);
145 typedef void (*smx_pfn_context_stop_t) (smx_context_t);
146 typedef void (*smx_pfn_context_suspend_t) (smx_context_t context);
147 typedef void (*smx_pfn_context_runall_t) (void);
148 typedef smx_context_t (*smx_pfn_context_self_t) (void);
149 typedef void* (*smx_pfn_context_get_data_t) (smx_context_t context);
150
151 /* interface of the context factories */
152 typedef struct s_smx_context_factory {
153   const char *name;
154   smx_pfn_context_factory_create_context_t create_context;
155   smx_pfn_context_factory_finalize_t finalize;
156   smx_pfn_context_free_t free;
157   smx_pfn_context_stop_t stop;
158   smx_pfn_context_suspend_t suspend;
159   smx_pfn_context_runall_t runall;
160   smx_pfn_context_self_t self;
161   smx_pfn_context_get_data_t get_data;
162 } s_smx_context_factory_t;
163
164 /* Hack: let msg load directly the right factory */
165 typedef void (*smx_ctx_factory_initializer_t)(smx_context_factory_t*);
166 XBT_PUBLIC(smx_ctx_factory_initializer_t) smx_factory_initializer_to_use;
167 extern char* smx_context_factory_name;
168 extern int smx_context_stack_size;
169 extern int smx_context_stack_size_was_set;
170
171 /* *********************** */
172 /* Context type definition */
173 /* *********************** */
174 /* the following function pointers types describe the interface that all context
175    concepts must implement */
176 /* each context type derive from this structure, so they must contain this structure
177  * at their beginning -- OOP in C :/ */
178 typedef struct s_smx_context {
179   s_xbt_swag_hookup_t hookup;
180   xbt_main_func_t code;
181   void_pfn_smxprocess_t cleanup_func;
182   void *data;   /* Here SIMIX stores the smx_process_t containing the context */
183   char **argv;
184   int argc;
185   unsigned iwannadie:1;
186 } s_smx_ctx_base_t;
187
188 /* methods of this class */
189 XBT_PUBLIC(void) smx_ctx_base_factory_init(smx_context_factory_t *factory);
190 XBT_PUBLIC(int) smx_ctx_base_factory_finalize(smx_context_factory_t *factory);
191
192 XBT_PUBLIC(smx_context_t)
193 smx_ctx_base_factory_create_context_sized(size_t size,
194                                           xbt_main_func_t code, int argc,
195                                           char **argv,
196                                           void_pfn_smxprocess_t cleanup,
197                                           void* data);
198 XBT_PUBLIC(void) smx_ctx_base_free(smx_context_t context);
199 XBT_PUBLIC(void) smx_ctx_base_stop(smx_context_t context);
200 XBT_PUBLIC(smx_context_t) smx_ctx_base_self(void);
201 XBT_PUBLIC(void) *smx_ctx_base_get_data(smx_context_t context);
202
203 XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable(void);
204 XBT_PUBLIC(smx_process_t) SIMIX_process_from_PID(int PID);
205 XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar(void);
206
207 /* parallelism */
208 XBT_PUBLIC(int) SIMIX_context_is_parallel(void);
209 XBT_PUBLIC(int) SIMIX_context_get_nthreads(void);
210 XBT_PUBLIC(void) SIMIX_context_set_nthreads(int nb_threads);
211 XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold(void);
212 XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
213 XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
214 XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
215
216
217
218 /********************************** Global ************************************/
219 /* Initialization and exit */
220 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
221
222
223 XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
224 XBT_PUBLIC(void) SIMIX_function_register_process_create(smx_creation_func_t function);
225 XBT_PUBLIC(void) SIMIX_function_register_process_kill(void_pfn_smxprocess_t_smxprocess_t function);
226
227 /* Simulation execution */
228 XBT_PUBLIC(void) SIMIX_run(void);    
229 XBT_PUBLIC(double) SIMIX_get_clock(void);
230
231 /* Timer functions FIXME: should these be public? */
232 XBT_PUBLIC(void) SIMIX_timer_set(double date, void *function, void *arg);
233 XBT_PUBLIC(double) SIMIX_timer_next(void);
234
235 XBT_PUBLIC(void) SIMIX_display_process_status(void);
236
237 /******************************* Environment **********************************/
238 XBT_PUBLIC(void) SIMIX_create_environment(const char *file);
239
240 /******************************** Deployment **********************************/
241
242 XBT_PUBLIC(void) SIMIX_function_register(const char *name, xbt_main_func_t code);
243 XBT_PUBLIC(void) SIMIX_function_register_default(xbt_main_func_t code);
244 XBT_PUBLIC(xbt_main_func_t) SIMIX_get_registered_function(const char *name);
245 XBT_PUBLIC(void) SIMIX_init_application(void);
246 XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
247
248 XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
249                                             const char *process_function,
250                                             xbt_dynar_t arguments,
251                                             double process_start_time,
252                                             double process_kill_time);
253
254 /*********************************** Host *************************************/
255 //XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_dict(u_smx_scalar_t *args);
256 XBT_PUBLIC(smx_host_t) SIMIX_host_get_by_name(const char *name);
257 XBT_PUBLIC(smx_host_t) SIMIX_host_self(void);
258 XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
259 XBT_PUBLIC(const char*) SIMIX_host_get_name(smx_host_t host); /* FIXME: make private: only the name of SIMIX_host_self() should be public without request */
260 XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
261 XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
262 XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
263 XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
264
265
266 /********************************* Process ************************************/
267 XBT_PUBLIC(int) SIMIX_process_count(void);
268 XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
269 XBT_PUBLIC(const char*) SIMIX_process_self_get_name(void);
270 XBT_PUBLIC(void) SIMIX_process_self_set_data(smx_process_t self, void *data);
271 XBT_PUBLIC(void*) SIMIX_process_self_get_data(smx_process_t self);
272 XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t);
273 XBT_PUBLIC(void) SIMIX_process_set_context(smx_process_t p,smx_context_t c);
274 XBT_PUBLIC(int) SIMIX_process_has_pending_comms(smx_process_t process);
275 XBT_PUBLIC(void) SIMIX_process_on_exit_runall(smx_process_t process);
276 XBT_PUBLIC(void) SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data);
277
278 /****************************** Communication *********************************/
279 XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, void*, size_t));
280 XBT_PUBLIC(void) SIMIX_comm_copy_pointer_callback(smx_action_t comm, void* buff, size_t buff_size);
281 XBT_PUBLIC(void) SIMIX_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_size);
282
283 XBT_PUBLIC(smx_action_t) SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data);
284 XBT_PUBLIC(int) SIMIX_comm_has_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data);
285 XBT_PUBLIC(int) SIMIX_comm_has_recv_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data);
286 XBT_PUBLIC(void) SIMIX_comm_finish(smx_action_t action);
287
288 /******************************************************************************/
289 /*                            SIMIX simcalls                                  */
290 /******************************************************************************/
291 /* These functions are a system call-like interface to the simulation kernel. */
292 /* They can also be called from maestro's context, and they are thread safe.  */
293 /******************************************************************************/
294
295 /******************************* Host simcalls ********************************/
296 /* TODO use handlers and keep smx_host_t hidden from higher levels */
297 XBT_PUBLIC(smx_host_t) simcall_host_get_by_name(const char *name);
298 XBT_PUBLIC(const char *) simcall_host_get_name(smx_host_t host);
299 XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(smx_host_t host);
300 XBT_PUBLIC(int) simcall_host_get_core(smx_host_t host);
301 XBT_PUBLIC(xbt_swag_t) simcall_host_get_process_list(smx_host_t host);
302 XBT_PUBLIC(double) simcall_host_get_speed(smx_host_t host);
303 XBT_PUBLIC(double) simcall_host_get_available_speed(smx_host_t host);
304 /* Two possible states, 1 - CPU ON and 0 CPU OFF */
305 XBT_PUBLIC(int) simcall_host_get_state(smx_host_t host);
306 XBT_PUBLIC(void *) simcall_host_get_data(smx_host_t host);
307
308 XBT_PUBLIC(void) simcall_host_set_data(smx_host_t host, void *data);
309
310 XBT_PUBLIC(double) simcall_host_get_current_power_peak(smx_host_t host);
311 XBT_PUBLIC(double) simcall_host_get_power_peak_at(smx_host_t host, int pstate_index);
312 XBT_PUBLIC(int) simcall_host_get_nb_pstates(smx_host_t host);
313 XBT_PUBLIC(void) simcall_host_set_power_peak_at(smx_host_t host, int pstate_index);
314 XBT_PUBLIC(double) simcall_host_get_consumed_energy(smx_host_t host);
315
316 XBT_PUBLIC(smx_action_t) simcall_host_execute(const char *name, smx_host_t host,
317                                                 double computation_amount,
318                                                 double priority);
319 XBT_PUBLIC(smx_action_t) simcall_host_parallel_execute(const char *name,
320                                                      int host_nb,
321                                                      smx_host_t *host_list,
322                                                      double *computation_amount,
323                                                      double *communication_amount,
324                                                      double amount,
325                                                      double rate);
326 XBT_PUBLIC(void) simcall_host_execution_destroy(smx_action_t execution);
327 XBT_PUBLIC(void) simcall_host_execution_cancel(smx_action_t execution);
328 XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_action_t execution);
329 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution);
330 XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority);
331 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
332
333
334 /**************************** Process simcalls ********************************/
335 /* Constructor and Destructor */
336 XBT_PUBLIC(void) simcall_process_create(smx_process_t *process,
337                                           const char *name,
338                                           xbt_main_func_t code,
339                                           void *data,
340                                           const char *hostname,
341                                           double kill_time,
342                                           int argc, char **argv,
343                                           xbt_dict_t properties,
344                                           int auto_restart);
345
346 XBT_PUBLIC(void) simcall_process_kill(smx_process_t process);
347 XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
348
349 /* Process handling */
350 XBT_PUBLIC(void) simcall_process_cleanup(smx_process_t process);
351 XBT_PUBLIC(void) simcall_process_change_host(smx_process_t process,
352                  smx_host_t dest);
353 XBT_PUBLIC(void) simcall_process_suspend(smx_process_t process);
354 XBT_PUBLIC(void) simcall_process_resume(smx_process_t process);
355
356 /* Getters and Setters */
357 XBT_PUBLIC(int) simcall_process_count(void);
358 XBT_PUBLIC(void *) simcall_process_get_data(smx_process_t process);
359 XBT_PUBLIC(void) simcall_process_set_data(smx_process_t process, void *data);
360 XBT_PUBLIC(smx_host_t) simcall_process_get_host(smx_process_t process);
361 XBT_PUBLIC(const char *) simcall_process_get_name(smx_process_t process);
362 XBT_PUBLIC(int) simcall_process_get_PID(smx_process_t process);
363 XBT_PUBLIC(int) simcall_process_get_PPID(smx_process_t process);
364 XBT_PUBLIC(int) simcall_process_is_suspended(smx_process_t process);
365 XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_process_t host);
366 XBT_PUBLIC(void) simcall_process_set_kill_time(smx_process_t process, double kill_time);
367 XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data);
368 XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int auto_restart);
369 XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process);
370 /* Sleep control */
371 XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
372
373 /************************** Comunication simcalls *****************************/
374 /***** Rendez-vous points *****/
375
376 XBT_PUBLIC(smx_rdv_t) simcall_rdv_create(const char *name);
377 XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp);
378 XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name);
379 XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
380 XBT_PUBLIC(smx_action_t) simcall_rdv_get_head(smx_rdv_t rdv);
381 XBT_PUBLIC(smx_process_t) simcall_rdv_get_receiver(smx_rdv_t rdv);
382 XBT_PUBLIC(void) simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process);
383
384 XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void);
385
386 /***** Communication simcalls *****/
387
388 XBT_PUBLIC(void) simcall_comm_send(smx_rdv_t rdv, double task_size,
389                                      double rate, void *src_buff,
390                                      size_t src_buff_size,
391                                      int (*match_fun)(void *, void *, smx_action_t),
392                                      void *data, double timeout);
393
394 XBT_PUBLIC(smx_action_t) simcall_comm_isend(smx_rdv_t rdv, double task_size,
395                                               double rate, void *src_buff,
396                                               size_t src_buff_size,
397                                               int (*match_fun)(void *, void *, smx_action_t),
398                                               void (*clean_fun)(void *),
399                                               void *data, int detached);
400
401 XBT_PUBLIC(void) simcall_comm_recv(smx_rdv_t rdv, void *dst_buff,
402                                      size_t * dst_buff_size,
403                                      int (*match_fun)(void *, void *, smx_action_t),
404                                      void *data, double timeout);
405
406 XBT_PUBLIC(smx_action_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff,
407                                               size_t * dst_buff_size,
408                                               int (*match_fun)(void *, void *, smx_action_t),
409                                               void *data);
410
411 XBT_PUBLIC(void) simcall_comm_recv_bounded(smx_rdv_t rdv, void *dst_buff,
412                                      size_t * dst_buff_size,
413                                      int (*match_fun)(void *, void *, smx_action_t),
414                                      void *data, double timeout, double rate);
415
416 XBT_PUBLIC(smx_action_t) simcall_comm_irecv_bounded(smx_rdv_t rdv, void *dst_buff,
417                                               size_t * dst_buff_size,
418                                               int (*match_fun)(void *, void *, smx_action_t),
419                                               void *data, double rate);
420
421 XBT_PUBLIC(void) simcall_comm_destroy(smx_action_t comm);
422 XBT_PUBLIC(smx_action_t) simcall_comm_iprobe(smx_rdv_t rdv, int src, int tag,
423                                 int (*match_fun)(void *, void *, smx_action_t), void *data);
424 XBT_PUBLIC(void) simcall_comm_cancel(smx_action_t comm);
425
426 /* FIXME: waitany is going to be a vararg function, and should take a timeout */
427 XBT_PUBLIC(unsigned int) simcall_comm_waitany(xbt_dynar_t comms);
428 XBT_PUBLIC(void) simcall_comm_wait(smx_action_t comm, double timeout);
429 XBT_PUBLIC(int) simcall_comm_test(smx_action_t comm);
430 XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms);
431
432 /* Getters and setters */
433 XBT_PUBLIC(double) simcall_comm_get_remains(smx_action_t comm);
434 XBT_PUBLIC(e_smx_state_t) simcall_comm_get_state(smx_action_t comm);
435 XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_action_t comm);
436 XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_action_t comm);
437 XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_action_t comm);
438 XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_action_t comm);
439
440 #ifdef HAVE_LATENCY_BOUND_TRACKING
441 XBT_PUBLIC(int) simcall_comm_is_latency_bounded(smx_action_t comm);
442 #endif
443
444 #ifdef HAVE_TRACING
445 /************************** Tracing handling **********************************/
446 XBT_PUBLIC(void) simcall_set_category(smx_action_t action, const char *category);
447 #endif
448
449 /************************** Synchro simcalls **********************************/
450
451 XBT_PUBLIC(smx_mutex_t) simcall_mutex_init(void);
452 XBT_PUBLIC(void) simcall_mutex_destroy(smx_mutex_t mutex);
453 XBT_PUBLIC(void) simcall_mutex_lock(smx_mutex_t mutex);
454 XBT_PUBLIC(int) simcall_mutex_trylock(smx_mutex_t mutex);
455 XBT_PUBLIC(void) simcall_mutex_unlock(smx_mutex_t mutex);
456
457 XBT_PUBLIC(smx_cond_t) simcall_cond_init(void);
458 XBT_PUBLIC(void) simcall_cond_destroy(smx_cond_t cond);
459 XBT_PUBLIC(void) simcall_cond_signal(smx_cond_t cond);
460 XBT_PUBLIC(void) simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
461 XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond,
462                                          smx_mutex_t mutex,
463                                          double max_duration);
464 XBT_PUBLIC(void) simcall_cond_broadcast(smx_cond_t cond);
465
466 XBT_PUBLIC(smx_sem_t) simcall_sem_init(int capacity);
467 XBT_PUBLIC(void) simcall_sem_destroy(smx_sem_t sem);
468 XBT_PUBLIC(void) simcall_sem_release(smx_sem_t sem);
469 XBT_PUBLIC(int) simcall_sem_would_block(smx_sem_t sem);
470 XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem);
471 XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem,
472                                              double max_duration);
473 XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
474
475 /*****************************   File   **********************************/
476 XBT_PUBLIC(size_t) simcall_file_read(size_t size, smx_file_t fd);
477 XBT_PUBLIC(size_t) simcall_file_write(size_t size, smx_file_t fd);
478 XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path);
479 XBT_PUBLIC(int) simcall_file_close(smx_file_t fd);
480 XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd);
481 XBT_PUBLIC(xbt_dict_t) simcall_file_ls(const char* mount, const char* path);
482 XBT_PUBLIC(size_t) simcall_file_get_size(smx_file_t fd);
483
484 /************************** AS router   **********************************/
485 XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
486 /************************** AS router simcalls ***************************/
487 XBT_PUBLIC(xbt_dict_t) simcall_asr_get_properties(const char *name);
488
489 /************************** MC simcalls   **********************************/
490 XBT_PUBLIC(void *) simcall_mc_snapshot(void);
491 XBT_PUBLIC(int) simcall_mc_compare_snapshots(void *s1, void *s2);
492 XBT_PUBLIC(int) simcall_mc_random(void);
493
494 /************************** New API simcalls **********************************/
495 /* TUTORIAL: New API                                                          */
496 /******************************************************************************/
497 XBT_PUBLIC(int) simcall_new_api_fct(const char* param1, double param2);
498
499 SG_END_DECL()
500 #endif                          /* _SIMIX_SIMIX_H */