-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <xbt/log.h>
#include <xbt/mmalloc.h>
-#include <xbt/swag.h>
#include <xbt/sysdep.h>
#include <simgrid/modelchecker.h>
#include "src/internal_config.h"
-#include "src/mc/mc_request.h"
+#include "src/mc/mc_request.hpp"
#include "src/mc/remote/Client.hpp"
#include "src/mc/remote/mc_protocol.h"
#include "src/smpi/include/private.hpp"
// We won't need those once the separation MCer/MCed is complete:
-#include "src/mc/mc_smx.h"
+#include "src/mc/mc_smx.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic");
socklen_t socklen = sizeof(type);
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) != 0)
xbt_die("Could not check socket type");
- if (type != SOCK_DGRAM)
+ if (type != SOCK_SEQPACKET)
xbt_die("Unexpected socket type %i", type);
XBT_DEBUG("Model-checked application found expected socket type");
return instance_.get();
}
-void Client::handleDeadlockCheck(mc_message_t* msg)
+void Client::handleDeadlockCheck(s_mc_message_t* msg)
{
bool deadlock = false;
if (not simix_global->process_list.empty()) {
deadlock = true;
- for (auto kv : simix_global->process_list)
+ for (auto const& kv : simix_global->process_list)
if (simgrid::mc::actor_is_enabled(kv.second)) {
deadlock = false;
break;
}
// Send result:
- mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock};
+ s_mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock};
xbt_assert(channel_.send(answer) == 0, "Could not send response");
}
-void Client::handleContinue(mc_message_t* msg)
+void Client::handleContinue(s_mc_message_t* msg)
{
/* Nothing to do */
}
void Client::handleRestore(s_mc_message_restore_t* message)
{
#if HAVE_SMPI
- smpi_really_switch_data_segment(message->index);
+ smpi_really_switch_data_segment(simgrid::s4u::Actor::by_pid(message->index));
#endif
}
void Client::handleActorEnabled(s_mc_message_actor_enabled_t* msg)
{
bool res = simgrid::mc::actor_is_enabled(SIMIX_process_from_PID(msg->aid));
- s_mc_message_int answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res};
+ s_mc_message_int_t answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res};
channel_.send(answer);
}
if (received_size < 0)
xbt_die("Could not receive commands from the model-checker");
- mc_message_t* message = (mc_message_t*)message_buffer;
+ s_mc_message_t* message = (s_mc_message_t*)message_buffer;
switch (message->type) {
case MC_MESSAGE_DEADLOCK_CHECK:
- xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zd != %zu)",
- received_size, sizeof(mc_message_t));
+ xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zd != %zu)",
+ received_size, sizeof(s_mc_message_t));
handleDeadlockCheck(message);
break;
case MC_MESSAGE_CONTINUE:
- xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for MESSAGE_CONTINUE (%zd != %zu)",
- received_size, sizeof(mc_message_t));
+ xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for MESSAGE_CONTINUE (%zd != %zu)",
+ received_size, sizeof(s_mc_message_t));
handleContinue(message);
return;
break;
case MC_MESSAGE_RESTORE:
- xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for MESSAGE_RESTORE (%zd != %zu)",
- received_size, sizeof(mc_message_t));
+ xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for MESSAGE_RESTORE (%zd != %zu)",
+ received_size, sizeof(s_mc_message_t));
handleRestore((s_mc_message_restore_t*)message_buffer);
break;
region.size = size;
region.block = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1;
#if HAVE_SMPI
- if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP && process)
- region.process_index = process->pid - 1;
+ if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP && process)
+ region.process_index = process->pid_ - 1;
else
#endif
region.process_index = -1;