diff --git a/procinfo-18-acct.patch b/procinfo-18-acct.patch new file mode 100644 index 0000000..e1f5291 --- /dev/null +++ b/procinfo-18-acct.patch @@ -0,0 +1,45 @@ +diff -urN procinfo-18.save/procinfo.c procinfo-18/procinfo.c +--- procinfo-18.save/procinfo.c 2001-02-25 06:29:16.000000000 -0500 ++++ procinfo-18/procinfo.c 2003-07-29 22:10:07.000000000 -0400 +@@ -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]), +diff -urN procinfo-18.save/procinfo.h procinfo-18/procinfo.h +--- procinfo-18.save/procinfo.h 2001-02-24 18:30:45.000000000 -0500 ++++ procinfo-18/procinfo.h 2003-07-29 22:10:09.000000000 -0400 +@@ -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]; diff --git a/procinfo-18-mharris-use-sysconf.patch b/procinfo-18-mharris-use-sysconf.patch new file mode 100644 index 0000000..ac4e58c --- /dev/null +++ b/procinfo-18-mharris-use-sysconf.patch @@ -0,0 +1,23 @@ +--- 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); diff --git a/procinfo.spec b/procinfo.spec index 0dee8e8..48e7f54 100644 --- a/procinfo.spec +++ b/procinfo.spec @@ -1,7 +1,7 @@ Summary: A tool for gathering and displaying system information. Name: procinfo Version: 18 -Release: 9 +Release: 11 License: GPL Group: Applications/System Source: ftp://ftp.cistron.nl/pub/people/svm/%{name}-%{version}.tar.bz2 @@ -9,6 +9,8 @@ Patch0: procinfo-14-misc.patch Patch3: procinfo-17-mandir.patch Patch5: procinfo-17-uptime.patch Patch6: procinfo-17-lsdev.patch +Patch7: procinfo-18-acct.patch +Patch8: procinfo-18-mharris-use-sysconf.patch Buildroot: %{_tmppath}/%{name}-%{version}-root BuildRequires: libtermcap-devel @@ -27,6 +29,8 @@ data. %patch3 -p1 -b .mandir %patch5 -p1 -b .uptime %patch6 -p1 -b .lsdev +%patch7 -p1 -b .acct +%patch8 -p1 -b .mharris-use-sysconf %build make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" @@ -51,6 +55,14 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/socklist.8* %changelog +* Sat Jan 17 2004 Mike A. Harris 18-11 +- Added procinfo-18-mharris-use-sysconf.patch to use sysconf for determining + the number of processors online, as this is more portable between different + CPU architectures than relying on particular /proc file entry contents and + formatting. We ship on 7 architectures (x86, ia64, AMD64, ppc, ppc64, s390, + s390x), and the current code only handled x86, alpha, sparc. sysconf will + work on all processors. Better fix for (#9497) + * Wed Jun 04 2003 Elliot Lee - rebuilt