diff --git a/src/server/dfly_main.cc b/src/server/dfly_main.cc index bc229ee29..53c46b67a 100644 --- a/src/server/dfly_main.cc +++ b/src/server/dfly_main.cc @@ -1,3 +1,4 @@ + // Copyright 2022, Roman Gershman. All rights reserved. // See LICENSE for licensing terms. // @@ -6,6 +7,7 @@ #include #endif +#include #include #include #include @@ -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();