Author: jim
Date: 2005-03-21 17:32:56 -0700 (Mon, 21 Mar 2005)
New Revision: 882
Added:
trunk/procinfo/procinfo-18-maxdevs-1.patch
trunk/procinfo/procinfo-18-use_sysconf-1.patch
Log:
Added: procinfo-18-maxdevs-1.patch procinfo-18-use_sysconf-1.patch
Added: trunk/procinfo/procinfo-18-maxdevs-1.patch
===================================================================
--- trunk/procinfo/procinfo-18-maxdevs-1.patch 2005-03-21 05:32:06 UTC (rev
881)
+++ trunk/procinfo/procinfo-18-maxdevs-1.patch 2005-03-22 00:32:56 UTC (rev
882)
@@ -0,0 +1,37 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-03-21
+Initial Package Version: 18
+Origin: Fedora
+Upstream Status: Unknown
+Description: Fixes the maximum # of devices
+
+diff -Naur procinfo-18.orig/procinfo.c procinfo-18/procinfo.c
+--- procinfo-18.orig/procinfo.c 2005-03-22 00:22:46.000000000 +0000
++++ procinfo-18/procinfo.c 2005-03-22 00:23:45.000000000 +0000
+@@ -613,7 +613,9 @@
+ printf ("%s\nCharacter Devices: "
+ "Block Devices:\n",
+ fs ? ce : "");
+- while (fgets (line, sizeof (line), devicesfp)) {
++ while (fgets (line, sizeof (line), devicesfp) &&
++ count[CDRV] < MAX_DEV &&
++ count[BDRV] < MAX_DEV) {
+ switch (line[0]) {
+ case 'C':
+ which = CDRV;
+diff -Naur procinfo-18.orig/procinfo.h procinfo-18/procinfo.h
+--- procinfo-18.orig/procinfo.h 2005-03-22 00:22:46.000000000 +0000
++++ procinfo-18/procinfo.h 2005-03-22 00:23:45.000000000 +0000
+@@ -69,10 +69,10 @@
+ #define CDRV 0
+ #define BDRV 1
+ #ifndef MAX_CHRDEV
+-#define MAX_CHRDEV 32
++#define MAX_CHRDEV 512
+ #endif
+ #ifndef MAX_BLKDEV
+-#define MAX_BLKDEV 32
++#define MAX_BLKDEV 512
+ #endif
+ #define MAX_DEV MAX(MAX_CHRDEV, MAX_BLKDEV)
+
Added: trunk/procinfo/procinfo-18-use_sysconf-1.patch
===================================================================
--- trunk/procinfo/procinfo-18-use_sysconf-1.patch 2005-03-21 05:32:06 UTC
(rev 881)
+++ trunk/procinfo/procinfo-18-use_sysconf-1.patch 2005-03-22 00:32:56 UTC
(rev 882)
@@ -0,0 +1,73 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-03-21
+Initial Package Version: 18
+Origin: Fedora
+Upstream Status: Unknown
+Description: Uses Sysconf to determine CPU information
+
+diff -Naur procinfo-18.orig/procinfo.c procinfo-18/procinfo.c
+--- procinfo-18.orig/procinfo.c 2001-02-25 11:29:16.000000000 +0000
++++ procinfo-18/procinfo.c 2005-03-22 00:21:43.000000000 +0000
+@@ -249,6 +249,9 @@
+ new.cpu_nice = VAL;
+ new.cpu_sys = VAL;
+ new.cpu_idle = VAL;
++ new.cpu_iowait = VAL;
++ new.cpu_irq = VAL;
++ new.cpu_softirq = VAL;
+ /*
+ * according to bug #1959, sometimes the cpu_idle
+ * seems to go backwards(!) on SMP boxes. This may
+@@ -373,7 +376,9 @@
+ putchar ('\n');
+
+ printf ("system: %s %s",
+- hms (bDIFF (cpu_sys)), perc (bDIFF (cpu_sys), elapsed, nr_cpus));
++ hms (bDIFF (cpu_sys) + bDIFF (cpu_irq) + bDIFF (cpu_softirq)),
++ perc (bDIFF (cpu_sys) + bDIFF (cpu_irq) + bDIFF (cpu_softirq),
++ elapsed, nr_cpus));
+ printf (" swap in :%9lu", bDIFF (swin));
+ if (new.disk_r[2])
+ printf (" disk 3: %8lur%8luw\n", bDIFF (disk_r[2]),
+@@ -384,7 +389,8 @@
+ putchar ('\n');
+
+ printf ("idle : %s %s",
+- hms (bDIFF (cpu_idle)), perc (bDIFF (cpu_idle), elapsed, nr_cpus));
++ hms (bDIFF (cpu_idle) + bDIFF (cpu_iowait)),
++ perc (bDIFF (cpu_idle) + bDIFF (cpu_iowait), elapsed, nr_cpus));
+ printf (" swap out:%9lu", bDIFF (swout));
+ if (new.disk_r[3])
+ printf (" disk 4: %8lur%8luw\n", bDIFF (disk_r[3]),
+@@ -831,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);
+diff -Naur procinfo-18.orig/procinfo.h procinfo-18/procinfo.h
+--- procinfo-18.orig/procinfo.h 2001-02-24 23:30:45.000000000 +0000
++++ procinfo-18/procinfo.h 2005-03-22 00:21:43.000000000 +0000
+@@ -82,6 +82,7 @@
+ long m_to, m_us, m_fr, m_sh, m_bu, m_ca;
+ long s_to, s_us, s_fr;
+ unsigned long cpu_user, cpu_nice, cpu_sys, cpu_idle;
++ unsigned long cpu_iowait, cpu_irq, cpu_softirq;
+ unsigned long disk[5];
+ unsigned long disk_r[5];
+ unsigned long disk_w[5];
--
http://linuxfromscratch.org/mailman/listinfo/patches
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page