mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Cleanup server instructions startup checking code
This commit is contained in:
parent
77c9f7af79
commit
9c09050e7c
@ -238,8 +238,9 @@ void checkRequiredInstructionsImpl(volatile InstructionFail & fail)
|
||||
}
|
||||
|
||||
/// This function is safe to use in static initializers.
|
||||
void writeError(const char * data, size_t size)
|
||||
void writeError(const char * data)
|
||||
{
|
||||
size_t size = strlen(data);
|
||||
while (size != 0)
|
||||
{
|
||||
ssize_t res = ::write(STDERR_FILENO, data, size);
|
||||
@ -272,8 +273,7 @@ void checkRequiredInstructions()
|
||||
/// Typical implementation of strlen is using SSE4.2 or AVX2.
|
||||
/// But this is not the case because it's compiler builtin and is executed at compile time.
|
||||
|
||||
const char * msg = "Can not set signal handler\n";
|
||||
writeError(msg, strlen(msg));
|
||||
writeError("Can not set signal handler\n");
|
||||
_Exit(1);
|
||||
}
|
||||
|
||||
@ -281,12 +281,9 @@ void checkRequiredInstructions()
|
||||
|
||||
if (sigsetjmp(jmpbuf, 1))
|
||||
{
|
||||
const char * msg1 = "Instruction check fail. The CPU does not support ";
|
||||
writeError(msg1, strlen(msg1));
|
||||
const char * msg2 = instructionFailToString(fail);
|
||||
writeError(msg2, strlen(msg2));
|
||||
const char * msg3 = " instruction set.\n";
|
||||
writeError(msg3, strlen(msg3));
|
||||
writeError("Instruction check fail. The CPU does not support ");
|
||||
writeError(instructionFailToString(fail));
|
||||
writeError(" instruction set.\n");
|
||||
_Exit(1);
|
||||
}
|
||||
|
||||
@ -294,13 +291,18 @@ void checkRequiredInstructions()
|
||||
|
||||
if (sigaction(signal, &sa_old, nullptr))
|
||||
{
|
||||
const char * msg = "Can not set signal handler\n";
|
||||
writeError(msg, strlen(msg));
|
||||
writeError("Can not set signal handler\n");
|
||||
_Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
struct Checker { Checker() { checkRequiredInstructions(); } } checker;
|
||||
struct Checker
|
||||
{
|
||||
Checker()
|
||||
{
|
||||
checkRequiredInstructions();
|
||||
}
|
||||
} checker;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user