[arch-commits] Commit in procps/trunk (18 files)

Eric Bélanger eric at archlinux.org
Sat Nov 20 03:15:44 UTC 2010


    Date: Friday, November 19, 2010 @ 22:15:43
  Author: eric
Revision: 100040

upgpkg: procps 3.2.8-2
Applied several patches from Fedora to fix misc problems (close FS#18623 and maybe FS#21461)

Added:
  procps/trunk/groff-top-manpage.patch
  procps/trunk/procps-3.2.7-free-hlmem.patch
  procps/trunk/procps-3.2.7-longcmd.patch
  procps/trunk/procps-3.2.7-ps-man-fmt.patch
  procps/trunk/procps-3.2.7-psman.patch
  procps/trunk/procps-3.2.7-slabtop-once.patch
  procps/trunk/procps-3.2.7-top-clrscr.patch
  procps/trunk/procps-3.2.7-top-cpu0.patch
  procps/trunk/procps-3.2.7-top-env-cpuloop.patch
  procps/trunk/procps-3.2.7-top-manpage.patch
  procps/trunk/procps-3.2.7-top-remcpu.patch
  procps/trunk/procps-3.2.7-w-best.patch
  procps/trunk/procps-3.2.7-watch-unicode.patch
  procps/trunk/procps-3.2.8+gmake-3.82.patch
  procps/trunk/procps-3.2.8-setlocale.patch
  procps/trunk/procps-3.2.8-threads.patch
Modified:
  procps/trunk/PKGBUILD
Deleted:
  procps/trunk/ChangeLog

------------------------------------+
 ChangeLog                          |   10 --
 PKGBUILD                           |   69 ++++++++++++++---
 groff-top-manpage.patch            |   39 +++++++++
 procps-3.2.7-free-hlmem.patch      |   23 +++++
 procps-3.2.7-longcmd.patch         |   22 +++++
 procps-3.2.7-ps-man-fmt.patch      |   12 +++
 procps-3.2.7-psman.patch           |   22 +++++
 procps-3.2.7-slabtop-once.patch    |  113 ++++++++++++++++++++++++++++
 procps-3.2.7-top-clrscr.patch      |   19 ++++
 procps-3.2.7-top-cpu0.patch        |   20 +++++
 procps-3.2.7-top-env-cpuloop.patch |   84 +++++++++++++++++++++
 procps-3.2.7-top-manpage.patch     |   32 ++++++++
 procps-3.2.7-top-remcpu.patch      |   98 ++++++++++++++++++++++++
 procps-3.2.7-w-best.patch          |   16 ++++
 procps-3.2.7-watch-unicode.patch   |  139 +++++++++++++++++++++++++++++++++++
 procps-3.2.8+gmake-3.82.patch      |   14 +++
 procps-3.2.8-setlocale.patch       |   66 ++++++++++++++++
 procps-3.2.8-threads.patch         |   49 ++++++++++++
 18 files changed, 826 insertions(+), 21 deletions(-)

Deleted: ChangeLog
===================================================================
--- ChangeLog	2010-11-20 01:16:05 UTC (rev 100039)
+++ ChangeLog	2010-11-20 03:15:43 UTC (rev 100040)
@@ -1,10 +0,0 @@
-2009-05-12  Eric Belanger  <eric at archlinux.org>
-
-	* procps 3.2.8-1
-	* Upstream update
-	* Fixed license
-
-2008-10-19  Eric Belanger  <eric at archlinux.org>
-
-	* Updated url
-	* Added ChangeLog

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2010-11-20 01:16:05 UTC (rev 100039)
+++ PKGBUILD	2010-11-20 03:15:43 UTC (rev 100040)
@@ -1,10 +1,9 @@
 # $Id$
 # Maintainer: Eric Belanger <eric at archlinux.org>
-# Contributor: judd <jvinet at zeroflux.org>
 
 pkgname=procps
 pkgver=3.2.8
-pkgrel=1
+pkgrel=2
 pkgdesc="Utilities for monitoring your system and processes on your system"
 arch=('i686' 'x86_64')
 url="http://procps.sourceforge.net/"
@@ -12,16 +11,64 @@
 groups=('base')
 depends=('ncurses')
 backup=('etc/sysctl.conf')
-source=(http://procps.sourceforge.net/procps-${pkgver}.tar.gz sysctl.conf)
-md5sums=('9532714b6846013ca9898984ba4cd7e0' '9be3a131a7068aae11418e6dd99e2221')
-sha1sums=('a0c86790569dec26b5d9037e8868ca907acc9829' '9b9a314010d042b5aa487893c06f361531525e6a')
+source=(http://procps.sourceforge.net/procps-${pkgver}.tar.gz sysctl.conf\
+        groff-top-manpage.patch            procps-3.2.7-free-hlmem.patch\
+        procps-3.2.7-longcmd.patch         procps-3.2.7-ps-man-fmt.patch\
+        procps-3.2.7-psman.patch           procps-3.2.7-slabtop-once.patch\
+        procps-3.2.7-top-clrscr.patch      procps-3.2.7-top-cpu0.patch\
+        procps-3.2.7-top-env-cpuloop.patch procps-3.2.7-top-manpage.patch\
+        procps-3.2.7-top-remcpu.patch      procps-3.2.7-top-sorthigh.path\
+        procps-3.2.7-watch-unicode.patch   procps-3.2.7-w-best.patch\
+        procps-3.2.8+gmake-3.82.patch      procps-3.2.8-setlocale.patch\
+        procps-3.2.8-threads.patch)
+md5sums=('9532714b6846013ca9898984ba4cd7e0' '9be3a131a7068aae11418e6dd99e2221'\
+         '111f33c3fd8fab2fed36c279065fefff' '81ac7fb50fcdb03e57055c7b763bb275'\
+         'cb020bfd46689908b56bf3fc5a55828a' '8d74603be1e426037a1e2c2743ef7345'\
+         'bfb7530e248b86f1abf32bca09f28b68' '9a8c81aee89531b4a72f4e4e44fb055d'\
+         '511023a3f39a90aa6efcf77120d32eb6' 'f29ef0b3a74767469651c9c335f09403'\
+         'd49673c19fa1a70f8e03fc1c24233458' '669955ca7fa7688e1c3ae7e723e0a567'\
+         'f77626450619b4bebbd67b9e164f1857' 'c71b853144b4d22b861e435362845091'\
+         '105fbbf179e63b7ca960a2dd2e5fab5b' '7f2540d2d4a2a1a6af70e9a980835753'\
+         '8d1025ae906bf0320ad9bb5095f1b970' '2e6cce598f11d75becebbe58dbe9cbd4'\
+         'e2e5393d49034435c68469d008d56489')
+sha1sums=('a0c86790569dec26b5d9037e8868ca907acc9829' '9b9a314010d042b5aa487893c06f361531525e6a'\
+         'bdd627f602ed2e38994d49309de0edbd90b41aff' 'da1b9e61f8df4a8e23a7032b245dd99e32e2c01c'\
+         '1a656d8094be41e019b2a9598b07c8a3d47f9de3' 'ba9ad9f0bde3e84484b5a0238e53534438e924be'\
+         '9944224ed2f5bd7d7fb505127bd71d6f01d88373' '954026785a9e6c90d796e93563fcea2a693691e8'\
+         '8582cd15346fa939f3fd01081620de0ffc617335' '80e31310da53baf095e905d94485324932e433df'\
+         '15fe886a2b4bed5885e6d457954e1145d1dcd2a2' '16737700b22eec8f4e8d16bce099f4b1662501e2'\
+         'bce21809ee0cb917ddf5b0c0bf2a91ea50feb0c6' '1be00d71e8e16ff2d656e5dd1f9988f2f3c0d5a0'\
+         '52068a433535ec3d5d974141be3d6d3b6a41725a' '3a8f1ba912112d7520becb28746e97b11d9b0c86'\
+         '3a4908ed8dbc936e39cb9094af8098ef9e656581' '09b1f6a3f9691b9f1432549a7a74a90ee5cfbdde'\
+         '926b92913201f21c45d48436c0902cffc059ce27')
 
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}"
-  sed -i "s:\$(lib64):lib:" Makefile || return 1
-  make || return 1
-  make DESTDIR="${pkgdir}" ldconfig=/bin/true install || return 1
-  install -D -m644 "${srcdir}/sysctl.conf" "${pkgdir}/etc/sysctl.conf" || return 1
-  install -d "${pkgdir}/usr/include/proc" || return 1
-  install -m644 proc/*.h "${pkgdir}/usr/include/proc" || return 1
+  patch -p1 < ../groff-top-manpage.patch
+  patch -p1 < ../procps-3.2.7-top-manpage.patch
+  patch -p1 < ../procps-3.2.7-free-hlmem.patch
+  patch -p1 < ../procps-3.2.7-ps-man-fmt.patch
+  patch -p1 < ../procps-3.2.7-psman.patch
+  patch -p1 < ../procps-3.2.7-longcmd.patch
+  patch -p1 < ../procps-3.2.7-slabtop-once.patch
+  patch -p1 < ../procps-3.2.7-top-clrscr.patch
+  patch -p1 < ../procps-3.2.7-top-cpu0.patch
+  patch -p1 < ../procps-3.2.7-top-env-cpuloop.patch
+  patch -p1 < ../procps-3.2.7-top-remcpu.patch
+  patch -p1 < ../procps-3.2.7-top-sorthigh.path
+  patch -p1 < ../procps-3.2.7-watch-unicode.patch
+  patch -p1 < ../procps-3.2.7-w-best.patch
+  patch -p1 < ../procps-3.2.8+gmake-3.82.patch
+  patch -p1 < ../procps-3.2.8-setlocale.patch
+  patch -p1 < ../procps-3.2.8-threads.patch
+  sed -i "s:\$(lib64):lib:" Makefile
+  make
 }
+
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  make DESTDIR="${pkgdir}" ldconfig=/bin/true install
+  install -D -m644 "${srcdir}/sysctl.conf" "${pkgdir}/etc/sysctl.conf"
+  install -d "${pkgdir}/usr/include/proc"
+  install -m644 proc/*.h "${pkgdir}/usr/include/proc"
+}

Added: groff-top-manpage.patch
===================================================================
--- groff-top-manpage.patch	                        (rev 0)
+++ groff-top-manpage.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,39 @@
+diff -Naur procps-3.2.8-orig//top.1 procps-3.2.8/top.1
+--- procps-3.2.8-orig//top.1	2010-11-19 00:43:13.000000000 -0500
++++ procps-3.2.8/top.1	2010-11-19 00:44:06.000000000 -0500
+@@ -42,7 +42,7 @@
+ .ds EM \ \fB\-\-\ \fR
+ \#                          - these two are for chuckles, makes great grammar
+ .ds Me top
+-.ds ME \fBtop\fR
++.ds MM \fBtop\fR
+ \#                          - other misc strings for consistent usage/emphasis
+ .ds F \fIOff\fR
+ .ds O \fIOn\fR
+@@ -85,7 +85,7 @@
+ .\" ----------------------------------------------------------------------
+ .SH SYNOPSIS
+ .\" ----------------------------------------------------------------------
+-\*(ME \-\fBhv\fR | \-\fBbcHisS\fR \-\fBd\fI delay\fR \-\fBn\fI
++\*(MM \-\fBhv\fR | \-\fBbcHisS\fR \-\fBd\fI delay\fR \-\fBn\fI
+ iterations\fR \-\fBp\fI pid\fR [,\fI pid\fR ...]
+ 
+ The traditional switches '-' and whitespace are optional.
+@@ -94,7 +94,7 @@
+ .\" ----------------------------------------------------------------------
+ .SH DESCRIPTION
+ .\" ----------------------------------------------------------------------
+-The \*(ME program provides a dynamic real-time view of a running system.
++The \*(MM program provides a dynamic real-time view of a running system.
+ It can display\fB system\fR summary information as well as a list of\fB
+ tasks\fR currently being managed by the Linux kernel.
+ The types of system summary information shown and the types, order and
+@@ -104,7 +104,7 @@
+ The program provides a limited interactive interface for process
+ manipulation as well as a much more extensive interface for personal
+ configuration \*(EM encompassing every aspect of its operation.
+-And while \*(ME is referred to throughout this document, you are free
++And while \*(MM is referred to throughout this document, you are free
+ to name the program anything you wish.
+ That new name, possibly an alias, will then be reflected on \*(Me's display
+ and used when reading and writing a \*(CF.

Added: procps-3.2.7-free-hlmem.patch
===================================================================
--- procps-3.2.7-free-hlmem.patch	                        (rev 0)
+++ procps-3.2.7-free-hlmem.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,23 @@
+diff -up procps-3.2.7/free.1.hlmem procps-3.2.7/free.1
+--- procps-3.2.7/free.1.hlmem	2009-02-24 10:54:35.000000000 +0100
++++ procps-3.2.7/free.1	2009-02-24 11:00:26.000000000 +0100
+@@ -7,7 +7,7 @@ free \- Display amount of free and used 
+ .SH SYNOPSIS
+ .BR "free " [ "\-b" " | " "\-k" " | " "\-m" "] [" "\-o" "] [" "\-s"
+ .I delay
+-.RB "] [" "\-t" "] [" "\-V" ]
++.RB "] [" "\-t" "] [" "\-l" "] [" "\-V" "]
+ .SH DESCRIPTION
+ \fBfree\fP displays the total amount of free and used physical and swap 
+ memory in the system, as well as the buffers used by the kernel.
+@@ -28,7 +28,9 @@ may actually specify any floating point 
+ .BR usleep (3)
+ is used for microsecond resolution delay times.
+ .PP
+-The \fB\-V\fP displays version information.
++The \fB-l\fP switch shows detailed low and high memory statistics.
++.PP
++The \fB\-V\fP switch displays version information.
+ .SH FILES
+ .ta
+ .IR /proc/meminfo "\-\- memory information"

Added: procps-3.2.7-longcmd.patch
===================================================================
--- procps-3.2.7-longcmd.patch	                        (rev 0)
+++ procps-3.2.7-longcmd.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,22 @@
+--- procps-3.2.7/proc/readproc.c.kzak	2006-06-16 10:18:13.000000000 +0200
++++ procps-3.2.7/proc/readproc.c	2006-09-27 11:25:13.000000000 +0200
+@@ -432,14 +432,17 @@
+     if(fd==-1) return NULL;
+ 
+     /* read whole file into a memory buffer, allocating as we go */
+-    while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
++    while ((n = read(fd, buf, sizeof buf - 1)) >= 0) {
+ 	if (n < (int)(sizeof buf - 1))
+ 	    end_of_file = 1;
+-	if (n == 0 && rbuf == 0)
++	if (n == 0 && rbuf == 0) {
++	    close(fd);
+ 	    return NULL;	/* process died between our open and read */
++	}
+ 	if (n < 0) {
+ 	    if (rbuf)
+ 		free(rbuf);
++	    close(fd);
+ 	    return NULL;	/* read error */
+ 	}
+ 	if (end_of_file && buf[n-1])		/* last read char not null */

Added: procps-3.2.7-ps-man-fmt.patch
===================================================================
--- procps-3.2.7-ps-man-fmt.patch	                        (rev 0)
+++ procps-3.2.7-ps-man-fmt.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,12 @@
+diff -up procps-3.2.7/ps/ps.1.ps-man-fmt procps-3.2.7/ps/ps.1
+--- procps-3.2.7/ps/ps.1.ps-man-fmt	2008-09-01 11:43:18.000000000 +0200
++++ procps-3.2.7/ps/ps.1	2008-09-01 11:43:41.000000000 +0200
+@@ -30,7 +30,7 @@
+ .\" the space needed for the 1st two columns.
+ .\" Making it messy: inches, ens, points, scaled points...
+ .\"
+-.nr ColSize ((\n(.lu-\n(.iu/\n(.Hu-20u)n)
++.nr ColSize ((\n[.l] - \n[.i]) / 1n - 20)
+ .\"
+ .\" This is for command options
+ .nr OptSize (16u)

Added: procps-3.2.7-psman.patch
===================================================================
--- procps-3.2.7-psman.patch	                        (rev 0)
+++ procps-3.2.7-psman.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,22 @@
+--- procps-3.2.7/ps/ps.1.psman	2007-06-20 08:30:47.000000000 +0200
++++ procps-3.2.7/ps/ps.1	2007-06-20 08:50:10.000000000 +0200
+@@ -21,8 +21,8 @@
+ .\" See /usr/share/groff/current/tmac/an-old.tmac for what these do.
+ .\" Setting them to zero provides extra space, but only do that for
+ .\" plain text output. PostScript and such will remain indented.
+-.if n .nr IN 0n
+-.if n .nr an-prevailing-indent 0n
++.\" .if n .nr IN 0n
++.\" .if n .nr an-prevailing-indent 0n
+ .\"
+ .\"
+ .\" ColSize is used for the format spec table.
+@@ -838,6 +838,8 @@
+ .\" lB1 lB1 lBw(5.5i)
+ .\" lB1 l1  l.
+ .\"
++.RE
++
+ .TS
+ expand;
+ lB1 lB1 lBw(\n[ColSize]n)

Added: procps-3.2.7-slabtop-once.patch
===================================================================
--- procps-3.2.7-slabtop-once.patch	                        (rev 0)
+++ procps-3.2.7-slabtop-once.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,113 @@
+diff -up procps-3.2.7/slabtop.c.once procps-3.2.7/slabtop.c
+--- procps-3.2.7/slabtop.c.once	2008-12-11 13:24:52.000000000 +0100
++++ procps-3.2.7/slabtop.c	2008-12-11 13:33:12.000000000 +0100
+@@ -268,9 +268,24 @@ static void parse_input(char c)
+ 	}
+ }
+ 
++/*printw or printf depending on the context*/
++static void printwf(int once, const char *s,...)
++{
++va_list va;
++
++va_start(va,s);
++if(once) 
++    vprintf(s,va);
++else     
++    vwprintw(stdscr, s, va);
++va_end(va);
++}
++
++
+ int main(int argc, char *argv[])
+ {
+ 	int o;
++        int once = 0;
+ 	unsigned short old_rows;
+ 	struct slab_info *slab_list = NULL;
+ 
+@@ -307,6 +322,7 @@ int main(int argc, char *argv[])
+ 			break;
+ 		case 'o':
+ 			delay = 0;
++                        once = 1;
+ 			break;
+ 		case 'V':
+ 			display_version();
+@@ -322,12 +338,18 @@ int main(int argc, char *argv[])
+ 	if (tcgetattr(0, &saved_tty) == -1)
+ 		perror("tcgetattr");
+ 
+-	initscr();
+-	term_size(0);
+-	old_rows = rows;
+-	resizeterm(rows, cols);
+-	signal(SIGWINCH, term_size);
+-	signal(SIGINT, sigint_handler);
++        if(!once) {
++            initscr();
++	    term_size(0);
++	    old_rows = rows;
++	    resizeterm(rows, cols);
++	    signal(SIGWINCH, term_size);
++	    signal(SIGINT, sigint_handler); 
++        } else {
++            old_rows = rows;
++            rows = 80;
++            cols = 24;
++        }
+ 
+ 	do {
+ 		struct slab_info *curr;
+@@ -341,12 +363,12 @@ int main(int argc, char *argv[])
+ 			break;
+ 
+ 		if (old_rows != rows) {
+-			resizeterm(rows, cols);
++			if(!once) resizeterm(rows, cols);
+ 			old_rows = rows;
+ 		}
+ 
+ 		move(0,0);
+-		printw(	" Active / Total Objects (%% used)    : %d / %d (%.1f%%)\n"
++		printwf(once,	" Active / Total Objects (%% used)    : %d / %d (%.1f%%)\n"
+ 			" Active / Total Slabs (%% used)      : %d / %d (%.1f%%)\n"
+ 			" Active / Total Caches (%% used)     : %d / %d (%.1f%%)\n"
+ 			" Active / Total Size (%% used)       : %.2fK / %.2fK (%.1f%%)\n"
+@@ -360,15 +382,15 @@ int main(int argc, char *argv[])
+ 
+ 		slab_list = slabsort(slab_list);
+ 
+-		attron(A_REVERSE);
+-		printw(	"%6s %6s %4s %8s %6s %8s %10s %-23s\n",
++		if(!once) attron(A_REVERSE);
++		printwf(once,	"%6s %6s %4s %8s %6s %8s %10s %-23s\n",
+ 			"OBJS", "ACTIVE", "USE", "OBJ SIZE", "SLABS",
+ 			"OBJ/SLAB", "CACHE SIZE", "NAME");
+-		attroff(A_REVERSE);
++		if(!once) attroff(A_REVERSE);
+ 
+ 		curr = slab_list;
+ 		for (i = 0; i < rows - 8 && curr->next; i++) {
+-			printw("%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n",
++			printwf(once, "%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n",
+ 				curr->nr_objs, curr->nr_active_objs, curr->use,
+ 				curr->obj_size / 1024.0, curr->nr_slabs,
+ 				curr->objs_per_slab, (unsigned)(curr->cache_size / 1024),
+@@ -376,7 +398,7 @@ int main(int argc, char *argv[])
+ 			curr = curr->next;
+ 		}
+ 
+-		refresh();
++		if(!once) refresh();
+ 		put_slabinfo(slab_list);
+ 
+ 		FD_ZERO(&readfds);
+@@ -392,6 +414,6 @@ int main(int argc, char *argv[])
+ 
+ 	tcsetattr(0, TCSAFLUSH, &saved_tty);
+ 	free_slabinfo(slab_list);
+-	endwin();
++	if(!once) endwin();
+ 	return 0;
+ }

Added: procps-3.2.7-top-clrscr.patch
===================================================================
--- procps-3.2.7-top-clrscr.patch	                        (rev 0)
+++ procps-3.2.7-top-clrscr.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,19 @@
+diff -up procps-3.2.7/top.c.clrscr procps-3.2.7/top.c
+--- procps-3.2.7/top.c.clrscr	2008-04-08 08:49:48.000000000 +0200
++++ procps-3.2.7/top.c	2008-04-08 08:50:07.000000000 +0200
+@@ -2109,6 +2109,7 @@ static void fields_sort (void)
+       *p = x + 'A';
+    Curwin->rc.sortindx = x;
+    putp(Cap_curs_norm);
++   putp(Cap_clr_scr);
+ }
+ 
+ 
+@@ -2134,6 +2135,7 @@ static void fields_toggle (void)
+          *p = i + 'A';
+    }
+    putp(Cap_curs_norm);
++   putp(Cap_clr_scr);
+ }
+ 
+ /*######  Windows/Field Groups support  #################################*/

Added: procps-3.2.7-top-cpu0.patch
===================================================================
--- procps-3.2.7-top-cpu0.patch	                        (rev 0)
+++ procps-3.2.7-top-cpu0.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,20 @@
+--- procps-3.2.7/top.c.orig	2007-09-07 21:28:41.000000000 +0100
++++ procps-3.2.7/top.c	2007-09-07 21:29:15.000000000 +0100
+@@ -959,8 +959,15 @@
+ 
+    // and just in case we're 2.2.xx compiled without SMP support...
+    if (Cpu_tot == 1) {
+-      cpus[1].id = 0;
+-      memcpy(cpus, &cpus[1], sizeof(CPU_t));
++      cpus[0].id = cpus[1].id = 0;
++      cpus[0].u = cpus[1].u;
++      cpus[0].n = cpus[1].n;
++      cpus[0].s = cpus[1].s;
++      cpus[0].i = cpus[1].i;
++      cpus[0].w = cpus[1].w;
++      cpus[0].x = cpus[1].x;
++      cpus[0].y = cpus[1].y;
++      cpus[0].z = cpus[1].z;
+    }
+ 
+    // now value each separate cpu's tics

Added: procps-3.2.7-top-env-cpuloop.patch
===================================================================
--- procps-3.2.7-top-env-cpuloop.patch	                        (rev 0)
+++ procps-3.2.7-top-env-cpuloop.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,84 @@
+diff -up procps-3.2.7/top.c.p15 procps-3.2.7/top.c
+--- procps-3.2.7/top.c.p15	2008-09-01 11:37:51.000000000 +0200
++++ procps-3.2.7/top.c	2008-09-01 11:37:51.000000000 +0200
+@@ -121,6 +121,7 @@ static int No_ksyms = -1,       // set t
+            Batch = 0,           // batch mode, collect no input, dumb output
+            Loops = -1,          // number of iterations, -1 loops forever
+            Secure_mode = 0;     // set if some functionality restricted
++static int CPU_loop = 0;	// wait for reliable CPU data
+ 
+         /* Some cap's stuff to reduce runtime calls --
+            to accomodate 'Batch' mode, they begin life as empty strings */
+@@ -1679,6 +1680,9 @@ static void before (char *me)
+       Fieldstab[P_PPD].fmts = pid_fmt;
+       Fieldstab[P_PPD].head = "       PPID" + 10 - pid_digits;
+    }
++
++   if (( getenv("CPULOOP")) && ( atoi(getenv("CPULOOP")) == 1 )) 
++	   CPU_loop = 1;
+ }
+ 
+ 
+@@ -2978,6 +2981,7 @@ static proc_t **summary_show (void)
+ {
+    static proc_t **p_table = NULL;
+    static CPU_t  *smpcpu = NULL;
++   static int first = 0;
+ 
+    // whoa first time, gotta' prime the pump...
+    if (!p_table) {
+@@ -3025,6 +3029,28 @@ static proc_t **summary_show (void)
+ 
+       smpcpu = cpus_refresh(smpcpu);
+ 
++      if (first==0 && CPU_loop)
++      {
++	 int i;
++	 CPU_t *cpu;
++	 for (i = 0; i < Cpu_tot; i++) {
++           cpu =  &smpcpu[i];
++	   cpu->u_sav = cpu->u;
++	   cpu->s_sav = cpu->s;
++	   cpu->n_sav = cpu->n;
++	   cpu->i_sav = cpu->i;
++	   cpu->w_sav = cpu->w;
++	   cpu->x_sav = cpu->x;
++	   cpu->y_sav = cpu->y;
++	   cpu->z_sav = cpu->z;
++	 }
++         tv.tv_sec = Rc.delay_time;
++         tv.tv_usec = (Rc.delay_time - (int)Rc.delay_time) * 1000000;
++         select(0, NULL, NULL, NULL, &tv);
++
++	 smpcpu = cpus_refresh(smpcpu);
++      }
++
+       if (CHKw(Curwin, View_CPUSUM)) {
+          // display just the 1st /proc/stat line
+          summaryhlp(&smpcpu[Cpu_tot], "Cpu(s):");
+@@ -3050,6 +3076,8 @@ static proc_t **summary_show (void)
+    }
+ 
+    SETw(Curwin, NEWFRAM_cwo);
++
++   first = 1;
+    return p_table;
+ }
+ 
+diff -up procps-3.2.7/top.1.p15 procps-3.2.7/top.1
+--- procps-3.2.7/top.1.p15	2008-09-01 11:37:51.000000000 +0200
++++ procps-3.2.7/top.1	2008-09-01 11:37:51.000000000 +0200
+@@ -1183,6 +1183,13 @@ Then ponder this:
+ Send bug reports to:
+    Albert D\. Cahalan, <albert at users.sf.net>
+ 
++The top command calculates Cpu(s) by looking at the change in CPU time values
++between samples. When you first run it, it has no previous sample to compare
++to, so these initial values are the percentages since boot. It means you need
++at least two loops or you have to ignore summary output from the first loop.
++This is problem for example for batch mode. There is a possible workaround if
++you define the CPULOOP=1 environment variable. The top command will be run one
++extra hidden loop for CPU data before standard output.
+ 
+ .\" ----------------------------------------------------------------------
+ .SH 8. HISTORY Former top

Added: procps-3.2.7-top-manpage.patch
===================================================================
--- procps-3.2.7-top-manpage.patch	                        (rev 0)
+++ procps-3.2.7-top-manpage.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,32 @@
+diff -up procps-3.2.7/top.1.cpudesc procps-3.2.7/top.1
+--- procps-3.2.7/top.1.cpudesc	2008-01-18 08:04:19.000000000 +0100
++++ procps-3.2.7/top.1	2008-01-18 08:15:49.000000000 +0100
+@@ -121,6 +121,7 @@
+     2. FIELDS / Columns
+        a. DESCRIPTIONS of Fields
+        b. SELECTING and ORDERING Columns
++       c. SUMMARY Area Fields
+     3. INTERACTIVE Commands
+        a. GLOBAL Commands
+        b. SUMMARY Area Commands
+@@ -540,6 +540,20 @@ You\fI move\fR a field to the\fB left\fR
+ upper case\fR letter and to the\fB right\fR with the\fB lower case\fR
+ letter.
+ 
++.\" ......................................................................
++.SS 2c. SUMMARY Area Fields
++.\" ----------------------------------------------------------------------
++The summary area fields describing CPU statistics are abbreviated.  They provide
++information about times spent in:
++  \fR  us = user mode
++  \fR  sy = system mode
++  \fR  ni = low priority user mode (nice)
++  \fR  id = idle task
++  \fR  wa = I/O waiting
++  \fR  hi = servicing IRQs
++  \fR  si = servicing soft IRQs
++  \fR  st = steal (time given to other DomU instances) 
++
+ 
+ .\" ----------------------------------------------------------------------
+ .SH 3. INTERACTIVE Commands

Added: procps-3.2.7-top-remcpu.patch
===================================================================
--- procps-3.2.7-top-remcpu.patch	                        (rev 0)
+++ procps-3.2.7-top-remcpu.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,98 @@
+--- procps-3.2.7/top.c.remcpu	2006-07-10 10:41:11.000000000 +0200
++++ procps-3.2.7/top.c	2006-07-10 10:41:35.000000000 +0200
+@@ -912,6 +912,7 @@
+ static CPU_t *cpus_refresh (CPU_t *cpus)
+ {
+    static FILE *fp = NULL;
++   static int cpu_max;
+    int i;
+    int num;
+    // enough for a /proc/stat CPU line (not the intr line)
+@@ -926,24 +927,29 @@
+                can hold tics representing the /proc/stat cpu summary (the first
+                line read) -- that slot supports our View_CPUSUM toggle */
+       cpus = alloc_c((1 + Cpu_tot) * sizeof(CPU_t));
++      cpu_max = Cpu_tot;
+    }
++   else if (cpu_max > Cpu_tot)
++      /* move saved CUPs summary to cpu_max possition */
++      memcpy(&cpus[cpu_max], &cpus[Cpu_tot], sizeof(CPU_t));
++   
+    rewind(fp);
+    fflush(fp);
+ 
+    // first value the last slot with the cpu summary line
+    if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
+-   cpus[Cpu_tot].x = 0;  // FIXME: can't tell by kernel version number
+-   cpus[Cpu_tot].y = 0;  // FIXME: can't tell by kernel version number
+-   cpus[Cpu_tot].z = 0;  // FIXME: can't tell by kernel version number
++   cpus[cpu_max].x = 0;  // FIXME: can't tell by kernel version number
++   cpus[cpu_max].y = 0;  // FIXME: can't tell by kernel version number
++   cpus[cpu_max].z = 0;  // FIXME: can't tell by kernel version number
+    num = sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
+-      &cpus[Cpu_tot].u,
+-      &cpus[Cpu_tot].n,
+-      &cpus[Cpu_tot].s,
+-      &cpus[Cpu_tot].i,
+-      &cpus[Cpu_tot].w,
+-      &cpus[Cpu_tot].x,
+-      &cpus[Cpu_tot].y,
+-      &cpus[Cpu_tot].z
++      &cpus[cpu_max].u,
++      &cpus[cpu_max].n,
++      &cpus[cpu_max].s,
++      &cpus[cpu_max].i,
++      &cpus[cpu_max].w,
++      &cpus[cpu_max].x,
++      &cpus[cpu_max].y,
++      &cpus[cpu_max].z
+    );
+    if (num < 4)
+          std_err("failed /proc/stat read");
+@@ -955,7 +961,7 @@
+    }
+ 
+    // now value each separate cpu's tics
+-   for (i = 0; 1 < Cpu_tot && i < Cpu_tot; i++) {
++   for (i = 0; ; i++) {
+       if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
+       cpus[i].x = 0;  // FIXME: can't tell by kernel version number
+       cpus[i].y = 0;  // FIXME: can't tell by kernel version number
+@@ -964,9 +970,35 @@
+          &cpus[i].id,
+          &cpus[i].u, &cpus[i].n, &cpus[i].s, &cpus[i].i, &cpus[i].w, &cpus[i].x, &cpus[i].y, &cpus[i].z
+       );
+-      if (num < 4)
+-            std_err("failed /proc/stat read");
++      if (num < 4) {
++	 Cpu_tot = i;
++	 break;
++      }
++      if (i == cpu_max - 1) {
++	 // Bump cpu_max and extend cpus
++	 cpu_max++;
++	 cpus = realloc(cpus, (1 + cpu_max) * sizeof(CPU_t));
++	 if (!cpus) std_err("realloc failed");
++	 memcpy(&cpus[cpu_max], &cpus[cpu_max-1], sizeof(CPU_t));
++      }
++   }
++
++   if (cpu_max > Cpu_tot)
++      memcpy(&cpus[Cpu_tot], &cpus[cpu_max], sizeof(CPU_t));
++
++   // and just in case we're 2.2.xx compiled without SMP support...
++   if (Cpu_tot == 1) {
++      cpus[0].id = cpus[1].id = 0;
++      cpus[0].u = cpus[1].u;
++      cpus[0].n = cpus[1].n;
++      cpus[0].s = cpus[1].s;
++      cpus[0].i = cpus[1].i;
++      cpus[0].w = cpus[1].w;
++      cpus[0].x = cpus[1].x;
++      cpus[0].y = cpus[1].y;
++      cpus[0].z = cpus[1].z;
+    }
++   
+    return cpus;
+ }
+ 

Added: procps-3.2.7-w-best.patch
===================================================================
--- procps-3.2.7-w-best.patch	                        (rev 0)
+++ procps-3.2.7-w-best.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,16 @@
+--- procps-3.2.7/w.c.kzak	2007-04-02 23:58:30.000000000 +0200
++++ procps-3.2.7/w.c	2007-04-03 00:09:15.000000000 +0200
+@@ -149,11 +149,11 @@
+ 	const proc_t *restrict const tmp = *pptr;
+ 	if(unlikely(tmp->tgid == u->ut_pid)) {
+ 	    *found_utpid = 1;
+-	    best = tmp;
++	    if (!best)
++	         best = tmp;
+ 	}
+ 	if(tmp->tty != line) continue;
+ 	(*jcpu) += tmp->utime + tmp->stime;
+-	secondbest = tmp;
+ 	/* same time-logic here as for "best" below */
+ 	if(!  (secondbest && tmp->start_time <= secondbest->start_time)  ){
+ 	    secondbest = tmp;

Added: procps-3.2.7-watch-unicode.patch
===================================================================
--- procps-3.2.7-watch-unicode.patch	                        (rev 0)
+++ procps-3.2.7-watch-unicode.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,139 @@
+diff -u procps-3.2.7/Makefile procps/Makefile
+--- procps-3.2.7/Makefile	2007-01-16 17:24:49.000000000 +0100
++++ procps/Makefile	2007-01-16 17:29:27.000000000 +0100
+@@ -67,7 +67,7 @@
+ # plus the top-level Makefile to make it work stand-alone.
+ _TARFILES := Makefile
+ 
+-CURSES := -lncurses
++CURSES := -lncursesw
+ 
+ # This seems about right for the dynamic library stuff.
+ # Something like this is probably needed to make the SE Linux
+diff -u procps-3.2.7/watch.c procps/watch.c
+--- procps-3.2.7/watch.c	2007-01-16 17:24:49.000000000 +0100
++++ procps/watch.c	2007-01-16 18:06:57.000000000 +0100
+@@ -28,6 +28,8 @@
+ #include <termios.h>
+ #include <locale.h>
+ #include "proc/procps.h"
++#include <wchar.h>
++#include <wctype.h>
+ 
+ #ifdef FORCE_8BIT
+ #undef isprint
+@@ -137,6 +139,27 @@
+ 	}
+ }
+ 
++static wint_t
++readwc(FILE *stream, mbstate_t *mbs)
++{
++	for (;;) {
++		int chr;
++		char c;
++		wchar_t wc;
++		size_t len;
++
++		chr = getc(stream);
++		if (chr == EOF)
++			return WEOF;
++		c = chr;
++		len = mbrtowc(&wc, &c, 1, mbs);
++		if (len == (size_t)-1)
++			memset(mbs, 0, sizeof(*mbs));
++		else if (len != (size_t)-2)
++			return wc;
++	}
++}
++
+ int
+ main(int argc, char *argv[])
+ {
+@@ -243,6 +266,7 @@
+ 		FILE *p;
+ 		int x, y;
+ 		int oldeolseen = 1;
++		mbstate_t mbs;
+ 
+ 		if (screen_size_changed) {
+ 			get_terminal_size();
+@@ -276,49 +300,63 @@
+ 			do_exit(2);
+ 		}
+ 
++		memset(&mbs, 0, sizeof(mbs));
+ 		for (y = show_title; y < height; y++) {
+ 			int eolseen = 0, tabpending = 0;
+ 			for (x = 0; x < width; x++) {
+-				int c = ' ';
+-				int attr = 0;
++				wint_t c = L' ';
++				int attr = 0, c_width;
++				cchar_t cc;
++				wchar_t wstr[2];
+ 
+ 				if (!eolseen) {
+ 					/* if there is a tab pending, just spit spaces until the
+ 					   next stop instead of reading characters */
+ 					if (!tabpending)
+ 						do
+-							c = getc(p);
+-						while (c != EOF && !isprint(c)
+-						       && c != '\n'
+-						       && c != '\t');
+-					if (c == '\n')
++							c = readwc(p, &mbs);
++						while (c != WEOF && !iswprint(c)
++						       && c != L'\n'
++						       && c != L'\t');
++					if (c == L'\n')
+ 						if (!oldeolseen && x == 0) {
+ 							x = -1;
+ 							continue;
+ 						} else
+ 							eolseen = 1;
+-					else if (c == '\t')
++					else if (c == L'\t')
+ 						tabpending = 1;
+-					if (c == EOF || c == '\n' || c == '\t')
+-						c = ' ';
++					if (c == WEOF || c == L'\n' || c == L'\t')
++						c = L' ';
+ 					if (tabpending && (((x + 1) % 8) == 0))
+ 						tabpending = 0;
+ 				}
++				wstr[0] = c;
++				wstr[1] = 0;
++				setcchar (&cc, wstr, 0, 0, NULL);
+ 				move(y, x);
+ 				if (option_differences) {
+-					chtype oldch = inch();
+-					char oldc = oldch & A_CHARTEXT;
++					cchar_t oldc;
++					wchar_t oldwstr[2];
++					attr_t attrs;
++					short colors;
++
++					in_wch(&oldc);
++					getcchar(&oldc, oldwstr, &attrs, &colors, NULL);
+ 					attr = !first_screen
+-					    && ((char)c != oldc
++					    && (wstr[0] != oldwstr[0]
+ 						||
+ 						(option_differences_cumulative
+-						 && (oldch & A_ATTRIBUTES)));
++						 && attrs));
+ 				}
+ 				if (attr)
+ 					standout();
+-				addch(c);
++				add_wch(&cc);
+ 				if (attr)
+ 					standend();
++				c_width = wcwidth(c);
++				if (c_width > 1)
++					x += c_width - 1;
+ 			}
+ 			oldeolseen = eolseen;
+ 		}

Added: procps-3.2.8+gmake-3.82.patch
===================================================================
--- procps-3.2.8+gmake-3.82.patch	                        (rev 0)
+++ procps-3.2.8+gmake-3.82.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,14 @@
+Index: procps-3.2.8/Makefile
+===================================================================
+--- procps-3.2.8.orig/Makefile
++++ procps-3.2.8/Makefile
+@@ -174,7 +174,8 @@ INSTALL := $(BINFILES) $(MANFILES)
+ # want this rule first, use := on ALL, and ALL not filled in yet
+ all: do_all
+ 
+--include */module.mk
++-include proc/module.mk
++-include ps/module.mk
+ 
+ do_all:    $(ALL)
+ 

Added: procps-3.2.8-setlocale.patch
===================================================================
--- procps-3.2.8-setlocale.patch	                        (rev 0)
+++ procps-3.2.8-setlocale.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,66 @@
+diff -Nur procps-3.2.8-orig/proc/sysinfo.c procps-3.2.8/proc/sysinfo.c
+--- procps-3.2.8-orig/proc/sysinfo.c	2008-03-24 05:33:43.000000000 +0100
++++ procps-3.2.8/proc/sysinfo.c	2009-12-18 22:50:52.000000000 +0100
+@@ -74,17 +74,19 @@
+ /***********************************************************************/
+ int uptime(double *restrict uptime_secs, double *restrict idle_secs) {
+     double up=0, idle=0;
+-    char *restrict savelocale;
++    char *savelocale;
+ 
+     FILE_TO_BUF(UPTIME_FILE,uptime_fd);
+-    savelocale = setlocale(LC_NUMERIC, NULL);
++    savelocale = strdup(setlocale(LC_NUMERIC, NULL));
+     setlocale(LC_NUMERIC,"C");
+     if (sscanf(buf, "%lf %lf", &up, &idle) < 2) {
+         setlocale(LC_NUMERIC,savelocale);
++        free(savelocale);
+         fputs("bad data in " UPTIME_FILE "\n", stderr);
+ 	    return 0;
+     }
+     setlocale(LC_NUMERIC,savelocale);
++    free(savelocale);
+     SET_IF_DESIRED(uptime_secs, up);
+     SET_IF_DESIRED(idle_secs, idle);
+     return up;	/* assume never be zero seconds in practice */
+@@ -128,9 +130,9 @@
+   double up_1, up_2, seconds;
+   unsigned long long jiffies;
+   unsigned h;
+-  char *restrict savelocale;
++  char *savelocale;
+ 
+-  savelocale = setlocale(LC_NUMERIC, NULL);
++  savelocale = strdup(setlocale(LC_NUMERIC, NULL));
+   setlocale(LC_NUMERIC, "C");
+   do{
+     FILE_TO_BUF(UPTIME_FILE,uptime_fd);  sscanf(buf, "%lf", &up_1);
+@@ -141,6 +143,7 @@
+     /* uptime(&up_2, NULL); */
+   } while((long long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */
+   setlocale(LC_NUMERIC, savelocale);
++  free(savelocale);
+   jiffies = user_j + nice_j + sys_j + other_j;
+   seconds = (up_1 + up_2) / 2;
+   h = (unsigned)( (double)jiffies/seconds/smp_num_cpus );
+@@ -303,16 +306,18 @@
+ /***********************************************************************/
+ void loadavg(double *restrict av1, double *restrict av5, double *restrict av15) {
+     double avg_1=0, avg_5=0, avg_15=0;
+-    char *restrict savelocale;
++    char *savelocale;
+     
+     FILE_TO_BUF(LOADAVG_FILE,loadavg_fd);
+-    savelocale = setlocale(LC_NUMERIC, NULL);
++    savelocale = strdup(setlocale(LC_NUMERIC, NULL));
+     setlocale(LC_NUMERIC, "C");
+     if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) {
+ 	fputs("bad data in " LOADAVG_FILE "\n", stderr);
++    free(savelocale);
+ 	exit(1);
+     }
+     setlocale(LC_NUMERIC, savelocale);
++    free(savelocale);
+     SET_IF_DESIRED(av1,  avg_1);
+     SET_IF_DESIRED(av5,  avg_5);
+     SET_IF_DESIRED(av15, avg_15);

Added: procps-3.2.8-threads.patch
===================================================================
--- procps-3.2.8-threads.patch	                        (rev 0)
+++ procps-3.2.8-threads.patch	2010-11-20 03:15:43 UTC (rev 100040)
@@ -0,0 +1,49 @@
+diff -up procps-3.2.8/top.c.threads procps-3.2.8/top.c
+--- procps-3.2.8/top.c.threads	2009-10-01 07:14:43.000000000 -0400
++++ procps-3.2.8/top.c	2009-10-05 14:05:00.000000000 -0400
+@@ -1138,6 +1138,7 @@ static proc_t **procs_refresh (proc_t **
+ #define ENTsz  sizeof(proc_t)
+    static unsigned savmax = 0;          // first time, Bypass: (i)
+    proc_t *ptsk = (proc_t *)-1;         // first time, Force: (ii)
++   proc_t *saved_ptsk;
+    unsigned curmax = 0;                 // every time  (jeeze)
+    PROCTAB* PT;
+    static int show_threads_was_enabled = 0; // optimization
+@@ -1172,6 +1173,10 @@ static proc_t **procs_refresh (proc_t **
+       while (curmax < savmax) {
+          proc_t *ttsk;
+          if (unlikely(!(ptsk = readproc(PT, NULL)))) break;
++	 if(!show_threads_was_enabled)
++             saved_ptsk = ptsk;
++	 else
++	     saved_ptsk = NULL;
+          show_threads_was_enabled = 1;
+          while (curmax < savmax) {
+             unsigned idx;
+@@ -1189,7 +1194,7 @@ static proc_t **procs_refresh (proc_t **
+             prochlp(ttsk);
+             ++curmax;
+          }
+-         free(ptsk);  // readproc() proc_t not used
++         if(!saved_ptsk) free(ptsk);  // readproc() proc_t not used
+       }
+    }
+ 
+@@ -1208,7 +1213,8 @@ static proc_t **procs_refresh (proc_t **
+    else {                          // show each thread in a process separately
+       while (ptsk) {
+          proc_t *ttsk;
+-         if (likely(ptsk = readproc(PT, NULL))) {
++         if (likely(ptsk = readproc(PT, NULL)) || 
++             unlikely(saved_ptsk && (ptsk = saved_ptsk)) ) {
+             show_threads_was_enabled = 1;
+             while (1) {
+                table = alloc_r(table, (curmax + 1) * PTRsz);
+@@ -1216,6 +1222,7 @@ static proc_t **procs_refresh (proc_t **
+                prochlp(ttsk);
+                table[curmax++] = ttsk;
+             }
++            saved_ptsk = NULL;
+             free(ptsk);   // readproc() proc_t not used
+          }
+       }




More information about the arch-commits mailing list