Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authormlaurent <mathieu.laurent@ens-rennes.fr>
Wed, 22 Feb 2023 15:35:29 +0000 (16:35 +0100)
committermlaurent <mathieu.laurent@ens-rennes.fr>
Wed, 22 Feb 2023 15:35:29 +0000 (16:35 +0100)
35 files changed:
ChangeLog
MANIFEST.in
include/simgrid/Exception.hpp
include/simgrid/actor.h
include/simgrid/engine.h
include/simgrid/s4u/Engine.hpp
include/simgrid/version.h.in
include/xbt.h
include/xbt/ex.h
include/xbt/module.h
include/xbt/sysdep.h
include/xbt/virtu.h
src/instr/instr_paje_header.cpp
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp
src/kernel/context/ContextThread.cpp
src/kernel/resource/profile/StochasticDatedValue.cpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Engine.cpp
src/simgrid/sg_config.cpp
src/smpi/internals/smpi_memory.cpp
src/xbt/backtrace.cpp
src/xbt/dict.cpp
src/xbt/exception.cpp
src/xbt/log.cpp
src/xbt/xbt_log_layout_format.cpp
src/xbt/xbt_log_layout_simple.cpp
src/xbt/xbt_main.cpp [deleted file]
src/xbt/xbt_misc.cpp [new file with mode: 0644]
src/xbt/xbt_modinter.h [deleted file]
src/xbt/xbt_virtu.cpp [deleted file]
teshsuite/models/lmm_usage/lmm_usage.cpp
teshsuite/models/maxmin_bench/maxmin_bench.cpp
teshsuite/xbt/mmalloc/mmalloc_test.cpp
tools/cmake/DefinePackages.cmake

index 73cd894..0d62c29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,10 @@ Models:
 sthread:
  - Implement pthread_join in MC mode.
 
+XBT:
+ - simgrid::xbt::cmdline and simgrid::xbt::binary_name are gone.
+   Please use simgrid::s4u::Engine::get_cmdline() instead.
+
 Documentation:
  - New section in the user guide on the provided performance models.
  - New section presenting some technical good practices for (potential) contributors.
index 5c50b59..d0b59a9 100644 (file)
@@ -2491,15 +2491,13 @@ include src/xbt/unit-tests_main.cpp
 include src/xbt/xbt_log_appender_file.cpp
 include src/xbt/xbt_log_layout_format.cpp
 include src/xbt/xbt_log_layout_simple.cpp
-include src/xbt/xbt_main.cpp
-include src/xbt/xbt_modinter.h
+include src/xbt/xbt_misc.cpp
 include src/xbt/xbt_os_file.cpp
 include src/xbt/xbt_os_time.c
 include src/xbt/xbt_parse_units.cpp
 include src/xbt/xbt_replay.cpp
 include src/xbt/xbt_str.cpp
 include src/xbt/xbt_str_test.cpp
-include src/xbt/xbt_virtu.cpp
 include teshsuite/kernel/CMakeLists.txt
 include teshsuite/mc/CMakeLists.txt
 include teshsuite/models/CMakeLists.txt
index e580ea9..5747ce1 100644 (file)
@@ -3,11 +3,12 @@
 /* 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. */
 
-/* This file defines all possible exception that could occur in a SimGrid library. */
+/* This file defines all possible exceptions that could occur in a SimGrid library. */
 
 #ifndef SIMGRID_EXCEPTIONS_HPP
 #define SIMGRID_EXCEPTIONS_HPP
 
+#include <simgrid/actor.h>
 #include <xbt/backtrace.hpp>
 #include <xbt/ex.h>
 #include <xbt/string.hpp>
@@ -51,7 +52,8 @@ public:
 
 /** Create a ThrowPoint with (__FILE__, __LINE__, __func__) */
 #define XBT_THROW_POINT                                                                                                \
-  ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid())
+  ::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__, simgrid::xbt::Backtrace(), sg_actor_self_get_name(),        \
+                             sg_actor_self_get_pid())
 
 class XBT_PUBLIC ImpossibleError : public std::logic_error {
 public:
index dcee507..fb34364 100644 (file)
@@ -72,6 +72,7 @@ XBT_PUBLIC void sg_actor_detach();
 XBT_PUBLIC sg_actor_t sg_actor_self();
 XBT_PUBLIC aid_t sg_actor_self_get_pid();
 XBT_PUBLIC aid_t sg_actor_self_get_ppid();
+/** Returns the name of the current actor (or "maestro" if maestro is running) */
 XBT_PUBLIC const char* sg_actor_self_get_name();
 XBT_PUBLIC void* sg_actor_self_get_data();
 XBT_PUBLIC void sg_actor_self_set_data(void* data);
index b4e8c08..d3ff02b 100644 (file)
@@ -11,9 +11,9 @@
 
 SG_BEGIN_DECL /* C interface */
 
-    /** Initialize the SimGrid engine, taking the command line parameters of your main function. */
-    XBT_PUBLIC void
-    simgrid_init(int* argc, char** argv);
+/** Initialize the SimGrid engine, taking the command line parameters of your main function. */
+XBT_PUBLIC void
+simgrid_init(int* argc, char** argv);
 
 /** Creates a new platform, including hosts, links, and the routing table.
  *
index 94b0202..c9fd475 100644 (file)
@@ -56,6 +56,7 @@ public:
   static s4u::Engine* get_instance();
   static s4u::Engine* get_instance(int* argc, char** argv);
   static bool has_instance() { return instance_ != nullptr; }
+  const std::vector<std::string>& get_cmdline() const;
 
   /**
    * Creates a new platform, including hosts, links, and the routing table.
@@ -199,7 +200,10 @@ public:
     return res;
   }
 
-  kernel::EngineImpl* get_impl() const { return pimpl; }
+  kernel::EngineImpl* get_impl() const
+  {
+    return pimpl_;
+  }
 
   /** Returns whether SimGrid was initialized yet -- mostly for internal use */
   static bool is_initialized();
@@ -255,7 +259,7 @@ private:
   static xbt::signal<void(void)> on_deadlock;
   static xbt::signal<void()> on_simulation_end;
 
-  kernel::EngineImpl* const pimpl;
+  kernel::EngineImpl* const pimpl_;
   static Engine* instance_;
   void initialize(int* argc, char** argv);
 };
index acd8644..daa8e9c 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef SIMGRID_VERSION_H
 #define SIMGRID_VERSION_H
 
+#include "xbt/base.h"
+
 #define SIMGRID_GIT_VERSION   "@GIT_VERSION@"
 
 /** Define the version numbers of the used header files.
index deafed8..0f6e5b8 100644 (file)
@@ -17,8 +17,6 @@
 #include <xbt/asserts.h>
 #include <xbt/log.h>
 
-#include <xbt/module.h>
-
 #include <xbt/dynar.h>
 #include <xbt/dict.h>
 
index 83e90c3..f221afe 100644 (file)
@@ -11,7 +11,6 @@
 #include <xbt/base.h>
 #include <xbt/misc.h>
 #include <xbt/sysdep.h>
-#include <xbt/virtu.h>
 
 /** @addtogroup XBT_ex_c
  *  @brief Exceptions support (C)
index 43fe15d..ee9d548 100644 (file)
@@ -8,11 +8,20 @@
 #ifndef XBT_MODULE_H
 #define XBT_MODULE_H
 
-#include <xbt/misc.h>           /* XBT_PUBLIC */
+// avoid deprecation warning on include (remove entire file with XBT_ATTRIB_DEPRECATED_v337)
+#ifndef XBT_MODULE_H_NO_DEPRECATED_WARNING
+#warning xbt/module.h is deprecated and will be removed in v3.37.
+#endif
+
+#include <simgrid/engine.h>
+#include <xbt/base.h>
 
 SG_BEGIN_DECL
 
-XBT_PUBLIC void xbt_init(int* argc, char** argv);
+XBT_ATTRIB_DEPRECATED_v337("Please use simgrid_init(&argc, argv) instead") static void xbt_init(int* argc, char** argv)
+{
+  simgrid_init(argc, argv);
+}
 
 SG_END_DECL
 
index a4800a1..e78e0bd 100644 (file)
@@ -78,8 +78,7 @@ static XBT_ALWAYS_INLINE void *xbt_realloc(void *p, size_t s) {
   return res;
 }
 
-/** @brief like free
-    @hideinitializer */
+/** @brief like free */
 #define xbt_free(p) free(p) /*nothing specific to do here. A poor valgrind replacement? */
 
 #ifdef __cplusplus
index b1a6e04..0789a9a 100644 (file)
@@ -8,29 +8,25 @@
 #ifndef XBT_VIRTU_H
 #define XBT_VIRTU_H
 
+#include <simgrid/actor.h>
 #include <xbt/base.h>
 
-#ifdef __cplusplus
-#include <string>
-#include <vector>
-
-namespace simgrid {
-namespace xbt {
-
-/* Get the name of the UNIX process englobing the world */
-XBT_PUBLIC_DATA std::string binary_name;
-/** Contains all the parameters we got from the command line (including argv[0]) */
-XBT_PUBLIC_DATA std::vector<std::string> cmdline;
-
-} // namespace xbt
-} // namespace simgrid
+// avoid deprecation warning on include (remove entire file with XBT_ATTRIB_DEPRECATED_v337)
+#ifndef XBT_VIRTU_H_NO_DEPRECATED_WARNING
+#warning xbt/virtu.h is deprecated and will be removed in v3.37.
 #endif
 
 SG_BEGIN_DECL
 
-XBT_PUBLIC const char* xbt_procname(void);
+XBT_ATTRIB_DEPRECATED_v337("Please use sg_actor_self_get_name()") static const char* xbt_procname(void)
+{
+  return sg_actor_self_get_name();
+}
 
-XBT_PUBLIC int xbt_getpid(void);
+XBT_ATTRIB_DEPRECATED_v337("Please use sg_actor_self_get_pid()") static int xbt_getpid(void)
+{
+  return sg_actor_self_get_pid();
+};
 
 SG_END_DECL
 
index 487f605..d69e4dd 100644 (file)
@@ -1,14 +1,13 @@
-/* Copyright (c) 2010-2023. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2023. 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 "simgrid/Exception.hpp"
 #include "simgrid/version.h"
 #include "src/instr/instr_private.hpp"
 #include "src/smpi/include/private.hpp"
-#include "xbt/virtu.h" /* xbt::cmdline */
+#include <simgrid/Exception.hpp>
+#include <simgrid/s4u/Engine.hpp>
 
 extern std::ofstream tracing_file;
 namespace simgrid::instr::paje {
@@ -18,7 +17,7 @@ void dump_generator_version()
   tracing_file << "#This file was generated using SimGrid-" << SIMGRID_VERSION_MAJOR << "." << SIMGRID_VERSION_MINOR
                << "." << SIMGRID_VERSION_PATCH << '\n';
   tracing_file << "#[";
-  for (auto const& str : simgrid::xbt::cmdline) {
+  for (auto const& str : simgrid::s4u::Engine::get_instance()->get_cmdline()) {
     tracing_file << str << " ";
   }
   tracing_file << "]\n";
index 1547836..6b2da71 100644 (file)
@@ -19,8 +19,8 @@
 #include "src/simgrid/math_utils.h"
 #include "src/simgrid/sg_config.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
-#include "src/xbt/xbt_modinter.h" /* whether initialization was already done */
-#include "xbt/module.h"
+
+#include "xbt/log.hpp"
 
 #include <boost/algorithm/string/predicate.hpp>
 #include <dlfcn.h>
@@ -139,6 +139,9 @@ static void install_signal_handlers()
   }
 }
 
+static simgrid::config::Flag<bool> cfg_dbg_clean_atexit{
+    "debug/clean-atexit", "Whether to cleanup SimGrid at exit. Disable it if your code segfaults after its end.", true};
+
 namespace simgrid::kernel {
 
 EngineImpl::~EngineImpl()
@@ -175,8 +178,15 @@ void EngineImpl::initialize(int* argc, char** argv)
   simgrid::mc::AppSide::initialize();
 #endif
 
-  if (xbt_initialized == 0) {
-    xbt_init(argc, argv);
+  static bool inited = false;
+  if (not inited) {
+    inited = true;
+    xbt_log_init(argc, argv);
+
+    simgrid::xbt::install_exception_handler();
+
+    for (int i = 0; i < *argc; i++)
+      cmdline_.emplace_back(argv[i]);
 
     sg_config_init(argc, argv);
   }
@@ -188,7 +198,7 @@ void EngineImpl::initialize(int* argc, char** argv)
   /* register a function to be called after the environment creation */
   s4u::Engine::on_platform_created_cb([this]() { this->presolve(); });
 
-  if (config::get_value<bool>("debug/clean-atexit"))
+  if (cfg_dbg_clean_atexit)
     atexit(shutdown);
 }
 
index 889f726..ab1ea07 100644 (file)
@@ -57,6 +57,7 @@ class EngineImpl {
   std::unique_ptr<void, std::function<int(void*)>> platf_handle_; //!< handle for platform library
   friend s4u::Engine;
 
+  std::vector<std::string> cmdline_; // Copy of the argv we got (including argv[0])
 public:
   EngineImpl() = default;
 
@@ -69,6 +70,10 @@ public:
 #endif
 
   void initialize(int* argc, char** argv);
+  const std::vector<std::string>& get_cmdline() const
+  {
+    return cmdline_;
+  }
   void load_platform(const std::string& platf);
   void load_deployment(const std::string& file) const;
   void seal_platform() const;
@@ -97,8 +102,14 @@ public:
   const std::vector<resource::Model*>& get_all_models() const { return models_; }
 
   static bool has_instance() { return s4u::Engine::has_instance(); }
-  static EngineImpl* get_instance() { return s4u::Engine::get_instance()->pimpl; }
-  static EngineImpl* get_instance(int* argc, char** argv) { return s4u::Engine::get_instance(argc, argv)->pimpl; }
+  static EngineImpl* get_instance()
+  {
+    return s4u::Engine::get_instance()->pimpl_;
+  }
+  static EngineImpl* get_instance(int* argc, char** argv)
+  {
+    return s4u::Engine::get_instance(argc, argv)->pimpl_;
+  }
 
   actor::ActorCodeFactory get_function(const std::string& name)
   {
index 68bb417..40efb6b 100644 (file)
@@ -8,7 +8,6 @@
 #include "simgrid/Exception.hpp"
 #include "src/internal_config.h" /* loads context system definitions */
 #include "src/kernel/EngineImpl.hpp"
-#include "src/xbt/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
 #include "xbt/function_types.h"
 
 #include <boost/core/demangle.hpp>
index 4f7208a..c1d383e 100644 (file)
@@ -4,8 +4,10 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/resource/profile/StochasticDatedValue.hpp"
-#include "xbt.h"
+
+#include "xbt/asserts.h"
 #include "xbt/random.hpp"
+
 #include <math.h>
 
 namespace simgrid::kernel::profile {
index ea0ea36..1e022aa 100644 (file)
@@ -413,7 +413,8 @@ ExecPtr exec_async(double flops)
 
 aid_t get_pid()
 {
-  return simgrid::kernel::actor::ActorImpl::self()->get_pid();
+  auto* self = simgrid::kernel::actor::ActorImpl::self();
+  return self ? self->get_pid() : 0;
 }
 
 aid_t get_ppid()
@@ -428,7 +429,8 @@ std::string get_name()
 
 const char* get_cname()
 {
-  return simgrid::kernel::actor::ActorImpl::self()->get_cname();
+  auto* self = simgrid::kernel::actor::ActorImpl::self();
+  return self ? self->get_cname() : nullptr;
 }
 
 Host* get_host()
@@ -753,6 +755,8 @@ aid_t sg_actor_self_get_ppid()
 
 const char* sg_actor_self_get_name()
 {
+  if (simgrid::s4u::Actor::is_maestro())
+    return "maestro";
   return simgrid::s4u::this_actor::get_cname();
 }
 
index c20cd8e..de66d41 100644 (file)
@@ -42,20 +42,20 @@ void Engine::initialize(int* argc, char** argv)
   xbt_assert(Engine::instance_ == nullptr, "It is currently forbidden to create more than one instance of s4u::Engine");
   Engine::instance_ = this;
   instr::init();
-  pimpl->initialize(argc, argv);
+  pimpl_->initialize(argc, argv);
   // Either create a new context with maestro or create
   // a context object with the current context maestro):
   kernel::actor::create_maestro(maestro_code);
 }
 
-Engine::Engine(std::string name) : pimpl(new kernel::EngineImpl())
+Engine::Engine(std::string name) : pimpl_(new kernel::EngineImpl())
 {
   int argc   = 1;
   char* argv = &name[0];
   initialize(&argc, &argv);
 }
 
-Engine::Engine(int* argc, char** argv) : pimpl(new kernel::EngineImpl())
+Engine::Engine(int* argc, char** argv) : pimpl_(new kernel::EngineImpl())
 {
   initialize(argc, argv);
 }
@@ -81,6 +81,10 @@ Engine* Engine::get_instance(int* argc, char** argv)
   }
   return Engine::instance_;
 }
+const std::vector<std::string>& Engine::get_cmdline() const
+{
+  return pimpl_->get_cmdline();
+}
 
 void Engine::shutdown() // XBT_ATTRIB_DEPRECATED_v335
 {
@@ -99,22 +103,22 @@ double Engine::get_clock()
 void Engine::add_model(std::shared_ptr<kernel::resource::Model> model,
                        const std::vector<kernel::resource::Model*>& dependencies)
 {
-  kernel::actor::simcall_answered([this, &model, &dependencies] { pimpl->add_model(std::move(model), dependencies); });
+  kernel::actor::simcall_answered([this, &model, &dependencies] { pimpl_->add_model(std::move(model), dependencies); });
 }
 
 const std::vector<simgrid::kernel::resource::Model*>& Engine::get_all_models() const
 {
-  return pimpl->get_all_models();
+  return pimpl_->get_all_models();
 }
 
 void Engine::load_platform(const std::string& platf) const
 {
-  pimpl->load_platform(platf);
+  pimpl_->load_platform(platf);
 }
 
 void Engine::seal_platform() const
 {
-  pimpl->seal_platform();
+  pimpl_->seal_platform();
 }
 
 static void flatify_hosts(Engine const& engine, std::stringstream& ss)
@@ -283,12 +287,12 @@ void Engine::register_default(const std::function<void(int, char**)>& code)
 }
 void Engine::register_default(const kernel::actor::ActorCodeFactory& code)
 {
-  simgrid::kernel::actor::simcall_answered([this, &code]() { pimpl->register_default(code); });
+  simgrid::kernel::actor::simcall_answered([this, &code]() { pimpl_->register_default(code); });
 }
 
 void Engine::register_function(const std::string& name, const kernel::actor::ActorCodeFactory& code)
 {
-  simgrid::kernel::actor::simcall_answered([this, name, &code]() { pimpl->register_function(name, code); });
+  simgrid::kernel::actor::simcall_answered([this, name, &code]() { pimpl_->register_function(name, code); });
 }
 
 /** Load a deployment file and launch the actors that it contains
@@ -299,7 +303,7 @@ void Engine::register_function(const std::string& name, const kernel::actor::Act
  */
 void Engine::load_deployment(const std::string& deploy) const
 {
-  pimpl->load_deployment(deploy);
+  pimpl_->load_deployment(deploy);
 }
 
 /** Returns the amount of hosts in the platform */
@@ -316,8 +320,8 @@ std::vector<Host*> Engine::get_all_hosts() const
 std::vector<Host*> Engine::get_filtered_hosts(const std::function<bool(Host*)>& filter) const
 {
   std::vector<Host*> hosts;
-  if (pimpl->netzone_root_) {
-    hosts = pimpl->netzone_root_->get_filtered_hosts(filter);
+  if (pimpl_->netzone_root_) {
+    hosts = pimpl_->netzone_root_->get_filtered_hosts(filter);
   }
   /* Sort hosts in lexicographical order: keep same behavior when the hosts were saved on Engine
    * Some tests do a get_all_hosts() and selects hosts in this order */
@@ -342,8 +346,8 @@ Host* Engine::host_by_name(const std::string& name) const
 Host* Engine::host_by_name_or_null(const std::string& name) const
 {
   Host* host = nullptr;
-  if (pimpl->netzone_root_) {
-    auto* host_impl = pimpl->netzone_root_->get_host_by_name_or_null(name);
+  if (pimpl_->netzone_root_) {
+    auto* host_impl = pimpl_->netzone_root_->get_host_by_name_or_null(name);
     if (host_impl)
       host = host_impl->get_iface();
   }
@@ -364,7 +368,8 @@ Link* Engine::link_by_name(const std::string& name) const
 
 SplitDuplexLink* Engine::split_duplex_link_by_name(const std::string& name) const
 {
-  auto* link_impl = pimpl->netzone_root_ ? pimpl->netzone_root_->get_split_duplex_link_by_name_or_null(name) : nullptr;
+  auto* link_impl =
+      pimpl_->netzone_root_ ? pimpl_->netzone_root_->get_split_duplex_link_by_name_or_null(name) : nullptr;
   if (not link_impl)
     throw std::invalid_argument("Link not found: " + name);
   return link_impl->get_iface();
@@ -374,11 +379,11 @@ SplitDuplexLink* Engine::split_duplex_link_by_name(const std::string& name) cons
 Link* Engine::link_by_name_or_null(const std::string& name) const
 {
   Link* link = nullptr;
-  if (pimpl->netzone_root_) {
+  if (pimpl_->netzone_root_) {
     /* keep behavior where internal __loopback__ link from network model is given to user */
     if (name == "__loopback__")
-      return pimpl->netzone_root_->get_network_model()->loopback_->get_iface();
-    auto* link_impl = pimpl->netzone_root_->get_link_by_name_or_null(name);
+      return pimpl_->netzone_root_->get_network_model()->loopback_->get_iface();
+    auto* link_impl = pimpl_->netzone_root_->get_link_by_name_or_null(name);
     if (link_impl)
       link = link_impl->get_iface();
   }
@@ -390,7 +395,7 @@ Mailbox* Engine::mailbox_by_name_or_create(const std::string& name) const
 {
   /* two actors may have pushed the same mbox_create simcall at the same time */
   kernel::activity::MailboxImpl* mbox = kernel::actor::simcall_answered([&name, this] {
-    auto [m, inserted] = pimpl->mailboxes_.try_emplace(name, nullptr);
+    auto [m, inserted] = pimpl_->mailboxes_.try_emplace(name, nullptr);
     if (inserted) {
       m->second = new kernel::activity::MailboxImpl(name);
       XBT_DEBUG("Creating a mailbox at %p with name %s", m->second, name.c_str());
@@ -404,10 +409,10 @@ Mailbox* Engine::mailbox_by_name_or_create(const std::string& name) const
 size_t Engine::get_link_count() const
 {
   int count = 0;
-  if (pimpl->netzone_root_) {
-    count += pimpl->netzone_root_->get_link_count();
+  if (pimpl_->netzone_root_) {
+    count += pimpl_->netzone_root_->get_link_count();
     /* keep behavior where internal __loopback__ link from network model is given to user */
-    count += pimpl->netzone_root_->get_network_model()->loopback_ ? 1 : 0;
+    count += pimpl_->netzone_root_->get_network_model()->loopback_ ? 1 : 0;
   }
   return count;
 }
@@ -421,25 +426,25 @@ std::vector<Link*> Engine::get_all_links() const
 std::vector<Link*> Engine::get_filtered_links(const std::function<bool(Link*)>& filter) const
 {
   std::vector<Link*> res;
-  if (pimpl->netzone_root_) {
-    res = pimpl->netzone_root_->get_filtered_links(filter);
+  if (pimpl_->netzone_root_) {
+    res = pimpl_->netzone_root_->get_filtered_links(filter);
     /* keep behavior where internal __loopback__ link from network model is given to user */
-    if (pimpl->netzone_root_->get_network_model()->loopback_ &&
-        filter(pimpl->netzone_root_->get_network_model()->loopback_->get_iface()))
-      res.push_back(pimpl->netzone_root_->get_network_model()->loopback_->get_iface());
+    if (pimpl_->netzone_root_->get_network_model()->loopback_ &&
+        filter(pimpl_->netzone_root_->get_network_model()->loopback_->get_iface()))
+      res.push_back(pimpl_->netzone_root_->get_network_model()->loopback_->get_iface());
   }
   return res;
 }
 
 size_t Engine::get_actor_count() const
 {
-  return pimpl->get_actor_count();
+  return pimpl_->get_actor_count();
 }
 
 std::vector<ActorPtr> Engine::get_all_actors() const
 {
   std::vector<ActorPtr> actor_list;
-  for (auto const& [_, actor] : pimpl->get_actor_list()) {
+  for (auto const& [_, actor] : pimpl_->get_actor_list()) {
     actor_list.push_back(actor->get_iface());
   }
   return actor_list;
@@ -448,7 +453,7 @@ std::vector<ActorPtr> Engine::get_all_actors() const
 std::vector<ActorPtr> Engine::get_filtered_actors(const std::function<bool(ActorPtr)>& filter) const
 {
   std::vector<ActorPtr> actor_list;
-  for (auto const& [_, actor] : pimpl->get_actor_list()) {
+  for (auto const& [_, actor] : pimpl_->get_actor_list()) {
     if (filter(actor->get_iface()))
       actor_list.push_back(actor->get_iface());
   }
@@ -469,7 +474,7 @@ void Engine::run_until(double max_date) const
   fflush(stdout);
   fflush(stderr);
 
-  pimpl->run(max_date);
+  pimpl_->run(max_date);
 }
 
 void Engine::track_vetoed_activities(std::set<Activity*>* vetoed_activities) const
@@ -480,15 +485,15 @@ void Engine::track_vetoed_activities(std::set<Activity*>* vetoed_activities) con
 /** @brief Retrieve the root netzone, containing all others */
 s4u::NetZone* Engine::get_netzone_root() const
 {
-  if (pimpl->netzone_root_)
-    return pimpl->netzone_root_->get_iface();
+  if (pimpl_->netzone_root_)
+    return pimpl_->netzone_root_->get_iface();
   return nullptr;
 }
 /** @brief Set the root netzone, containing all others. Once set, it cannot be changed. */
 void Engine::set_netzone_root(const s4u::NetZone* netzone)
 {
-  xbt_assert(pimpl->netzone_root_ == nullptr, "The root NetZone cannot be changed once set");
-  pimpl->netzone_root_ = netzone->get_impl();
+  xbt_assert(pimpl_->netzone_root_ == nullptr, "The root NetZone cannot be changed once set");
+  pimpl_->netzone_root_ = netzone->get_impl();
 }
 
 static NetZone* netzone_by_name_recursive(NetZone* current, const std::string& name)
@@ -514,8 +519,8 @@ NetZone* Engine::netzone_by_name_or_null(const std::string& name) const
 /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
 kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(const std::string& name) const
 {
-  auto netp = pimpl->netpoints_.find(name);
-  return netp == pimpl->netpoints_.end() ? nullptr : netp->second;
+  auto netp = pimpl_->netpoints_.find(name);
+  return netp == pimpl_->netpoints_.end() ? nullptr : netp->second;
 }
 
 kernel::routing::NetPoint* Engine::netpoint_by_name(const std::string& name) const
@@ -530,7 +535,7 @@ kernel::routing::NetPoint* Engine::netpoint_by_name(const std::string& name) con
 std::vector<kernel::routing::NetPoint*> Engine::get_all_netpoints() const
 {
   std::vector<kernel::routing::NetPoint*> res;
-  for (auto const& [_, netpoint] : pimpl->netpoints_)
+  for (auto const& [_, netpoint] : pimpl_->netpoints_)
     res.push_back(netpoint);
   return res;
 }
@@ -538,14 +543,14 @@ std::vector<kernel::routing::NetPoint*> Engine::get_all_netpoints() const
 /** @brief Register a new netpoint to the system */
 void Engine::netpoint_register(kernel::routing::NetPoint* point)
 {
-  simgrid::kernel::actor::simcall_answered([this, point] { pimpl->netpoints_[point->get_name()] = point; });
+  simgrid::kernel::actor::simcall_answered([this, point] { pimpl_->netpoints_[point->get_name()] = point; });
 }
 
 /** @brief Unregister a given netpoint */
 void Engine::netpoint_unregister(kernel::routing::NetPoint* point)
 {
   kernel::actor::simcall_answered([this, point] {
-    pimpl->netpoints_.erase(point->get_name());
+    pimpl_->netpoints_.erase(point->get_name());
     delete point;
   });
 }
@@ -587,7 +592,7 @@ Engine* Engine::set_default_comm_data_copy_callback(
 /* **************************** Public C interface *************************** */
 void simgrid_init(int* argc, char** argv)
 {
-  static simgrid::s4u::Engine e(argc, argv);
+  simgrid::s4u::Engine::get_instance(argc, argv);
 }
 void simgrid_load_platform(const char* file)
 {
index ddaec3f..fb1df9d 100644 (file)
@@ -137,6 +137,7 @@ void sg_config_init(int *argc, char **argv)
     XBT_WARN("Call to sg_config_init() after initialization ignored");
     return;
   }
+  _sg_cfg_init_status = 1;
 
   /* Plugins and models configuration */
   simgrid_plugins().create_flag("plugin", "The plugins", "", true);
@@ -234,8 +235,6 @@ void sg_config_init(int *argc, char **argv)
   static simgrid::config::Flag<bool> cfg_execution_cutpath{
       "exception/cutpath", "Whether to cut all path information from call traces, used e.g. in exceptions.", false};
 
-  _sg_cfg_init_status = 1;
-
   sg_config_cmd_line(argc, argv);
 
   xbt_mallocator_initialization_is_done(simgrid::kernel::context::Context::is_parallel());
index d2d121e..fdfcb18 100644 (file)
@@ -5,9 +5,9 @@
 
 #include "private.hpp"
 #include "src/internal_config.h"
+#include "src/kernel/EngineImpl.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
 #include "src/xbt/memory_map.hpp"
-#include "xbt/virtu.h"
 
 #include <algorithm>
 #include <cerrno>
@@ -52,8 +52,9 @@ void smpi_prepare_global_memory_segment()
 
 static void smpi_get_executable_global_size()
 {
-  char* buffer = realpath(simgrid::xbt::binary_name.c_str(), nullptr);
-  xbt_assert(buffer != nullptr, "Could not resolve real path of binary file '%s'", simgrid::xbt::binary_name.c_str());
+  auto* binary_name = simgrid::kernel::EngineImpl::get_instance()->get_cmdline().front().c_str();
+  char* buffer      = realpath(binary_name, nullptr);
+  xbt_assert(buffer != nullptr, "Could not resolve real path of binary file '%s'", binary_name);
   std::string full_name = buffer;
   free(buffer);
 
index 24ebc39..4914d2b 100644 (file)
@@ -5,10 +5,11 @@
 
 #include "src/internal_config.h"
 
+#include <simgrid/actor.h>
+#include <simgrid/s4u/Actor.hpp>
 #include <xbt/backtrace.hpp>
 #include <xbt/string.hpp>
 #include <xbt/sysdep.h>
-#include <xbt/virtu.h>
 
 #include <cstdio>
 #include <cstdlib>
@@ -90,7 +91,8 @@ std::string Backtrace::resolve() const
 void Backtrace::display() const
 {
   std::string backtrace = resolve();
-  std::fprintf(stderr, "Backtrace (displayed in actor %s%s):\n%s\n", xbt_procname(),
+  std::fprintf(stderr, "Backtrace (displayed in actor %s%s):\n%s\n",
+               simgrid::s4u::Actor::is_maestro() ? "maestro" : sg_actor_self_get_name(),
                (xbt_log_no_loc ? " -- short trace because of --log=no_loc" : ""),
                backtrace.empty() ? "(backtrace not set -- did you install Boost.Stacktrace?)" : backtrace.c_str());
 }
index a155e19..bbc4599 100644 (file)
@@ -8,7 +8,6 @@
 #include "xbt/dict.h"
 #include "dict_private.h"
 #include "simgrid/Exception.hpp"
-#include "src/xbt/xbt_modinter.h"
 #include "xbt/ex.h"
 #include "xbt/log.h"
 #include "xbt/mallocator.h"
@@ -23,6 +22,23 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict, xbt, "Dictionaries provide the same fu
 
 constexpr int MAX_FILL_PERCENT = 80;
 
+/** Handle the dict mallocators init/fini cycle. */
+static void xbt_dict_postexit()
+{
+  if (dict_elm_mallocator != nullptr) {
+    xbt_mallocator_free(dict_elm_mallocator);
+    dict_elm_mallocator = nullptr;
+  }
+}
+static void xbt_dict_preinit()
+{
+  if (dict_elm_mallocator == nullptr) {
+    dict_elm_mallocator =
+        xbt_mallocator_new(256, dict_elm_mallocator_new_f, dict_elm_mallocator_free_f, dict_elm_mallocator_reset_f);
+    atexit(xbt_dict_postexit);
+  }
+}
+
 /**
  * @brief Constructor
  * @param free_ctn function to call with (@a data as argument) when @a data is removed from the dictionary
@@ -34,7 +50,7 @@ constexpr int MAX_FILL_PERCENT = 80;
  */
 xbt_dict_t xbt_dict_new_homogeneous(void_f_pvoid_t free_ctn)
 {
-  xbt_dict_preinit();
+  xbt_dict_preinit(); // Make sure that the module is intialized
 
   xbt_dict_t dict;
 
@@ -304,27 +320,3 @@ int xbt_dict_is_empty(const_xbt_dict_t dict)
 {
   return not dict || (xbt_dict_length(dict) == 0);
 }
-
-/**
- * Create the dict mallocators.
- * This is an internal XBT function called during the lib initialization.
- * It can be used several times to recreate the mallocator, for example when you switch to MC mode
- */
-void xbt_dict_preinit()
-{
-  if (dict_elm_mallocator == nullptr)
-    dict_elm_mallocator = xbt_mallocator_new(256, dict_elm_mallocator_new_f, dict_elm_mallocator_free_f,
-      dict_elm_mallocator_reset_f);
-}
-
-/**
- * Destroy the dict mallocators.
- * This is an internal XBT function during the lib initialization
- */
-void xbt_dict_postexit()
-{
-  if (dict_elm_mallocator != nullptr) {
-    xbt_mallocator_free(dict_elm_mallocator);
-    dict_elm_mallocator = nullptr;
-  }
-}
index 5aa9eae..51e9649 100644 (file)
@@ -17,9 +17,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
 
 void _xbt_throw(char* message, const char* file, int line, const char* func)
 {
-  simgrid::Exception e(
-      simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid()),
-      message ? message : "");
+  simgrid::Exception e(simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), sg_actor_self_get_name(),
+                                                sg_actor_self_get_pid()),
+                       message ? message : "");
   xbt_free(message);
   throw e;
 }
index e9c6542..65c5dae 100644 (file)
@@ -6,7 +6,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/xbt/log_private.hpp"
-#include "src/xbt/xbt_modinter.h"
 #include "xbt/string.hpp"
 #include "xbt/sysdep.h"
 
@@ -56,6 +55,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log, xbt, "Loggings from the logging mechanism i
 
 static void xbt_log_help();
 static void xbt_log_help_categories();
+static void xbt_log_postexit();
 
 void xbt_log_init(int *argc, char **argv)
 {
@@ -64,6 +64,7 @@ void xbt_log_init(int *argc, char **argv)
   int parse_args          = 1; // Stop parsing the parameters once we found '--'
 
   xbt_log_control_set("xbt_help.app:stdout xbt_help.threshold:VERBOSE xbt_help.fmt:%m%n");
+  atexit(xbt_log_postexit);
 
   /* Set logs and init log submodule */
   for (int i = 1; i < *argc; i++) {
@@ -97,24 +98,27 @@ void xbt_log_init(int *argc, char **argv)
   }
 }
 
-static void log_cat_exit(const s_xbt_log_category_t* cat)
+static void log_cat_exit(xbt_log_category_t cat)
 {
   if (cat->appender) {
     if (cat->appender->free_)
       cat->appender->free_(cat->appender);
     xbt_free(cat->appender);
+    cat->appender = nullptr;
   }
   if (cat->layout) {
     if (cat->layout->free_)
       cat->layout->free_(cat->layout);
     xbt_free(cat->layout);
+    cat->layout = nullptr;
   }
 
-  for (auto const* child = cat->firstChild; child != nullptr; child = child->nextSibling)
+  for (auto* child = cat->firstChild; child != nullptr; child = child->nextSibling)
     log_cat_exit(child);
+  cat->firstChild = nullptr;
 }
 
-void xbt_log_postexit(void)
+static void xbt_log_postexit(void)
 {
   XBT_VERB("Exiting log");
   log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT));
index 61bb830..e09d701 100644 (file)
@@ -9,7 +9,9 @@
 #include "simgrid/host.h"
 #include "src/xbt/log_private.hpp"
 #include "xbt/sysdep.h"
-#include "xbt/virtu.h"
+#include <simgrid/actor.h>
+#include <simgrid/s4u/Actor.hpp>
+
 #include <algorithm>
 #include <cstdio>
 
@@ -67,6 +69,7 @@ static constexpr const char* ERRMSG =
   } else                                                                                                               \
     (void)0
 #define show_int(data) show_it((data), "d")
+#define show_long(data) show_it((data), "ld")
 #define show_double(data) show_it((data), "f")
 
 static bool xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_event_t ev, const char* msg_fmt)
@@ -134,10 +137,10 @@ static bool xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_even
         case 't': /* thread/process name; LOG4J compliant */
         case 'P': /* Used before SimGrid 3.26 and kept for compatiblity. Should not hurt. */
         case 'a': /* actor name; SimGrid extension */
-          show_string(xbt_procname());
+          show_string(sg_actor_self_get_name());
           break;
         case 'i': /* actor ID; SimGrid extension */
-          show_int(xbt_getpid());
+          show_long(sg_actor_self_get_pid());
           break;
         case 'F': /* file name; LOG4J compliant */
           show_string(ev->fileName);
index a689123..da43e17 100644 (file)
@@ -7,7 +7,8 @@
 
 #include "src/xbt/log_private.hpp"
 #include "xbt/sysdep.h"
-#include "xbt/virtu.h"
+#include <simgrid/actor.h>
+#include <simgrid/s4u/Actor.hpp>
 
 #include "simgrid/engine.h" /* simgrid_get_clock */
 #include "simgrid/host.h"   /* sg_host_self_get_name */
@@ -34,12 +35,12 @@ static bool xbt_log_layout_simple_doit(const s_xbt_log_layout_t*, xbt_log_event_
   check_overflow(1);
 
   /* Display the proc info if available */
-  procname = xbt_procname();
+  procname = sg_actor_self_get_name();
   if (procname && strcmp(procname,"maestro")) {
-    len = snprintf(p, rem_size, "%s:%s:(%d) ", sg_host_self_get_name(), procname, xbt_getpid());
+    len = snprintf(p, rem_size, "%s:%s:(%ld) ", sg_host_self_get_name(), procname, sg_actor_self_get_pid());
     check_overflow(len);
   } else if (not procname) {
-    len = snprintf(p, rem_size, "%s::(%d) ", sg_host_self_get_name(), xbt_getpid());
+    len = snprintf(p, rem_size, "%s::(%ld) ", sg_host_self_get_name(), sg_actor_self_get_pid());
     check_overflow(len);
   }
 
diff --git a/src/xbt/xbt_main.cpp b/src/xbt/xbt_main.cpp
deleted file mode 100644 (file)
index ee40cfc..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* module handling                                                          */
-
-/* Copyright (c) 2006-2023. 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. */
-
-#define XBT_LOG_LOCALLY_DEFINE_XBT_CHANNEL /* MSVC don't want it to be declared extern in headers and local here */
-
-#include "simgrid/config.h"
-#include "src/internal_config.h"
-#include "src/simgrid/sg_config.hpp"
-#include "src/sthread/sthread.h" // sthread_inside_simgrid
-#include "src/xbt/coverage.h"
-#include "src/xbt/xbt_modinter.h" /* prototype of other module's init/exit in XBT */
-#include "xbt/config.hpp"
-#include "xbt/dynar.h"
-#include "xbt/log.h"
-#include "xbt/log.hpp"
-#include "xbt/misc.h"
-#include "xbt/module.h" /* this module */
-#include "xbt/sysdep.h"
-
-#include <cmath>
-#include <cstdio>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#include <string>
-#include <vector>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
-
-XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories"); /* lives here even if that's a bit odd to solve linking issues: this is used in xbt_log_file_appender to detect whether SMPI is used (and thus whether we should unbench the writing to disk) */
-
-namespace simgrid::xbt {
-std::string binary_name;          /* Name of the system process containing us (mandatory to retrieve neat backtraces) */
-std::vector<std::string> cmdline; /* all we got in argv */
-} // namespace simgrid::xbt
-
-
-int xbt_initialized = 0;
-simgrid::config::Flag<bool> cfg_dbg_clean_atexit{
-    "debug/clean-atexit",
-    "Whether to cleanup SimGrid at exit. Disable it if your code segfaults after its end.",
-    true};
-
-const int xbt_pagesize = static_cast<int>(sysconf(_SC_PAGESIZE));
-const int xbt_pagebits = static_cast<int>(log2(xbt_pagesize));
-
-/* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
- * This is crude and rather compiler-specific, unfortunately.
- */
-static void xbt_preinit() XBT_ATTRIB_CONSTRUCTOR(200);
-static void xbt_postexit();
-XBT_ATTRIB_NOINLINE void sthread_enable()
-{ // These symbols are used from ContextSwapped in any case, but they are only useful
-  asm("");
-}
-XBT_ATTRIB_NOINLINE void sthread_disable()
-{ //  when libsthread is LD_PRELOADED. In this case, sthread's implem gets used instead.
-  asm("");
-}
-
-static void xbt_preinit()
-{
-  xbt_dict_preinit();
-  atexit(xbt_postexit);
-}
-
-static void xbt_postexit()
-{
-  if (not cfg_dbg_clean_atexit)
-    return;
-  xbt_initialized--;
-  xbt_dict_postexit();
-  xbt_log_postexit();
-}
-
-/** @brief Initialize the xbt mechanisms. */
-void xbt_init(int *argc, char **argv)
-{
-  xbt_initialized++;
-  if (xbt_initialized > 1) {
-    XBT_DEBUG("XBT has been initialized %d times.", xbt_initialized);
-    return;
-  }
-
-  simgrid::xbt::install_exception_handler();
-
-  if (*argc > 0)
-    simgrid::xbt::binary_name = argv[0];
-  for (int i = 0; i < *argc; i++)
-    simgrid::xbt::cmdline.emplace_back(argv[i]);
-
-  xbt_log_init(argc, argv);
-}
-
-/* these two functions belong to xbt/sysdep.h, which have no corresponding .c file */
-/** @brief like xbt_free, but you can be sure that it is a function  */
-void xbt_free_f(void* p) noexcept(noexcept(::free))
-{
-  xbt_free(p);
-}
-
-/** @brief should be given a pointer to pointer, and frees the second one */
-void xbt_free_ref(void* d) noexcept(noexcept(::free))
-{
-  xbt_free(*(void**)d);
-}
-
-/** @brief Kill the program in silence */
-void xbt_abort()
-{
-  /* Call __gcov_flush on abort when compiling with coverage options. */
-  coverage_checkpoint();
-  abort();
-}
-
-#ifndef HAVE_SMPI
-int SMPI_is_inited()
-{
-  return false;
-}
-#endif
diff --git a/src/xbt/xbt_misc.cpp b/src/xbt/xbt_misc.cpp
new file mode 100644 (file)
index 0000000..d5522f8
--- /dev/null
@@ -0,0 +1,64 @@
+/* Various pieces of code which don't fit in any module                     */
+
+/* Copyright (c) 2006-2023. 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. */
+
+#define XBT_LOG_LOCALLY_DEFINE_XBT_CHANNEL /* MSVC don't want it to be declared extern in headers and local here */
+
+#include "src/internal_config.h"
+#include "src/sthread/sthread.h" // sthread_inside_simgrid
+#include "src/xbt/coverage.h"
+#include "xbt/log.h"
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+
+#include <cmath>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories"); /* lives here even if that's a bit odd to solve linking issues: this
+                                                      is used in xbt_log_file_appender to detect whether SMPI is used
+                                                      (and thus whether we should unbench the writing to disk) */
+
+const int xbt_pagesize = static_cast<int>(sysconf(_SC_PAGESIZE));
+const int xbt_pagebits = static_cast<int>(log2(xbt_pagesize));
+
+XBT_ATTRIB_NOINLINE void sthread_enable()
+{ // These symbols are used from ContextSwapped in any case, but they are only useful
+  asm("");
+}
+XBT_ATTRIB_NOINLINE void sthread_disable()
+{ //  when libsthread is LD_PRELOADED. In this case, sthread's implem gets used instead.
+  asm("");
+}
+
+/* these two functions belong to xbt/sysdep.h, which have no corresponding .c file */
+/** @brief like xbt_free, but you can be sure that it is a function  */
+void xbt_free_f(void* p) noexcept(noexcept(::free))
+{
+  xbt_free(p);
+}
+
+/** @brief should be given a pointer to pointer, and frees the second one */
+void xbt_free_ref(void* d) noexcept(noexcept(::free))
+{
+  xbt_free(*(void**)d);
+}
+
+/** @brief Kill the program in silence */
+void xbt_abort()
+{
+  /* Call __gcov_flush on abort when compiling with coverage options. */
+  coverage_checkpoint();
+  abort();
+}
+
+#ifndef HAVE_SMPI
+int SMPI_is_inited()
+{
+  return false;
+}
+#endif
diff --git a/src/xbt/xbt_modinter.h b/src/xbt/xbt_modinter.h
deleted file mode 100644 (file)
index 6eee62f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* xbt_modinter - How to init/exit the XBT modules                          */
-
-/* Copyright (c) 2004-2023. 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. */
-
-#ifndef XBT_MODINTER_H
-#define XBT_MODINTER_H
-#include "xbt/misc.h"
-
-SG_BEGIN_DECL
-
-/* Modules definitions */
-
-void xbt_log_postexit(void);
-
-void xbt_dict_preinit(void);
-void xbt_dict_postexit(void);
-
-extern int xbt_initialized;
-
-SG_END_DECL
-
-#endif
diff --git a/src/xbt/xbt_virtu.cpp b/src/xbt/xbt_virtu.cpp
deleted file mode 100644 (file)
index 56b2616..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* virtualization layer for XBT */
-
-/* Copyright (c) 2007-2023. 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 <simgrid/s4u/Actor.hpp>
-#include <xbt/virtu.h>
-
-#include "src/kernel/actor/ActorImpl.hpp"
-
-int xbt_getpid()
-{
-  const auto* self = simgrid::kernel::actor::ActorImpl::self();
-  return self == nullptr ? 0 : static_cast<int>(self->get_pid());
-}
-
-const char* xbt_procname(void)
-{
-  return simgrid::s4u::Actor::is_maestro() ? "maestro" : simgrid::kernel::actor::ActorImpl::self()->get_cname();
-}
index c37cfdc..190d995 100644 (file)
@@ -8,7 +8,6 @@
 #include "simgrid/s4u/Engine.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "xbt/log.h"
-#include "xbt/module.h"
 #include "xbt/sysdep.h"
 #include <algorithm>
 #include <array>
index d905956..b43d234 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "simgrid/s4u/Engine.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
-#include "xbt/module.h"
 #include "xbt/random.hpp"
 #include "xbt/sysdep.h" /* time manipulation for benchmarking */
 #include "xbt/xbt_os_time.h"
index 3b03ea9..c76ea46 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/Exception.hpp"
+#include "simgrid/engine.h"
 #include "src/xbt/mmalloc/mmalloc.h"
 #include "xbt.h"
 
@@ -34,7 +35,7 @@ int main(int argc, char**argv)
 {
   xbt_mheap_t heapA = nullptr;
   std::array<void*, TESTSIZE> pointers;
-  xbt_init(&argc,argv);
+  simgrid_init(&argc, argv);
 
   XBT_INFO("Allocating a new heap");
   unsigned long mask = ~((unsigned long)xbt_pagesize - 1);
index c30d4cd..58af6c4 100644 (file)
@@ -56,7 +56,6 @@ set(EXTRA_DIST
   src/xbt/log_private.hpp
   src/xbt/mallocator_private.h
   src/xbt/parmap.hpp
-  src/xbt/xbt_modinter.h
   
   src/xbt/mmalloc/mmalloc.h
   src/xbt/mmalloc/mfree.c
@@ -278,13 +277,12 @@ set(XBT_SRC
   src/xbt/xbt_log_appender_file.cpp
   src/xbt/xbt_log_layout_format.cpp
   src/xbt/xbt_log_layout_simple.cpp
-  src/xbt/xbt_main.cpp
+  src/xbt/xbt_misc.cpp
   src/xbt/xbt_os_file.cpp
   src/xbt/xbt_os_time.c
   src/xbt/xbt_parse_units.cpp
   src/xbt/xbt_replay.cpp
   src/xbt/xbt_str.cpp
-  src/xbt/xbt_virtu.cpp
   )
 
 if(HAVE_MMALLOC)