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.
#ifndef SIMGRID_EXCEPTIONS_HPP
#define SIMGRID_EXCEPTIONS_HPP
+#include <simgrid/actor.h>
#include <xbt/backtrace.hpp>
#include <xbt/ex.h>
#include <xbt/string.hpp>
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.
#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.
#include <xbt/base.h>
#include <xbt/misc.h>
#include <xbt/sysdep.h>
-#include <xbt/virtu.h>
/** @addtogroup XBT_ex_c
* @brief Exceptions support (C)
#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_ATTRIB_DEPRECATED_v337("Please use sg_actor_self_get_name()") static const char* xbt_procname(void)
{
- return sg_actor_self_get_name() ?: "maestro";
+ return sg_actor_self_get_name();
}
XBT_ATTRIB_DEPRECATED_v337("Please use sg_actor_self_get_pid()") static int xbt_getpid(void)
-/* 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 {
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";
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]);
+ cmdline_.emplace_back(argv[i]);
sg_config_init(argc, argv);
}
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;
#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;
}
return Engine::instance_;
}
+const std::vector<std::string>& Engine::get_cmdline() const
+{
+ return pimpl->get_cmdline();
+}
void Engine::shutdown() // XBT_ATTRIB_DEPRECATED_v335
{
#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>
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);