create core package
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed under the GNU General Public License, version 3.
|
||||
# See the file http://www.gnu.org/licenses/gpl.txt
|
||||
|
||||
from pisi.actionsapi import autotools
|
||||
from pisi.actionsapi import pisitools
|
||||
from pisi.actionsapi import get
|
||||
|
||||
def build():
|
||||
autotools.make('CC=%s CPPFLAGS="%s" CFLAGS="%s" LDFLAGS="%s" lib64=lib' % \
|
||||
(get.CC(), get.CXXFLAGS(), get.CFLAGS(), get.LDFLAGS()))
|
||||
|
||||
def install():
|
||||
autotools.rawInstall('ln_f="ln -sf" ldconfig="true" lib64=lib DESTDIR=%s SKIP="/bin/kill /usr/share/man/man1/kill.1"' % get.installDIR())
|
||||
|
||||
pisitools.dosym("libproc-%s.so" % get.srcVERSION(), "/lib/libproc.so")
|
||||
|
||||
pisitools.dodoc("BUGS", "NEWS", "TODO", "ps/HACKING")
|
||||
@@ -0,0 +1,10 @@
|
||||
--- procps-3.2.7~/top.c 2006-06-25 08:41:48.000000000 +0200
|
||||
+++ procps-3.2.7/top.c 2007-07-20 12:50:00.000000000 +0200
|
||||
@@ -2886,6 +2886,7 @@
|
||||
s_frme = cpu->s - cpu->s_sav;
|
||||
n_frme = cpu->n - cpu->n_sav;
|
||||
i_frme = TRIMz(cpu->i - cpu->i_sav);
|
||||
+ if ((u_frme == 0) && (i_frme == 0)) i_frme = 100.0;
|
||||
w_frme = cpu->w - cpu->w_sav;
|
||||
x_frme = cpu->x - cpu->x_sav;
|
||||
y_frme = cpu->y - cpu->y_sav;
|
||||
@@ -0,0 +1,10 @@
|
||||
--- procps-3.2.5/top.h
|
||||
+++ procps-3.2.5/top.h
|
||||
@@ -132,6 +132,7 @@
|
||||
#define _PUFF(fmt,arg...) \
|
||||
do { \
|
||||
char _str[ROWBUFSIZ]; \
|
||||
+ if (Pseudo_row >= Screen_rows-1) break; \
|
||||
int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \
|
||||
putp ( Batch ? _str : \
|
||||
({ \
|
||||
@@ -0,0 +1,19 @@
|
||||
--- procps-3.2.5/w.c
|
||||
+++ procps-3.2.5/w.c
|
||||
@@ -285,10 +285,16 @@
|
||||
|
||||
if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_col > 0)
|
||||
maxcmd = win.ws_col;
|
||||
+#if 0
|
||||
+/* I have no idea why I shouldn't be allowed to see the result
|
||||
+ with a line wrap. The other solution would be to create a
|
||||
+ wcat alias, which does w|cat to work around this, but this
|
||||
+ would be stupid in my opinion. */
|
||||
if (maxcmd < 71) {
|
||||
fprintf(stderr, "%d column window is too narrow\n", maxcmd);
|
||||
exit(1);
|
||||
}
|
||||
+#endif
|
||||
maxcmd -= 29 + (from ? 16 : 0) + (longform ? 20 : 0);
|
||||
if (maxcmd < 3)
|
||||
fprintf(stderr, "warning: screen width %d suboptimal.\n", win.ws_col);
|
||||
@@ -0,0 +1,11 @@
|
||||
--- procps-3.2.5/top.c
|
||||
+++ procps-3.2.5/top.c
|
||||
@@ -3285,7 +3285,7 @@
|
||||
if (rc <= 0) {
|
||||
// EOF is pretty much a "can't happen" except for a kernel bug.
|
||||
// We should quickly die via SIGHUP, and thus not spin here.
|
||||
- // if (rc == 0) end_pgm(0); /* EOF from terminal */
|
||||
+ if (rc == 0) end_pgm(0); /* EOF from terminal */
|
||||
fcntl(STDIN_FILENO, F_SETFL, file_flags);
|
||||
select(1, &fs, NULL, NULL, &tv);
|
||||
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags);
|
||||
@@ -0,0 +1,6 @@
|
||||
--- a/proc/readproc.c
|
||||
+++ b/proc/readproc.c
|
||||
@@ -858,2 +858,2 @@
|
||||
if(file2str("/proc/self", "stat", sbuf, sizeof sbuf) == -1){
|
||||
- fprintf(stderr, "Error, do this: mount -t proc none /proc\n");
|
||||
+ fprintf(stderr, "Error, do this: mount -t proc proc /proc\n");
|
||||
@@ -0,0 +1,28 @@
|
||||
diff -up procps-3.2.7/proc/escape.c.p8 procps-3.2.7/proc/escape.c
|
||||
--- procps-3.2.7/proc/escape.c.p8 2005-01-05 21:50:26.000000000 +0100
|
||||
+++ procps-3.2.7/proc/escape.c 2008-09-01 11:31:15.000000000 +0200
|
||||
@@ -79,6 +79,7 @@ static int escape_str_utf8(char *restric
|
||||
// multibyte - printable
|
||||
// Got space?
|
||||
if (my_cells+wlen > *maxcells || my_bytes+1+len >= bufsize) break;
|
||||
+#ifdef OUTPUT_PARANOID
|
||||
// 0x9b is control byte for some terminals
|
||||
if (memchr(src, 0x9B, len)) {
|
||||
// unsafe multibyte
|
||||
@@ -87,13 +88,16 @@ static int escape_str_utf8(char *restric
|
||||
my_cells++;
|
||||
my_bytes++;
|
||||
} else {
|
||||
+#endif
|
||||
// safe multibyte
|
||||
memcpy(dst, src, len);
|
||||
my_cells += wlen;
|
||||
dst += len;
|
||||
my_bytes += len;
|
||||
src += len;
|
||||
+#ifdef OUTPUT_PARANOID
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
//fprintf(stdout, "cells: %d\n", my_cells);
|
||||
@@ -0,0 +1,49 @@
|
||||
diff -up procps-3.2.7/ps/parser.c.p3 procps-3.2.7/ps/parser.c
|
||||
--- procps-3.2.7/ps/parser.c.p3 2008-09-01 11:11:50.000000000 +0200
|
||||
+++ procps-3.2.7/ps/parser.c 2008-09-01 11:11:50.000000000 +0200
|
||||
@@ -1238,7 +1238,7 @@ try_bsd:
|
||||
// as SysV options... and you're screwed if you've been patching
|
||||
// out the friendly warning. Cut-over is likely to be in 2005.
|
||||
if(!(personality & PER_FORCE_BSD))
|
||||
- fprintf(stderr, "Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html\n");
|
||||
+ fprintf(stderr, "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-%s/FAQ\n",procps_number_version);
|
||||
// Remember: contact albert@users.sf.net or procps-feedback@lists.sf.net
|
||||
// if you should feel tempted. Be damn sure you understand all
|
||||
// the issues. The same goes for other stuff too, BTW. Please ask.
|
||||
diff -up procps-3.2.7/proc/version.h.p3 procps-3.2.7/proc/version.h
|
||||
--- procps-3.2.7/proc/version.h.p3 2002-12-15 01:08:32.000000000 +0100
|
||||
+++ procps-3.2.7/proc/version.h 2008-09-01 11:11:50.000000000 +0200
|
||||
@@ -16,6 +16,7 @@ EXTERN_C_BEGIN
|
||||
|
||||
extern void display_version(void); /* display suite version */
|
||||
extern const char procps_version[]; /* global buf for suite version */
|
||||
+extern const char procps_number_version[]; /* global buf for suite number version */
|
||||
|
||||
extern int linux_version_code; /* runtime version of LINUX_VERSION_CODE
|
||||
in /usr/include/linux/version.h */
|
||||
diff -up procps-3.2.7/proc/library.map.p3 procps-3.2.7/proc/library.map
|
||||
--- procps-3.2.7/proc/library.map.p3 2005-03-14 05:32:40.000000000 +0100
|
||||
+++ procps-3.2.7/proc/library.map 2008-09-01 11:11:50.000000000 +0200
|
||||
@@ -9,7 +9,7 @@ global:
|
||||
escape_str; escape_strlist;
|
||||
openproc; closeproc;
|
||||
tty_to_dev; dev_to_tty; open_psdb_message; open_psdb; lookup_wchan;
|
||||
- display_version; procps_version; linux_version_code;
|
||||
+ display_version; procps_version; procps_number_version; linux_version_code;
|
||||
Hertz; smp_num_cpus; have_privs;
|
||||
sprint_uptime; uptime; user_from_uid; print_uptime; loadavg;
|
||||
pretty_print_signals; print_given_signals; unix_print_signals; signal_name_to_number; signal_number_to_name;
|
||||
diff -up procps-3.2.7/proc/version.c.p3 procps-3.2.7/proc/version.c
|
||||
--- procps-3.2.7/proc/version.c.p3 2003-01-29 02:11:43.000000000 +0100
|
||||
+++ procps-3.2.7/proc/version.c 2008-09-01 11:11:50.000000000 +0200
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
#ifdef MINORVERSION
|
||||
const char procps_version[] = "procps version " VERSION "." SUBVERSION "." MINORVERSION;
|
||||
+const char procps_number_version[] = VERSION "." SUBVERSION "." MINORVERSION;
|
||||
#else
|
||||
const char procps_version[] = "procps version " VERSION "." SUBVERSION;
|
||||
+const char procps_number_version[] = VERSION "." SUBVERSION;
|
||||
#endif
|
||||
|
||||
void display_version(void) {
|
||||
@@ -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"
|
||||
@@ -0,0 +1,61 @@
|
||||
diff -up procps-3.2.7/ps/output.c.p12 procps-3.2.7/ps/output.c
|
||||
--- procps-3.2.7/ps/output.c.p12 2006-06-19 01:27:02.000000000 +0200
|
||||
+++ procps-3.2.7/ps/output.c 2008-09-01 11:35:06.000000000 +0200
|
||||
@@ -1090,7 +1090,7 @@ static int pr_sgi_p(char *restrict const
|
||||
return snprintf(outbuf, COLWID, "*");
|
||||
}
|
||||
|
||||
-
|
||||
+#ifdef STATICLIB
|
||||
/****************** FLASK & seLinux security stuff **********************/
|
||||
// move the bulk of this to libproc sometime
|
||||
|
||||
@@ -1122,7 +1122,7 @@ fail:
|
||||
return 1;
|
||||
}
|
||||
|
||||
-#if 0
|
||||
+#else
|
||||
// This needs more study, considering:
|
||||
// 1. the static linking option (maybe disable this in that case)
|
||||
// 2. the -z and -Z option issue
|
||||
@@ -1134,7 +1134,7 @@ static int pr_context(char *restrict con
|
||||
char *context;
|
||||
|
||||
if(!ps_getpidcon && !tried_load){
|
||||
- void *handle = dlopen("libselinux.so.1", RTLD_NOW);
|
||||
+ void *handle = dlopen("libselinux.so", RTLD_NOW);
|
||||
if(handle){
|
||||
dlerror();
|
||||
ps_getpidcon = dlsym(handle, "getpidcon");
|
||||
diff -up procps-3.2.7/Makefile.p12 procps-3.2.7/Makefile
|
||||
--- procps-3.2.7/Makefile.p12 2006-06-24 11:02:25.000000000 +0200
|
||||
+++ procps-3.2.7/Makefile 2008-09-01 11:35:06.000000000 +0200
|
||||
@@ -73,12 +73,12 @@ CURSES := -lncurses
|
||||
# Something like this is probably needed to make the SE Linux
|
||||
# library loading not conflict with embedded systems stuff.
|
||||
#
|
||||
-#ifeq ($(SHARED),1)
|
||||
-#ldl := -ldl
|
||||
-#LIBTYPE := -DSHAREDLIB
|
||||
-#else
|
||||
-#LIBTYPE := -DSTATICLIB
|
||||
-#endif
|
||||
+ifeq ($(SHARED),1)
|
||||
+ldl := -ldl
|
||||
+LIBTYPE := -DSHAREDLIB
|
||||
+else
|
||||
+LIBTYPE := -DSTATICLIB
|
||||
+endif
|
||||
|
||||
# Preprocessor flags.
|
||||
PKG_CPPFLAGS := -D_GNU_SOURCE -I proc
|
||||
@@ -103,7 +103,7 @@ PKG_CFLAGS := -fno-common -ffast-math
|
||||
# Note that some stuff below is conditional on CFLAGS containing
|
||||
# an option that starts with "-g". (-g, -g2, -g3, -ggdb, etc.)
|
||||
CFLAGS := -O2 -s
|
||||
-ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS)
|
||||
+ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) $(LIBTYPE)
|
||||
|
||||
PKG_LDFLAGS := -Wl,-warn-common
|
||||
LDFLAGS :=
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,36 @@
|
||||
diff -up procps-3.2.7/watch.c.p2 procps-3.2.7/watch.c
|
||||
--- procps-3.2.7/watch.c.p2 2006-06-17 11:18:38.000000000 +0200
|
||||
+++ procps-3.2.7/watch.c 2008-09-01 10:46:17.000000000 +0200
|
||||
@@ -25,6 +25,9 @@
|
||||
#include <termios.h>
|
||||
#include <locale.h>
|
||||
#include "proc/procps.h"
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#ifdef FORCE_8BIT
|
||||
#undef isprint
|
||||
@@ -138,6 +141,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int optc;
|
||||
+ int fd;
|
||||
int option_differences = 0,
|
||||
option_differences_cumulative = 0,
|
||||
option_help = 0, option_version = 0;
|
||||
@@ -260,7 +264,13 @@ main(int argc, char *argv[])
|
||||
mvaddstr(0, width - tsl + 1, ts);
|
||||
free(header);
|
||||
}
|
||||
-
|
||||
+ close(0);
|
||||
+ fd=open("/dev/null",O_RDWR);
|
||||
+ if (fd!=0) {
|
||||
+ perror("open");
|
||||
+ do_exit(2);
|
||||
+ }
|
||||
+
|
||||
if (!(p = popen(command, "r"))) {
|
||||
perror("popen");
|
||||
do_exit(2);
|
||||
@@ -0,0 +1,19 @@
|
||||
diff -up procps-3.2.7/top.c.p6 procps-3.2.7/top.c
|
||||
--- procps-3.2.7/top.c.p6 2006-06-25 08:41:48.000000000 +0200
|
||||
+++ procps-3.2.7/top.c 2008-09-01 11:28:15.000000000 +0200
|
||||
@@ -3331,12 +3331,15 @@ static void frame_make (void)
|
||||
|
||||
int main (int dont_care_argc, char *argv[])
|
||||
{
|
||||
+ struct stat isproc;
|
||||
(void)dont_care_argc;
|
||||
before(*argv);
|
||||
// +-------------+
|
||||
windows_stage1(); // top (sic) slice
|
||||
configs_read(); // > spread etc, <
|
||||
parse_args(&argv[1]); // > lean stuff, <
|
||||
+ if (stat("/proc/self", &isproc)==-1)
|
||||
+ std_err("/proc is not mounted, required for output data");
|
||||
whack_terminal(); // > onions etc. <
|
||||
windows_stage2(); // as bottom slice
|
||||
// +-------------+
|
||||
@@ -0,0 +1,67 @@
|
||||
diff -up procps-3.2.7/ps/output.c.pom procps-3.2.7/ps/output.c
|
||||
--- procps-3.2.7/ps/output.c.pom 2009-02-15 13:16:27.000000000 +0100
|
||||
+++ procps-3.2.7/ps/output.c 2009-02-15 14:02:34.000000000 +0100
|
||||
@@ -1097,6 +1097,40 @@ static int pr_sgi_p(char *restrict const
|
||||
return snprintf(outbuf, COLWID, "*");
|
||||
}
|
||||
|
||||
+static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
+ char filename[48];
|
||||
+ FILE *fd;
|
||||
+ int counter = 0;
|
||||
+ int c;
|
||||
+ int is_cgroup = 0;
|
||||
+
|
||||
+ outbuf[0]='\0';
|
||||
+ snprintf(filename, sizeof filename, "/proc/%d/cgroup", pp->tgid);
|
||||
+ fd = fopen(filename, "r");
|
||||
+ if (likely(fd == NULL)) goto fail;
|
||||
+ while (( (c = fgetc(fd)) != EOF) && (counter<665)) {
|
||||
+ if (is_cgroup == 0) {
|
||||
+ if (c == ':') {
|
||||
+ is_cgroup = 1;
|
||||
+ if (counter>0)
|
||||
+ outbuf[counter++]=';';
|
||||
+ }
|
||||
+ }else
|
||||
+ if ((c == '\n') || (c == '\0'))
|
||||
+ is_cgroup = 0;
|
||||
+ else
|
||||
+ outbuf[counter++]=c;
|
||||
+ }
|
||||
+ outbuf[counter]='\0';
|
||||
+ close(fd);
|
||||
+ if (counter>0)
|
||||
+ return counter;
|
||||
+fail:
|
||||
+ outbuf[0] = '-';
|
||||
+ outbuf[1] = '\0';
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
#ifdef STATICLIB
|
||||
/****************** FLASK & seLinux security stuff **********************/
|
||||
// move the bulk of this to libproc sometime
|
||||
@@ -1291,6 +1325,7 @@ static const format_struct format_array[
|
||||
{"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, ET|RIGHT},
|
||||
{"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT},
|
||||
{"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/
|
||||
+{"cgroup", "CGROUP", pr_cgroup, sr_nop, 35, 0, LNX, PO|LEFT}, /* cgroups*/
|
||||
{"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT},
|
||||
{"cls", "CLS", pr_class, sr_sched, 3, 0, HPU, TO|RIGHT}, /*says HPUX or RT*/
|
||||
{"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT},
|
||||
diff -up procps-3.2.7/ps/ps.1.pom procps-3.2.7/ps/ps.1
|
||||
--- procps-3.2.7/ps/ps.1.pom 2009-02-15 13:16:27.000000000 +0100
|
||||
+++ procps-3.2.7/ps/ps.1 2009-02-15 14:00:33.000000000 +0100
|
||||
@@ -908,6 +908,10 @@ width of the field, a 32 or 64 bits mask
|
||||
displayed. (alias\ \fBsig_catch\fR,\ \fBsigcatch\fR).
|
||||
T}
|
||||
|
||||
+cgroup CGROUP T{
|
||||
+display control groups to which the process belonges.
|
||||
+t}
|
||||
+
|
||||
class CLS T{
|
||||
scheduling class of the process. (alias\ \fBpolicy\fR,\ \fBcls\fR).
|
||||
Field's possible values are:
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
--- procps-3.2.7/ps/ps.1.eip64 2007-06-14 11:08:35.000000000 +0200
|
||||
+++ procps-3.2.7/ps/ps.1 2007-06-14 11:03:28.000000000 +0200
|
||||
@@ -1156,6 +1156,14 @@
|
||||
or\ a\ decimal representation otherwise.
|
||||
T}
|
||||
|
||||
+rip RIP T{
|
||||
+64-bit instruction pointer.
|
||||
+T}
|
||||
+
|
||||
+rsp RSP T{
|
||||
+64-bit stack pointer.
|
||||
+T}
|
||||
+
|
||||
rss RSS T{
|
||||
resident set size, the non\-swapped physical memory that
|
||||
a task has used (in\ kiloBytes).
|
||||
--- procps-3.2.7/ps/output.c.eip64 2007-06-14 11:08:24.000000000 +0200
|
||||
+++ procps-3.2.7/ps/output.c 2007-06-14 10:58:21.000000000 +0200
|
||||
@@ -764,10 +764,18 @@
|
||||
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_esp));
|
||||
}
|
||||
|
||||
+static int pr_rsp(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
+ return snprintf(outbuf, COLWID, "%016lx", (unsigned long)(pp->kstk_esp));
|
||||
+}
|
||||
+
|
||||
static int pr_eip(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_eip));
|
||||
}
|
||||
|
||||
+static int pr_rip(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
+ return snprintf(outbuf, COLWID, "%016lx", (unsigned long)(pp->kstk_eip));
|
||||
+}
|
||||
+
|
||||
/* This function helps print old-style time formats */
|
||||
static int old_time_helper(char *dst, unsigned long long t, unsigned long long rel) {
|
||||
if(!t) return snprintf(dst, COLWID, " -");
|
||||
@@ -1403,7 +1411,9 @@
|
||||
{"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, PO|RIGHT},
|
||||
{"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, ET|RIGHT},
|
||||
{"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, ET|USER}, /* was 8 wide */
|
||||
+{"rip", "RIP", pr_rip, sr_kstk_eip, 16, 0, LNX, TO|RIGHT},
|
||||
{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
|
||||
+{"rsp", "RSP", pr_rsp, sr_kstk_eip, 16, 0, LNX, TO|RIGHT},
|
||||
{"rss", "RSS", pr_rss, sr_rss, 5, 0, XXX, PO|RIGHT}, /* was 5 wide */
|
||||
{"rssize", "RSS", pr_rss, sr_vm_rss, 5, 0, DEC, PO|RIGHT}, /*rsz*/
|
||||
{"rsz", "RSZ", pr_rss, sr_vm_rss, 5, 0, BSD, PO|RIGHT}, /*rssize*/
|
||||
@@ -0,0 +1,11 @@
|
||||
--- procps-3.2.7/ps/output.c.libselinux 2007-08-27 08:34:13.000000000 +0200
|
||||
+++ procps-3.2.7/ps/output.c 2007-08-27 08:34:30.000000000 +0200
|
||||
@@ -1141,7 +1141,7 @@
|
||||
char *context;
|
||||
|
||||
if(!ps_getpidcon && !tried_load){
|
||||
- void *handle = dlopen("libselinux.so", RTLD_NOW);
|
||||
+ void *handle = dlopen("libselinux.so.1", RTLD_NOW);
|
||||
if(handle){
|
||||
dlerror();
|
||||
ps_getpidcon = dlsym(handle, "getpidcon");
|
||||
@@ -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)
|
||||
@@ -0,0 +1,71 @@
|
||||
--- procps-3.2.7/ps/output.c.jitter 2007-04-26 13:15:47.000000000 +0200
|
||||
+++ procps-3.2.7/ps/output.c 2007-04-26 13:31:24.000000000 +0200
|
||||
@@ -77,7 +77,6 @@
|
||||
static int wide_signals; /* true if we have room */
|
||||
|
||||
static unsigned long seconds_since_1970;
|
||||
-static unsigned long time_of_boot;
|
||||
static unsigned long page_shift;
|
||||
|
||||
|
||||
@@ -1952,7 +1951,6 @@
|
||||
// available space: page_size*outbuf_pages-SPACE_AMOUNT
|
||||
|
||||
seconds_since_1970 = time(NULL);
|
||||
- time_of_boot = seconds_since_1970 - seconds_since_boot;
|
||||
|
||||
meminfo();
|
||||
|
||||
--- procps-3.2.7/ps/common.h.jitter 2005-01-27 04:43:22.000000000 +0100
|
||||
+++ procps-3.2.7/ps/common.h 2007-04-26 12:44:01.000000000 +0200
|
||||
@@ -302,6 +302,7 @@
|
||||
extern int screen_cols;
|
||||
extern int screen_rows;
|
||||
extern unsigned long seconds_since_boot;
|
||||
+extern unsigned long time_of_boot;
|
||||
extern selection_node *selection_list;
|
||||
extern unsigned simple_select;
|
||||
extern sort_node *sort_list;
|
||||
--- procps-3.2.7/ps/global.c.jitter 2005-10-30 01:43:34.000000000 +0200
|
||||
+++ procps-3.2.7/ps/global.c 2007-04-26 13:26:38.000000000 +0200
|
||||
@@ -70,6 +70,7 @@
|
||||
int screen_cols = -1;
|
||||
int screen_rows = -1;
|
||||
unsigned long seconds_since_boot = -1;
|
||||
+unsigned long time_of_boot = -1;
|
||||
selection_node *selection_list = (selection_node *)0xdeadbeef;
|
||||
unsigned simple_select = 0xffffffff;
|
||||
sort_node *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */
|
||||
@@ -361,7 +362,23 @@
|
||||
look_up_our_self(&p);
|
||||
set_screen_size();
|
||||
set_personality();
|
||||
-
|
||||
+ int fd;
|
||||
+ char *buf[BUFFSIZE];
|
||||
+ const char *b;
|
||||
+
|
||||
+ /* get boot time from /proc/stat */
|
||||
+ fd = open("/proc/stat", O_RDONLY, 0);
|
||||
+ if (fd != -1) {
|
||||
+ buf[BUFFSIZE-1] = 0;
|
||||
+ read(fd, buf, BUFFSIZE-1);
|
||||
+ b = strstr(buf, "btime ");
|
||||
+ if (b) {
|
||||
+ sscanf(b, "btime %lu", &time_of_boot);
|
||||
+ seconds_since_boot = time(0) - time_of_boot;
|
||||
+ }
|
||||
+ close(fd);
|
||||
+ }
|
||||
+
|
||||
all_processes = 0;
|
||||
bsd_c_option = 0;
|
||||
bsd_e_option = 0;
|
||||
@@ -380,7 +397,6 @@
|
||||
negate_selection = 0;
|
||||
page_size = getpagesize();
|
||||
running_only = 0;
|
||||
- seconds_since_boot = uptime(0,0);
|
||||
selection_list = NULL;
|
||||
simple_select = 0;
|
||||
sort_list = NULL;
|
||||
@@ -0,0 +1,19 @@
|
||||
diff -up procps-3.2.7/top.h.p7 procps-3.2.7/top.h
|
||||
--- procps-3.2.7/top.h.p7 2006-06-25 08:41:48.000000000 +0200
|
||||
+++ procps-3.2.7/top.h 2008-09-01 11:29:15.000000000 +0200
|
||||
@@ -149,8 +149,13 @@ do {
|
||||
int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \
|
||||
if (Batch) _ptr = _str; \
|
||||
else { \
|
||||
- _ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \
|
||||
- if (memcmp(_ptr, _str, _len)) { \
|
||||
+ int _rest; \
|
||||
+ _ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \
|
||||
+ _rest = Pseudo_size-(_ptr-Pseudo_scrn); \
|
||||
+ Pseudo_row = (Pseudo_row+1) % Screen_rows; \
|
||||
+ if (_rest < _len) \
|
||||
+ _len = _rest; \
|
||||
+ if (memcmp(_ptr, _str, _len)) { \
|
||||
memcpy(_ptr, _str, _len); \
|
||||
} else { \
|
||||
_ptr = "\n"; \
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
--- procps-3.2.7/sysctl.c.kzak 2007-04-03 01:26:01.000000000 +0200
|
||||
+++ procps-3.2.7/sysctl.c 2007-04-03 01:26:13.000000000 +0200
|
||||
@@ -63,6 +63,44 @@
|
||||
static const char ERR_PRELOAD_FILE[] = "error: unable to open preload file \"%s\"\n";
|
||||
static const char WARN_BAD_LINE[] = "warning: %s(%d): invalid syntax, continuing...\n";
|
||||
|
||||
+/* Ignore deprecated sysctls
|
||||
+ * -- we use this list when we scan (DisplayAll) /proc/sys only. We don't use it
|
||||
+ * in case when user direcly uses deprecated key. It's better when user can read
|
||||
+ * an error message from kernel.
|
||||
+ */
|
||||
+struct sysctl_ignore {
|
||||
+ const char *prefix;
|
||||
+ int prefix_len;
|
||||
+ const char *option;
|
||||
+ int option_len;
|
||||
+};
|
||||
+
|
||||
+#define IGNORE_ENTRY(prefix, option) \
|
||||
+ { prefix, sizeof(prefix)-1, option, sizeof(option)-1 }
|
||||
+
|
||||
+static struct sysctl_ignore Ignore[] =
|
||||
+{
|
||||
+ IGNORE_ENTRY( "net.ipv6.neigh", "base_reachable_time" ),
|
||||
+ IGNORE_ENTRY( "net.ipv6.neigh", "retrans_time" )
|
||||
+};
|
||||
+
|
||||
+static bool IsIgnored(const char *name)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ int sz = strlen(name);
|
||||
+
|
||||
+ for (i = 0; i < sizeof(Ignore)/sizeof(struct sysctl_ignore); i++) {
|
||||
+ struct sysctl_ignore *p = &Ignore[i];
|
||||
+
|
||||
+ if (sz < (p->prefix_len + p->option_len))
|
||||
+ continue;
|
||||
+
|
||||
+ if (strncmp(name, p->prefix, p->prefix_len) == 0 &&
|
||||
+ strcmp(name + (sz - p->option_len), p->option) == 0)
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
|
||||
static void slashdot(char *restrict p, char old, char new){
|
||||
p = strpbrk(p,"/.");
|
||||
@@ -122,7 +160,7 @@
|
||||
* Read a sysctl setting
|
||||
*
|
||||
*/
|
||||
-static int ReadSetting(const char *restrict const name) {
|
||||
+static int ReadSetting(const char *restrict const name, bool useign) {
|
||||
int rc = 0;
|
||||
char *restrict tmpname;
|
||||
char *restrict outname;
|
||||
@@ -145,6 +183,12 @@
|
||||
outname = strdup(name);
|
||||
slashdot(outname,'/','.'); /* change / to . */
|
||||
|
||||
+ if (useign && IsIgnored(outname)) {
|
||||
+ free(outname);
|
||||
+ free(tmpname);
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
if (stat(tmpname, &st)==0) {
|
||||
if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP))
|
||||
fp = fopen(tmpname, "r");
|
||||
@@ -257,7 +301,7 @@
|
||||
strcat(tmpdir, "/");
|
||||
DisplayAll(tmpdir);
|
||||
} else {
|
||||
- rc |= ReadSetting(tmpdir+strlen(PROC_PATH));
|
||||
+ rc |= ReadSetting(tmpdir+strlen(PROC_PATH), true);
|
||||
}
|
||||
}
|
||||
free(tmpdir);
|
||||
@@ -519,7 +563,7 @@
|
||||
if (WriteMode || index(*argv, '='))
|
||||
ReturnCode = WriteSetting(*argv);
|
||||
else
|
||||
- ReturnCode = ReadSetting(*argv);
|
||||
+ ReturnCode = ReadSetting(*argv, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
diff -up procps-3.2.7/sysctl.c.p9 procps-3.2.7/sysctl.c
|
||||
--- procps-3.2.7/sysctl.c.p9 2006-06-25 02:51:51.000000000 +0200
|
||||
+++ procps-3.2.7/sysctl.c 2008-09-01 11:31:58.000000000 +0200
|
||||
@@ -127,7 +127,8 @@ static int ReadSetting(const char *restr
|
||||
char *restrict tmpname;
|
||||
char *restrict outname;
|
||||
char inbuf[1025];
|
||||
- FILE *restrict fp;
|
||||
+ FILE *restrict fp = NULL;
|
||||
+ struct stat st;
|
||||
|
||||
if (!name || !*name) {
|
||||
fprintf(stderr, ERR_INVALID_KEY, name);
|
||||
@@ -144,7 +145,13 @@ static int ReadSetting(const char *restr
|
||||
outname = strdup(name);
|
||||
slashdot(outname,'/','.'); /* change / to . */
|
||||
|
||||
- fp = fopen(tmpname, "r");
|
||||
+ if (stat(tmpname, &st)==0) {
|
||||
+ if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP))
|
||||
+ fp = fopen(tmpname, "r");
|
||||
+ else
|
||||
+ /* ignore write-only files */
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
if (!fp) {
|
||||
switch(errno) {
|
||||
@@ -158,12 +165,16 @@ static int ReadSetting(const char *restr
|
||||
fprintf(stderr, ERR_PERMISSION_DENIED, outname);
|
||||
rc = -1;
|
||||
break;
|
||||
+ case EINVAL: /* fopen()/stat() invalid argument */
|
||||
+ case ENOTTY: /* inappropriate ioctl for device */
|
||||
+ break;
|
||||
default:
|
||||
fprintf(stderr, ERR_UNKNOWN_READING, strerror(errno), outname);
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
+ errno=0;
|
||||
if(fgets(inbuf, sizeof inbuf - 1, fp)) {
|
||||
// this loop is required, see
|
||||
// /sbin/sysctl -a | egrep -6 dev.cdrom.info
|
||||
@@ -183,7 +194,9 @@ static int ReadSetting(const char *restr
|
||||
}
|
||||
}
|
||||
} while(fgets(inbuf, sizeof inbuf - 1, fp));
|
||||
- } else {
|
||||
+
|
||||
+ /* fgets() returns NULL and errno without change if the file is empty */
|
||||
+ } else if (errno) {
|
||||
switch(errno) {
|
||||
case EACCES:
|
||||
fprintf(stderr, ERR_PERMISSION_DENIED, outname);
|
||||
@@ -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 #################################*/
|
||||
@@ -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
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up procps-3.2.7/top.c.cpuint procps-3.2.7/top.c
|
||||
--- procps-3.2.7/top.c.cpuint 2008-01-11 08:32:44.000000000 +0100
|
||||
+++ procps-3.2.7/top.c 2008-01-11 08:32:52.000000000 +0100
|
||||
@@ -1824,7 +1824,7 @@ static void configs_read (void)
|
||||
if(Rc.mode_irixps && smp_num_cpus>1){
|
||||
// good for 100 CPUs per process
|
||||
pcpu_max_value = 9999.0;
|
||||
- Fieldstab[P_CPU].fmts = " %4.0f";
|
||||
+ Fieldstab[P_CPU].fmts = " %4.1f";
|
||||
}
|
||||
|
||||
// lastly, establish the true runtime secure mode and delay time
|
||||
@@ -0,0 +1,83 @@
|
||||
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
|
||||
Secure_mode = 0; // set if some functionality restricted
|
||||
|
||||
static int VIRT_vmsize = 0; //use vm_size for VIRT
|
||||
+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,8 @@ static void before (char *me)
|
||||
|
||||
if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 ))
|
||||
VIRT_vmsize = 1;
|
||||
+ 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
|
||||
@@ -0,0 +1,55 @@
|
||||
diff -up procps-3.2.7/top.c.p14 procps-3.2.7/top.c
|
||||
--- procps-3.2.7/top.c.p14 2008-09-01 11:36:55.000000000 +0200
|
||||
+++ procps-3.2.7/top.c 2008-09-01 11:36:55.000000000 +0200
|
||||
@@ -120,6 +120,8 @@ static int No_ksyms = -1, // set t
|
||||
Loops = -1, // number of iterations, -1 loops forever
|
||||
Secure_mode = 0; // set if some functionality restricted
|
||||
|
||||
+static int VIRT_vmsize = 0; //use vm_size for VIRT
|
||||
+
|
||||
/* Some cap's stuff to reduce runtime calls --
|
||||
to accomodate 'Batch' mode, they begin life as empty strings */
|
||||
static char Cap_clr_eol [CAPBUFSIZ],
|
||||
@@ -1674,6 +1676,9 @@ static void before (char *me)
|
||||
Fieldstab[P_PPD].fmts = pid_fmt;
|
||||
Fieldstab[P_PPD].head = " PPID" + 10 - pid_digits;
|
||||
}
|
||||
+
|
||||
+ if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 ))
|
||||
+ VIRT_vmsize = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2207,6 +2212,7 @@ static void reframewins (void)
|
||||
}
|
||||
if (!Frames_libflags) Frames_libflags = L_DEFAULT;
|
||||
if (selection_type=='p') Frames_libflags |= PROC_PID;
|
||||
+ if (VIRT_vmsize) Frames_libflags |= L_status;
|
||||
}
|
||||
|
||||
|
||||
@@ -3186,7 +3192,10 @@ static void task_show (const WIN_t *q, c
|
||||
MKCOL(p->ruser);
|
||||
break;
|
||||
case P_VRT:
|
||||
- MKCOL(scale_num(PAGES_TO_KB(p->size), w, s));
|
||||
+ if (VIRT_vmsize)
|
||||
+ MKCOL(scale_num(PAGES_TO_KB(p->vm_size), w, s));
|
||||
+ else
|
||||
+ MKCOL(scale_num(PAGES_TO_KB(p->size), w, s));
|
||||
break;
|
||||
case P_WCH:
|
||||
if (No_ksyms) {
|
||||
diff -up procps-3.2.7/top.1.p14 procps-3.2.7/top.1
|
||||
--- procps-3.2.7/top.1.p14 2006-06-19 06:33:51.000000000 +0200
|
||||
+++ procps-3.2.7/top.1 2008-09-01 11:36:55.000000000 +0200
|
||||
@@ -401,7 +401,8 @@ A task's currently used share of availab
|
||||
o:\fB VIRT\fR \*(EM Virtual Image (kb)
|
||||
The total amount of \*(MV used by the task.
|
||||
It includes all code, data and shared libraries plus pages that have been
|
||||
-swapped out.
|
||||
+swapped out. (Note: you can define the STATSIZE=1 environment variable and the VIRT
|
||||
+will be calculated from the /proc/#/state VmSize field.)
|
||||
|
||||
VIRT = SWAP + RES.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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
|
||||
@@ -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
|
||||
@@ -0,0 +1,15 @@
|
||||
diff -up procps-3.2.7/top.c.p10 procps-3.2.7/top.c
|
||||
--- procps-3.2.7/top.c.p10 2008-09-01 11:33:06.000000000 +0200
|
||||
+++ procps-3.2.7/top.c 2008-09-01 11:33:06.000000000 +0200
|
||||
@@ -2462,7 +2462,10 @@ static void windows_stage2 (void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < GROUPSMAX; i++) {
|
||||
- win_names(&Winstk[i], Winstk[i].rc.winname);
|
||||
+ /* Please, never use something like sprintf(x, "%s", x); ... see win_names() */
|
||||
+ char buf[WINNAMSIZ];
|
||||
+ strncpy(buf, Winstk[i].rc.winname, WINNAMSIZ);
|
||||
+ win_names(&Winstk[i], buf);
|
||||
capsmk(&Winstk[i]);
|
||||
}
|
||||
// rely on this next guy to force a call (eventually) to reframewins
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
--- 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(
|
||||
@@ -0,0 +1,342 @@
|
||||
--- procps-3.2.7/top.1
|
||||
+++ procps-3.2.7/top.1 2006-06-26 16:34:01.000000000 +0200
|
||||
@@ -20,7 +20,7 @@
|
||||
..
|
||||
.\" Setup ////////////////////////////////////////////////////////////////
|
||||
\# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' !
|
||||
-.nr half_xtra 4
|
||||
+.nr half_xtra 0
|
||||
.
|
||||
.ll +(\n[half_xtra] + \n[half_xtra])
|
||||
.
|
||||
@@ -504,7 +504,7 @@ and 'Order fields' screens.
|
||||
.\" ......................................................................
|
||||
.SS 2b. SELECTING and ORDERING Columns
|
||||
.\" ----------------------------------------------------------------------
|
||||
-After pressing the \*(CIs 'f' (Fields select) or \'o' (Order fields) you will
|
||||
+After pressing the \*(CIs 'f' (Fields select) or 'o' (Order fields) you will
|
||||
be shown a screen containing the current \fBfields string\fR followed by names
|
||||
and descriptions for all fields.
|
||||
|
||||
@@ -580,7 +580,7 @@ Use either of these keys if you have a l
|
||||
see current status,
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fB?\fR\' or \'\fBh\fR\' :\fIHelp\fR
|
||||
+\ \ '\fB?\fR' or '\fBh\fR' :\fIHelp\fR
|
||||
There are two help levels available.
|
||||
The first will provide a reminder of all the basic \*(CIs.
|
||||
If \*(Me is\fI secured\fR, that screen will be abbreviated.
|
||||
@@ -589,7 +589,7 @@ Typing 'h' or '?' on that help screen wi
|
||||
applicable to \*(AM.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fB=\fR\' :\fIExit_Task_Limits\fR
|
||||
+\ \ '\fB=\fR' :\fIExit_Task_Limits\fR
|
||||
Removes restrictions on which tasks are shown.
|
||||
This command will reverse any 'i' (idle tasks) and 'n' (max tasks) commands
|
||||
that might be active.
|
||||
@@ -599,13 +599,13 @@ See the '-p' \*(CO for a discussion of P
|
||||
When operating in \*(AM this command has a slightly broader meaning.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR
|
||||
+\ \ '\fBA\fR' :\fIAlternate_Display_Mode_toggle\fR
|
||||
This command will switch between \*(FM and \*(AM.
|
||||
\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into
|
||||
\*(CWs and field groups.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBB\fR\' :\fIBold_Disable/Enable_toggle\fR
|
||||
+\ \ '\fBB\fR' :\fIBold_Disable/Enable_toggle\fR
|
||||
This command will influence use of the 'bold' terminfo capability and
|
||||
alters\fB both\fR the \*(SA and \*(TA for the \*(CW.
|
||||
While it is intended primarily for use with dumb terminals, it can be
|
||||
@@ -617,7 +617,7 @@ Thus, unless the 'x' and/or 'y' toggles
|
||||
there will be no visual confirmation that they are even on.
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fR
|
||||
+*\ '\fBd\fR' or '\fBs\fR' :\fIChange_Delay_Time_interval\fR
|
||||
You will be prompted to enter the delay time, in seconds, between
|
||||
display updates.
|
||||
|
||||
@@ -631,32 +631,32 @@ If at any time you wish to know the curr
|
||||
and view the system summary on the second line.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fR
|
||||
+\ \ '\fBG\fR' :\fIChoose_Another_Window/Field_Group\fR
|
||||
You will be prompted to enter a number between 1 and 4 designating the
|
||||
window/field group which should be made the \*(CW.
|
||||
You will soon grow comfortable with these 4 windows, especially after
|
||||
experimenting with \*(AM.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBI\fR\' :\fIIrix/Solaris_Mode_toggle\fR
|
||||
+\ \ '\fBI\fR' :\fIIrix/Solaris_Mode_toggle\fR
|
||||
When operating in 'Solaris mode' ('I' toggled \*F), a task's \*(Pu usage
|
||||
will be divided by the total number of \*(PUs.
|
||||
After issuing this command, you'll be informed of the new state of this toggle.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBu\fR\' :\fIselect a user\fR
|
||||
+\ \ '\fBu\fR' :\fIselect a user\fR
|
||||
You will be prompted for a UID or username. Only processes
|
||||
belonging to the selected user will be displayed. This option
|
||||
matches on the effective UID.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBU\fR\' :\fIselect a user\fR
|
||||
+\ \ '\fBU\fR' :\fIselect a user\fR
|
||||
You will be prompted for a UID or username. Only processes
|
||||
belonging to the selected user will be displayed. This option
|
||||
matches on the real, effective, saved, and filesystem UID.
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fBk\fR\' :\fIKill_a_task\fR
|
||||
+*\ '\fBk\fR' :\fIKill_a_task\fR
|
||||
You will be prompted for a PID and then the signal to send.
|
||||
The default signal, as reflected in the prompt, is SIGTERM.
|
||||
However, you can send any signal, via number or name.
|
||||
@@ -667,24 +667,24 @@ depending on your progress:
|
||||
2) at the signal prompt, type 0
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBq\fR\' :\fIQuit\fR
|
||||
+\ \ '\fBq\fR' :\fIQuit\fR
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fBr\fR\' :\fIRenice_a_Task\fR
|
||||
+*\ '\fBr\fR' :\fIRenice_a_Task\fR
|
||||
You will be prompted for a PID and then the value to nice it to.
|
||||
Entering a positive value will cause a process to lose priority.
|
||||
Conversely, a negative value will cause a process to be viewed more
|
||||
favorably by the kernel.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBW\fR\' :\fIWrite_the_Configuration_File\fR
|
||||
+\ \ '\fBW\fR' :\fIWrite_the_Configuration_File\fR
|
||||
This will save all of your options and toggles plus the current
|
||||
display mode and delay time.
|
||||
By issuing this command just before quitting \*(Me, you will be able restart
|
||||
later in exactly that same state.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBZ\fR\' :\fIChange_Color_Mapping
|
||||
+\ \ '\fBZ\fR' :\fIChange_Color_Mapping
|
||||
This key will take you to a separate screen where you can change the
|
||||
colors for the \*(CW, or for all windows.
|
||||
For details regarding this \*(CI \*(Xt 3d. COLOR Mapping.
|
||||
@@ -704,21 +704,21 @@ These commands always impact just the \*
|
||||
\*(CWs and field groups.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBl\fR\' :\fIToggle_Load_Average/Uptime\fR \*(EM On/Off
|
||||
+\ \ '\fBl\fR' :\fIToggle_Load_Average/Uptime\fR \*(EM On/Off
|
||||
This is also the line containing the program name (possibly an alias) when
|
||||
operating in \*(FM or the \*(CW name when operating in \*(AM.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBm\fR\' :\fIToggle_Memory/Swap_Usage\fR \*(EM On/Off
|
||||
+\ \ '\fBm\fR' :\fIToggle_Memory/Swap_Usage\fR \*(EM On/Off
|
||||
This command affects two \*(SA lines.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBt\fR\' :\fIToggle_Task/Cpu_States\fR \*(EM On/Off
|
||||
+\ \ '\fBt\fR' :\fIToggle_Task/Cpu_States\fR \*(EM On/Off
|
||||
This command affects from 2 to many \*(SA lines, depending on the state
|
||||
of the '1' toggle and whether or not \*(Me is running under true SMP.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fB1\fR\' :\fIToggle_Single/Separate_Cpu_States\fR \*(EM On/Off
|
||||
+\ \ '\fB1\fR' :\fIToggle_Single/Separate_Cpu_States\fR \*(EM On/Off
|
||||
This command affects how the 't' command's Cpu States portion is shown.
|
||||
Although this toggle exists primarily to serve massively-parallel SMP machines,
|
||||
it is not restricted to solely SMP environments.
|
||||
@@ -750,12 +750,12 @@ global 'B' (bold disable) toggle.
|
||||
.in
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBb\fR\' :\fIBold/Reverse_toggle\fR
|
||||
+\ \ '\fBb\fR' :\fIBold/Reverse_toggle\fR
|
||||
This command will impact how the 'x' and 'y' toggles are displayed.
|
||||
Further, it will only be available when at least one of those toggles is \*O.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBx\fR\' :\fIColumn_Highlight_toggle\fR
|
||||
+\ \ '\fBx\fR' :\fIColumn_Highlight_toggle\fR
|
||||
Changes highlighting for the current sort field.
|
||||
You probably don't need a constant visual reminder of the sort field and
|
||||
\*(Me hopes that you always run with 'column highlight' \*F, due to the cost
|
||||
@@ -765,7 +765,7 @@ If you forget which field is being sorte
|
||||
visual reminder.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBy\fR\' :\fIRow_Highlight_toggle\fR
|
||||
+\ \ '\fBy\fR' :\fIRow_Highlight_toggle\fR
|
||||
Changes highlighting for "running" tasks.
|
||||
For additional insight into this task state, \*(Xt 2a. DESCRIPTIONS of Fields,
|
||||
Process Status.
|
||||
@@ -774,7 +774,7 @@ Use of this provision provides important
|
||||
The only costs will be a few additional tty escape sequences.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBz\fR\' :\fIColor/Monochrome_toggle\fR
|
||||
+\ \ '\fBz\fR' :\fIColor/Monochrome_toggle\fR
|
||||
Switches the \*(CW between your last used color scheme and the older form
|
||||
of black-on-white or white-on-black.
|
||||
This command will alter\fB both\fR the \*(SA and \*(TA but does not affect the
|
||||
@@ -785,24 +785,24 @@ state of the 'x', 'y' or 'b' toggles.
|
||||
.B CONTENT\fR of \*(TW
|
||||
.PD 0
|
||||
.TP 7
|
||||
-\ \ \'\fBc\fR\' :\fICommand_Line/Program_Name_toggle\fR
|
||||
+\ \ '\fBc\fR' :\fICommand_Line/Program_Name_toggle\fR
|
||||
This command will be honored whether or not the 'Command' column
|
||||
is currently visible.
|
||||
Later, should that field come into view, the change you applied will be seen.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBf\fR\' and \'\fBo\fR\' :\fIFields_select\fR or \fIOrder_fields\fR
|
||||
+\ \ '\fBf\fR' and '\fBo\fR' :\fIFields_select\fR or \fIOrder_fields\fR
|
||||
These keys display separate screens where you can change which
|
||||
fields are displayed and their order.
|
||||
For additional information on these \*(CIs
|
||||
\*(Xt 2b. SELECTING and ORDERING Columns.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBH\fR\' :\fIThreads_toggle\fR
|
||||
+\ \ '\fBH\fR' :\fIThreads_toggle\fR
|
||||
When this toggle is \*O, all individual threads will be displayed. Otherwise, \*(Me displays a summation of all threads in a process.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBS\fR\' :\fICumulative_Time_Mode_toggle\fR
|
||||
+\ \ '\fBS\fR' :\fICumulative_Time_Mode_toggle\fR
|
||||
When 'Cumulative mode' is \*O, each process is listed with the \*(Pu
|
||||
time that it and its dead children have used.
|
||||
|
||||
@@ -818,7 +818,7 @@ If you wish to know in advance whether o
|
||||
effect, simply ask for help and view the window summary on the second line.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBu\fR\' :\fIShow_Specific_User_Only\fR
|
||||
+\ \ '\fBu\fR' :\fIShow_Specific_User_Only\fR
|
||||
You will be prompted to enter the name of the user to display.
|
||||
Thereafter, in that \*(TW only matching User ID's will be shown, or possibly
|
||||
no tasks will be shown.
|
||||
@@ -831,7 +831,7 @@ just press <Enter> at the prompt, withou
|
||||
.B SIZE\fR of \*(TW
|
||||
.PD 0
|
||||
.TP 7
|
||||
-\ \ \'\fBi\fR\' :\fIIdle_Processes_toggle\fR
|
||||
+\ \ '\fBi\fR' :\fIIdle_Processes_toggle\fR
|
||||
Displays all tasks or just active tasks.
|
||||
When this toggle is \*F, idled or zombied processes will not be displayed.
|
||||
|
||||
@@ -839,7 +839,7 @@ If this command is applied to the last \
|
||||
affect the window's size, as all prior \*(TDs will have already been painted.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBn\fR\' or \'#\' :\fISet_Maximum_Tasks\fR
|
||||
+\ \ '\fBn\fR' or '#' :\fISet_Maximum_Tasks\fR
|
||||
You will be prompted to enter the number of tasks to display.
|
||||
The lessor of your number and available screen rows will be used.
|
||||
|
||||
@@ -878,12 +878,12 @@ The sort field might\fI not\fR be visibl
|
||||
.in
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fB<\fR\' :\fIMove_Sort_Field_Left\fR
|
||||
+\ \ '\fB<\fR' :\fIMove_Sort_Field_Left\fR
|
||||
Moves the sort column to the left unless the current sort field is
|
||||
the first field being displayed.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fB>\fR\' :\fIMove_Sort_Field_Right\fR
|
||||
+\ \ '\fB>\fR' :\fIMove_Sort_Field_Right\fR
|
||||
Moves the sort column to the right unless the current sort field is
|
||||
the last field being displayed.
|
||||
|
||||
@@ -894,7 +894,7 @@ the current sort field is visible.
|
||||
.in
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBF\fR\' or \'\fBO\fR\' :\fISelect_Sort_Field\fR
|
||||
+\ \ '\fBF\fR' or '\fBO\fR' :\fISelect_Sort_Field\fR
|
||||
These keys display a separate screen where you can change which field
|
||||
is used as the sort column.
|
||||
|
||||
@@ -907,7 +907,7 @@ This \*(CI can be a convenient way to si
|
||||
when running \*(Me with column highlighting turned \*F.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBR\fR\' :\fIReverse/Normal_Sort_Field_toggle\fR
|
||||
+\ \ '\fBR\fR' :\fIReverse/Normal_Sort_Field_toggle\fR
|
||||
Using this \*(CI you can alternate between high-to-low and low-to-high sorts.
|
||||
|
||||
.PP
|
||||
@@ -984,7 +984,7 @@ know what window is the \*(CW.
|
||||
.\" ......................................................................
|
||||
.SS 4b. COMMANDS for Windows
|
||||
.TP 7
|
||||
-\ \ \'\fB-\fR\' and \'\fB_\fR\' :\fIShow/Hide_Window(s)_toggles\fR
|
||||
+\ \ '\fB-\fR' and '\fB_\fR' :\fIShow/Hide_Window(s)_toggles\fR
|
||||
The '-' key turns the \*(CW's \*(TD \*O and \*F.
|
||||
When \*O, that \*(TA will show a minimum of the columns header you've
|
||||
established with the 'f' and 'o' commands.
|
||||
@@ -998,7 +998,7 @@ If all 4 \*(TDs are currently visible, t
|
||||
as the only display element.
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fB=\fR\' and \'\fB+\fR\' :\fIEqualize_(re-balance)_Window(s)\fR
|
||||
+*\ '\fB=\fR' and '\fB+\fR' :\fIEqualize_(re-balance)_Window(s)\fR
|
||||
The '=' key forces the \*(CW's \*(TD to be visible.
|
||||
It also reverses any 'i' (idle tasks) and 'n' (max tasks) commands that might
|
||||
be active.
|
||||
@@ -1009,7 +1009,7 @@ They will also have retained any customi
|
||||
except for the 'i' (idle tasks) and 'n' (max tasks) commands.
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR
|
||||
+*\ '\fBA\fR' :\fIAlternate_Display_Mode_toggle\fR
|
||||
This command will switch between \*(FM and \*(AM.
|
||||
|
||||
The first time you issue this command, all four \*(TDs will be shown.
|
||||
@@ -1017,7 +1017,7 @@ Thereafter when you switch modes, you wi
|
||||
chosen to make visible.
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fBa\fR\' and \'\fBw\fR\' :\fINext_Window_Forward/Backward\fR
|
||||
+*\ '\fBa\fR' and '\fBw\fR' :\fINext_Window_Forward/Backward\fR
|
||||
This will change the \*(CW, which in turn changes the window to which
|
||||
commands are directed.
|
||||
These keys act in a circular fashion so you can reach any desired \*(CW
|
||||
@@ -1028,7 +1028,7 @@ whenever the \*(CW name loses its emphas
|
||||
the \*(TD is \*F and many commands will be restricted.
|
||||
|
||||
.TP 7
|
||||
-*\ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fR
|
||||
+*\ '\fBG\fR' :\fIChoose_Another_Window/Field_Group\fR
|
||||
You will be prompted to enter a number between 1 and 4 designating the
|
||||
window/field group which should be made the \*(CW.
|
||||
|
||||
@@ -1037,15 +1037,15 @@ In \*(AM, it is simply a less convenient
|
||||
commands.
|
||||
|
||||
.TP 7
|
||||
-\ \ \'\fBg\fR\' :\fIChange_Window/Field_Group_Name\fR
|
||||
+\ \ '\fBg\fR' :\fIChange_Window/Field_Group_Name\fR
|
||||
You will be prompted for a new name to be applied to the \*(CW.
|
||||
It does not require that the window name be visible
|
||||
(the 'l' toggle to be \*O).
|
||||
|
||||
.IP "*" 3
|
||||
The \*(CIs shown with an \*(AS have use beyond \*(AM.
|
||||
- \'=', 'A', 'G' are always available
|
||||
- \'a', 'w' act the same when color mapping
|
||||
+ '=', 'A', 'G' are always available
|
||||
+ 'a', 'w' act the same when color mapping
|
||||
|
||||
|
||||
.\" ----------------------------------------------------------------------
|
||||
@@ -0,0 +1,52 @@
|
||||
--- procps-3.2.7/vmstat.c.steal 2006-07-10 10:49:49.000000000 +0200
|
||||
+++ procps-3.2.7/vmstat.c 2006-07-10 10:54:03.000000000 +0200
|
||||
@@ -150,15 +150,15 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void new_header(void){
|
||||
- printf("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n");
|
||||
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n");
|
||||
printf(
|
||||
- "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s\n",
|
||||
+ "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
|
||||
"r","b",
|
||||
"swpd", "free", a_option?"inact":"buff", a_option?"active":"cache",
|
||||
"si","so",
|
||||
"bi","bo",
|
||||
"in","cs",
|
||||
- "us","sy","id","wa"
|
||||
+ "us","sy","id","wa", "st"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void new_format(void) {
|
||||
- const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u\n";
|
||||
+ const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
|
||||
unsigned int tog=0; /* toggle switch for cleaner code */
|
||||
unsigned int i;
|
||||
unsigned int hz = Hertz;
|
||||
@@ -217,8 +217,8 @@
|
||||
(unsigned)( (100*duse + divo2) / Div ),
|
||||
(unsigned)( (100*dsys + divo2) / Div ),
|
||||
(unsigned)( (100*didl + divo2) / Div ),
|
||||
- (unsigned)( (100*diow + divo2) / Div ) /* ,
|
||||
- (unsigned)( (100*dstl + divo2) / Div ) */
|
||||
+ (unsigned)( (100*diow + divo2) / Div ),
|
||||
+ (unsigned)( (100*dstl + divo2) / Div )
|
||||
);
|
||||
|
||||
for(i=1;i<num_updates;i++) { /* \\\\\\\\\\\\\\\\\\\\ main loop ////////////////// */
|
||||
@@ -266,8 +266,8 @@
|
||||
(unsigned)( (100*duse+divo2)/Div ), /*us*/
|
||||
(unsigned)( (100*dsys+divo2)/Div ), /*sy*/
|
||||
(unsigned)( (100*didl+divo2)/Div ), /*id*/
|
||||
- (unsigned)( (100*diow+divo2)/Div )/*, //wa
|
||||
- (unsigned)( (100*dstl+divo2)/Div ) //st */
|
||||
+ (unsigned)( (100*diow+divo2)/Div ), //wa
|
||||
+ (unsigned)( (100*dstl+divo2)/Div ) //st
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up procps-3.2.7/vmstat.c.jx procps-3.2.7/vmstat.c
|
||||
--- procps-3.2.7/vmstat.c.jx 2009-01-07 14:13:52.000000000 -0500
|
||||
+++ procps-3.2.7/vmstat.c 2009-01-07 14:17:07.000000000 -0500
|
||||
@@ -150,7 +150,7 @@ static int format_1000(unsigned long lon
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void new_header(void){
|
||||
- printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n");
|
||||
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n");
|
||||
printf(
|
||||
"%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
|
||||
"r","b",
|
||||
@@ -0,0 +1,95 @@
|
||||
diff -up procps-3.2.7/proc/sysinfo.c.vmstat procps-3.2.7/proc/sysinfo.c
|
||||
--- procps-3.2.7/proc/sysinfo.c.vmstat 2008-12-04 15:25:50.000000000 +0100
|
||||
+++ procps-3.2.7/proc/sysinfo.c 2008-12-04 16:54:29.000000000 +0100
|
||||
@@ -784,6 +784,18 @@ unsigned int getpartitions_num(struct di
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
+static int is_disk(char *dev)
|
||||
+{
|
||||
+ char syspath[PATH_MAX];
|
||||
+ char *slash;
|
||||
+
|
||||
+ while ((slash = strchr(dev, '/')))
|
||||
+ *slash = '!';
|
||||
+ snprintf(syspath, sizeof(syspath), "/sys/block/%s", dev);
|
||||
+ return !(access(syspath, F_OK));
|
||||
+}
|
||||
+
|
||||
+/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **partitions){
|
||||
FILE* fd;
|
||||
@@ -791,6 +803,7 @@ unsigned int getdiskstat(struct disk_sta
|
||||
int cPartition = 0;
|
||||
int fields;
|
||||
unsigned dummy;
|
||||
+ char devname[PATH_MAX];
|
||||
|
||||
*disks = NULL;
|
||||
*partitions = NULL;
|
||||
@@ -803,10 +816,11 @@ unsigned int getdiskstat(struct disk_sta
|
||||
fclose(fd);
|
||||
break;
|
||||
}
|
||||
- fields = sscanf(buff, " %*d %*d %*s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u", &dummy);
|
||||
- if (fields == 1){
|
||||
+ fields = sscanf(buff, " %*d %*d %15s %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %u",
|
||||
+ &devname, &dummy);
|
||||
+ if (fields == 2 && is_disk(devname)){
|
||||
(*disks) = realloc(*disks, (cDisk+1)*sizeof(struct disk_stat));
|
||||
- sscanf(buff, " %*d %*d %15s %u %u %llu %u %u %u %llu %u %u %u %u",
|
||||
+ sscanf(buff, " %*d %*d %15s %lu %lu %llu %lu %lu %lu %llu %lu %lu %lu %lu",
|
||||
//&disk_major,
|
||||
//&disk_minor,
|
||||
(*disks)[cDisk].disk_name,
|
||||
@@ -827,7 +841,9 @@ unsigned int getdiskstat(struct disk_sta
|
||||
}else{
|
||||
(*partitions) = realloc(*partitions, (cPartition+1)*sizeof(struct partition_stat));
|
||||
fflush(stdout);
|
||||
- sscanf(buff, " %*d %*d %15s %u %llu %u %u",
|
||||
+ sscanf(buff, (fields == 2)
|
||||
+ ? " %*d %*d %15s %u %*u %llu %*u %u %*u %llu %*u %*u %*u %*u"
|
||||
+ : " %*d %*d %15s %u %llu %u %llu",
|
||||
//&part_major,
|
||||
//&part_minor,
|
||||
(*partitions)[cPartition].partition_name,
|
||||
diff -up procps-3.2.7/proc/sysinfo.h.vmstat procps-3.2.7/proc/sysinfo.h
|
||||
--- procps-3.2.7/proc/sysinfo.h.vmstat 2008-12-04 15:25:41.000000000 +0100
|
||||
+++ procps-3.2.7/proc/sysinfo.h 2008-12-04 16:54:32.000000000 +0100
|
||||
@@ -95,16 +95,16 @@ typedef struct disk_stat{
|
||||
unsigned long long reads_sectors;
|
||||
unsigned long long written_sectors;
|
||||
char disk_name [16];
|
||||
- unsigned inprogress_IO;
|
||||
- unsigned merged_reads;
|
||||
- unsigned merged_writes;
|
||||
- unsigned milli_reading;
|
||||
- unsigned milli_spent_IO;
|
||||
- unsigned milli_writing;
|
||||
- unsigned partitions;
|
||||
- unsigned reads;
|
||||
- unsigned weighted_milli_spent_IO;
|
||||
- unsigned writes;
|
||||
+ unsigned long inprogress_IO;
|
||||
+ unsigned long merged_reads;
|
||||
+ unsigned long merged_writes;
|
||||
+ unsigned long milli_reading;
|
||||
+ unsigned long milli_spent_IO;
|
||||
+ unsigned long milli_writing;
|
||||
+ unsigned long partitions;
|
||||
+ unsigned long reads;
|
||||
+ unsigned long weighted_milli_spent_IO;
|
||||
+ unsigned long writes;
|
||||
}disk_stat;
|
||||
|
||||
typedef struct partition_stat{
|
||||
@@ -113,7 +113,7 @@ typedef struct partition_stat{
|
||||
unsigned parent_disk; // index into a struct disk_stat array
|
||||
unsigned reads;
|
||||
unsigned writes;
|
||||
- unsigned requested_writes;
|
||||
+ unsigned long long requested_writes;
|
||||
}partition_stat;
|
||||
|
||||
extern unsigned int getpartitions_num(struct disk_stat *disks, int ndisks);
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -up procps-3.2.7/vmstat.c.vmstat procps-3.2.7/vmstat.c
|
||||
--- procps-3.2.7/vmstat.c.vmstat 2009-02-23 13:44:27.000000000 +0100
|
||||
+++ procps-3.2.7/vmstat.c 2009-02-23 13:45:03.000000000 +0100
|
||||
@@ -312,7 +312,7 @@ static int diskpartition_format(const ch
|
||||
struct disk_stat *disks;
|
||||
struct partition_stat *partitions, *current_partition=NULL;
|
||||
unsigned long ndisks, j, k, npartitions;
|
||||
- const char format[] = "%20u %10llu %10u %10u\n";
|
||||
+ const char format[] = "%20u %10llu %10u %10llu\n";
|
||||
|
||||
fDiskstat=fopen("/proc/diskstats","rb");
|
||||
if(!fDiskstat){
|
||||
@@ -0,0 +1,235 @@
|
||||
--- procps-3.2.7/proc/sysinfo.h.kzak 2006-06-25 08:41:48.000000000 +0200
|
||||
+++ procps-3.2.7/proc/sysinfo.h 2006-08-04 11:19:09.000000000 +0200
|
||||
@@ -57,7 +57,7 @@
|
||||
#define BUFFSIZE (64*1024)
|
||||
typedef unsigned long long jiff;
|
||||
extern void getstat(jiff *restrict cuse, jiff *restrict cice, jiff *restrict csys, jiff *restrict cide, jiff *restrict ciow, jiff *restrict cxxx, jiff *restrict cyyy, jiff *restrict czzz,
|
||||
- unsigned long *restrict pin, unsigned long *restrict pout, unsigned long *restrict s_in, unsigned long *restrict sout,
|
||||
+ unsigned long long *restrict pin, unsigned long long *restrict pout, unsigned long long *restrict s_in, unsigned long long *restrict sout,
|
||||
unsigned *restrict intr, unsigned *restrict ctxt,
|
||||
unsigned int *restrict running, unsigned int *restrict blocked,
|
||||
unsigned int *restrict btime, unsigned int *restrict processes);
|
||||
@@ -72,10 +72,10 @@
|
||||
extern unsigned long vm_nr_reverse_maps;
|
||||
extern unsigned long vm_nr_mapped;
|
||||
extern unsigned long vm_nr_slab;
|
||||
-extern unsigned long vm_pgpgin;
|
||||
-extern unsigned long vm_pgpgout;
|
||||
-extern unsigned long vm_pswpin;
|
||||
-extern unsigned long vm_pswpout;
|
||||
+extern unsigned long long vm_pgpgin;
|
||||
+extern unsigned long long vm_pgpgout;
|
||||
+extern unsigned long long vm_pswpin;
|
||||
+extern unsigned long long vm_pswpout;
|
||||
extern unsigned long vm_pgalloc;
|
||||
extern unsigned long vm_pgfree;
|
||||
extern unsigned long vm_pgactivate;
|
||||
--- procps-3.2.7/proc/sysinfo.c.kzak 2006-06-25 08:41:48.000000000 +0200
|
||||
+++ procps-3.2.7/proc/sysinfo.c 2006-08-04 12:04:06.000000000 +0200
|
||||
@@ -368,7 +368,7 @@
|
||||
/***********************************************************************/
|
||||
|
||||
void getstat(jiff *restrict cuse, jiff *restrict cice, jiff *restrict csys, jiff *restrict cide, jiff *restrict ciow, jiff *restrict cxxx, jiff *restrict cyyy, jiff *restrict czzz,
|
||||
- unsigned long *restrict pin, unsigned long *restrict pout, unsigned long *restrict s_in, unsigned long *restrict sout,
|
||||
+ unsigned long long *restrict pin, unsigned long long *restrict pout, unsigned long long *restrict s_in, unsigned long long *restrict sout,
|
||||
unsigned *restrict intr, unsigned *restrict ctxt,
|
||||
unsigned int *restrict running, unsigned int *restrict blocked,
|
||||
unsigned int *restrict btime, unsigned int *restrict processes) {
|
||||
@@ -396,11 +396,11 @@
|
||||
if(b) sscanf(b, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", cuse, cice, csys, cide, ciow, cxxx, cyyy, czzz);
|
||||
|
||||
b = strstr(buff, "page ");
|
||||
- if(b) sscanf(b, "page %lu %lu", pin, pout);
|
||||
+ if(b) sscanf(b, "page %llu %llu", pin, pout);
|
||||
else need_vmstat_file = 1;
|
||||
|
||||
b = strstr(buff, "swap ");
|
||||
- if(b) sscanf(b, "swap %lu %lu", s_in, sout);
|
||||
+ if(b) sscanf(b, "swap %llu %llu", s_in, sout);
|
||||
else need_vmstat_file = 1;
|
||||
|
||||
b = strstr(buff, "intr ");
|
||||
@@ -611,9 +611,12 @@
|
||||
|
||||
typedef struct vm_table_struct {
|
||||
const char *name; /* VM statistic name */
|
||||
- unsigned long *slot; /* slot in return struct */
|
||||
+ void *slot; /* slot in return struct */
|
||||
+ int sz; /* size of slot value */
|
||||
} vm_table_struct;
|
||||
|
||||
+#define VM_TABENTRY(_name_) { # _name_, &vm_ ## _name_, sizeof(vm_ ## _name_) }
|
||||
+
|
||||
static int compare_vm_table_structs(const void *a, const void *b){
|
||||
return strcmp(((const vm_table_struct*)a)->name,((const vm_table_struct*)b)->name);
|
||||
}
|
||||
@@ -626,10 +629,10 @@
|
||||
unsigned long vm_nr_reverse_maps; // includes PageDirect
|
||||
unsigned long vm_nr_mapped; // mapped into pagetables
|
||||
unsigned long vm_nr_slab; // in slab
|
||||
-unsigned long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line)
|
||||
-unsigned long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line)
|
||||
-unsigned long vm_pswpin; // swap reads (same as 1st num on /proc/stat swap line)
|
||||
-unsigned long vm_pswpout; // swap writes (same as 2nd num on /proc/stat swap line)
|
||||
+unsigned long long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line)
|
||||
+unsigned long long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line)
|
||||
+unsigned long long vm_pswpin; // swap reads (same as 1st num on /proc/stat swap line)
|
||||
+unsigned long long vm_pswpout; // swap writes (same as 2nd num on /proc/stat swap line)
|
||||
unsigned long vm_pgalloc; // page allocations
|
||||
unsigned long vm_pgfree; // page freeings
|
||||
unsigned long vm_pgactivate; // pages moved inactive -> active
|
||||
@@ -668,54 +671,54 @@
|
||||
|
||||
void vminfo(void){
|
||||
char namebuf[16]; /* big enough to hold any row name */
|
||||
- vm_table_struct findme = { namebuf, NULL};
|
||||
+ vm_table_struct findme = { namebuf, NULL, 0};
|
||||
vm_table_struct *found;
|
||||
char *head;
|
||||
char *tail;
|
||||
static const vm_table_struct vm_table[] = {
|
||||
- {"allocstall", &vm_allocstall},
|
||||
- {"kswapd_inodesteal", &vm_kswapd_inodesteal},
|
||||
- {"kswapd_steal", &vm_kswapd_steal},
|
||||
- {"nr_dirty", &vm_nr_dirty}, // page version of meminfo Dirty
|
||||
- {"nr_mapped", &vm_nr_mapped}, // page version of meminfo Mapped
|
||||
- {"nr_page_table_pages", &vm_nr_page_table_pages},// same as meminfo PageTables
|
||||
- {"nr_pagecache", &vm_nr_pagecache}, // gone in 2.5.66+ kernels
|
||||
- {"nr_reverse_maps", &vm_nr_reverse_maps}, // page version of meminfo ReverseMaps GONE
|
||||
- {"nr_slab", &vm_nr_slab}, // page version of meminfo Slab
|
||||
- {"nr_unstable", &vm_nr_unstable},
|
||||
- {"nr_writeback", &vm_nr_writeback}, // page version of meminfo Writeback
|
||||
- {"pageoutrun", &vm_pageoutrun},
|
||||
- {"pgactivate", &vm_pgactivate},
|
||||
- {"pgalloc", &vm_pgalloc}, // GONE (now separate dma,high,normal)
|
||||
- {"pgalloc_dma", &vm_pgalloc_dma},
|
||||
- {"pgalloc_high", &vm_pgalloc_high},
|
||||
- {"pgalloc_normal", &vm_pgalloc_normal},
|
||||
- {"pgdeactivate", &vm_pgdeactivate},
|
||||
- {"pgfault", &vm_pgfault},
|
||||
- {"pgfree", &vm_pgfree},
|
||||
- {"pginodesteal", &vm_pginodesteal},
|
||||
- {"pgmajfault", &vm_pgmajfault},
|
||||
- {"pgpgin", &vm_pgpgin}, // important
|
||||
- {"pgpgout", &vm_pgpgout}, // important
|
||||
- {"pgrefill", &vm_pgrefill}, // GONE (now separate dma,high,normal)
|
||||
- {"pgrefill_dma", &vm_pgrefill_dma},
|
||||
- {"pgrefill_high", &vm_pgrefill_high},
|
||||
- {"pgrefill_normal", &vm_pgrefill_normal},
|
||||
- {"pgrotated", &vm_pgrotated},
|
||||
- {"pgscan", &vm_pgscan}, // GONE (now separate direct,kswapd and dma,high,normal)
|
||||
- {"pgscan_direct_dma", &vm_pgscan_direct_dma},
|
||||
- {"pgscan_direct_high", &vm_pgscan_direct_high},
|
||||
- {"pgscan_direct_normal",&vm_pgscan_direct_normal},
|
||||
- {"pgscan_kswapd_dma", &vm_pgscan_kswapd_dma},
|
||||
- {"pgscan_kswapd_high", &vm_pgscan_kswapd_high},
|
||||
- {"pgscan_kswapd_normal",&vm_pgscan_kswapd_normal},
|
||||
- {"pgsteal", &vm_pgsteal}, // GONE (now separate dma,high,normal)
|
||||
- {"pgsteal_dma", &vm_pgsteal_dma},
|
||||
- {"pgsteal_high", &vm_pgsteal_high},
|
||||
- {"pgsteal_normal", &vm_pgsteal_normal},
|
||||
- {"pswpin", &vm_pswpin}, // important
|
||||
- {"pswpout", &vm_pswpout}, // important
|
||||
- {"slabs_scanned", &vm_slabs_scanned},
|
||||
+ VM_TABENTRY(allocstall),
|
||||
+ VM_TABENTRY(kswapd_inodesteal),
|
||||
+ VM_TABENTRY(kswapd_steal),
|
||||
+ VM_TABENTRY(nr_dirty),
|
||||
+ VM_TABENTRY(nr_mapped),
|
||||
+ VM_TABENTRY(nr_page_table_pages),
|
||||
+ VM_TABENTRY(nr_pagecache),
|
||||
+ VM_TABENTRY(nr_reverse_maps),
|
||||
+ VM_TABENTRY(nr_slab),
|
||||
+ VM_TABENTRY(nr_unstable),
|
||||
+ VM_TABENTRY(nr_writeback),
|
||||
+ VM_TABENTRY(pageoutrun),
|
||||
+ VM_TABENTRY(pgactivate),
|
||||
+ VM_TABENTRY(pgalloc),
|
||||
+ VM_TABENTRY(pgalloc_dma),
|
||||
+ VM_TABENTRY(pgalloc_high),
|
||||
+ VM_TABENTRY(pgalloc_normal),
|
||||
+ VM_TABENTRY(pgdeactivate),
|
||||
+ VM_TABENTRY(pgfault),
|
||||
+ VM_TABENTRY(pgfree),
|
||||
+ VM_TABENTRY(pginodesteal),
|
||||
+ VM_TABENTRY(pgmajfault),
|
||||
+ VM_TABENTRY(pgpgin),
|
||||
+ VM_TABENTRY(pgpgout),
|
||||
+ VM_TABENTRY(pgrefill),
|
||||
+ VM_TABENTRY(pgrefill_dma),
|
||||
+ VM_TABENTRY(pgrefill_high),
|
||||
+ VM_TABENTRY(pgrefill_normal),
|
||||
+ VM_TABENTRY(pgrotated),
|
||||
+ VM_TABENTRY(pgscan),
|
||||
+ VM_TABENTRY(pgscan_direct_dma),
|
||||
+ VM_TABENTRY(pgscan_direct_high),
|
||||
+ VM_TABENTRY(pgscan_direct_normal),
|
||||
+ VM_TABENTRY(pgscan_kswapd_dma),
|
||||
+ VM_TABENTRY(pgscan_kswapd_high),
|
||||
+ VM_TABENTRY(pgscan_kswapd_normal),
|
||||
+ VM_TABENTRY(pgsteal),
|
||||
+ VM_TABENTRY(pgsteal_dma),
|
||||
+ VM_TABENTRY(pgsteal_high),
|
||||
+ VM_TABENTRY(pgsteal_normal),
|
||||
+ VM_TABENTRY(pswpin),
|
||||
+ VM_TABENTRY(pswpout),
|
||||
+ VM_TABENTRY(slabs_scanned)
|
||||
};
|
||||
const int vm_table_count = sizeof(vm_table)/sizeof(vm_table_struct);
|
||||
|
||||
@@ -741,7 +744,10 @@
|
||||
);
|
||||
head = tail+1;
|
||||
if(!found) goto nextline;
|
||||
- *(found->slot) = strtoul(head,&tail,10);
|
||||
+ if (found->sz == sizeof(unsigned long long))
|
||||
+ *((unsigned long long *) found->slot) = strtoull(head,&tail,10);
|
||||
+ else
|
||||
+ *((unsigned long *) found->slot) = strtoul(head,&tail,10);
|
||||
nextline:
|
||||
|
||||
//if(found) fprintf(stderr,"%s=%d\n",found->name,*(found->slot));
|
||||
--- procps-3.2.7/vmstat.c.kzak 2006-08-04 10:52:38.000000000 +0200
|
||||
+++ procps-3.2.7/vmstat.c 2006-08-04 12:05:49.000000000 +0200
|
||||
@@ -180,7 +180,7 @@
|
||||
unsigned int running,blocked,dummy_1,dummy_2;
|
||||
jiff cpu_use[2], cpu_nic[2], cpu_sys[2], cpu_idl[2], cpu_iow[2], cpu_xxx[2], cpu_yyy[2], cpu_zzz[2];
|
||||
jiff duse, dsys, didl, diow, dstl, Div, divo2;
|
||||
- unsigned long pgpgin[2], pgpgout[2], pswpin[2], pswpout[2];
|
||||
+ unsigned long long pgpgin[2], pgpgout[2], pswpin[2], pswpout[2];
|
||||
unsigned int intr[2], ctxt[2];
|
||||
unsigned int sleep_half;
|
||||
unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
|
||||
@@ -509,7 +509,7 @@
|
||||
static void sum_format(void) {
|
||||
unsigned int running, blocked, btime, processes;
|
||||
jiff cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy, cpu_zzz;
|
||||
- unsigned long pgpgin, pgpgout, pswpin, pswpout;
|
||||
+ unsigned long long pgpgin, pgpgout, pswpin, pswpout;
|
||||
unsigned int intr, ctxt;
|
||||
|
||||
meminfo();
|
||||
@@ -539,10 +539,10 @@
|
||||
printf("%13Lu IRQ cpu ticks\n", cpu_xxx);
|
||||
printf("%13Lu softirq cpu ticks\n", cpu_yyy);
|
||||
printf("%13Lu stolen cpu ticks\n", cpu_zzz);
|
||||
- printf("%13lu pages paged in\n", pgpgin);
|
||||
- printf("%13lu pages paged out\n", pgpgout);
|
||||
- printf("%13lu pages swapped in\n", pswpin);
|
||||
- printf("%13lu pages swapped out\n", pswpout);
|
||||
+ printf("%13llu pages paged in\n", pgpgin);
|
||||
+ printf("%13llu pages paged out\n", pgpgout);
|
||||
+ printf("%13llu pages swapped in\n", pswpin);
|
||||
+ printf("%13llu pages swapped out\n", pswpout);
|
||||
printf("%13u interrupts\n", intr);
|
||||
printf("%13u CPU context switches\n", ctxt);
|
||||
printf("%13u boot time\n", btime);
|
||||
@@ -554,7 +554,7 @@
|
||||
static void fork_format(void) {
|
||||
unsigned int running, blocked, btime, processes;
|
||||
jiff cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy, cpu_zzz;
|
||||
- unsigned long pgpgin, pgpgout, pswpin, pswpout;
|
||||
+ unsigned long long pgpgin, pgpgout, pswpin, pswpout;
|
||||
unsigned int intr, ctxt;
|
||||
|
||||
getstat(&cpu_use, &cpu_nic, &cpu_sys, &cpu_idl,
|
||||
@@ -0,0 +1,22 @@
|
||||
diff -up procps-3.2.7/vmstat.8.timestamp procps-3.2.7/vmstat.8
|
||||
--- procps-3.2.7/vmstat.8.timestamp 2009-02-03 12:32:27.000000000 +0100
|
||||
+++ procps-3.2.7/vmstat.8 2009-02-03 12:34:37.000000000 +0100
|
||||
@@ -8,6 +8,7 @@ vmstat \- Report virtual memory statisti
|
||||
.B vmstat
|
||||
.RB [ "\-a" ]
|
||||
.RB [ "\-n" ]
|
||||
+.RB [ "\-t" ]
|
||||
.RI [ delay " [ " count ]]
|
||||
.br
|
||||
.B vmstat
|
||||
@@ -43,7 +44,9 @@ equivalent to the total number of tasks
|
||||
is represented by one or more tasks, depending on thread usage.
|
||||
This display does not repeat.
|
||||
.PP
|
||||
-The \fB-m\fP displays slabinfo.
|
||||
+The \fB-t\fP switch adds timestamp to the output.
|
||||
+.PP
|
||||
+The \fB-m\fP switch displays slabinfo.
|
||||
.PP
|
||||
The \fB-n\fP switch causes the header to be displayed only once rather than periodically.
|
||||
.PP
|
||||
@@ -0,0 +1,117 @@
|
||||
--- procps-3.2.7/vmstat.c 2008-12-11 22:11:30.042532106 -0500
|
||||
+++ procps-3.2.7/vmstat.c.timestamp 2008-12-11 22:08:11.553529883 -0500
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/dir.h>
|
||||
#include <dirent.h>
|
||||
+#include <time.h>
|
||||
|
||||
#include "proc/sysinfo.h"
|
||||
#include "proc/version.h"
|
||||
@@ -56,6 +57,7 @@
|
||||
|
||||
static unsigned int height; // window height
|
||||
static unsigned int moreheaders=TRUE;
|
||||
+static unsigned int showtimestamp=FALSE;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -71,6 +73,7 @@
|
||||
fprintf(stderr," -p prints disk partition statistics\n");
|
||||
fprintf(stderr," -s prints vm table\n");
|
||||
fprintf(stderr," -m prints slabinfo\n");
|
||||
+ fprintf(stderr," -t add timestamp to output\n");
|
||||
fprintf(stderr," -S unit size\n");
|
||||
fprintf(stderr," delay is the delay between updates in seconds. \n");
|
||||
fprintf(stderr," unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)\n");
|
||||
@@ -150,7 +153,11 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void new_header(void){
|
||||
- printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n");
|
||||
+ if(!showtimestamp){
|
||||
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n");
|
||||
+ } else {
|
||||
+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp---\n");
|
||||
+ }
|
||||
printf(
|
||||
"%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
|
||||
"r","b",
|
||||
@@ -173,7 +180,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void new_format(void) {
|
||||
- const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
|
||||
+ const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\t%s\n";
|
||||
unsigned int tog=0; /* toggle switch for cleaner code */
|
||||
unsigned int i;
|
||||
unsigned int hz = Hertz;
|
||||
@@ -185,6 +192,10 @@
|
||||
unsigned int sleep_half;
|
||||
unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
|
||||
int debt = 0; // handle idle ticks running backwards
|
||||
+ struct tm *tm_ptr;
|
||||
+ time_t the_time;
|
||||
+ char timebuf[32];
|
||||
+ timebuf[0] = '\0';
|
||||
|
||||
sleep_half=(sleep_time/2);
|
||||
new_header();
|
||||
@@ -196,6 +207,13 @@
|
||||
&running,&blocked,
|
||||
&dummy_1, &dummy_2);
|
||||
|
||||
+ if (showtimestamp)
|
||||
+ {
|
||||
+ (void) time( &the_time );
|
||||
+ tm_ptr = localtime( &the_time );
|
||||
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr);
|
||||
+ }
|
||||
+
|
||||
duse= *cpu_use + *cpu_nic;
|
||||
dsys= *cpu_sys + *cpu_xxx + *cpu_yyy;
|
||||
didl= *cpu_idl;
|
||||
@@ -218,7 +236,8 @@
|
||||
(unsigned)( (100*dsys + divo2) / Div ),
|
||||
(unsigned)( (100*didl + divo2) / Div ),
|
||||
(unsigned)( (100*diow + divo2) / Div ),
|
||||
- (unsigned)( (100*dstl + divo2) / Div )
|
||||
+ (unsigned)( (100*dstl + divo2) / Div ),
|
||||
+ timebuf
|
||||
);
|
||||
|
||||
for(i=1;i<num_updates;i++) { /* \\\\\\\\\\\\\\\\\\\\ main loop ////////////////// */
|
||||
@@ -234,6 +253,13 @@
|
||||
&running,&blocked,
|
||||
&dummy_1,&dummy_2);
|
||||
|
||||
+ if (showtimestamp)
|
||||
+ {
|
||||
+ (void) time( &the_time );
|
||||
+ tm_ptr = localtime( &the_time );
|
||||
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr);
|
||||
+ }
|
||||
+
|
||||
duse= cpu_use[tog]-cpu_use[!tog] + cpu_nic[tog]-cpu_nic[!tog];
|
||||
dsys= cpu_sys[tog]-cpu_sys[!tog] + cpu_xxx[tog]-cpu_xxx[!tog] + cpu_yyy[tog]-cpu_yyy[!tog];
|
||||
didl= cpu_idl[tog]-cpu_idl[!tog];
|
||||
@@ -267,7 +293,8 @@
|
||||
(unsigned)( (100*dsys+divo2)/Div ), /*sy*/
|
||||
(unsigned)( (100*didl+divo2)/Div ), /*id*/
|
||||
(unsigned)( (100*diow+divo2)/Div ), //wa
|
||||
- (unsigned)( (100*dstl+divo2)/Div ) //st
|
||||
+ (unsigned)( (100*dstl+divo2)/Div ), //st
|
||||
+ timebuf /* timestamp */
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -641,6 +668,9 @@
|
||||
case 's':
|
||||
statMode |= VMSUMSTAT;
|
||||
break;
|
||||
+ case 't':
|
||||
+ showtimestamp=TRUE;
|
||||
+ break;
|
||||
default:
|
||||
/* no other aguments defined yet. */
|
||||
usage();
|
||||
@@ -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;
|
||||
@@ -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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.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;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
Description: Call libproc constructors in strict order
|
||||
Having one constructor depend on another means if the order is reversed
|
||||
you get a different result. Patched based on idea by Tom Evans.
|
||||
Bug-Debian: http://bugs.debian.org/460331
|
||||
Author: Craig Small <csmall@debian.org>
|
||||
Adapted to Fedora: Jan Görig <jgorig@redhat.com>
|
||||
--- a/proc/sysinfo.c
|
||||
+++ b/proc/sysinfo.c
|
||||
@@ -213,6 +213,7 @@
|
||||
static void init_libproc(void) __attribute__((constructor));
|
||||
static void init_libproc(void){
|
||||
have_privs = check_for_privs();
|
||||
+ init_Linux_version(); /* Must be called before we check code */
|
||||
// ought to count CPUs in /proc/stat instead of relying
|
||||
// on glibc, which foolishly tries to parse /proc/cpuinfo
|
||||
//
|
||||
--- a/proc/version.c
|
||||
+++ b/proc/version.c
|
||||
@@ -33,8 +33,7 @@
|
||||
|
||||
int linux_version_code;
|
||||
|
||||
-static void init_Linux_version(void) __attribute__((constructor));
|
||||
-static void init_Linux_version(void) {
|
||||
+void init_Linux_version(void) {
|
||||
static struct utsname uts;
|
||||
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */
|
||||
|
||||
--- a/proc/version.h
|
||||
+++ b/proc/version.h
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
+void init_Linux_version(void); /* Get Linux version */
|
||||
extern void display_version(void); /* display suite version */
|
||||
extern const char procps_version[]; /* global buf for suite version */
|
||||
extern const char procps_number_version[]; /* global buf for suite number version */
|
||||
@@ -0,0 +1,13 @@
|
||||
diff -up procps-3.2.8/Makefile.make procps-3.2.8/Makefile
|
||||
--- procps-3.2.8/Makefile.make 2010-09-08 18:16:34.000000000 +0200
|
||||
+++ procps-3.2.8/Makefile 2010-09-08 18:54:41.668727996 +0200
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
--- procps-3.2.8/ps/output.c 2010-05-18 06:00:18.000000000 +0200
|
||||
+++ procps-3.2.8.lennart/ps/output.c 2010-05-18 05:59:46.000000000 +0200
|
||||
@@ -1109,7 +1109,7 @@
|
||||
static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
char filename[48];
|
||||
FILE *fd;
|
||||
- int counter = 0;
|
||||
+ int counter = 0, last_begin = 0, slash = 0;
|
||||
int c;
|
||||
int is_cgroup = 0;
|
||||
|
||||
@@ -1121,15 +1121,22 @@
|
||||
if (is_cgroup == 0) {
|
||||
if (c == ':') {
|
||||
is_cgroup = 1;
|
||||
+ slash = 0;
|
||||
if (counter>0)
|
||||
outbuf[counter++]=';';
|
||||
}
|
||||
}else
|
||||
- if ((c == '\n') || (c == '\0'))
|
||||
- is_cgroup = 0;
|
||||
+ if ((c == '\n') || (c == '\0')){
|
||||
+ if (slash) /* if the last char was a / this process is in the root cgroup which we should suppress */
|
||||
+ counter = last_begin;
|
||||
else
|
||||
+ last_begin = counter;
|
||||
+ is_cgroup = 0;
|
||||
+ } else {
|
||||
+ slash = c == '/';
|
||||
outbuf[counter++]=c;
|
||||
}
|
||||
+ }
|
||||
outbuf[counter]='\0';
|
||||
close(fd);
|
||||
if (counter>0)
|
||||
@@ -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);
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
diff -up procps-3.2.8/vmstat.c.getopt procps-3.2.8/vmstat.c
|
||||
--- procps-3.2.8/vmstat.c.getopt 2010-04-06 14:39:24.000000000 +0200
|
||||
+++ procps-3.2.8/vmstat.c 2010-04-06 14:47:52.000000000 +0200
|
||||
@@ -30,14 +30,15 @@
|
||||
#include "proc/sysinfo.h"
|
||||
#include "proc/version.h"
|
||||
|
||||
-static unsigned long dataUnit=1024;
|
||||
-static char szDataUnit [16];
|
||||
#define UNIT_B 1
|
||||
#define UNIT_k 1000
|
||||
#define UNIT_K 1024
|
||||
#define UNIT_m 1000000
|
||||
#define UNIT_M 1048576
|
||||
|
||||
+static unsigned long dataUnit=UNIT_K;
|
||||
+static char szDataUnit[3] = "K";
|
||||
+
|
||||
#define VMSTAT 0
|
||||
#define DISKSTAT 0x00000001
|
||||
#define VMSUMSTAT 0x00000002
|
||||
@@ -609,12 +610,10 @@ static int winhi(void) {
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
- char partition[16];
|
||||
- argc=0; /* redefined as number of integer arguments */
|
||||
- for (argv++;*argv;argv++) {
|
||||
- if ('-' ==(**argv)) {
|
||||
- switch (*(++(*argv))) {
|
||||
-
|
||||
+ char *partition = NULL;
|
||||
+ int c;
|
||||
+
|
||||
+ while((c = getopt(argc, argv, "VdafmDnp:S:s")) != EOF) switch(c) {
|
||||
case 'V':
|
||||
display_version();
|
||||
exit(0);
|
||||
@@ -630,7 +629,7 @@ int main(int argc, char *argv[]) {
|
||||
fork_format();
|
||||
exit(0);
|
||||
case 'm':
|
||||
- statMode |= SLABSTAT;
|
||||
+ statMode |= SLABSTAT;
|
||||
break;
|
||||
case 'D':
|
||||
statMode |= DISKSUMSTAT;
|
||||
@@ -641,29 +640,21 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
case 'p':
|
||||
statMode |= PARTITIONSTAT;
|
||||
- if (argv[1]){
|
||||
- char *cp = *++argv;
|
||||
- if(!memcmp(cp,"/dev/",5)) cp += 5;
|
||||
- snprintf(partition, sizeof partition, "%s", cp);
|
||||
- }else{
|
||||
- fprintf(stderr, "-p requires an argument\n");
|
||||
- exit(EXIT_FAILURE);
|
||||
- }
|
||||
+ partition = optarg;
|
||||
+ if (memcmp(partition, "/dev/", 5) == 0) partition += 5;
|
||||
break;
|
||||
case 'S':
|
||||
- if (argv[1]){
|
||||
- ++argv;
|
||||
- if (!strcmp(*argv, "k")) dataUnit=UNIT_k;
|
||||
- else if (!strcmp(*argv, "K")) dataUnit=UNIT_K;
|
||||
- else if (!strcmp(*argv, "m")) dataUnit=UNIT_m;
|
||||
- else if (!strcmp(*argv, "M")) dataUnit=UNIT_M;
|
||||
- else {fprintf(stderr, "-S requires k, K, m or M (default is kb)\n");
|
||||
- exit(EXIT_FAILURE);
|
||||
- }
|
||||
- strcpy(szDataUnit, *argv);
|
||||
- }else {fprintf(stderr, "-S requires an argument\n");
|
||||
- exit(EXIT_FAILURE);
|
||||
- }
|
||||
+ switch(optarg[0]) {
|
||||
+ case 'b': case 'B': dataUnit = UNIT_B; break;
|
||||
+ case 'k': dataUnit = UNIT_k; break;
|
||||
+ case 'K': dataUnit = UNIT_K; break;
|
||||
+ case 'm': dataUnit = UNIT_m; break;
|
||||
+ case 'M': dataUnit = UNIT_M; break;
|
||||
+ default:
|
||||
+ fprintf(stderr, "-S requires k, K, m or M (default is kb)\n");
|
||||
+ exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ szDataUnit[0] = optarg[0];
|
||||
break;
|
||||
case 's':
|
||||
statMode |= VMSUMSTAT;
|
||||
@@ -674,23 +665,18 @@ int main(int argc, char *argv[]) {
|
||||
default:
|
||||
/* no other aguments defined yet. */
|
||||
usage();
|
||||
- }
|
||||
- }else{
|
||||
- argc++;
|
||||
- switch (argc) {
|
||||
- case 1:
|
||||
- if ((sleep_time = atoi(*argv)) == 0)
|
||||
- usage();
|
||||
- num_updates = ULONG_MAX;
|
||||
- break;
|
||||
- case 2:
|
||||
- num_updates = atol(*argv);
|
||||
- break;
|
||||
- default:
|
||||
- usage();
|
||||
- } /* switch */
|
||||
- }
|
||||
-}
|
||||
+ }
|
||||
+
|
||||
+ if (optind < argc) {
|
||||
+if ((sleep_time = atoi(argv[optind++])) == 0)
|
||||
+ usage();
|
||||
+ num_updates = ULONG_MAX;
|
||||
+ }
|
||||
+ if (optind < argc)
|
||||
+ num_updates = atol(argv[optind++]);
|
||||
+ if (optind < argc)
|
||||
+ usage();
|
||||
+
|
||||
if (moreheaders) {
|
||||
int tmp=winhi()-3;
|
||||
height=((tmp>0)?tmp:22);
|
||||
@@ -0,0 +1,11 @@
|
||||
--- procps-3.2.7/ps/display.c.enable-core 2009-02-27 11:57:21.000000000 +0000
|
||||
+++ procps-3.2.7/ps/display.c 2009-02-27 11:57:48.000000000 +0000
|
||||
@@ -562,6 +562,8 @@
|
||||
default:
|
||||
sigaction(i,&sa,NULL);
|
||||
case 0:
|
||||
+ case SIGABRT:
|
||||
+ case SIGSEGV:
|
||||
case SIGINT: /* ^C */
|
||||
case SIGTSTP: /* ^Z */
|
||||
case SIGTTOU: /* see stty(1) man page */
|
||||
@@ -0,0 +1,138 @@
|
||||
diff -up procps-3.2.8/pmap.c.pmap procps-3.2.8/pmap.c
|
||||
--- procps-3.2.8/pmap.c.pmap 2008-10-19 21:34:34.000000000 +0200
|
||||
+++ procps-3.2.8/pmap.c 2010-02-08 15:40:19.000000000 +0100
|
||||
@@ -126,24 +126,38 @@ static int one_proc(proc_t *p){
|
||||
char buf[32];
|
||||
char mapbuf[9600];
|
||||
char cmdbuf[512];
|
||||
+ FILE *fp;
|
||||
unsigned long total_shared = 0ul;
|
||||
unsigned long total_private_readonly = 0ul;
|
||||
unsigned long total_private_writeable = 0ul;
|
||||
|
||||
+ char *cp2=NULL;
|
||||
+ unsigned long long rss = 0ull;
|
||||
+ unsigned long long private_dirty = 0ull;
|
||||
+ unsigned long long shared_dirty = 0ull;
|
||||
+ unsigned long long total_rss = 0ull;
|
||||
+ unsigned long long total_private_dirty = 0ull;
|
||||
+ unsigned long long total_shared_dirty = 0ull;
|
||||
+ unsigned KLONG diff = 0;
|
||||
+
|
||||
// Overkill, but who knows what is proper? The "w" prog
|
||||
// uses the tty width to determine this.
|
||||
int maxcmd = 0xfffff;
|
||||
|
||||
sprintf(buf,"/proc/%u/maps",p->tgid);
|
||||
- if(!freopen(buf, "r", stdin)) return 1;
|
||||
+ if ( (fp = fopen(buf, "r")) == NULL) return 1;
|
||||
+ if (x_option) {
|
||||
+ sprintf(buf,"/proc/%u/smaps",p->tgid);
|
||||
+ if ( (fp = freopen(buf, "r", fp)) == NULL) return 1;
|
||||
+ }
|
||||
|
||||
escape_command(cmdbuf, p, sizeof cmdbuf, &maxcmd, ESC_ARGS|ESC_BRACKETS);
|
||||
printf("%u: %s\n", p->tgid, cmdbuf);
|
||||
|
||||
if(!q_option && (x_option|d_option)){
|
||||
if(x_option){
|
||||
- if(sizeof(KLONG)==4) printf("Address Kbytes RSS Anon Locked Mode Mapping\n");
|
||||
- else printf("Address Kbytes RSS Anon Locked Mode Mapping\n");
|
||||
+ if(sizeof(KLONG)==4) printf("Address Kbytes RSS Dirty Mode Mapping\n");
|
||||
+ else printf("Address Kbytes RSS Dirty Mode Mapping\n");
|
||||
}
|
||||
if(d_option){
|
||||
if(sizeof(KLONG)==4) printf("Address Kbytes Mode Offset Device Mapping\n");
|
||||
@@ -151,12 +165,54 @@ static int one_proc(proc_t *p){
|
||||
}
|
||||
}
|
||||
|
||||
- while(fgets(mapbuf,sizeof mapbuf,stdin)){
|
||||
+ while(fgets(mapbuf,sizeof mapbuf,fp)){
|
||||
char flags[32];
|
||||
char *tmp; // to clean up unprintables
|
||||
- unsigned KLONG start, end, diff;
|
||||
+ unsigned KLONG start, end;
|
||||
unsigned long long file_offset, inode;
|
||||
unsigned dev_major, dev_minor;
|
||||
+ unsigned long long smap_value;
|
||||
+ char smap_key[20];
|
||||
+
|
||||
+ /* hex values are lower case or numeric, keys are upper */
|
||||
+ if (mapbuf[0] >= 'A' && mapbuf[0] <= 'Z') {
|
||||
+ /* Its a key */
|
||||
+ if (sscanf(mapbuf,"%20[^:]: %llu", smap_key, &smap_value) == 2) {
|
||||
+ if (strncmp("Rss", smap_key, 3) == 0) {
|
||||
+ rss = smap_value;
|
||||
+ total_rss += smap_value;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strncmp("Shared_Dirty", smap_key, 12) == 0) {
|
||||
+ shared_dirty = smap_value;
|
||||
+ total_shared_dirty += smap_value;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strncmp("Private_Dirty", smap_key, 13) == 0) {
|
||||
+ private_dirty = smap_value;
|
||||
+ total_private_dirty += smap_value;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (strncmp("Swap", smap_key, 4) == 0) { /*doesnt matter as long as last*/
|
||||
+ printf(
|
||||
+ (sizeof(KLONG)==8)
|
||||
+ ? "%016"KLF"x %7lu %7llu %7llu %s %s\n"
|
||||
+ : "%08lx %7lu %7llu %7llu %s %s\n",
|
||||
+ start,
|
||||
+ (unsigned long)(diff>>10),
|
||||
+ rss,
|
||||
+ (private_dirty + shared_dirty),
|
||||
+ flags,
|
||||
+ cp2
|
||||
+ );
|
||||
+ /* reset some counters */
|
||||
+ rss = shared_dirty = private_dirty = 0ull;
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* Other keys */
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx %x:%x %Lu", &start, &end, flags, &file_offset, &dev_major, &dev_minor, &inode);
|
||||
|
||||
if(start > range_high)
|
||||
@@ -186,16 +242,9 @@ static int one_proc(proc_t *p){
|
||||
flags[5] = '\0';
|
||||
|
||||
if(x_option){
|
||||
- const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode);
|
||||
- printf(
|
||||
- (sizeof(KLONG)==8)
|
||||
- ? "%016"KLF"x %7lu - - - %s %s\n"
|
||||
- : "%08lx %7lu - - - %s %s\n",
|
||||
- start,
|
||||
- (unsigned long)(diff>>10),
|
||||
- flags,
|
||||
- cp
|
||||
- );
|
||||
+ cp2 = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode);
|
||||
+ /* printed with the keys */
|
||||
+ continue;
|
||||
}
|
||||
if(d_option){
|
||||
const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode);
|
||||
@@ -232,10 +281,12 @@ static int one_proc(proc_t *p){
|
||||
if(!q_option){
|
||||
if(x_option){
|
||||
if(sizeof(KLONG)==8){
|
||||
- printf("---------------- ------ ------ ------ ------\n");
|
||||
+ printf("---------------- ------ ------ ------\n");
|
||||
printf(
|
||||
- "total kB %15ld - - -\n",
|
||||
- (total_shared + total_private_writeable + total_private_readonly) >> 10
|
||||
+ "total kB %15ld %7llu %7llu\n",
|
||||
+ (total_shared + total_private_writeable + total_private_readonly) >> 10,
|
||||
+ total_rss, (total_shared_dirty+total_private_dirty)
|
||||
+
|
||||
);
|
||||
}else{
|
||||
printf("-------- ------- ------- ------- -------\n");
|
||||
@@ -0,0 +1,10 @@
|
||||
--- procps-3.2.7/pwdx.c
|
||||
+++ procps-3.2.7/pwdx.c 2006-06-26 16:38:12.000000000 +0200
|
||||
@@ -60,6 +60,7 @@
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (regexec(&re, argv[i], 0, NULL, 0) != 0) {
|
||||
snprintf(buf, sizeof buf, "pwdx: invalid process id: %s\n", argv[i]);
|
||||
+ buf[sizeof(buf)-1] = '\0';
|
||||
die(buf);
|
||||
}
|
||||
if (!strcmp("-V", argv[i]) || !strcmp("--version", argv[i]))
|
||||
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>procps</Name>
|
||||
<Homepage>http://procps.sourceforge.net/</Homepage>
|
||||
<Packager>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Packager>
|
||||
<License>GPLv2</License>
|
||||
<IsA>app:console</IsA>
|
||||
<Summary>Standard informational utilities and process-handling tools</Summary>
|
||||
<Description>procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill.</Description>
|
||||
<Archive sha1sum="a0c86790569dec26b5d9037e8868ca907acc9829" type="targz">http://procps.sf.net/procps-3.2.8.tar.gz</Archive>
|
||||
<BuildDependencies>
|
||||
<Dependency>ncurses</Dependency>
|
||||
</BuildDependencies>
|
||||
<Patches>
|
||||
<Patch level="1">procps-3.2.5-proc-mount.patch</Patch>
|
||||
<Patch level="1">nohz.patch</Patch>
|
||||
<Patch level="1">procps-3.2.5-eof.diff</Patch>
|
||||
<Patch level="1">procps-3.2.2-top-termsize.patch</Patch>
|
||||
<Patch level="1">procps-3.2.2-w-simply-work.diff</Patch>
|
||||
<Patch level="1">procps-3.2.7-top.1.diff</Patch>
|
||||
<Patch level="1">pwdx-bufferoverflow.diff</Patch>
|
||||
|
||||
<!-- Fedora patches -->
|
||||
|
||||
<!--<Patch level="1">procps-3.2.7-selinux.patch</Patch>-->
|
||||
<Patch level="1">procps-3.2.7-libselinux.patch</Patch>
|
||||
<!--<Patch level="1">procps-3.2.7-selinux-workaround.patch</Patch>-->
|
||||
<Patch level="1">procps-3.2.7-ps-libselinux.patch</Patch>
|
||||
|
||||
<Patch level="1">procps-3.2.7-misc.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-FAQ.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-noproc.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-pseudo.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-0x9b.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-sysctl-writeonly.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-rc.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-remcpu.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-env-vmsize.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-env-cpuloop.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-cpusteal.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-longcmd.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-pgpg.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-sysctl-ignore.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-sorthigh.path</Patch>
|
||||
<Patch level="1">procps-3.2.7-w-best.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-watch-unicode.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-ps-stime.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-ps-eip64.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-psman.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-cpu0.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-cpuint.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-manpage.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-top-clrscr.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-ps-man-fmt.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-partstats-long.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-header.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-slabtop-once.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-timestamp.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-timestamp-manpage.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-ps-cgroup.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-vmstat-partstats-reqwrites.patch</Patch>
|
||||
<Patch level="1">procps-3.2.7-free-hlmem.patch</Patch>
|
||||
<Patch level="1">procps-3.2.8-threads.patch</Patch>
|
||||
<Patch level="1">procps-enable-core.patch</Patch>
|
||||
<Patch level="1">procps-3.2.8-setlocale.patch</Patch>
|
||||
<Patch level="1">procps-pmap-smaps.patch</Patch>
|
||||
<!--<Patch level="1">procps-3.2.7-vmstat-sm.patch</Patch>-->
|
||||
<Patch level="1">procps-3.2.8-vmstat-getopt.patch</Patch>
|
||||
<Patch level="1">procps-3.2.8-ps-cgroup-suppress-root-group.patch</Patch>
|
||||
<Patch level="1">procps-3.2.8-make.patch</Patch>
|
||||
<Patch level="1">procps-3.2.8-constructor-order.patch</Patch>
|
||||
</Patches>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>procps</Name>
|
||||
<RuntimeDependencies>
|
||||
<Dependency>ncurses</Dependency>
|
||||
</RuntimeDependencies>
|
||||
<Files>
|
||||
<Path fileType="executable">/bin</Path>
|
||||
<Path fileType="executable">/sbin</Path>
|
||||
<Path fileType="library">/lib</Path>
|
||||
<Path fileType="executable">/usr/bin</Path>
|
||||
<Path fileType="doc">/usr/share/doc</Path>
|
||||
<Path fileType="man">/usr/share/man</Path>
|
||||
<Path fileType="header">/usr/include</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="2">
|
||||
<Date>2014-05-11</Date>
|
||||
<Version>3.2.8</Version>
|
||||
<Comment>Release bump.</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="1">
|
||||
<Date>2010-10-12</Date>
|
||||
<Version>3.2.8</Version>
|
||||
<Comment>First release</Comment>
|
||||
<Name>Pisi Linux Admins</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Update>
|
||||
</History>
|
||||
</PISI>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" ?>
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>procps</Name>
|
||||
<Summary xml:lang="tr">Geleneksel bilgilendirme yardımcı programları ve süreç işleme araçları</Summary>
|
||||
<Description xml:lang="tr">Procps /proc dosya sistemini kullanarak çalışan süreçler hakkında bilgi vermeye yarayan bazı kullanışlı uygulamaları içeren bir pakettir. Paket ps, top, vmstat, w, kill, free, slabtop ve skill gibi uygulamaları içerir.</Description>
|
||||
<Description xml:lang="fr">procps est un paquet regroupant une multitude de petits utilitaires utiles donnant des informations concernant les process en utilisant le système de fichier /proc. Le paquet inclus les programmes ps, top, vmstat, w, kill, free, slabtop et skill.</Description>
|
||||
</Source>
|
||||
</PISI>
|
||||
Reference in New Issue
Block a user