construct: Call exit(3) to invoke module dtors attached to atexit.
This commit is contained in:
parent
b46019dcbd
commit
2aa169695a
|
@ -131,6 +131,7 @@ const char *const usererrstr
|
|||
[[noreturn]] static void do_restart(char *const *const &argv, char *const *const &envp);
|
||||
static void smoketest_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 void applyargs();
|
||||
static void enable_coredumps();
|
||||
|
@ -257,6 +258,7 @@ noexcept try
|
|||
{
|
||||
{ smoketest_handler },
|
||||
{ nobanner_handler },
|
||||
{ muslexit_handler },
|
||||
};
|
||||
|
||||
// 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
|
||||
/// static initialization.
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue