Logo AND Algorithmique Numérique Distribuée

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