rpms/procps/devel procps-3.2.8-threads.patch, NONE, 1.1 procps.spec, 1.82, 1.83

Daniel Novotny dnovotny at fedoraproject.org
Wed Oct 7 10:24:55 UTC 2009


Author: dnovotny

Update of /cvs/extras/rpms/procps/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3847

Modified Files:
	procps.spec 
Added Files:
	procps-3.2.8-threads.patch 
Log Message:
fix #510181


procps-3.2.8-threads.patch:
 top.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- NEW FILE procps-3.2.8-threads.patch ---
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
          }
       }


Index: procps.spec
===================================================================
RCS file: /cvs/extras/rpms/procps/devel/procps.spec,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -p -r1.82 -r1.83
--- procps.spec	26 Jul 2009 19:27:24 -0000	1.82
+++ procps.spec	7 Oct 2009 10:24:55 -0000	1.83
@@ -1,7 +1,7 @@
 Summary: System and process monitoring utilities
 Name: procps
 Version: 3.2.8
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: Applications/System
 URL: http://procps.sourceforge.net
@@ -82,7 +82,8 @@ Patch41: procps-3.2.7-ps-cgroup.patch
 Patch42: procps-3.2.7-vmstat-partstats-reqwrites.patch
 # '-l' option of 'free' documented
 Patch43: procps-3.2.7-free-hlmem.patch
-
+# bug in showing threads fixed
+Patch44: procps-3.2.8-threads.patch
 
 BuildRequires: ncurses-devel
 
@@ -147,6 +148,7 @@ working directory of a process or proces
 %patch41 -p1
 %patch42 -p1
 %patch43 -p1
+%patch44 -p1
 
 cp %SOURCE1 .
 
@@ -184,6 +186,10 @@ rm -rf %{buildroot}
 %attr(0644,root,root) %{_mandir}/man5/*
 
 %changelog
+* Wed Oct 07 2009 Daniel Novotny <dnovotny at redhat.com> 3.2.8-3
+- fix #510181 -  top doesn't add all threads if using pid option 
+                 and turn on show threads interactively
+
 * Sun Jul 26 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.2.8-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 




More information about the fedora-extras-commits mailing list