X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/02f267e2895f3985fe73344a8b96ac05363b8b62..9b7c007d68cc9aabd52746479c68a8287a087fe3:/src/mc/mc_client.c diff --git a/src/mc/mc_client.c b/src/mc/mc_client.c index c903246cce..da8d8c41a4 100644 --- a/src/mc/mc_client.c +++ b/src/mc/mc_client.c @@ -22,6 +22,7 @@ #include "mc_mmalloc.h" #include "mc_ignore.h" #include "mc_model_checker.h" +#include "mc_private.h" // MC_deadlock_check() XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic"); @@ -44,7 +45,7 @@ void MC_client_init(void) int type; socklen_t socklen = sizeof(type); if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) != 0) - xbt_die("Could not check socket type: %s", strerror(errno)); + xbt_die("Could not check socket type"); if (type != SOCK_DGRAM) xbt_die("Unexpected socket type %i", type); XBT_DEBUG("Model-checked application found expected socket type"); @@ -85,28 +86,23 @@ void MC_client_handle_messages(void) xbt_die("Message is too short"); memcpy(&message, message_buffer, sizeof(message)); switch (message.type) { + + case MC_MESSAGE_DEADLOCK_CHECK: + { + int result = MC_deadlock_check(); + s_mc_int_message_t answer; + answer.type = MC_MESSAGE_DEADLOCK_CHECK_REPLY; + answer.value = result; + if (MC_protocol_send(mc_client->fd, &answer, sizeof(answer))) + xbt_die("Could nor send response"); + } + break; + case MC_MESSAGE_CONTINUE: return; + default: xbt_die("Unexpected message from model-checker %i", message.type); } } } - -void MC_ignore(void* addr, size_t size) -{ - if (mc_mode == MC_MODE_CLIENT) { - s_mc_ignore_memory_message_t message; - message.type = MC_MESSAGE_IGNORE_MEMORY; - message.addr = addr; - message.size = size; - MC_client_send_message(&message, sizeof(message)); - } - - // TODO, remove this once the migration has been completed - int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); - MC_SET_MC_HEAP; - MC_process_ignore_memory(&mc_model_checker->process, addr, size); - if (!raw_mem_set) - MC_SET_STD_HEAP; -}