mirror of
https://github.com/matrix-construct/construct
synced 2024-09-26 18:38:52 +02:00
construct: Call exit(3) to invoke module dtors attached to atexit.
This commit is contained in:
parent
b46019dcbd
commit
2aa169695a
1 changed files with 20 additions and 0 deletions
|
@ -131,6 +131,7 @@ const char *const usererrstr
|
||||||
[[noreturn]] static void do_restart(char *const *const &argv, char *const *const &envp);
|
[[noreturn]] static void do_restart(char *const *const &argv, char *const *const &envp);
|
||||||
static void smoketest_handler(const enum ircd::run::level &);
|
static void smoketest_handler(const enum ircd::run::level &);
|
||||||
static void nobanner_handler(const enum ircd::run::level &);
|
static void nobanner_handler(const enum ircd::run::level &);
|
||||||
|
static void muslexit_handler(const enum ircd::run::level &);
|
||||||
static bool startup_checks();
|
static bool startup_checks();
|
||||||
static void applyargs();
|
static void applyargs();
|
||||||
static void enable_coredumps();
|
static void enable_coredumps();
|
||||||
|
@ -257,6 +258,7 @@ noexcept try
|
||||||
{
|
{
|
||||||
{ smoketest_handler },
|
{ smoketest_handler },
|
||||||
{ nobanner_handler },
|
{ nobanner_handler },
|
||||||
|
{ muslexit_handler },
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is the sole io_context for Construct, and the ios.run() below is the
|
// This is the sole io_context for Construct, and the ios.run() below is the
|
||||||
|
@ -519,6 +521,24 @@ nobanner_handler(const enum ircd::run::level &level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Musl our way out by calling exit() since all module .dtors are
|
||||||
|
/// attached to atexit.
|
||||||
|
void
|
||||||
|
muslexit_handler(const enum ircd::run::level &level)
|
||||||
|
{
|
||||||
|
switch(level)
|
||||||
|
{
|
||||||
|
#if !defined(__GNU_LIBRARY__) //TODO: musl?
|
||||||
|
case ircd::run::level::HALT:
|
||||||
|
exit(0);
|
||||||
|
__builtin_unreachable();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// These operations are safe to call before ircd::init() and anytime after
|
/// These operations are safe to call before ircd::init() and anytime after
|
||||||
/// static initialization.
|
/// static initialization.
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue