X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a8117ad0492ce7b4a42d963915fdd05e6d6a7a9f..HEAD:/src/mc/remote/CheckerSide.hpp diff --git a/src/mc/remote/CheckerSide.hpp b/src/mc/remote/CheckerSide.hpp index 55f7b32dfc..f4605e4cd2 100644 --- a/src/mc/remote/CheckerSide.hpp +++ b/src/mc/remote/CheckerSide.hpp @@ -18,25 +18,25 @@ namespace simgrid::mc { /* CheckerSide: All what the checker needs to interact with a given application process */ class CheckerSide { - void (*const free_event_fun)(event*) = [](event* evt) { - event_del(evt); - event_free(evt); - }; - std::unique_ptr socket_event_{nullptr, &event_free}; - std::unique_ptr signal_event_{nullptr, &event_free}; + event* socket_event_; + event* signal_event_; std::unique_ptr base_{nullptr, &event_base_free}; - std::unique_ptr remote_memory_; Channel channel_; bool running_ = false; pid_t pid_; + // When forking (no meminfo), the real app is our grandchild. In this case, + // child_checker_ is a CheckerSide to our child that can waitpid our grandchild on our behalf + CheckerSide* child_checker_ = nullptr; - void setup_events(); // Part of the initialization - void clear_memory_cache(); - void handle_waitpid(); + void setup_events(bool socket_only); // Part of the initialization + void handle_dead_child(int status); // Launched when the dying child is the PID we follow + void handle_waitpid(); // Launched when receiving a sigchild public: - explicit CheckerSide(const std::vector& args, bool need_memory_introspection); + explicit CheckerSide(int socket, CheckerSide* child_checker); + explicit CheckerSide(const std::vector& args); + ~CheckerSide(); // No copy: CheckerSide(CheckerSide const&) = delete; @@ -52,11 +52,16 @@ public: void break_loop() const; void wait_for_requests(); + /* Create a new CheckerSide by forking the currently existing one, and connect it through the master_socket */ + std::unique_ptr clone(int master_socket, const std::string& master_socket_name); + + /** Ask the application to run post-mortem analysis, and maybe to stop ASAP */ + void finalize(bool terminate_asap = false); + /* Interacting with the application process */ pid_t get_pid() const { return pid_; } bool running() const { return running_; } void terminate() { running_ = false; } - RemoteProcessMemory* get_remote_memory() { return remote_memory_.get(); } }; } // namespace simgrid::mc