Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
52c0b716141723f62616d0a3271dcb7046b4bcc8
[simgrid.git] / src / simix / popping_private.h
1 /* Copyright (c) 2007-2010, 2012-2014. 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 _POPPING_PRIVATE_H
8 #define _POPPING_PRIVATE_H
9
10 SG_BEGIN_DECL()
11
12 /********************************* Simcalls *********************************/
13 XBT_PUBLIC(const char*) simcall_names[]; /* Name of each simcall */
14
15 #include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */
16 #include "mc/mc_interface.h" /* Definition of mc_snapshot_t, used by one simcall */
17
18 typedef int (*simix_match_func_t)(void *, void *, smx_synchro_t);
19 typedef void (*simix_copy_data_func_t)(smx_synchro_t, void*, size_t);
20 typedef void (*simix_clean_func_t)(void *);
21 typedef void (*FPtr)(void); // Hide the ugliness
22
23 /* Pack all possible scalar types in an union */
24 union u_smx_scalar {
25   char            c;
26   const char*     cc;
27   short           s;
28   int             i;
29   long            l;
30   unsigned char   uc;
31   unsigned short  us;
32   unsigned int    ui;
33   unsigned long   ul;
34   float           f;
35   double          d;
36   size_t          sz;
37   sg_size_t       sgsz;
38   sg_offset_t     sgoff;
39   void*           dp;
40   FPtr            fp;
41   const void*     cp;
42 };
43
44 /**
45  * \brief Represents a simcall to the kernel.
46  */
47 typedef struct s_smx_simcall {
48   e_smx_simcall_t call;
49   smx_process_t issuer;
50 #ifdef HAVE_MC
51   int mc_value;
52 #endif
53   union u_smx_scalar args[11];
54   union u_smx_scalar result;
55 } s_smx_simcall_t, *smx_simcall_t;
56
57 #if HAVE_MC
58 #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
59 #define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
60 #else
61 #define SIMCALL_SET_MC_VALUE(simcall, value) ((void)0)
62 #define SIMCALL_GET_MC_VALUE(simcall) 0
63 #endif
64
65 #include "popping_accessors.h"
66
67 /******************************** General *************************************/
68
69 void SIMIX_simcall_answer(smx_simcall_t);
70 void SIMIX_simcall_handle(smx_simcall_t, int);
71 void SIMIX_simcall_exit(smx_synchro_t);
72 const char *SIMIX_simcall_name(e_smx_simcall_t kind);
73
74 SG_END_DECL()
75
76 #endif