1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix(server): setup sigill handler (#183) (#198)

Signed-off-by: iko1 <me@remotecpp.dev>
This commit is contained in:
iko1 2022-07-09 22:36:05 +03:00 committed by GitHub
parent 2b0869c16d
commit 7adf80fccd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
// Copyright 2022, Roman Gershman. All rights reserved.
// See LICENSE for licensing terms.
//
@ -6,6 +7,7 @@
#include <mimalloc-new-delete.h>
#endif
#include <signal.h>
#include <liburing.h>
#include <absl/flags/usage.h>
#include <absl/flags/usage_config.h>
@ -137,6 +139,13 @@ extern "C" void _mi_options_init();
using namespace dfly;
void sigill_hdlr(int signo) {
LOG(ERROR)
<< "An attempt to execute an instruction failed."
<< "The root cause might be an old hardware. Exiting...";
exit(1);
}
int main(int argc, char* argv[]) {
absl::SetProgramUsageMessage(
R"(a modern in-memory store.
@ -157,6 +166,11 @@ Usage: dragonfly [FLAGS]
MainInitGuard guard(&argc, &argv);
struct sigaction act;
act.sa_handler = sigill_hdlr;
sigemptyset(&act.sa_mask);
sigaction(SIGILL, &act, nullptr);
CHECK_GT(GetFlag(FLAGS_port), 0u);
mi_stats_reset();