mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Fixed gb.h - the file handle for /proc/cpuinfo is needed to read chars.
This commit is contained in:
+5
-1
@@ -5012,7 +5012,10 @@ void gb_affinity_init(gbAffinity *a) {
|
|||||||
// Parsing /proc/cpuinfo to get the number of threads per core.
|
// Parsing /proc/cpuinfo to get the number of threads per core.
|
||||||
// NOTE(zangent): This calls the CPU's threads "cores", although the wording
|
// NOTE(zangent): This calls the CPU's threads "cores", although the wording
|
||||||
// is kind of weird. This should be right, though.
|
// is kind of weird. This should be right, though.
|
||||||
if (fopen("/proc/cpuinfo", "r") != NULL) {
|
|
||||||
|
FILE* cpu_info = fopen("/proc/cpuinfo", "r");
|
||||||
|
|
||||||
|
if (cpu_info != NULL) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// The 'temporary char'. Everything goes into this char,
|
// The 'temporary char'. Everything goes into this char,
|
||||||
// so that we can check against EOF at the end of this loop.
|
// so that we can check against EOF at the end of this loop.
|
||||||
@@ -5043,6 +5046,7 @@ void gb_affinity_init(gbAffinity *a) {
|
|||||||
}
|
}
|
||||||
#undef AF__CHECK
|
#undef AF__CHECK
|
||||||
}
|
}
|
||||||
|
fclose(cpu_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threads == 0) {
|
if (threads == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user