0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

ircd::mods: Various cleanup.

This commit is contained in:
Jason Volk 2019-01-05 17:18:08 -08:00
parent b878f577d5
commit 005e4217ed
3 changed files with 15 additions and 25 deletions

View file

@ -17,12 +17,12 @@ namespace ircd::mods
struct mod;
IRCD_EXCEPTION(ircd::error, error)
IRCD_EXCEPTION(error, filesystem_error)
IRCD_EXCEPTION(error, invalid_export)
IRCD_EXCEPTION(error, expired_symbol)
IRCD_EXCEPTION(error, undefined_symbol)
IRCD_EXCEPTION(expired_symbol, unavailable)
extern log::log log;
extern conf::item<bool> enable;
extern conf::item<bool> autoload;

View file

@ -18,6 +18,18 @@ namespace load_mode = boost::dll::load_mode;
#include <ircd/mods/mapi.h> // Module's internal API
#include "mods.h"
const filesystem::path
ircd::mods::suffix
{
boost::dll::shared_library::suffix()
};
ircd::log::log
ircd::mods::log
{
"modules", 'M'
};
decltype(ircd::mods::enable)
ircd::mods::enable
{
@ -34,22 +46,6 @@ ircd::mods::autoload
{ "persist", false },
};
//
// mods.h
//
ircd::log::log
ircd::mods::log
{
"modules", 'M'
};
const filesystem::path
ircd::mods::suffix
{
boost::dll::shared_library::suffix()
};
//
// mods::mod
//
@ -81,7 +77,6 @@ ircd::mods::mod::mod(const filesystem::path &path,
try
:path{path}
,mode{mode}
//,mangles{mods::mangles(path)}
,handle{[this, &path, &mode]
{
// Can't interrupt this ctx during the dlopen() as long as exceptions
@ -139,10 +134,9 @@ try
{
log::debug
{
log, "Loaded static segment of '%s' @ `%s' with %zu symbols",
log, "Loaded static segment of '%s' @ `%s'",
name(),
location(),
mangles.size()
};
if(unlikely(!header))
@ -197,7 +191,7 @@ catch(const boost::system::system_error &e)
const string_view msg(what.substr(pos));
const std::string mangled(between(msg, ": ", ")"));
const std::string demangled(demangle(mangled));
throw error
throw undefined_symbol
{
"undefined symbol: '%s' (%s)", demangled, mangled
};

View file

@ -10,9 +10,6 @@
namespace ircd::mods
{
struct mod;
struct log::log extern log;
extern const filesystem::path suffix;
filesystem::path prefix_if_relative(const filesystem::path &path);
@ -47,7 +44,6 @@ struct ircd::mods::mod
filesystem::path path;
load_mode::type mode;
std::deque<mod *> children;
std::unordered_map<std::string, std::string> mangles;
boost::dll::shared_library handle;
const std::string _name;
const std::string _location;