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,
48 #define MC_MESSAGE_LENGTH 512
50 /** Basic structure for a MC message
52 * The current version of the client/server protocol sends C structures over `AF_LOCAL`
53 * `SOCK_DGRAM` sockets. This means that the protocol is ABI/architecture specific:
54 * we currently can't model-check a x86 process from a x86_64 process.
56 * Moreover the protocol is not stable. The same version of the library should be used
57 * for the client and the server.
59 * This is the basic structure shared by all messages: all message start with a message
62 typedef struct s_mc_message {
63 e_mc_message_type type;
64 } s_mc_message_t, *mc_message_t;
66 typedef struct s_mc_ignore_heap_message {
67 e_mc_message_type type;
68 s_mc_heap_ignore_region_t region;
69 } s_mc_ignore_heap_message_t, *mc_ignore_heap_message_t;
71 typedef struct s_mc_ignore_memory_message {
72 e_mc_message_type type;
75 } s_mc_ignore_memory_message_t, *mc_ignore_memory_message_t;
77 int MC_protocol_send(int socket, void* message, size_t size);
78 int MC_protocol_send_simple_message(int socket, int type);
79 int MC_protocol_hello(int socket);