diff options
author | Marat Dukhan <marat@fb.com> | 2018-12-18 18:14:31 -0800 |
---|---|---|
committer | Marat Dukhan <marat@fb.com> | 2018-12-18 18:14:31 -0800 |
commit | a61747aebe5748505c2430d7e4335c7f85d31275 (patch) | |
tree | 99d454703415744fa1b0a77278ebbd4e50d13bdb /src/linux/processors.c | |
parent | 204ef6ed78d51470f97f40c7180e66fe487b9168 (diff) | |
download | cpuinfo-a61747aebe5748505c2430d7e4335c7f85d31275.tar.gz |
Support Linux x86 systems without /sys/devices/system/cpu/{possible,present} files
- On x86 Linux, if processor doesn't have /sys/devices/system/cpu/{possible,present} files, cpuinfo will fall back to counting processors in /proc/cpuinfo
- On ARM Linux, we still require /sys/devices/system/cpu/{possible,present} to be available, as missing processors in /proc/cpuinfo are very common
Diffstat (limited to 'src/linux/processors.c')
-rw-r--r-- | src/linux/processors.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/linux/processors.c b/src/linux/processors.c index cf87548..849c6a1 100644 --- a/src/linux/processors.c +++ b/src/linux/processors.c @@ -228,7 +228,7 @@ uint32_t cpuinfo_linux_get_max_possible_processor(uint32_t max_processors_count) uint32_t max_possible_processor = 0; if (!cpuinfo_linux_parse_cpulist(POSSIBLE_CPULIST_FILENAME, max_processor_number_parser, &max_possible_processor)) { cpuinfo_log_error("failed to parse the list of possible processors in %s", POSSIBLE_CPULIST_FILENAME); - return max_processors_count; + return UINT32_MAX; } if (max_possible_processor >= max_processors_count) { cpuinfo_log_warning( @@ -243,7 +243,7 @@ uint32_t cpuinfo_linux_get_max_present_processor(uint32_t max_processors_count) uint32_t max_present_processor = 0; if (!cpuinfo_linux_parse_cpulist(PRESENT_CPULIST_FILENAME, max_processor_number_parser, &max_present_processor)) { cpuinfo_log_error("failed to parse the list of present processors in %s", PRESENT_CPULIST_FILENAME); - return max_processors_count; + return UINT32_MAX; } if (max_present_processor >= max_processors_count) { cpuinfo_log_warning( @@ -271,7 +271,7 @@ static bool detect_processor_parser(uint32_t processor_list_start, uint32_t proc if (processor >= max_processors_count) { break; } - *((uint32_t*) ((void*) processor0_flags + processor_struct_size * processor)) |= detected_flag; + *((uint32_t*) ((uintptr_t) processor0_flags + processor_struct_size * processor)) |= detected_flag; } return true; } |