MCPcopy Create free account
hub / github.com/apache/arrow / IntegerSysCtlByName

Function IntegerSysCtlByName

cpp/src/arrow/util/cpu_info.cc:171–184  ·  view source on GitHub ↗

------------------------------ MACOS ------------------------------//

Source from the content-addressed store, hash-verified

169#elif defined(__APPLE__)
170//------------------------------ MACOS ------------------------------//
171std::optional<int64_t> IntegerSysCtlByName(const char* name) {
172 size_t len = sizeof(int64_t);
173 int64_t data = 0;
174 if (sysctlbyname(name, &data, &len, nullptr, 0) == 0) {
175 return data;
176 }
177 // ENOENT is the official errno value for non-existing sysctl's,
178 // but EINVAL and ENOTSUP have been seen in the wild.
179 if (errno != ENOENT && errno != EINVAL && errno != ENOTSUP) {
180 auto st = IOErrorFromErrno(errno, "sysctlbyname failed for '", name, "'");
181 ARROW_LOG(WARNING) << st.ToString();
182 }
183 return std::nullopt;
184}
185
186template <std::size_t N>
187void OsRetrieveCacheSize(std::array<int64_t, N>* cache_sizes) {

Callers 1

OsRetrieveCacheSizeFunction · 0.85

Calls 2

IOErrorFromErrnoFunction · 0.85
ToStringMethod · 0.45

Tested by

no test coverage detected