1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-20 23:01:51 +00:00

Improve cpuid_tool behavior when cpu_types array is empty

It happens when cpuid_get_all_raw_data() cannot use set_cpu_affinity()
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2024-07-27 13:33:55 +02:00
parent 2133c22052
commit c6723aa914
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A

View file

@ -758,15 +758,17 @@ int main(int argc, char** argv)
if (verbose_level >= 1) {
printf("Writing decoded CPU report to `%s'\n", out_file);
}
/* Write a thorough report of cpu_id_t structure to output (usually stdout) */
fprintf(fout, "CPUID is present\n");
/*
* Try CPU identification
* (this fill the `data' structure with decoded CPU features)
*/
if (cpu_identify_all(&raw_array, &data) < 0)
fprintf(fout, "Error identifying the CPU: %s\n", cpuid_error());
else if (data.num_cpu_types == 0)
fprintf(fout, "The cpu_types array is empty: there is nothing to report\n");
else {
/* Write a thorough report of cpu_id_t structure to output (usually stdout) */
fprintf(fout, "CPUID is present\n");
/* OK, now write what we have in `data'...: */
for (cpu_type_index = 0; cpu_type_index < data.num_cpu_types; cpu_type_index++) {
fprintf(fout, "CPU Info for type #%d:\n------------------\n", cpu_type_index);
@ -827,6 +829,7 @@ int main(int argc, char** argv)
fprintf(fout, " %s", cpu_feature_str(i));
fprintf(fout, "\n");
}
}
/* Is CPU clock info requested? */
if (need_clockreport) {