1 /* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "simgrid/s4u/Host.hpp"
8 #include "src/kernel/actor/ActorImpl.hpp"
9 #include "src/kernel/actor/SimcallObserver.hpp"
10 #include "src/kernel/context/Context.hpp"
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_simcall, kernel, "transmuting from user request into kernel handlers");
20 * @brief (in kernel mode) unpack the simcall and activate the handler
23 void ActorImpl::simcall_handle(int times_considered)
25 XBT_DEBUG("Handling simcall %p: %s", &simcall_, simcall_.get_cname());
26 if (simcall_.observer_ != nullptr)
27 simcall_.observer_->prepare(times_considered);
31 xbt_assert(simcall_.call_ != Simcall::Type::NONE, "Asked to do the noop syscall on %s@%s", get_cname(),
32 get_host()->get_cname());
35 if (simcall_.call_ == Simcall::Type::RUN_ANSWERED)
39 /** @brief returns a printable string representing a simcall */
40 const char* Simcall::get_cname() const
42 if (observer_ != nullptr) {
43 static std::string name;
44 name = boost::core::demangle(typeid(*observer_).name());
45 const char* cname = name.c_str();
46 if (name.rfind("simgrid::kernel::", 0) == 0)
47 cname += 17; // strip prefix "simgrid::kernel::"
50 return to_c_str(call_);
56 } // namespace simgrid