procinfo/procinfo-18-mharris-use-sysconf.patch

24 lines
811 B
Diff
Raw Permalink Normal View History

--- procinfo-18/procinfo.c.mharris-use-sysconf 2004-01-16 15:40:37.000000000 -0500
+++ procinfo-18/procinfo.c 2004-01-17 02:01:16.000000000 -0500
@@ -837,19 +837,7 @@
}
/* Count number of CPUs */
- cpuinfofp = myfopen (PROC_DIR "cpuinfo");
- if (cpuinfofp) {
- while (fgets (line, sizeof (line), cpuinfofp))
- if (!strncmp ("processor", line, 9)) /* intel */
- nr_cpus++;
- else if (!strncmp ("ncpus ", line, 6)) /* sparc */
- nr_cpus = atoi(line+19);
- else if (!strncmp ("cpus detected", line, 13)) /* alpha */
- nr_cpus = atoi(line+27);
- fclose (cpuinfofp);
- }
- if (nr_cpus == 0)
- nr_cpus = 1;
+ nr_cpus = sysconf (_SC_NPROCESSORS_ONLN);
/* Gets called from winsz(), but in case stdout is redirected: */
version = make_version (versionfp);