1 diff -up procps-3.2.7/slabtop.c.once procps-3.2.7/slabtop.c
2 --- procps-3.2.7/slabtop.c.once 2008-12-11 13:24:52.000000000 +0100
3 +++ procps-3.2.7/slabtop.c 2008-12-11 13:33:12.000000000 +0100
4 @@ -268,9 +268,24 @@ static void parse_input(char c)
8 +/*printw or printf depending on the context*/
9 +static void printwf(int once, const char *s,...)
17 + vwprintw(stdscr, s, va);
22 int main(int argc, char *argv[])
26 unsigned short old_rows;
27 struct slab_info *slab_list = NULL;
29 @@ -307,6 +322,7 @@ int main(int argc, char *argv[])
37 @@ -322,12 +338,18 @@ int main(int argc, char *argv[])
38 if (tcgetattr(0, &saved_tty) == -1)
44 - resizeterm(rows, cols);
45 - signal(SIGWINCH, term_size);
46 - signal(SIGINT, sigint_handler);
51 + resizeterm(rows, cols);
52 + signal(SIGWINCH, term_size);
53 + signal(SIGINT, sigint_handler);
61 struct slab_info *curr;
62 @@ -341,12 +363,12 @@ int main(int argc, char *argv[])
65 if (old_rows != rows) {
66 - resizeterm(rows, cols);
67 + if(!once) resizeterm(rows, cols);
72 - printw( " Active / Total Objects (%% used) : %d / %d (%.1f%%)\n"
73 + printwf(once, " Active / Total Objects (%% used) : %d / %d (%.1f%%)\n"
74 " Active / Total Slabs (%% used) : %d / %d (%.1f%%)\n"
75 " Active / Total Caches (%% used) : %d / %d (%.1f%%)\n"
76 " Active / Total Size (%% used) : %.2fK / %.2fK (%.1f%%)\n"
77 @@ -360,15 +382,15 @@ int main(int argc, char *argv[])
79 slab_list = slabsort(slab_list);
82 - printw( "%6s %6s %4s %8s %6s %8s %10s %-23s\n",
83 + if(!once) attron(A_REVERSE);
84 + printwf(once, "%6s %6s %4s %8s %6s %8s %10s %-23s\n",
85 "OBJS", "ACTIVE", "USE", "OBJ SIZE", "SLABS",
86 "OBJ/SLAB", "CACHE SIZE", "NAME");
88 + if(!once) attroff(A_REVERSE);
91 for (i = 0; i < rows - 8 && curr->next; i++) {
92 - printw("%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n",
93 + printwf(once, "%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n",
94 curr->nr_objs, curr->nr_active_objs, curr->use,
95 curr->obj_size / 1024.0, curr->nr_slabs,
96 curr->objs_per_slab, (unsigned)(curr->cache_size / 1024),
97 @@ -376,7 +398,7 @@ int main(int argc, char *argv[])
102 + if(!once) refresh();
103 put_slabinfo(slab_list);
106 @@ -392,6 +414,6 @@ int main(int argc, char *argv[])
108 tcsetattr(0, TCSAFLUSH, &saved_tty);
109 free_slabinfo(slab_list);
111 + if(!once) endwin();