MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / errnoToString

Function errnoToString

base/base/errnoToString.cpp:6–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6std::string errnoToString(int the_errno)
7{
8 const size_t buf_size = 128;
9 char buf[buf_size];
10
11#ifndef _GNU_SOURCE
12 int rc = strerror_r(the_errno, buf, buf_size);
13#ifdef OS_DARWIN
14 if (rc != 0 && rc != EINVAL)
15#else
16 if (rc != 0)
17#endif
18 {
19 std::string tmp = std::to_string(the_errno);
20 const char * code_str = tmp.c_str();
21 const char * unknown_message = "Unknown error ";
22 strcpy(buf, unknown_message);
23 strcpy(buf + strlen(unknown_message), code_str);
24 }
25 return fmt::format("errno: {}, strerror: {}", the_errno, buf);
26#else
27 return fmt::format("errno: {}, strerror: {}", the_errno, strerror_r(the_errno, buf, sizeof(buf)));
28#endif
29}

Callers 15

executeImplMethod · 0.85
mainMethod · 0.85
mainMethod · 0.85
checkResultCodeImplFunction · 0.85
checkResultMethod · 0.85
setupWatchdogMethod · 0.85
initMethod · 0.85
finalizeCurrentFileMethod · 0.85
tryPreallocateForFileMethod · 0.85
changeIfModifiedMethod · 0.85
pollMethod · 0.85

Calls 2

to_stringFunction · 0.70
formatFunction · 0.50

Tested by 1