1 /* Copyright (c) 2015. The SimGrid Team.
2 * All rights reserved. */
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. */
12 #include "mc/datatypes.h"
16 // ***** Environment variables for passing context to the model-checked process
18 /** Environment variable name set by `simgrid-mc` to enable MC support in the
19 * children MC processes
21 #define MC_ENV_VARIABLE "SIMGRIC_MC"
23 /** Environment variable name used to pass the communication socket */
24 #define MC_ENV_SOCKET_FD "SIMGRID_MC_SOCKET_FD"
35 extern e_mc_mode_t mc_mode;
43 MC_MESSAGE_IGNORE_HEAP,
44 MC_MESSAGE_UNIGNORE_HEAP,
45 MC_MESSAGE_IGNORE_MEMORY,
46 MC_MESSAGE_STACK_REGION,
49 #define MC_MESSAGE_LENGTH 512
51 /** Basic structure for a MC message
53 * The current version of the client/server protocol sends C structures over `AF_LOCAL`
54 * `SOCK_DGRAM` sockets. This means that the protocol is ABI/architecture specific:
55 * we currently can't model-check a x86 process from a x86_64 process.
57 * Moreover the protocol is not stable. The same version of the library should be used
58 * for the client and the server.
60 * This is the basic structure shared by all messages: all message start with a message
63 typedef struct s_mc_message {
64 e_mc_message_type type;
65 } s_mc_message_t, *mc_message_t;
67 typedef struct s_mc_ignore_heap_message {
68 e_mc_message_type type;
69 s_mc_heap_ignore_region_t region;
70 } s_mc_ignore_heap_message_t, *mc_ignore_heap_message_t;
72 typedef struct s_mc_ignore_memory_message {
73 e_mc_message_type type;
76 } s_mc_ignore_memory_message_t, *mc_ignore_memory_message_t;
78 typedef struct s_mc_stack_region_message {
79 e_mc_message_type type;
80 s_stack_region_t stack_region;
81 } s_mc_stack_region_message_t, *mc_stack_region_message_t;
83 int MC_protocol_send(int socket, void* message, size_t size);
84 int MC_protocol_send_simple_message(int socket, int type);
85 int MC_protocol_hello(int socket);