1 /* Copyright (c) 2007-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. */
7 #ifndef SIMGRID_MC_MODEL_CHECKER_HPP
8 #define SIMGRID_MC_MODEL_CHECKER_HPP
10 #include <sys/types.h>
15 #include <simgrid_config.h>
18 #include <sys/types.h>
20 #include "src/mc/mc_forward.hpp"
21 #include "src/mc/Process.hpp"
22 #include "src/mc/PageStore.hpp"
23 #include "src/mc/mc_protocol.h"
28 /** State of the model-checker (global variables for the model checker)
33 struct pollfd fds_[2];
34 /** String pool for host names */
35 // TODO, use std::unordered_set with heterogeneous comparison lookup (C++14)
36 xbt_dict_t /* <hostname, NULL> */ hostnames_;
37 // This is the parent snapshot of the current state:
38 PageStore page_store_;
39 std::unique_ptr<Process> process_;
41 mc_snapshot_t parent_snapshot_;
44 ModelChecker(ModelChecker const&) = delete;
45 ModelChecker& operator=(ModelChecker const&) = delete;
46 ModelChecker(pid_t pid, int socket);
53 PageStore& page_store()
57 const char* get_host_name(const char* name);
59 bool is_important_snapshot(Snapshot const& snapshot) const
61 return &snapshot == this->parent_snapshot_;
66 void resume(simgrid::mc::Process& process);
69 void wait_client(simgrid::mc::Process& process);
70 void simcall_handle(simgrid::mc::Process& process, unsigned long pid, int value);
71 void wait_for_requests()
73 mc_model_checker->wait_client(mc_model_checker->process());
77 bool handle_message(char* buffer, ssize_t size);
78 void handle_signals();
79 void handle_waitpid();
80 void on_signal(const struct signalfd_siginfo* info);