Commit 37ac7413 authored by Sara Golemon's avatar Sara Golemon

don't use readFromSysfs on non-linux

Summary:
It eventually tries to read from /sys/devices which is not portable.
Let's just fall back to sysconf/CacheLocality::uniform.

This fixes a runtime crash on OSX, but CYGWIN/BSD were probably also
affected.
Closes #80

@override-unit-failures

Test Plan: author tested, contbuild, flib

Reviewed By: joelm@fb.com

FB internal diff: D1498567
parent bc5b5b9e
......@@ -32,11 +32,13 @@ namespace folly { namespace detail {
/// Returns the best real CacheLocality information available
static CacheLocality getSystemLocalityInfo() {
#ifdef __linux__
try {
return CacheLocality::readFromSysfs();
} catch (...) {
// keep trying
}
#endif
long numCpus = sysconf(_SC_NPROCESSORS_CONF);
if (numCpus <= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment