|
@@ -716,18 +716,19 @@ static int build_cpu_topo(struct cpu_topo *tp, int cpu)
|
|
|
char filename[MAXPATHLEN];
|
|
|
char *buf = NULL, *p;
|
|
|
size_t len = 0;
|
|
|
+ ssize_t sret;
|
|
|
u32 i = 0;
|
|
|
int ret = -1;
|
|
|
|
|
|
sprintf(filename, CORE_SIB_FMT, cpu);
|
|
|
fp = fopen(filename, "r");
|
|
|
if (!fp)
|
|
|
- return -1;
|
|
|
-
|
|
|
- if (getline(&buf, &len, fp) <= 0)
|
|
|
- goto done;
|
|
|
+ goto try_threads;
|
|
|
|
|
|
+ sret = getline(&buf, &len, fp);
|
|
|
fclose(fp);
|
|
|
+ if (sret <= 0)
|
|
|
+ goto try_threads;
|
|
|
|
|
|
p = strchr(buf, '\n');
|
|
|
if (p)
|
|
@@ -743,7 +744,9 @@ static int build_cpu_topo(struct cpu_topo *tp, int cpu)
|
|
|
buf = NULL;
|
|
|
len = 0;
|
|
|
}
|
|
|
+ ret = 0;
|
|
|
|
|
|
+try_threads:
|
|
|
sprintf(filename, THRD_SIB_FMT, cpu);
|
|
|
fp = fopen(filename, "r");
|
|
|
if (!fp)
|