procps: removed; superseded by procps-ng.

This commit is contained in:
Juan RP 2013-02-20 08:18:53 +01:00
parent d91bd80fd4
commit bbe58302b6
19 changed files with 0 additions and 961 deletions

View File

@ -1,129 +0,0 @@
--- a/proc/module.mk.orig 2010-04-22 13:22:25.736775611 +0200
+++ b/proc/module.mk 2010-04-22 13:24:09.814780650 +0200
@@ -42,7 +42,7 @@ FPIC := -fpic
ifeq ($(SHARED),1)
ALL += proc/$(SONAME)
-INSTALL += ldconfig
+INSTALL += ldconfig
LIBFLAGS := -DSHARED=1 $(FPIC)
# This is in gcc 3.5, but exported functions must be marked.
#LIBFLAGS += $(call check_gcc,-fvisibility=hidden,)
@@ -96,7 +96,7 @@ endif
#################### install rules ###########################
$(lib)$(SOFILE) : proc/$(SONAME)
- $(install) --mode a=rx $< $@
+ $(install) -m755 $< $@
ifneq ($(SOLINK),$(SOFILE))
.PHONY: $(lib)$(SOLINK)
@@ -115,7 +115,7 @@ ldconfig : $(lib)$(SONAME) $(lib)$(SOLIN
$(ldconfig)
$(usr/lib)$(ANAME) : proc/$(ANAME)
- $(install) --mode a=r $< $@
+ $(install) -m644 $< $@
# Junk anyway... supposed to go in /usr/include/$(NAME)
#INSTALL += $(addprefix $(include),$(HDRFILES))
--- a/ps/module.mk.orig 2010-04-22 13:26:49.156775917 +0200
+++ b/ps/module.mk 2010-04-22 13:27:05.019792210 +0200
@@ -33,8 +33,8 @@ ps/stacktrace.o: ps/stacktrace.c
$(bin)ps: ps/ps
- $(install) --mode a=rx $< $@
+ $(install) -m755 $< $@
$(man1)ps.1 : ps/ps.1
- $(install) --mode a=r $< $@
+ $(install) -m644 $< $@
-rm -f $(DESTDIR)/var/catman/cat1/ps.1.gz $(DESTDIR)/var/man/cat1/ps.1.gz
--- a/Makefile.orig 2009-05-10 20:50:48.000000000 +0200
+++ b/Makefile 2013-02-11 13:52:37.814939368 +0100
@@ -24,35 +24,35 @@ TARVERSION := $(VERSION).$(SUBVERSION)
############ vars
# so you can disable them or choose alternates
-ldconfig := ldconfig
+ldconfig :=
ln_f := ln -f
ln_sf := ln -sf
-install := install -D --owner 0 --group 0
+install := install -D
# Lame x86-64 /lib64 and /usr/lib64 abomination:
lib64 := lib$(shell [ -d /lib64 ] && echo 64)
usr/bin := $(DESTDIR)/usr/bin/
-bin := $(DESTDIR)/bin/
-sbin := $(DESTDIR)/sbin/
+bin := $(DESTDIR)/usr/bin/
+sbin := $(DESTDIR)/usr/sbin/
usr/proc/bin := $(DESTDIR)/usr/bin/
man1 := $(DESTDIR)/usr/share/man/man1/
man5 := $(DESTDIR)/usr/share/man/man5/
man8 := $(DESTDIR)/usr/share/man/man8/
-lib := $(DESTDIR)/$(lib64)/
-usr/lib := $(DESTDIR)/usr/$(lib64)/
+lib := $(DESTDIR)/usr/lib/
+usr/lib := $(DESTDIR)/usr/lib/
usr/include := $(DESTDIR)/usr/include/
#SKIP := $(bin)kill $(man1)kill.1
-BINFILES := $(usr/bin)uptime $(usr/bin)tload $(usr/bin)free $(usr/bin)w \
+BINFILES := $(usr/bin)tload $(usr/bin)free $(usr/bin)w \
$(usr/bin)top $(usr/bin)vmstat $(usr/bin)watch $(usr/bin)skill \
- $(usr/bin)snice $(bin)kill $(sbin)sysctl $(usr/bin)pmap \
+ $(usr/bin)snice $(sbin)sysctl $(usr/bin)pmap \
$(usr/proc/bin)pgrep $(usr/proc/bin)pkill $(usr/bin)slabtop \
$(usr/proc/bin)pwdx
-MANFILES := $(man1)uptime.1 $(man1)tload.1 $(man1)free.1 $(man1)w.1 \
- $(man1)top.1 $(man1)watch.1 $(man1)skill.1 $(man1)kill.1 \
+MANFILES := $(man1)tload.1 $(man1)free.1 $(man1)w.1 \
+ $(man1)top.1 $(man1)watch.1 $(man1)skill.1 \
$(man1)snice.1 $(man1)pgrep.1 $(man1)pkill.1 $(man1)pmap.1 \
$(man5)sysctl.conf.5 $(man8)vmstat.8 $(man8)sysctl.8 \
$(man1)slabtop.1 $(man1)pwdx.1
@@ -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)
@@ -222,14 +223,14 @@ clean:
###### install
$(BINFILES) : all
- $(install) --mode a=rx $(notdir $@) $@
+ $(install) -m755 $(notdir $@) $@
$(MANFILES) : all
- $(install) --mode a=r $(notdir $@) $@
+ $(install) -m644 $(notdir $@) $@
install: $(filter-out $(SKIP) $(addprefix $(DESTDIR),$(SKIP)),$(INSTALL))
- cd $(usr/bin) && $(ln_f) skill snice
- cd $(usr/proc/bin) && $(ln_f) pgrep pkill
+ cd $(usr/bin) && $(ln_sf) skill snice
+ cd $(usr/proc/bin) && $(ln_sf) pgrep pkill
############ prog.c --> prog.o
@@ -255,7 +256,7 @@ watch: % : %.o
############ progX --> progY
snice kill: skill
- $(ln_f) skill $@
+ $(ln_sf) skill $@
pkill: pgrep
- $(ln_f) pgrep pkill
+ $(ln_sf) pgrep pkill

View File

@ -1,39 +0,0 @@
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.

View File

@ -1,23 +0,0 @@
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"

View File

@ -1,22 +0,0 @@
--- 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 */

View File

@ -1,12 +0,0 @@
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)

View File

@ -1,22 +0,0 @@
--- 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)

View File

@ -1,113 +0,0 @@
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;
}

View File

@ -1,19 +0,0 @@
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 #################################*/

View File

@ -1,20 +0,0 @@
--- 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

View File

@ -1,84 +0,0 @@
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@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

View File

@ -1,32 +0,0 @@
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

View File

@ -1,98 +0,0 @@
--- 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;
}

View File

@ -1,37 +0,0 @@
--- procps-3.2.7/top.c.sorthigh 2007-02-05 09:06:34.000000000 +0100
+++ procps-3.2.7/top.c 2007-02-05 09:09:35.000000000 +0100
@@ -3121,6 +3121,7 @@
unsigned w = Fieldstab[i].width;
int advance = (x==0) && !Rc.mode_altscr;
+ f += advance;
switch (i) {
case P_CMD:
@@ -3179,7 +3180,7 @@
break;
case P_PRI:
if (unlikely(-99 > p->priority) || unlikely(999 < p->priority)) {
- f = " RT";
+ f = advance ? " RT" : " RT";
MKCOL("");
} else
MKCOL((int)p->priority);
@@ -3227,7 +3228,7 @@
break;
case P_WCH:
if (No_ksyms) {
- f = " %08lx ";
+ f = advance ? "%08lx " : " %08lx ";
MKCOL((long)p->wchan);
} else {
MKCOL(lookup_wchan(p->wchan, p->XXXID));
@@ -3236,7 +3237,7 @@
} /* end: switch 'procflag' */
- rp = scat(rp, cbuf+advance);
+ rp = scat(rp, cbuf);
} /* end: for 'maxpflgs' */
PUFF(

View File

@ -1,16 +0,0 @@
--- 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;

View File

@ -1,139 +0,0 @@
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;
}

View File

@ -1,23 +0,0 @@
https://bugs.gentoo.org/303120
make sure the linux version constructor runs before the libproc constructor
since the latter uses variables setup by the former
fix by Chris Coleman
Index: proc/version.c
===================================================================
RCS file: /cvsroot/procps/procps/proc/version.c,v
retrieving revision 1.7
diff -u -p -r1.7 version.c
--- procps-old/proc/version.c 9 Feb 2003 07:27:16 -0000 1.7
+++ procps/proc/version.c 14 Nov 2010 00:22:44 -0000
@@ -33,7 +33,7 @@ void display_version(void) {
int linux_version_code;
-static void init_Linux_version(void) __attribute__((constructor));
+static void init_Linux_version(void) __attribute__((constructor(100)));
static void init_Linux_version(void) {
static struct utsname uts;
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */

View File

@ -1,66 +0,0 @@
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);

View File

@ -1,49 +0,0 @@
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
}
}

View File

@ -1,18 +0,0 @@
# Template file for 'procps'
pkgname=procps
version=3.2.8
revision=9
patch_args="-Np1"
build_style=gnu-makefile
makedepends="ncurses-devel"
crossmakedepends="${makedepends}"
short_desc="The /proc file system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-2, LGPL-2.1"
homepage="http://procps.sourceforge.net"
distfiles="http://procps.sf.net/$pkgname-$version.tar.gz"
checksum=11ed68d8a4433b91cd833deb714a3aa849c02aea738c42e6b4557982419c1535
post_install() {
ln -sfr ${DESTDIR}/usr/bin/pgrep ${DESTDIR}/usr/bin/pidof
}