+ * Number of processors.
+ * 0: one proc and non SMP kernel.
+ * 1: one proc and SMP kernel (NB: On SMP machines where all the CPUs but
+ * one have been disabled, we get the total number of proc since we use
+ * /sys to count them).
+ * 2: two proc...
+ *
+ * USED BY:
+ * sadc, cifsiostat, iostat, mpstat, pidstat, tapestat
+ ***************************************************************************
+ */
+__nr_t get_cpu_nr(unsigned int max_nr_cpus, int highest)
+{
+ __nr_t cpu_nr;
+
+ if ((cpu_nr = get_sys_cpu_nr(highest)) == 0) {
+ /* /sys may be not mounted. Use /proc/stat instead */
+ cpu_nr = get_proc_cpu_nr();
+ }
+
+ if (cpu_nr > max_nr_cpus) {
+ fprintf(stderr, _("Cannot handle so many processors!\n"));
+ exit(1);
+ }
+
+ return cpu_nr;
+}
+
+/*
+ ***************************************************************************
+ * Find number of interrupts available per processor (use
+ * /proc/interrupts file or /proc/softirqs).
+ *
+ * IN:
+ * @file /proc file to read (interrupts or softirqs).
+ * @max_nr_irqcpu Maximum number of interrupts per processor that
+ * sadc can handle.
+ * @cpu_nr Number of processors.
+ *
+ * RETURNS:
+ * Number of interrupts per processor.
+ *
+ * USED BY:
+ * sadc, mpstat