diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2009-03-18 21:55:05 +0000 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2009-03-18 21:55:05 +0000 |
commit | 4bc4ef091bc24718fc06c58a16a7b749a4518d77 (patch) | |
tree | 39af4842124545b16de3f681b162fbadcb063bc3 | |
parent | 1df18ea60f81d5a5a54384b403808e51a21e8484 (diff) | |
download | ptxdist-4bc4ef091bc24718fc06c58a16a7b749a4518d77.tar.gz ptxdist-4bc4ef091bc24718fc06c58a16a7b749a4518d77.tar.xz |
[procps] add debian's patches
These are debian's procps patches:
http://ftp.de.debian.org/debian/pool/main/p/procps/procps_3.2.7-11.diff.gz
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@10122 33e552b5-05e3-0310-8538-816dae2090ed
54 files changed, 5793 insertions, 0 deletions
diff --git a/patches/procps-3.2.7/generic/10_free.1.dpatch b/patches/procps-3.2.7/generic/10_free.1.dpatch new file mode 100644 index 000000000..75eb73846 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_free.1.dpatch @@ -0,0 +1,66 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_free.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: -g flag documented #286900 +## DP: hypen escaped #282168 + +@DPATCH@ +diff -urNad procps-3.2.7~/free.1 procps-3.2.7/free.1 +--- procps-3.2.7~/free.1 2004-02-24 08:35:55.000000000 +1100 ++++ procps-3.2.7/free.1 2007-10-04 22:32:20.000000000 +1000 +@@ -5,7 +5,7 @@ + .SH NAME + free \- Display amount of free and used memory in the system + .SH SYNOPSIS +-.BR "free " [ "\-b" " | " "\-k" " | " "\-m" "] [" "\-o" "] [" "\-s" ++.BR "free " [ "\-b" " | " "\-k" " | " "\-m" " | " "\-g" "] [" "\-o" "] [" "\-s" + .I delay + .RB "] [" "\-t" "] [" "\-V" ] + .SH DESCRIPTION +@@ -13,32 +13,34 @@ + memory in the system, as well as the buffers used by the kernel. + The shared memory column should be ignored; it is obsolete. + .SS Options +-The \fB-b\fP switch displays the amount of memory in bytes; the +-\fB-k\fP switch (set by default) displays it in kilobytes; the \fB-m\fP +-switch displays it in megabytes. ++The \fB\-b\fP switch displays the amount of memory in bytes; the ++\fB\-k\fP switch (set by default) displays it in kilobytes; the \fB\-m\fP ++switch displays it in megabytes; the \fB\-g\fP switch displays it in ++gigabytes. + .PP +-The \fB-t\fP switch displays a line containing the totals. ++The \fB\-t\fP switch displays a line containing the totals. + .PP +-The \fB-o\fP switch disables the display of a "buffer adjusted" line. +-If the -o option is not specified, \fBfree\fP subtracts buffer memory ++The \fB\-o\fP switch disables the display of a "buffer adjusted" line. ++If the \-o option is not specified, \fBfree\fP subtracts buffer memory + from the used memory and adds it to the free memory reported. + .PP +-The \fB-s\fP switch activates continuous polling \fIdelay\fP seconds apart. You ++The \fB\-s\fP switch activates continuous polling \fIdelay\fP seconds apart. You + may actually specify any floating point number for \fIdelay\fP, + .BR usleep (3) + is used for microsecond resolution delay times. + .PP + The \fB\-V\fP displays version information. + .SH FILES +-.ta +-.IR /proc/meminfo "\-\- memory information" +-.fi ++.TP ++.I /proc/meminfo ++memory information ++ + + .SH "SEE ALSO" + .BR ps (1), + .BR slabtop (1), + .BR vmstat (8), +-.BR top(1) ++.BR top (1) + + .SH AUTHORS + Written by Brian Edmonds. diff --git a/patches/procps-3.2.7/generic/10_output_sort_time.dpatch b/patches/procps-3.2.7/generic/10_output_sort_time.dpatch new file mode 100644 index 000000000..f6def835e --- /dev/null +++ b/patches/procps-3.2.7/generic/10_output_sort_time.dpatch @@ -0,0 +1,2059 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_output_sort_time.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: More ps time sorting #508435 + +@DPATCH@ +diff -urNad procps-3.2.7~/ps/output.c procps-3.2.7/ps/output.c +--- procps-3.2.7~/ps/output.c 2006-06-19 09:27:02.000000000 +1000 ++++ procps-3.2.7/ps/output.c 2009-01-07 17:52:09.000000000 +1100 +@@ -110,6 +110,20 @@ + return (int)(P->NAME) - (int)(Q->NAME); \ + } + ++#define cook_time(P) (P->utime + P->stime) / Hertz ++ ++#define cook_etime(P) seconds_since_boot - (unsigned long)(P->start_time / Hertz) ++ ++#define CMP_COOKED_TIME(NAME) \ ++static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \ ++ unsigned long p_time,q_time; \ ++ p_time=cook_ ##NAME (P); \ ++ q_time=cook_ ##NAME (Q); \ ++ if (p_time < q_time) return -1; \ ++ if (p_time > q_time) return 1; \ ++ return 0; \ ++} ++ + CMP_INT(rtprio) + CMP_SMALL(sched) + CMP_INT(cutime) +@@ -185,6 +199,9 @@ + + CMP_SMALL(state) + ++CMP_COOKED_TIME(time) ++CMP_COOKED_TIME(etime) ++ + /* approximation to: kB of address space that could end up in swap */ + static int sr_swapable(const proc_t* P, const proc_t* Q) { + unsigned long p_swapable = P->vm_data + P->vm_stack; +@@ -408,7 +425,7 @@ + unsigned long t; + unsigned dd,hh,mm,ss; + char *cp = outbuf; +- t = seconds_since_boot - (unsigned long)(pp->start_time / Hertz); ++ t = cook_etime(pp); + ss = t%60; + t /= 60; + mm = t%60; +@@ -476,7 +493,7 @@ + unsigned long t; + unsigned dd,hh,mm,ss; + int c; +- t = (pp->utime + pp->stime) / Hertz; ++ t = cook_time(pp); + ss = t%60; + t /= 60; + mm = t%60; +@@ -1277,7 +1294,7 @@ + {"alarm", "ALARM", pr_alarm, sr_alarm, 5, 0, LNX, AN|RIGHT}, + {"argc", "ARGC", pr_nop, sr_nop, 4, 0, LNX, PO|RIGHT}, + {"args", "COMMAND", pr_args, sr_cmd, 27, ARG, U98, PO|UNLIMITED}, /*command*/ +-{"atime", "TIME", pr_time, sr_nop, 8, 0, SOE, ET|RIGHT}, /*cputime*/ /* was 6 wide */ ++{"atime", "TIME", pr_time, sr_time, 8, 0, SOE, ET|RIGHT}, /*cputime*/ /* was 6 wide */ + {"blocked", "BLOCKED", pr_sigmask, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigmask*/ + {"bnd", "BND", pr_nop, sr_nop, 1, 0, AIX, TO|RIGHT}, + {"bsdstart", "START", pr_bsdstart, sr_nop, 6, 0, LNX, ET|RIGHT}, +@@ -1296,7 +1313,7 @@ + {"cp", "CP", pr_cp, sr_pcpu, 3, 0, DEC, ET|RIGHT}, /*cpu*/ + {"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */ + {"cpuid", "CPUID", pr_psr, sr_nop, 5, 0, BSD, TO|RIGHT}, // OpenBSD: 8 wide! +-{"cputime", "TIME", pr_time, sr_nop, 8, 0, DEC, ET|RIGHT}, /*time*/ ++{"cputime", "TIME", pr_time, sr_time, 8, 0, DEC, ET|RIGHT}, /*time*/ + {"cstime", "-", pr_nop, sr_cstime, 1, 0, LNX, AN|RIGHT}, + {"ctid", "CTID", pr_nop, sr_nop, 5, 0, SUN, ET|RIGHT}, // resource contracts? + {"cursig", "CURSIG", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT}, +@@ -1311,7 +1328,7 @@ + {"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, PO|RIGHT}, + {"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, PO|UNLIMITED}, + {"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, TO|RIGHT}, +-{"etime", "ELAPSED", pr_etime, sr_nop, 11, 0, U98, ET|RIGHT}, /* was 7 wide */ ++{"etime", "ELAPSED", pr_etime, sr_etime, 11, 0, U98, ET|RIGHT}, /* was 7 wide */ + {"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, ET|RIGHT}, + {"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, ET|USER}, + {"f", "F", pr_flag, sr_flags, 1, 0, XXX, ET|RIGHT}, /*flags*/ +@@ -1455,7 +1472,7 @@ + {"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT}, + {"thcount", "THCNT", pr_nlwp, sr_nlwp, 5, 0, AIX, PO|RIGHT}, + {"tid", "TID", pr_thread, sr_tid, 5, 0, AIX, TO|PIDMAX|RIGHT}, +-{"time", "TIME", pr_time, sr_nop, 8, 0, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */ ++{"time", "TIME", pr_time, sr_time, 8, 0, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */ + {"timeout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era + {"tmout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era + {"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, PO|LEFT}, +diff -urNad procps-3.2.7~/ps/output.c.orig procps-3.2.7/ps/output.c.orig +--- procps-3.2.7~/ps/output.c.orig 1970-01-01 10:00:00.000000000 +1000 ++++ procps-3.2.7/ps/output.c.orig 2006-06-19 09:27:02.000000000 +1000 +@@ -0,0 +1,1960 @@ ++/* ++ * Copyright 1999-2004 by Albert Cahalan; all rights reserved. ++ * ++ * This file may be used subject to the terms and conditions of the ++ * GNU Library General Public License Version 2, or any later version ++ * at your option, as published by the Free Software Foundation. ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Library General Public License for more details. ++ */ ++ ++/* ++ * This file is really gross, and I know it. I looked into several ++ * alternate ways to deal with the mess, and they were all ugly. ++ * ++ * FreeBSD has a fancy hack using offsets into a struct -- that ++ * saves code but it is _really_ gross. See the PO macro below. ++ * ++ * We could have a second column width for wide output format. ++ * For example, Digital prints the real-time signals. ++ */ ++ ++ ++/* ++ * Data table idea: ++ * ++ * table 1 maps aix to specifier ++ * table 2 maps shortsort to specifier ++ * table 3 maps macro to specifiers ++ * table 4 maps specifier to title,datatype,offset,vendor,helptext ++ * table 5 maps datatype to justification,width,widewidth,sorting,printing ++ * ++ * Here, "datatype" could be user,uid,u16,pages,deltaT,signals,tty,longtty... ++ * It must be enough to determine printing and sorting. ++ * ++ * After the tables, increase width as needed to fit the header. ++ * ++ * Table 5 could go in a file with the output functions. ++ */ ++ ++#include <ctype.h> ++#include <fcntl.h> ++#include <grp.h> ++#include <limits.h> ++#include <pwd.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <sys/ioctl.h> ++#include <sys/resource.h> ++#include <sys/types.h> ++#include <sys/mman.h> ++#include <time.h> ++#include <unistd.h> ++#include <dlfcn.h> ++ ++#include "../proc/readproc.h" ++#include "../proc/sysinfo.h" ++#include "../proc/wchan.h" ++#include "../proc/procps.h" ++#include "../proc/devname.h" ++#include "../proc/escape.h" ++#include "common.h" ++ ++/* TODO: ++ * Stop assuming system time is local time. ++ */ ++ ++#define COLWID 240 /* satisfy snprintf, which is faster than sprintf */ ++ ++static unsigned max_rightward = 0x12345678; /* space for RIGHT stuff */ ++static unsigned max_leftward = 0x12345678; /* space for LEFT stuff */ ++ ++ ++ ++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; ++ ++ ++/*************************************************************************/ ++/************ Lots of sort functions, starting with the NOP **************/ ++ ++static int sr_nop(const proc_t* a, const proc_t* b){ ++ (void)a;(void)b; /* shut up gcc */ ++ return 0; ++} ++ ++#define CMP_STR(NAME) \ ++static int sr_ ## NAME(const proc_t* P, const proc_t* Q) { \ ++ return strcmp(P->NAME, Q->NAME); \ ++} ++ ++#define CMP_INT(NAME) \ ++static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \ ++ if (P->NAME < Q->NAME) return -1; \ ++ if (P->NAME > Q->NAME) return 1; \ ++ return 0; \ ++} ++ ++/* fast version, for values which either: ++ * a. differ by no more than 0x7fffffff ++ * b. only need to be grouped same w/ same ++ */ ++#define CMP_SMALL(NAME) \ ++static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \ ++ return (int)(P->NAME) - (int)(Q->NAME); \ ++} ++ ++CMP_INT(rtprio) ++CMP_SMALL(sched) ++CMP_INT(cutime) ++CMP_INT(cstime) ++CMP_SMALL(priority) /* nice */ ++CMP_SMALL(nlwp) ++CMP_SMALL(nice) /* priority */ ++CMP_INT(rss) /* resident set size from stat file */ /* vm_rss, resident */ ++CMP_INT(alarm) ++CMP_INT(size) /* total pages */ /* vm_size, vsize */ ++CMP_INT(resident) /* resident pages */ /* vm_rss, rss */ ++CMP_INT(share) /* shared pages */ ++CMP_INT(trs) /* executable pages */ ++CMP_INT(lrs) /* obsolete "library" pages above 0x60000000 */ ++CMP_INT(drs) /* other pages (assumed data?) */ ++CMP_INT(dt) /* dirty pages */ ++ ++CMP_INT(vm_size) /* kB VM */ /* size, vsize */ ++CMP_INT(vm_lock) /* kB locked */ ++CMP_INT(vm_rss) /* kB rss */ /* rss, resident */ ++CMP_INT(vm_data) /* kB "data" == data-stack */ ++CMP_INT(vm_stack) /* kB stack */ ++CMP_INT(vm_exe) /* kB "exec" == exec-lib */ ++CMP_INT(vm_lib) /* kB "libraries" */ ++CMP_INT(vsize) /* pages VM */ /* size, vm_size */ ++CMP_INT(rss_rlim) ++CMP_SMALL(flags) ++CMP_INT(min_flt) ++CMP_INT(maj_flt) ++CMP_INT(cmin_flt) ++CMP_INT(cmaj_flt) ++CMP_INT(utime) ++CMP_INT(stime) /* Old: sort by systime. New: show start time. Uh oh. */ ++CMP_INT(start_code) ++CMP_INT(end_code) ++CMP_INT(start_stack) ++CMP_INT(kstk_esp) ++CMP_INT(kstk_eip) ++CMP_INT(start_time) ++CMP_INT(wchan) ++ ++/* CMP_STR(*environ) */ ++/* CMP_STR(*cmdline) */ ++ ++CMP_STR(ruser) ++CMP_STR(euser) ++CMP_STR(suser) ++CMP_STR(fuser) ++CMP_STR(rgroup) ++CMP_STR(egroup) ++CMP_STR(sgroup) ++CMP_STR(fgroup) ++CMP_STR(cmd) ++/* CMP_STR(ttyc) */ /* FIXME -- use strncmp with 8 max */ ++ ++CMP_INT(ruid) ++CMP_INT(rgid) ++CMP_INT(euid) ++CMP_INT(egid) ++CMP_INT(suid) ++CMP_INT(sgid) ++CMP_INT(fuid) ++CMP_INT(fgid) ++CMP_SMALL(tid) ++CMP_SMALL(tgid) ++CMP_SMALL(ppid) ++CMP_SMALL(pgrp) ++CMP_SMALL(session) ++CMP_INT(tty) ++CMP_SMALL(tpgid) ++ ++CMP_SMALL(pcpu) ++ ++CMP_SMALL(state) ++ ++/* approximation to: kB of address space that could end up in swap */ ++static int sr_swapable(const proc_t* P, const proc_t* Q) { ++ unsigned long p_swapable = P->vm_data + P->vm_stack; ++ unsigned long q_swapable = Q->vm_data + Q->vm_stack; ++ if (p_swapable < q_swapable) return -1; ++ if (p_swapable > q_swapable) return 1; ++ return 0; ++} ++ ++ ++/***************************************************************************/ ++/************ Lots of format functions, starting with the NOP **************/ ++ ++// so popular it can't be "static" ++int pr_nop(char *restrict const outbuf, const proc_t *restrict const pp){ ++ (void)pp; ++ return snprintf(outbuf, COLWID, "%c", '-'); ++} ++ ++ ++/********* Unix 98 ************/ ++ ++/*** ++ ++Only comm and args are allowed to contain blank characters; all others are ++not. Any implementation-dependent variables will be specified in the system ++documentation along with the default header and indicating if the field ++may contain blank characters. ++ ++Some headers do not have a standardized specifier! ++ ++%CPU pcpu The % of cpu time used recently, with unspecified "recently". ++ADDR The address of the process. ++C Processor utilisation for scheduling. ++CMD The command name, or everything with -f. ++COMMAND args Command + args. May chop as desired. May use either version. ++COMMAND comm argv[0] ++ELAPSED etime Elapsed time since the process was started. [[dd-]hh:]mm:ss ++F Flags (octal and additive) ++GROUP group Effective group ID, prefer text over decimal. ++NI nice Decimal system scheduling priority, see nice(1). ++PGID pgid The decimal value of the process group ID. ++PID pid Decimal PID. ++PPID ppid Decimal PID. ++PRI Priority. Higher numbers mean lower priority. ++RGROUP rgroup Real group ID, prefer text over decimal. ++RUSER ruser Real user ID, prefer text over decimal. ++S The state of the process. ++STIME Starting time of the process. ++SZ The size in blocks of the core image of the process. ++TIME time Cumulative CPU time. [dd-]hh:mm:ss ++TT tty Name of tty in format used by who(1). ++TTY The controlling terminal for the process. ++UID UID, or name when -f ++USER user Effective user ID, prefer text over decimal. ++VSZ vsz Virtual memory size in decimal kB. ++WCHAN Where waiting/sleeping or blank if running. ++ ++The nice value is used to compute the priority. ++ ++For some undefined ones, Digital does: ++ ++F flag Process flags -- but in hex! ++PRI pri Process priority ++S state Symbolic process status ++TTY tt,tty,tname,longtname -- all do "ttyp1", "console", "??" ++UID uid Process user ID (effective UID) ++WCHAN wchan Address of event on which a ++ ++For some undefined ones, Sun does: ++ ++ADDR addr memory address of the process ++C c Processor utilization for scheduling (obsolete). ++CMD ++F f ++S s state: OSRZT ++STIME start time, printed w/o blanks. If 24h old, months & days ++SZ size (in pages) of the swappable process's image in main memory ++TTY ++UID uid ++WCHAN wchan ++ ++For some undefined ones, SCO does: ++ADDR addr Virtual address of the process' entry in the process table. ++SZ swappable size in kB of the virtual data and stack ++STIME stime hms or md time format ++***/ ++ ++/* Source & destination are known. Return bytes or screen characters? */ ++static int forest_helper(char *restrict const outbuf){ ++ char *p = forest_prefix; ++ char *q = outbuf; ++ int rightward=max_rightward; ++ if(!*p) return 0; ++ /* Arrrgh! somebody defined unix as 1 */ ++ if(forest_type == 'u') goto unixy; ++ while(*p){ ++ switch(*p){ ++ case ' ': strcpy(q, " "); break; ++ case 'L': strcpy(q, " \\_ "); break; ++ case '+': strcpy(q, " \\_ "); break; ++ case '|': strcpy(q, " | "); break; ++ case '\0': return q-outbuf; /* redundant & not used */ ++ } ++ if (rightward-4 < 0) { ++ *(q+rightward)='\0'; ++ return max_rightward; ++ } ++ q += 4; ++ rightward -= 4; ++ p++; ++ } ++ return q-outbuf; /* gcc likes this here */ ++unixy: ++ while(*p){ ++ switch(*p){ ++ case ' ': strcpy(q, " "); break; ++ case 'L': strcpy(q, " "); break; ++ case '+': strcpy(q, " "); break; ++ case '|': strcpy(q, " "); break; ++ case '\0': return q-outbuf; /* redundant & not used */ ++ } ++ if (rightward-2 < 0) { ++ *(q+rightward)='\0'; ++ return max_rightward; ++ } ++ q += 2; ++ rightward -= 2; ++ p++; ++ } ++ return q-outbuf; /* gcc likes this here */ ++} ++ ++ ++/* XPG4-UNIX, according to Digital: ++The "args" and "command" specifiers show what was passed to the command. ++Modifications to the arguments are not shown. ++*/ ++ ++/* ++ * pp->cmd short accounting name (comm & ucomm) ++ * pp->cmdline long name with args (args & command) ++ * pp->environ environment ++ */ ++ ++// FIXME: some of these may hit the guard page in forest mode ++ ++/* "command" is the same thing: long unless c */ ++static int pr_args(char *restrict const outbuf, const proc_t *restrict const pp){ ++ char *endp = outbuf; ++ unsigned flags; ++ int rightward=max_rightward; ++ ++ if(forest_prefix){ ++ int fh = forest_helper(outbuf); ++ endp += fh; ++ rightward -= fh; ++ } ++ if(bsd_c_option) flags = ESC_DEFUNCT; ++ else flags = ESC_DEFUNCT | ESC_BRACKETS | ESC_ARGS; ++ endp += escape_command(endp, pp, OUTBUF_SIZE, &rightward, flags); ++ ++ if(bsd_e_option && rightward>1){ ++ const char **env = (const char**)pp->environ; ++ if(env && *env){ ++ *endp++ = ' '; ++ rightward--; ++ endp += escape_strlist(endp, env, OUTBUF_SIZE, &rightward); ++ } ++ } ++ //return endp - outbuf; ++ return max_rightward-rightward; ++} ++ ++/* "ucomm" is the same thing: short unless -f */ ++static int pr_comm(char *restrict const outbuf, const proc_t *restrict const pp){ ++ char *endp = outbuf; ++ unsigned flags; ++ int rightward=max_rightward; ++ ++ if(forest_prefix){ ++ int fh = forest_helper(outbuf); ++ endp += fh; ++ rightward -= fh; ++ } ++ if(unix_f_option) flags = ESC_DEFUNCT | ESC_BRACKETS | ESC_ARGS; ++ else flags = ESC_DEFUNCT; ++ endp += escape_command(endp, pp, OUTBUF_SIZE, &rightward, flags); ++ ++ if(bsd_e_option && rightward>1){ ++ const char **env = (const char**)pp->environ; ++ if(env && *env){ ++ *endp++ = ' '; ++ rightward--; ++ endp += escape_strlist(endp, env, OUTBUF_SIZE, &rightward); ++ } ++ } ++ //return endp - outbuf; ++ return max_rightward-rightward; ++} ++/* Non-standard, from SunOS 5 */ ++static int pr_fname(char *restrict const outbuf, const proc_t *restrict const pp){ ++ char *endp = outbuf; ++ int rightward = max_rightward; ++ ++ if(forest_prefix){ ++ int fh = forest_helper(outbuf); ++ endp += fh; ++ rightward -= fh; ++ } ++ if (rightward>8) /* 8=default, but forest maybe feeds more */ ++ rightward = 8; ++ ++ endp += escape_str(endp, pp->cmd, OUTBUF_SIZE, &rightward); ++ //return endp - outbuf; ++ return max_rightward-rightward; ++} ++ ++/* elapsed wall clock time, [[dd-]hh:]mm:ss format (not same as "time") */ ++static int pr_etime(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long t; ++ unsigned dd,hh,mm,ss; ++ char *cp = outbuf; ++ t = seconds_since_boot - (unsigned long)(pp->start_time / Hertz); ++ ss = t%60; ++ t /= 60; ++ mm = t%60; ++ t /= 60; ++ hh = t%24; ++ t /= 24; ++ dd = t; ++ cp +=( dd ? snprintf(cp, COLWID, "%u-", dd) : 0 ); ++ cp +=( (dd || hh) ? snprintf(cp, COLWID, "%02u:", hh) : 0 ); ++ cp += snprintf(cp, COLWID, "%02u:%02u", mm, ss) ; ++ return (int)(cp-outbuf); ++} ++ ++/* "Processor utilisation for scheduling." --- we use %cpu w/o fraction */ ++static int pr_c(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long long total_time; /* jiffies used by this process */ ++ unsigned pcpu = 0; /* scaled %cpu, 99 means 99% */ ++ unsigned long long seconds; /* seconds of process life */ ++ total_time = pp->utime + pp->stime; ++ if(include_dead_children) total_time += (pp->cutime + pp->cstime); ++ seconds = seconds_since_boot - pp->start_time / Hertz; ++ if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds; ++ if (pcpu > 99U) pcpu = 99U; ++ return snprintf(outbuf, COLWID, "%2u", pcpu); ++} ++/* normal %CPU in ##.# format. */ ++static int pr_pcpu(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long long total_time; /* jiffies used by this process */ ++ unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */ ++ unsigned long long seconds; /* seconds of process life */ ++ total_time = pp->utime + pp->stime; ++ if(include_dead_children) total_time += (pp->cutime + pp->cstime); ++ seconds = seconds_since_boot - pp->start_time / Hertz; ++ if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; ++ if (pcpu > 999U) ++ return snprintf(outbuf, COLWID, "%u", pcpu/10U); ++ return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U); ++} ++/* this is a "per-mill" format, like %cpu with no decimal point */ ++static int pr_cp(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long long total_time; /* jiffies used by this process */ ++ unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */ ++ unsigned long long seconds; /* seconds of process life */ ++ total_time = pp->utime + pp->stime; ++ if(include_dead_children) total_time += (pp->cutime + pp->cstime); ++ seconds = seconds_since_boot - pp->start_time / Hertz ; ++ if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; ++ if (pcpu > 999U) pcpu = 999U; ++ return snprintf(outbuf, COLWID, "%3u", pcpu); ++} ++ ++static int pr_pgid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%u", pp->pgrp); ++} ++static int pr_pid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%u", pp->tgid); ++} ++static int pr_ppid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%u", pp->ppid); ++} ++ ++ ++/* cumulative CPU time, [dd-]hh:mm:ss format (not same as "etime") */ ++static int pr_time(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long t; ++ unsigned dd,hh,mm,ss; ++ int c; ++ t = (pp->utime + pp->stime) / Hertz; ++ ss = t%60; ++ t /= 60; ++ mm = t%60; ++ t /= 60; ++ hh = t%24; ++ t /= 24; ++ dd = t; ++ c =( dd ? snprintf(outbuf, COLWID, "%u-", dd) : 0 ); ++ c +=( snprintf(outbuf+c, COLWID, "%02u:%02u:%02u", hh, mm, ss) ); ++ return c; ++} ++ ++/* HP-UX puts this (I forget, vsz or vsize?) in kB and uses "sz" for pages. ++ * Unix98 requires "vsz" to be kB. ++ * Tru64 does both vsize and vsz like "1.23M" ++ * ++ * Our pp->vm_size is kB and our pp->vsize is pages. ++ * ++ * TODO: add flag for "1.23M" behavior, on this and other columns. ++ */ ++static int pr_vsz(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%lu", pp->vm_size); ++} ++ ++////////////////////////////////////////////////////////////////////////////////////// ++ ++// "PRI" is created by "opri", or by "pri" when -c is used. ++// ++// Unix98 only specifies that a high "PRI" is low priority. ++// Sun and SCO add the -c behavior. Sun defines "pri" and "opri". ++// Linux may use "priority" for historical purposes. ++// ++// According to the kernel's fs/proc/array.c and kernel/sched.c source, ++// the kernel reports it in /proc via this: ++// p->prio - MAX_RT_PRIO ++// such that "RT tasks are offset by -200. Normal tasks are centered ++// around 0, value goes from -16 to +15" but who knows if that is ++// before or after the conversion... ++// ++// <linux/sched.h> says: ++// MAX_RT_PRIO is currently 100. (so we see 0 in /proc) ++// RT tasks have a p->prio of 0 to 99. (so we see -100 to -1) ++// non-RT tasks are from 100 to 139. (so we see 0 to 39) ++// Lower values have higher priority, as in the UNIX standard. ++// ++// In any case, pp->priority+100 should get us back to what the kernel ++// has for p->prio. ++// ++// Test results with the "yes" program on a 2.6.x kernel: ++// ++// # ps -C19,_20 -o pri,opri,intpri,priority,ni,pcpu,pid,comm ++// PRI PRI PRI PRI NI %CPU PID COMMAND ++// 0 99 99 39 19 10.6 8686 19 ++// 34 65 65 5 -20 94.7 8687 _20 ++// ++// Grrr. So the UNIX standard "PRI" must NOT be from "pri". ++// Either of the others will do. We use "opri" for this. ++// (and use "pri" when the "-c" option is used) ++// Probably we should have Linux-specific "pri_for_l" and "pri_for_lc" ++// ++// sched_get_priority_min.2 says the Linux static priority is ++// 1..99 for RT and 0 for other... maybe 100 is kernel-only? ++// ++// A nice range would be -99..0 for RT and 1..40 for normal, ++// which is pp->priority+1. (3-digit max, positive is normal, ++// negative or 0 is RT, and meets the standard for PRI) ++// ++ ++// legal as UNIX "PRI" ++// "priority" (was -20..20, now -100..39) ++static int pr_priority(char *restrict const outbuf, const proc_t *restrict const pp){ /* -20..20 */ ++ return snprintf(outbuf, COLWID, "%ld", pp->priority); ++} ++ ++// legal as UNIX "PRI" ++// "intpri" and "opri" (was 39..79, now -40..99) ++static int pr_opri(char *restrict const outbuf, const proc_t *restrict const pp){ /* 39..79 */ ++ return snprintf(outbuf, COLWID, "%ld", 60 + pp->priority); ++} ++ ++// legal as UNIX "PRI" ++// "pri_foo" -- match up w/ nice values of sleeping processes (-120..19) ++static int pr_pri_foo(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%ld", pp->priority - 20); ++} ++ ++// legal as UNIX "PRI" ++// "pri_bar" -- makes RT pri show as negative (-99..40) ++static int pr_pri_bar(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%ld", pp->priority + 1); ++} ++ ++// legal as UNIX "PRI" ++// "pri_baz" -- the kernel's ->prio value, as of Linux 2.6.8 (1..140) ++static int pr_pri_baz(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%ld", pp->priority + 100); ++} ++ ++ ++// not legal as UNIX "PRI" ++// "pri" (was 20..60, now 0..139) ++static int pr_pri(char *restrict const outbuf, const proc_t *restrict const pp){ /* 20..60 */ ++ return snprintf(outbuf, COLWID, "%ld", 39 - pp->priority); ++} ++ ++// not legal as UNIX "PRI" ++// "pri_api" -- match up w/ RT API (-40..99) ++static int pr_pri_api(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%ld", -1 - pp->priority); ++} ++ ++static int pr_nice(char *restrict const outbuf, const proc_t *restrict const pp){ ++ if(pp->sched!=0 && pp->sched!=-1) return snprintf(outbuf, COLWID, "-"); ++ return snprintf(outbuf, COLWID, "%ld", pp->nice); ++} ++ ++// HP-UX "cls": RT RR RR2 ???? HPUX FIFO KERN ++// Solaris "class": SYS TS FX IA RT FSS (FIFO is RR w/ Inf quant) ++// FIFO+RR share RT; FIFO has Inf quant ++// IA=interactive; FX=fixed; TS=timeshare; SYS=system ++// FSS=fairshare; INTS=interrupts ++// Tru64 "policy": FF RR TS ++// IRIX "class": RT TS B BC WL GN ++// RT=real-time; TS=time-share; B=batch; BC=batch-critical ++// WL=weightless; GN=gang-scheduled ++// see miser(1) for this; PRI has some letter codes too ++static int pr_class(char *restrict const outbuf, const proc_t *restrict const pp){ ++ switch(pp->sched){ ++ case -1: return snprintf(outbuf, COLWID, "-"); // not reported ++ case 0: return snprintf(outbuf, COLWID, "TS"); // SCHED_OTHER ++ case 1: return snprintf(outbuf, COLWID, "FF"); // SCHED_FIFO ++ case 2: return snprintf(outbuf, COLWID, "RR"); // SCHED_RR ++ case 3: return snprintf(outbuf, COLWID, "B"); // SCHED_BATCH? (will be "B") ++ case 4: return snprintf(outbuf, COLWID, "#4"); // SCHED_ISO? (Con Kolivas) ++ case 5: return snprintf(outbuf, COLWID, "#5"); // ++ case 8: return snprintf(outbuf, COLWID, "#8"); // ++ default: return snprintf(outbuf, COLWID, "?"); // unknown value ++ } ++} ++// Based on "type", FreeBSD would do: ++// REALTIME "real:%u", prio ++// NORMAL "normal" ++// IDLE "idle:%u", prio ++// default "%u:%u", type, prio ++// We just print the priority, and have other keywords for type. ++static int pr_rtprio(char *restrict const outbuf, const proc_t *restrict const pp){ ++ if(pp->sched==0 || pp->sched==-1) return snprintf(outbuf, COLWID, "-"); ++ return snprintf(outbuf, COLWID, "%ld", pp->rtprio); ++} ++static int pr_sched(char *restrict const outbuf, const proc_t *restrict const pp){ ++ if(pp->sched==-1) return snprintf(outbuf, COLWID, "-"); ++ return snprintf(outbuf, COLWID, "%ld", pp->sched); ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++ ++static int pr_wchan(char *restrict const outbuf, const proc_t *restrict const pp){ ++/* ++ * Unix98 says "blank if running" and also "no blanks"! :-( ++ * Unix98 also says to use '-' if something is meaningless. ++ * Digital uses both '*' and '-', with undocumented differences. ++ * (the '*' for -1 (rare) and the '-' for 0) ++ * Sun claims to use a blank AND use '-', in the same man page. ++ * Perhaps "blank" should mean '-'. ++ * ++ * AIX uses '-' for running processes, the location when there is ++ * only one thread waiting in the kernel, and '*' when there is ++ * more than one thread waiting in the kernel. ++ * ++ * The output should be truncated to maximal columns width -- overflow ++ * is not supported for the "wchan". ++ */ ++ const char *w; ++ size_t len; ++ if(!(pp->wchan & 0xffffff)) return memcpy(outbuf,"-",2),1; ++ if(wchan_is_number) return snprintf(outbuf, COLWID, "%x", (unsigned)(pp->wchan) & 0xffffffu); ++ w = lookup_wchan(pp->wchan, pp->XXXID); ++ len = strlen(w); ++ if(len>max_rightward) len=max_rightward; ++ memcpy(outbuf, w, len); ++ outbuf[len] = '\0'; ++ return len; ++} ++ ++static int pr_wname(char *restrict const outbuf, const proc_t *restrict const pp){ ++/* SGI's IRIX always uses a number for "wchan", so "wname" is provided too. ++ * ++ * We use '-' for running processes, the location when there is ++ * only one thread waiting in the kernel, and '*' when there is ++ * more than one thread waiting in the kernel. ++ * ++ * The output should be truncated to maximal columns width -- overflow ++ * is not supported for the "wchan". ++ */ ++ const char *w; ++ size_t len; ++ if(!(pp->wchan & 0xffffff)) return memcpy(outbuf,"-",2),1; ++ w = lookup_wchan(pp->wchan, pp->XXXID); ++ len = strlen(w); ++ if(len>max_rightward) len=max_rightward; ++ memcpy(outbuf, w, len); ++ outbuf[len] = '\0'; ++ return len; ++} ++ ++static int pr_nwchan(char *restrict const outbuf, const proc_t *restrict const pp){ ++ if(!(pp->wchan & 0xffffff)) return memcpy(outbuf,"-",2),1; ++ return snprintf(outbuf, COLWID, "%x", (unsigned)(pp->wchan) & 0xffffffu); ++} ++ ++/* Terrible trunctuation, like BSD crap uses: I999 J999 K999 */ ++/* FIXME: disambiguate /dev/tty69 and /dev/pts/69. */ ++static int pr_tty4(char *restrict const outbuf, const proc_t *restrict const pp){ ++/* snprintf(outbuf, COLWID, "%02x:%02x", pp->tty>>8, pp->tty&0xff); */ ++ return dev_to_tty(outbuf, 4, pp->tty, pp->XXXID, ABBREV_DEV|ABBREV_TTY|ABBREV_PTS); ++} ++ ++/* Unix98: format is unspecified, but must match that used by who(1). */ ++static int pr_tty8(char *restrict const outbuf, const proc_t *restrict const pp){ ++/* snprintf(outbuf, COLWID, "%02x:%02x", pp->tty>>8, pp->tty&0xff); */ ++ return dev_to_tty(outbuf, COLWID, pp->tty, pp->XXXID, ABBREV_DEV); ++} ++ ++#if 0 ++/* This BSD state display may contain spaces, which is illegal. */ ++static int pr_oldstate(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%s", status(pp)); ++} ++#endif ++ ++// This state display is Unix98 compliant and has lots of info like BSD. ++static int pr_stat(char *restrict const outbuf, const proc_t *restrict const pp){ ++ int end = 0; ++ outbuf[end++] = pp->state; ++// if(pp->rss==0 && pp->state!='Z') outbuf[end++] = 'W'; // useless "swapped out" ++ if(pp->nice < 0) outbuf[end++] = '<'; ++ if(pp->nice > 0) outbuf[end++] = 'N'; ++// In this order, NetBSD would add: ++// traced 'X' ++// systrace 'x' ++// exiting 'E' (not printed for zombies) ++// vforked 'V' ++// system 'K' (and do not print 'L' too) ++ if(pp->vm_lock) outbuf[end++] = 'L'; ++ if(pp->session == pp->tgid) outbuf[end++] = 's'; // session leader ++ if(pp->nlwp > 1) outbuf[end++] = 'l'; // multi-threaded ++ if(pp->pgrp == pp->tpgid) outbuf[end++] = '+'; // in foreground process group ++ outbuf[end] = '\0'; ++ return end; ++} ++ ++/* This minimal state display is Unix98 compliant, like SCO and SunOS 5 */ ++static int pr_s(char *restrict const outbuf, const proc_t *restrict const pp){ ++ outbuf[0] = pp->state; ++ outbuf[1] = '\0'; ++ return 1; ++} ++ ++static int pr_flag(char *restrict const outbuf, const proc_t *restrict const pp){ ++ /* Unix98 requires octal flags */ ++ /* this user-hostile and volatile junk gets 1 character */ ++ return snprintf(outbuf, COLWID, "%o", (unsigned)(pp->flags>>6U)&0x7U); ++} ++ ++// plus these: euid,ruid,egroup,rgroup (elsewhere in this file) ++ ++/*********** non-standard ***********/ ++ ++/*** BSD ++sess session pointer ++(SCO has:Process session leader ID as a decimal value. (SESSION)) ++jobc job control count ++cpu short-term cpu usage factor (for scheduling) ++sl sleep time (in seconds; 127 = infinity) ++re core residency time (in seconds; 127 = infinity) ++pagein pageins (same as majflt) ++lim soft memory limit ++tsiz text size (in Kbytes) ++***/ ++ ++static int pr_stackp(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->start_stack)); ++} ++ ++static int pr_esp(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%08x", (unsigned)(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)); ++} ++ ++/* 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, " -"); ++ if(t == ~0ULL) return snprintf(dst, COLWID, " xx"); ++ if((long long)(t-=rel) < 0) t=0ULL; ++ if(t>9999ULL) return snprintf(dst, COLWID, "%5Lu", t/100ULL); ++ else return snprintf(dst, COLWID, "%2u.%02u", (unsigned)t/100U, (unsigned)t%100U); ++} ++ ++static int pr_bsdtime(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long long t; ++ unsigned u; ++ t = pp->utime + pp->stime; ++ if(include_dead_children) t += (pp->cutime + pp->cstime); ++ u = t / Hertz; ++ return snprintf(outbuf, COLWID, "%3u:%02u", u/60U, u%60U); ++} ++ ++static int pr_bsdstart(char *restrict const outbuf, const proc_t *restrict const pp){ ++ time_t start; ++ time_t seconds_ago; ++ start = time_of_boot + pp->start_time / Hertz; ++ seconds_ago = seconds_since_1970 - start; ++ if(seconds_ago < 0) seconds_ago=0; ++ if(seconds_ago > 3600*24) strcpy(outbuf, ctime(&start)+4); ++ else strcpy(outbuf, ctime(&start)+10); ++ outbuf[6] = '\0'; ++ return 6; ++} ++ ++static int pr_alarm(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return old_time_helper(outbuf, pp->alarm, 0ULL); ++} ++ ++/* HP-UX puts this in pages and uses "vsz" for kB */ ++static int pr_sz(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%lu", (pp->vm_size)/(page_size/1024)); ++} ++ ++ ++/* ++ * FIXME: trs,drs,tsiz,dsiz,m_trs,m_drs,vm_exe,vm_data,trss ++ * I suspect some/all of those are broken. They seem to have been ++ * inherited by Linux and AIX from early BSD systems. FreeBSD only ++ * retains tsiz. The prefixed versions come from Debian. ++ * Sun and Digital have none of this crap. The code here comes ++ * from an old Linux ps, and might not be correct for ELF executables. ++ * ++ * AIX TRS size of resident-set (real memory) of text ++ * AIX TSIZ size of text (shared-program) image ++ * FreeBSD tsiz text size (in Kbytes) ++ * 4.3BSD NET/2 trss text resident set size (in Kbytes) ++ * 4.3BSD NET/2 tsiz text size (in Kbytes) ++ */ ++ ++/* kB data size. See drs, tsiz & trs. */ ++static int pr_dsiz(char *restrict const outbuf, const proc_t *restrict const pp){ ++ long dsiz = 0; ++ if(pp->vsize) dsiz += (pp->vsize - pp->end_code + pp->start_code) >> 10; ++ return snprintf(outbuf, COLWID, "%ld", dsiz); ++} ++ ++/* kB text (code) size. See trs, dsiz & drs. */ ++static int pr_tsiz(char *restrict const outbuf, const proc_t *restrict const pp){ ++ long tsiz = 0; ++ if(pp->vsize) tsiz += (pp->end_code - pp->start_code) >> 10; ++ return snprintf(outbuf, COLWID, "%ld", tsiz); ++} ++ ++/* kB _resident_ data size. See dsiz, tsiz & trs. */ ++static int pr_drs(char *restrict const outbuf, const proc_t *restrict const pp){ ++ long drs = 0; ++ if(pp->vsize) drs += (pp->vsize - pp->end_code + pp->start_code) >> 10; ++ return snprintf(outbuf, COLWID, "%ld", drs); ++} ++ ++/* kB text _resident_ (code) size. See tsiz, dsiz & drs. */ ++static int pr_trs(char *restrict const outbuf, const proc_t *restrict const pp){ ++ long trs = 0; ++ if(pp->vsize) trs += (pp->end_code - pp->start_code) >> 10; ++ return snprintf(outbuf, COLWID, "%ld", trs); ++} ++ ++/* approximation to: kB of address space that could end up in swap */ ++static int pr_swapable(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%ld", pp->vm_data + pp->vm_stack); ++} ++ ++/* nasty old Debian thing */ ++static int pr_size(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%ld", pp->size); ++} ++ ++ ++static int pr_minflt(char *restrict const outbuf, const proc_t *restrict const pp){ ++ long flt = pp->min_flt; ++ if(include_dead_children) flt += pp->cmin_flt; ++ return snprintf(outbuf, COLWID, "%ld", flt); ++} ++ ++static int pr_majflt(char *restrict const outbuf, const proc_t *restrict const pp){ ++ long flt = pp->maj_flt; ++ if(include_dead_children) flt += pp->cmaj_flt; ++ return snprintf(outbuf, COLWID, "%ld", flt); ++} ++ ++static int pr_lim(char *restrict const outbuf, const proc_t *restrict const pp){ ++ if(pp->rss_rlim == RLIM_INFINITY){ ++ outbuf[0] = 'x'; ++ outbuf[1] = 'x'; ++ outbuf[2] = '\0'; ++ return 2; ++ } ++ return snprintf(outbuf, COLWID, "%5ld", pp->rss_rlim >> 10); ++} ++ ++/* should print leading tilde ('~') if process is bound to the CPU */ ++static int pr_psr(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->processor); ++} ++ ++static int pr_rss(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%lu", pp->vm_rss); ++} ++ ++/* pp->vm_rss * 1000 would overflow on 32-bit systems with 64 GB memory */ ++static int pr_pmem(char *restrict const outbuf, const proc_t *restrict const pp){ ++ unsigned long pmem = 0; ++ pmem = pp->vm_rss * 1000ULL / kb_main_total; ++ if (pmem > 999) pmem = 999; ++ return snprintf(outbuf, COLWID, "%2u.%u", (unsigned)(pmem/10), (unsigned)(pmem%10)); ++} ++ ++static int pr_lstart(char *restrict const outbuf, const proc_t *restrict const pp){ ++ time_t t; ++ t = time_of_boot + pp->start_time / Hertz; ++ return snprintf(outbuf, COLWID, "%24.24s", ctime(&t)); ++} ++ ++/* Unix98 specifies a STIME header for a column that shows the start ++ * time of the process, but does not specify a format or format specifier. ++ * From the general Unix98 rules, we know there must not be any spaces. ++ * Most systems violate that rule, though the Solaris documentation ++ * claims to print the column without spaces. (NOT!) ++ * ++ * So this isn't broken, but could be renamed to u98_std_stime, ++ * as long as it still shows as STIME when using the -f option. ++ */ ++static int pr_stime(char *restrict const outbuf, const proc_t *restrict const pp){ ++ struct tm *proc_time; ++ struct tm *our_time; ++ time_t t; ++ const char *fmt; ++ int tm_year; ++ int tm_yday; ++ our_time = localtime(&seconds_since_1970); /* not reentrant */ ++ tm_year = our_time->tm_year; ++ tm_yday = our_time->tm_yday; ++ t = time_of_boot + pp->start_time / Hertz; ++ proc_time = localtime(&t); /* not reentrant, this corrupts our_time */ ++ fmt = "%H:%M"; /* 03:02 23:59 */ ++ if(tm_yday != proc_time->tm_yday) fmt = "%b%d"; /* Jun06 Aug27 */ ++ if(tm_year != proc_time->tm_year) fmt = "%Y"; /* 1991 2001 */ ++ return strftime(outbuf, 42, fmt, proc_time); ++} ++ ++static int pr_start(char *restrict const outbuf, const proc_t *restrict const pp){ ++ time_t t; ++ char *str; ++ t = time_of_boot + pp->start_time / Hertz; ++ str = ctime(&t); ++ if(str[8]==' ') str[8]='0'; ++ if(str[11]==' ') str[11]='0'; ++ if((unsigned long)t+60*60*24 > seconds_since_1970) ++ return snprintf(outbuf, COLWID, "%8.8s", str+11); ++ return snprintf(outbuf, COLWID, " %6.6s", str+4); ++} ++ ++ ++#ifdef SIGNAL_STRING ++static int help_pr_sig(char *restrict const outbuf, const char *restrict const sig){ ++ long len = 0; ++ len = strlen(sig); ++ if(wide_signals){ ++ if(len>8) return snprintf(outbuf, COLWID, "%s", sig); ++ return snprintf(outbuf, COLWID, "00000000%s", sig); ++ } ++ if(len-strspn(sig,"0") > 8) ++ return snprintf(outbuf, COLWID, "<%s", sig+len-8); ++ return snprintf(outbuf, COLWID, "%s", sig+len-8); ++} ++#else ++static int help_pr_sig(unsigned long long sig){ ++ if(wide_signals) return snprintf(outbuf, COLWID, "%016Lx", sig); ++ if(sig>>32) return snprintf(outbuf, COLWID, "<%08Lx", sig&0xffffffffLL); ++ return snprintf(outbuf, COLWID, "%08Lx", sig&0xffffffffLL); ++} ++#endif ++ ++static int pr_sig(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return help_pr_sig(outbuf, pp->signal); ++} ++static int pr_sigmask(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return help_pr_sig(outbuf, pp->blocked); ++} ++static int pr_sigignore(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return help_pr_sig(outbuf, pp->sigignore); ++} ++static int pr_sigcatch(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return help_pr_sig(outbuf, pp->sigcatch); ++} ++ ++ ++//////////////////////////////////////////////////////////////////////////////// ++ ++/* ++ * internal terms: ruid euid suid fuid ++ * kernel vars: uid euid suid fsuid ++ * command args: ruid uid svuid n/a ++ */ ++ ++static int pr_egid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->egid); ++} ++static int pr_rgid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->rgid); ++} ++static int pr_sgid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->sgid); ++} ++static int pr_fgid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->fgid); ++} ++ ++static int pr_euid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->euid); ++} ++static int pr_ruid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->ruid); ++} ++static int pr_suid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->suid); ++} ++static int pr_fuid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->fuid); ++} ++ ++// The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004 Edition) ++// requires that user and group names print as decimal numbers if there is ++// not enough room in the column, so tough luck if you don't like it. ++// ++// The UNIX and POSIX way to change column width is to rename it: ++// ps -o pid,user=CumbersomeUserNames -o comm ++// The easy way is to directly specify the desired width: ++// ps -o pid,user:19,comm ++// ++static int do_pr_name(char *restrict const outbuf, const char *restrict const name, unsigned u){ ++ if(!user_is_number){ ++ int rightward = OUTBUF_SIZE; /* max cells */ ++ int len; /* real cells */ ++ ++ escape_str(outbuf, name, OUTBUF_SIZE, &rightward); ++ len = OUTBUF_SIZE-rightward; ++ ++ if(len <= (int)max_rightward) ++ return len; /* returns number of cells */ ++ } ++ return snprintf(outbuf, COLWID, "%u", u); ++} ++ ++static int pr_ruser(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->ruser, pp->ruid); ++} ++static int pr_euser(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->euser, pp->euid); ++} ++static int pr_fuser(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->fuser, pp->fuid); ++} ++static int pr_suser(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->suser, pp->suid); ++} ++ ++static int pr_egroup(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->egroup, pp->egid); ++} ++static int pr_rgroup(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->rgroup, pp->rgid); ++} ++static int pr_fgroup(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->fgroup, pp->fgid); ++} ++static int pr_sgroup(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return do_pr_name(outbuf, pp->sgroup, pp->sgid); ++} ++ ++////////////////////////////////////////////////////////////////////////////////// ++ ++// TID tid LWP lwp SPID spid ++static int pr_thread(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%u", pp->tid); ++} ++// thcount THCNT ++static int pr_nlwp(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->nlwp); ++} ++ ++static int pr_sess(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%u", pp->session); ++} ++static int pr_tpgid(char *restrict const outbuf, const proc_t *restrict const pp){ ++ return snprintf(outbuf, COLWID, "%d", pp->tpgid); ++} ++ ++ ++/* SGI uses "cpu" to print the processor ID with header "P" */ ++static int pr_sgi_p(char *restrict const outbuf, const proc_t *restrict const pp){ /* FIXME */ ++ if(pp->state == 'R') return snprintf(outbuf, COLWID, "%d", pp->processor); ++ return snprintf(outbuf, COLWID, "*"); ++} ++ ++ ++/****************** FLASK & seLinux security stuff **********************/ ++// move the bulk of this to libproc sometime ++ ++static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){ ++ char filename[48]; ++ size_t len; ++ ssize_t num_read; ++ int fd; ++ ++// wchan file is suitable for testing ++//snprintf(filename, sizeof filename, "/proc/%d/wchan", pp->tgid); ++snprintf(filename, sizeof filename, "/proc/%d/attr/current", pp->tgid); ++ ++ fd = open(filename, O_RDONLY, 0); ++ if(likely(fd==-1)) goto fail; ++ num_read = read(fd, outbuf, 666); ++ close(fd); ++ if(unlikely(num_read<=0)) goto fail; ++ outbuf[num_read] = '\0'; ++ ++ len = 0; ++ while(outbuf[len]>' ' && outbuf[len]<='~') len++; ++ outbuf[len] = '\0'; ++ if(len) return len; ++ ++fail: ++ outbuf[0] = '-'; ++ outbuf[1] = '\0'; ++ return 1; ++} ++ ++#if 0 ++// This needs more study, considering: ++// 1. the static linking option (maybe disable this in that case) ++// 2. the -z and -Z option issue ++// 3. width of output ++static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static int (*ps_getpidcon)(pid_t pid, char **context) = 0; ++ static int tried_load = 0; ++ size_t len; ++ char *context; ++ ++ if(!ps_getpidcon && !tried_load){ ++ void *handle = dlopen("libselinux.so.1", RTLD_NOW); ++ if(handle){ ++ dlerror(); ++ ps_getpidcon = dlsym(handle, "getpidcon"); ++ if(dlerror()) ++ ps_getpidcon = 0; ++ } ++ tried_load++; ++ } ++ if(ps_getpidcon && !ps_getpidcon(pp->tgid, &context)){ ++ size_t max_len = OUTBUF_SIZE-1; ++ len = strlen(context); ++ if(len > max_len) len = max_len; ++ memcpy(outbuf, context, len); ++ outbuf[len] = '\0'; ++ free(context); ++ }else{ ++ outbuf[0] = '-'; ++ outbuf[1] = '\0'; ++ len = 1; ++ } ++ return len; ++} ++#endif ++ ++ ++////////////////////////////// Test code ///////////////////////////////// ++ ++// like "args" ++static int pr_t_unlimited(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static const char *const vals[] = {"[123456789-12345] <defunct>","ps","123456789-123456"}; ++ (void)pp; ++ snprintf(outbuf, max_rightward+1, "%s", vals[lines_to_next_header%3u]); ++ return strlen(outbuf); ++} ++static int pr_t_unlimited2(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static const char *const vals[] = {"unlimited", "[123456789-12345] <defunct>","ps","123456789-123456"}; ++ (void)pp; ++ snprintf(outbuf, max_rightward+1, "%s", vals[lines_to_next_header%4u]); ++ return strlen(outbuf); ++} ++ ++// like "etime" ++static int pr_t_right(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static const char *const vals[] = {"999-23:59:59","99-23:59:59","9-23:59:59","59:59"}; ++ (void)pp; ++ return snprintf(outbuf, COLWID, "%s", vals[lines_to_next_header%4u]); ++} ++static int pr_t_right2(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static const char *const vals[] = {"999-23:59:59","99-23:59:59","9-23:59:59"}; ++ (void)pp; ++ return snprintf(outbuf, COLWID, "%s", vals[lines_to_next_header%3u]); ++} ++ ++// like "tty" ++static int pr_t_left(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static const char *const vals[] = {"tty7","pts/9999","iseries/vtty42","ttySMX0","3270/tty4"}; ++ (void)pp; ++ return snprintf(outbuf, COLWID, "%s", vals[lines_to_next_header%5u]); ++} ++static int pr_t_left2(char *restrict const outbuf, const proc_t *restrict const pp){ ++ static const char *const vals[] = {"tty7","pts/9999","ttySMX0","3270/tty4"}; ++ (void)pp; ++ return snprintf(outbuf, COLWID, "%s", vals[lines_to_next_header%4u]); ++} ++ ++/***************************************************************************/ ++/*************************** other stuff ***********************************/ ++ ++/* ++ * Old header specifications. ++ * ++ * short Up " PID TTY STAT TIME COMMAND" ++ * long l Pp " FLAGS UID PID PPID PRI NI SIZE RSS WCHAN STA TTY TIME COMMAND ++ * user u up "USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND ++ * jobs j gPp " PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND ++ * sig s p " UID PID SIGNAL BLOCKED IGNORED CATCHED STAT TTY TIME COMMAND ++ * vm v r " PID TTY STAT TIME PAGEIN TSIZ DSIZ RSS LIM %MEM COMMAND ++ * m m r " PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND ++ * regs X p "NR PID STACK ESP EIP TMOUT ALARM STAT TTY TIME COMMAND ++ */ ++ ++/* ++ * Unix98 requires that the heading for tty is TT, though XPG4, Digital, ++ * and BSD use TTY. The Unix98 headers are: ++ * args,comm,etime,group,nice,pcpu,pgid ++ * pid,ppid,rgroup,ruser,time,tty,user,vsz ++ * ++ * BSD c: "command" becomes accounting name ("comm" or "ucomm") ++ * BSD n: "user" becomes "uid" and "wchan" becomes "nwchan" (number) ++ */ ++ ++/* Justification control for flags field. */ ++#define USER CF_USER // left if text, right if numeric ++#define LEFT CF_LEFT ++#define RIGHT CF_RIGHT ++#define UNLIMITED CF_UNLIMITED ++#define WCHAN CF_WCHAN // left if text, right if numeric ++#define SIGNAL CF_SIGNAL // right in 9, or 16 if room ++#define PIDMAX CF_PIDMAX ++#define TO CF_PRINT_THREAD_ONLY ++#define PO CF_PRINT_PROCESS_ONLY ++#define ET CF_PRINT_EVERY_TIME ++#define AN CF_PRINT_AS_NEEDED // no idea ++ ++/* short names to save space */ ++#define MEM PROC_FILLMEM /* read statm */ ++#define ARG PROC_FILLARG /* read cmdline (cleared if c option) */ ++#define COM PROC_FILLCOM /* read cmdline (cleared if not -f option) */ ++#define ENV PROC_FILLENV /* read environ */ ++#define USR PROC_FILLUSR /* uid_t -> user names */ ++#define GRP PROC_FILLGRP /* gid_t -> group names */ ++#define WCH PROC_FILLWCHAN /* do WCHAN lookup */ ++ ++ ++/* TODO ++ * pull out annoying BSD aliases into another table (to macro table?) ++ * add sorting functions here (to unify names) ++ */ ++ ++/* temporary hack -- mark new stuff grabbed from Debian ps */ ++#define LNx LNX ++ ++/* there are about 211 listed */ ++ ++/* Many of these are placeholders for unsupported options. */ ++static const format_struct format_array[] = { ++/* code header print() sort() width need vendor flags */ ++{"%cpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, BSD, ET|RIGHT}, /*pcpu*/ ++{"%mem", "%MEM", pr_pmem, sr_nop, 4, 0, BSD, PO|RIGHT}, /*pmem*/ ++{"_left", "LLLLLLLL", pr_t_left, sr_nop, 8, 0, TST, ET|LEFT}, ++{"_left2", "L2L2L2L2", pr_t_left2, sr_nop, 8, 0, TST, ET|LEFT}, ++{"_right", "RRRRRRRRRRR", pr_t_right, sr_nop, 11, 0, TST, ET|RIGHT}, ++{"_right2", "R2R2R2R2R2R", pr_t_right2, sr_nop, 11, 0, TST, ET|RIGHT}, ++{"_unlimited","U", pr_t_unlimited, sr_nop, 16, 0, TST, ET|UNLIMITED}, ++{"_unlimited2","U2", pr_t_unlimited2, sr_nop, 16, 0, TST, ET|UNLIMITED}, ++{"acflag", "ACFLG", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT}, /*acflg*/ ++{"acflg", "ACFLG", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*acflag*/ ++{"addr", "ADDR", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT}, ++{"addr_1", "ADDR", pr_nop, sr_nop, 1, 0, LNX, AN|LEFT}, ++{"alarm", "ALARM", pr_alarm, sr_alarm, 5, 0, LNX, AN|RIGHT}, ++{"argc", "ARGC", pr_nop, sr_nop, 4, 0, LNX, PO|RIGHT}, ++{"args", "COMMAND", pr_args, sr_cmd, 27, ARG, U98, PO|UNLIMITED}, /*command*/ ++{"atime", "TIME", pr_time, sr_nop, 8, 0, SOE, ET|RIGHT}, /*cputime*/ /* was 6 wide */ ++{"blocked", "BLOCKED", pr_sigmask, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigmask*/ ++{"bnd", "BND", pr_nop, sr_nop, 1, 0, AIX, TO|RIGHT}, ++{"bsdstart", "START", pr_bsdstart, sr_nop, 6, 0, LNX, ET|RIGHT}, ++{"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*/ ++{"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}, ++{"cmd", "CMD", pr_args, sr_cmd, 27, ARG, DEC, PO|UNLIMITED}, /*ucomm*/ ++{"cmin_flt", "-", pr_nop, sr_cmin_flt, 1, 0, LNX, AN|RIGHT}, ++{"cnswap", "-", pr_nop, sr_nop, 1, 0, LNX, AN|RIGHT}, ++{"comm", "COMMAND", pr_comm, sr_cmd, 15, COM, U98, PO|UNLIMITED}, /*ucomm*/ ++{"command", "COMMAND", pr_args, sr_cmd, 27, ARG, XXX, PO|UNLIMITED}, /*args*/ ++{"context", "CONTEXT", pr_context, sr_nop, 31, 0, LNX, ET|LEFT}, ++{"cp", "CP", pr_cp, sr_pcpu, 3, 0, DEC, ET|RIGHT}, /*cpu*/ ++{"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */ ++{"cpuid", "CPUID", pr_psr, sr_nop, 5, 0, BSD, TO|RIGHT}, // OpenBSD: 8 wide! ++{"cputime", "TIME", pr_time, sr_nop, 8, 0, DEC, ET|RIGHT}, /*time*/ ++{"cstime", "-", pr_nop, sr_cstime, 1, 0, LNX, AN|RIGHT}, ++{"ctid", "CTID", pr_nop, sr_nop, 5, 0, SUN, ET|RIGHT}, // resource contracts? ++{"cursig", "CURSIG", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT}, ++{"cutime", "-", pr_nop, sr_cutime, 1, 0, LNX, AN|RIGHT}, ++{"cwd", "CWD", pr_nop, sr_nop, 3, 0, LNX, AN|LEFT}, ++{"drs", "DRS", pr_drs, sr_drs, 5, MEM, LNX, PO|RIGHT}, ++{"dsiz", "DSIZ", pr_dsiz, sr_nop, 4, 0, LNX, PO|RIGHT}, ++{"egid", "EGID", pr_egid, sr_egid, 5, 0, LNX, ET|RIGHT}, ++{"egroup", "EGROUP", pr_egroup, sr_egroup, 8, GRP, LNX, ET|USER}, ++{"eip", "EIP", pr_eip, sr_kstk_eip, 8, 0, LNX, TO|RIGHT}, ++{"emul", "EMUL", pr_nop, sr_nop, 13, 0, BSD, PO|LEFT}, /* "FreeBSD ELF32" and such */ ++{"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, PO|RIGHT}, ++{"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, PO|UNLIMITED}, ++{"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, TO|RIGHT}, ++{"etime", "ELAPSED", pr_etime, sr_nop, 11, 0, U98, ET|RIGHT}, /* was 7 wide */ ++{"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, ET|RIGHT}, ++{"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, ET|USER}, ++{"f", "F", pr_flag, sr_flags, 1, 0, XXX, ET|RIGHT}, /*flags*/ ++{"fgid", "FGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT}, ++{"fgroup", "FGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER}, ++{"flag", "F", pr_flag, sr_flags, 1, 0, DEC, ET|RIGHT}, ++{"flags", "F", pr_flag, sr_flags, 1, 0, BSD, ET|RIGHT}, /*f*/ /* was FLAGS, 8 wide */ ++{"fname", "COMMAND", pr_fname, sr_nop, 8, 0, SUN, PO|LEFT}, ++{"fsgid", "FSGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT}, ++{"fsgroup", "FSGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER}, ++{"fsuid", "FSUID", pr_fuid, sr_fuid, 5, 0, LNX, ET|RIGHT}, ++{"fsuser", "FSUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER}, ++{"fuid", "FUID", pr_fuid, sr_fuid, 5, 0, LNX, ET|RIGHT}, ++{"fuser", "FUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER}, ++{"gid", "GID", pr_egid, sr_egid, 5, 0, SUN, ET|RIGHT}, ++{"group", "GROUP", pr_egroup, sr_egroup, 8, GRP, U98, ET|USER}, ++{"iac", "IAC", pr_nop, sr_nop, 4, 0, BSD, AN|RIGHT}, // DragonFly ++{"ignored", "IGNORED", pr_sigignore,sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigignore*/ ++{"inblk", "INBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*inblock*/ ++{"inblock", "INBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*inblk*/ ++{"intpri", "PRI", pr_opri, sr_priority, 3, 0, HPU, TO|RIGHT}, ++{"jid", "JID", pr_nop, sr_nop, 1, 0, SGI, PO|RIGHT}, ++{"jobc", "JOBC", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT}, ++{"ktrace", "KTRACE", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT}, ++{"ktracep", "KTRACEP", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT}, ++{"label", "LABEL", pr_context, sr_nop, 31, 0, SGI, ET|LEFT}, ++{"lastcpu", "C", pr_psr, sr_nop, 3, 0, BSD, TO|RIGHT}, // DragonFly ++{"lim", "LIM", pr_lim, sr_rss_rlim, 5, 0, BSD, AN|RIGHT}, ++{"login", "LOGNAME", pr_nop, sr_nop, 8, 0, BSD, AN|LEFT}, /*logname*/ /* double check */ ++{"logname", "LOGNAME", pr_nop, sr_nop, 8, 0, XXX, AN|LEFT}, /*login*/ ++{"longtname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, PO|LEFT}, ++{"lstart", "STARTED", pr_lstart, sr_nop, 24, 0, XXX, ET|RIGHT}, ++{"luid", "LUID", pr_nop, sr_nop, 5, 0, LNX, ET|RIGHT}, /* login ID */ ++{"luser", "LUSER", pr_nop, sr_nop, 8, USR, LNX, ET|USER}, /* login USER */ ++{"lwp", "LWP", pr_thread, sr_tid, 5, 0, SUN, TO|PIDMAX|RIGHT}, ++{"m_drs", "DRS", pr_drs, sr_drs, 5, MEM, LNx, PO|RIGHT}, ++{"m_dt", "DT", pr_nop, sr_dt, 4, MEM, LNx, PO|RIGHT}, ++{"m_lrs", "LRS", pr_nop, sr_lrs, 5, MEM, LNx, PO|RIGHT}, ++{"m_resident", "RES", pr_nop, sr_resident, 5,MEM, LNx, PO|RIGHT}, ++{"m_share", "SHRD", pr_nop, sr_share, 5, MEM, LNx, PO|RIGHT}, ++{"m_size", "SIZE", pr_size, sr_size, 5, MEM, LNX, PO|RIGHT}, ++{"m_swap", "SWAP", pr_nop, sr_nop, 5, 0, LNx, PO|RIGHT}, ++{"m_trs", "TRS", pr_trs, sr_trs, 5, MEM, LNx, PO|RIGHT}, ++{"maj_flt", "MAJFL", pr_majflt, sr_maj_flt, 6, 0, LNX, AN|RIGHT}, ++{"majflt", "MAJFLT", pr_majflt, sr_maj_flt, 6, 0, XXX, AN|RIGHT}, ++{"min_flt", "MINFL", pr_minflt, sr_min_flt, 6, 0, LNX, AN|RIGHT}, ++{"minflt", "MINFLT", pr_minflt, sr_min_flt, 6, 0, XXX, AN|RIGHT}, ++{"msgrcv", "MSGRCV", pr_nop, sr_nop, 6, 0, XXX, AN|RIGHT}, ++{"msgsnd", "MSGSND", pr_nop, sr_nop, 6, 0, XXX, AN|RIGHT}, ++{"mwchan", "MWCHAN", pr_nop, sr_nop, 6, WCH, BSD, TO|WCHAN}, /* mutex (FreeBSD) */ ++{"ni", "NI", pr_nice, sr_nice, 3, 0, BSD, TO|RIGHT}, /*nice*/ ++{"nice", "NI", pr_nice, sr_nice, 3, 0, U98, TO|RIGHT}, /*ni*/ ++{"nivcsw", "IVCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT}, ++{"nlwp", "NLWP", pr_nlwp, sr_nlwp, 4, 0, SUN, PO|RIGHT}, ++{"nsignals", "NSIGS", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*nsigs*/ ++{"nsigs", "NSIGS", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*nsignals*/ ++{"nswap", "NSWAP", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT}, ++{"nvcsw", "VCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT}, ++{"nwchan", "WCHAN", pr_nwchan, sr_nop, 6, 0, XXX, TO|RIGHT}, ++{"opri", "PRI", pr_opri, sr_priority, 3, 0, SUN, TO|RIGHT}, ++{"osz", "SZ", pr_nop, sr_nop, 2, 0, SUN, PO|RIGHT}, ++{"oublk", "OUBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*oublock*/ ++{"oublock", "OUBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*oublk*/ ++{"p_ru", "P_RU", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT}, ++{"paddr", "PADDR", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT}, ++{"pagein", "PAGEIN", pr_majflt, sr_maj_flt, 6, 0, XXX, AN|RIGHT}, ++{"pcpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, U98, ET|RIGHT}, /*%cpu*/ ++{"pending", "PENDING", pr_sig, sr_nop, 9, 0, BSD, ET|SIGNAL}, /*sig*/ ++{"pgid", "PGID", pr_pgid, sr_pgrp, 5, 0, U98, PO|PIDMAX|RIGHT}, ++{"pgrp", "PGRP", pr_pgid, sr_pgrp, 5, 0, LNX, PO|PIDMAX|RIGHT}, ++{"pid", "PID", pr_pid, sr_tgid, 5, 0, U98, PO|PIDMAX|RIGHT}, ++{"pmem", "%MEM", pr_pmem, sr_nop, 4, 0, XXX, PO|RIGHT}, /*%mem*/ ++{"poip", "-", pr_nop, sr_nop, 1, 0, BSD, AN|RIGHT}, ++{"policy", "POL", pr_class, sr_sched, 3, 0, DEC, TO|LEFT}, ++{"ppid", "PPID", pr_ppid, sr_ppid, 5, 0, U98, PO|PIDMAX|RIGHT}, ++{"pri", "PRI", pr_pri, sr_nop, 3, 0, XXX, TO|RIGHT}, ++{"pri_api", "API", pr_pri_api, sr_nop, 3, 0, LNX, TO|RIGHT}, ++{"pri_bar", "BAR", pr_pri_bar, sr_nop, 3, 0, LNX, TO|RIGHT}, ++{"pri_baz", "BAZ", pr_pri_baz, sr_nop, 3, 0, LNX, TO|RIGHT}, ++{"pri_foo", "FOO", pr_pri_foo, sr_nop, 3, 0, LNX, TO|RIGHT}, ++{"priority", "PRI", pr_priority, sr_priority, 3, 0, LNX, TO|RIGHT}, ++{"prmgrp", "PRMGRP", pr_nop, sr_nop, 12, 0, HPU, PO|RIGHT}, ++{"prmid", "PRMID", pr_nop, sr_nop, 12, 0, HPU, PO|RIGHT}, ++{"project", "PROJECT", pr_nop, sr_nop, 12, 0, SUN, PO|LEFT}, // see prm* andctid ++{"projid", "PROJID", pr_nop, sr_nop, 5, 0, SUN, PO|RIGHT}, ++{"pset", "PSET", pr_nop, sr_nop, 4, 0, DEC, TO|RIGHT}, ++{"psr", "PSR", pr_psr, sr_nop, 3, 0, DEC, TO|RIGHT}, ++{"psxpri", "PPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT}, ++{"re", "RE", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT}, ++{"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 */ ++{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|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*/ ++{"rtprio", "RTPRIO", pr_rtprio, sr_rtprio, 6, 0, BSD, TO|RIGHT}, ++{"ruid", "RUID", pr_ruid, sr_ruid, 5, 0, XXX, ET|RIGHT}, ++{"ruser", "RUSER", pr_ruser, sr_ruser, 8, USR, U98, ET|USER}, ++{"s", "S", pr_s, sr_state, 1, 0, SUN, TO|LEFT}, /*stat,state*/ ++{"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, TO|RIGHT}, ++{"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, AN|RIGHT}, /* man page misspelling of scount? */ ++{"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */ ++{"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT}, ++{"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PO|PIDMAX|RIGHT}, ++{"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, TO|RIGHT}, /* "cpu" number */ ++{"sgi_rss", "RSS", pr_rss, sr_nop, 4, 0, LNX, PO|LEFT}, /* SZ:RSS */ ++{"sgid", "SGID", pr_sgid, sr_sgid, 5, 0, LNX, ET|RIGHT}, ++{"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER}, ++{"share", "-", pr_nop, sr_share, 1, MEM, LNX, PO|RIGHT}, ++{"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */ ++{"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, ET|SIGNAL}, /*pending*/ ++{"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, TO|SIGNAL}, ++{"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, TO|SIGNAL}, ++{"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, TO|SIGNAL}, ++{"sig_pend", "SIGNAL", pr_sig, sr_nop, 9, 0, LNX, ET|SIGNAL}, ++{"sigcatch", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*caught*/ ++{"sigignore", "IGNORED", pr_sigignore,sr_nop, 9, 0, XXX, TO|SIGNAL}, /*ignored*/ ++{"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*blocked*/ ++{"size", "SZ", pr_swapable, sr_swapable, 5, 0, SCO, PO|RIGHT}, ++{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT}, ++{"spid", "SPID", pr_thread, sr_tid, 5, 0, SGI, TO|PIDMAX|RIGHT}, ++{"stackp", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*start_stack*/ ++{"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, ET|RIGHT}, ++{"start_code", "S_CODE", pr_nop, sr_start_code, 8, 0, LNx, PO|RIGHT}, ++{"start_stack", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*stackp*/ ++{"start_time", "START", pr_stime, sr_start_time, 5, 0, LNx, ET|RIGHT}, ++{"stat", "STAT", pr_stat, sr_state, 4, 0, BSD, TO|LEFT}, /*state,s*/ ++{"state", "S", pr_s, sr_state, 1, 0, XXX, TO|LEFT}, /*stat,s*/ /* was STAT */ ++{"status", "STATUS", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT}, ++{"stime", "STIME", pr_stime, sr_stime, 5, 0, XXX, ET|RIGHT}, /* was 6 wide */ ++{"suid", "SUID", pr_suid, sr_suid, 5, 0, LNx, ET|RIGHT}, ++{"suser", "SUSER", pr_suser, sr_suser, 8, USR, LNx, ET|USER}, ++{"svgid", "SVGID", pr_sgid, sr_sgid, 5, 0, XXX, ET|RIGHT}, ++{"svgroup", "SVGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER}, ++{"svuid", "SVUID", pr_suid, sr_suid, 5, 0, XXX, ET|RIGHT}, ++{"svuser", "SVUSER", pr_suser, sr_suser, 8, USR, LNX, ET|USER}, ++{"systime", "SYSTEM", pr_nop, sr_nop, 6, 0, DEC, ET|RIGHT}, ++{"sz", "SZ", pr_sz, sr_nop, 5, 0, HPU, PO|RIGHT}, ++{"taskid", "TASKID", pr_nop, sr_nop, 5, 0, SUN, TO|PIDMAX|RIGHT}, // is this a thread ID? ++{"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT}, ++{"thcount", "THCNT", pr_nlwp, sr_nlwp, 5, 0, AIX, PO|RIGHT}, ++{"tid", "TID", pr_thread, sr_tid, 5, 0, AIX, TO|PIDMAX|RIGHT}, ++{"time", "TIME", pr_time, sr_nop, 8, 0, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */ ++{"timeout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era ++{"tmout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era ++{"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, PO|LEFT}, ++{"tpgid", "TPGID", pr_tpgid, sr_tpgid, 5, 0, XXX, PO|PIDMAX|RIGHT}, ++{"trs", "TRS", pr_trs, sr_trs, 4, MEM, AIX, PO|RIGHT}, ++{"trss", "TRSS", pr_trs, sr_trs, 4, MEM, BSD, PO|RIGHT}, /* 4.3BSD NET/2 */ ++{"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT}, ++{"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, PO|PIDMAX|RIGHT}, ++{"tsid", "TSID", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT}, ++{"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, PO|RIGHT}, ++{"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, PO|LEFT}, ++{"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, PO|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */ ++{"tty4", "TTY", pr_tty4, sr_tty, 4, 0, LNX, PO|LEFT}, ++{"tty8", "TTY", pr_tty8, sr_tty, 8, 0, LNX, PO|LEFT}, ++{"u_procp", "UPROCP", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT}, ++{"ucmd", "CMD", pr_comm, sr_cmd, 15, COM, DEC, PO|UNLIMITED}, /*ucomm*/ ++{"ucomm", "COMMAND", pr_comm, sr_cmd, 15, COM, XXX, PO|UNLIMITED}, /*comm*/ ++{"uid", "UID", pr_euid, sr_euid, 5, 0, XXX, ET|RIGHT}, ++{"uid_hack", "UID", pr_euser, sr_euser, 8, USR, XXX, ET|USER}, ++{"umask", "UMASK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, ++{"uname", "USER", pr_euser, sr_euser, 8, USR, DEC, ET|USER}, /* man page misspelling of user? */ ++{"upr", "UPR", pr_nop, sr_nop, 3, 0, BSD, TO|RIGHT}, /*usrpri*/ ++{"uprocp", "UPROCP", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT}, ++{"user", "USER", pr_euser, sr_euser, 8, USR, U98, ET|USER}, /* BSD n forces this to UID */ ++{"usertime", "USER", pr_nop, sr_nop, 4, 0, DEC, ET|RIGHT}, ++{"usrpri", "UPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT}, /*upr*/ ++{"util", "C", pr_c, sr_pcpu, 2, 0, SGI, ET|RIGHT}, // not sure about "C" ++{"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, ET|RIGHT}, ++{"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, PO|RIGHT}, ++{"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, PO|RIGHT}, ++{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, PO|RIGHT}, ++{"vm_lock", "LCK", pr_nop, sr_vm_lock, 3, 0, LNx, PO|RIGHT}, ++{"vm_stack", "STACK", pr_nop, sr_vm_stack, 5, 0, LNx, PO|RIGHT}, ++{"vsize", "VSZ", pr_vsz, sr_vsize, 6, 0, DEC, PO|RIGHT}, /*vsz*/ ++{"vsz", "VSZ", pr_vsz, sr_vm_size, 6, 0, U98, PO|RIGHT}, /*vsize*/ ++{"wchan", "WCHAN", pr_wchan, sr_wchan, 6, WCH, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */ ++{"wname", "WCHAN", pr_wname, sr_nop, 6, WCH, SGI, TO|WCHAN}, /* opposite of nwchan */ ++{"xstat", "XSTAT", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, ++{"zone", "ZONE", pr_context, sr_nop, 31, 0, SUN, ET|LEFT}, // Solaris zone == Linux context? ++{"zoneid", "ZONEID", pr_nop, sr_nop, 31, 0, SUN, ET|RIGHT},// Linux only offers context names ++{"~", "-", pr_nop, sr_nop, 1, 0, LNX, AN|RIGHT} /* NULL would ruin alphabetical order */ ++}; ++ ++#undef USER ++#undef LEFT ++#undef RIGHT ++#undef UNLIMITED ++#undef WCHAN ++#undef SIGNAL ++#undef PIDMAX ++#undef PO ++#undef TO ++#undef AN ++#undef ET ++ ++static const int format_array_count = sizeof(format_array)/sizeof(format_struct); ++ ++ ++/****************************** Macro formats *******************************/ ++/* First X field may be NR, which is p->start_code>>26 printed with %2ld */ ++/* That seems useless though, and Debian already killed it. */ ++/* The ones marked "Digital" have the name defined, not just the data. */ ++static const macro_struct macro_array[] = { ++{"DFMT", "pid,tname,state,cputime,cmd"}, /* Digital's default */ ++{"DefBSD", "pid,tname,stat,bsdtime,args"}, /* Our BSD default */ ++{"DefSysV", "pid,tname,time,cmd"}, /* Our SysV default */ ++{"END_BSD", "state,tname,cputime,comm"}, /* trailer for O */ ++{"END_SYS5", "state,tname,time,command"}, /* trailer for -O */ ++{"F5FMT", "uname,pid,ppid,c,start,tname,time,cmd"}, /* Digital -f */ ++ ++{"FB_", "pid,tt,stat,time,command"}, /* FreeBSD default */ ++{"FB_j", "user,pid,ppid,pgid,sess,jobc,stat,tt,time,command"}, /* FreeBSD j */ ++{"FB_l", "uid,pid,ppid,cpu,pri,nice,vsz,rss,wchan,stat,tt,time,command"}, /* FreeBSD l */ ++{"FB_u", "user,pid,pcpu,pmem,vsz,rss,tt,stat,start,time,command"}, /* FreeBSD u */ ++{"FB_v", "pid,stat,time,sl,re,pagein,vsz,rss,lim,tsiz,pcpu,pmem,command"}, /* FreeBSD v */ ++ ++{"FD_", "pid,tty,time,comm"}, /* Fictional Debian SysV default */ ++{"FD_f", "user,pid,ppid,start_time,tty,time,comm"}, /* Fictional Debian -f */ ++{"FD_fj", "user,pid,ppid,start_time,tty,time,pgid,sid,comm"}, /* Fictional Debian -jf */ ++{"FD_j", "pid,tty,time,pgid,sid,comm"}, /* Fictional Debian -j */ ++{"FD_l", "flags,state,uid,pid,ppid,priority,nice,vsz,wchan,tty,time,comm"}, /* Fictional Debian -l */ ++{"FD_lj", "flags,state,uid,pid,ppid,priority,nice,vsz,wchan,tty,time,pgid,sid,comm"}, /* Fictional Debian -jl */ ++ ++{"FL5FMT", "f,state,uid,pid,ppid,pcpu,pri,nice,rss,wchan,start,time,command"}, /* Digital -fl */ ++ ++{"FLASK_context", "pid,context,command"}, /* Flask Linux context, --context */ ++ ++{"HP_", "pid,tty,time,comm"}, /* HP default */ ++{"HP_f", "user,pid,ppid,cpu,stime,tty,time,args"}, /* HP -f */ ++{"HP_fl", "flags,state,user,pid,ppid,cpu,intpri,nice,addr,sz,wchan,stime,tty,time,args"}, /* HP -fl */ ++{"HP_l", "flags,state,uid,pid,ppid,cpu,intpri,nice,addr,sz,wchan,tty,time,comm"}, /* HP -l */ ++ ++{"J390", "pid,sid,pgrp,tname,atime,args"}, /* OS/390 -j */ ++{"JFMT", "user,pid,ppid,pgid,sess,jobc,state,tname,cputime,command"}, /* Digital j and -j */ ++{"L5FMT", "f,state,uid,pid,ppid,c,pri,nice,addr,sz,wchan,tt,time,ucmd"}, /* Digital -l */ ++{"LFMT", "uid,pid,ppid,cp,pri,nice,vsz,rss,wchan,state,tname,cputime,command"}, /* Digital l */ ++ ++{"OL_X", "pid,start_stack,esp,eip,timeout,alarm,stat,tname,bsdtime,args"}, /* Old i386 Linux X */ ++{"OL_j", "ppid,pid,pgid,sid,tname,tpgid,stat,uid,bsdtime,args"}, /* Old Linux j */ ++{"OL_l", "flags,uid,pid,ppid,priority,nice,vsz,rss,wchan,stat,tname,bsdtime,args"}, /* Old Linux l */ ++{"OL_m", "pid,tname,majflt,minflt,m_trs,m_drs,m_size,m_swap,rss,m_share,vm_lib,m_dt,args"}, /* Old Linux m */ ++{"OL_s", "uid,pid,pending,sig_block,sig_ignore,caught,stat,tname,bsdtime,args"}, /* Old Linux s */ ++{"OL_u", "user,pid,pcpu,pmem,vsz,rss,tname,stat,start_time,bsdtime,args"}, /* Old Linux u */ ++{"OL_v", "pid,tname,stat,bsdtime,maj_flt,m_trs,m_drs,rss,pmem,args"}, /* Old Linux v */ ++ ++{"RD_", "pid,tname,state,bsdtime,comm"}, /* Real Debian default */ ++{"RD_f", "uid,pid,ppid,start_time,tname,bsdtime,args"}, /* Real Debian -f */ ++{"RD_fj", "uid,pid,ppid,start_time,tname,bsdtime,pgid,sid,args"}, /* Real Debian -jf */ ++{"RD_j", "pid,tname,state,bsdtime,pgid,sid,comm"}, /* Real Debian -j */ ++{"RD_l", "flags,state,uid,pid,ppid,priority,nice,wchan,tname,bsdtime,comm"}, /* Real Debian -l */ ++{"RD_lj", "flags,state,uid,pid,ppid,priority,nice,wchan,tname,bsdtime,pgid,sid,comm"}, /* Real Debian -jl */ ++ ++{"RUSAGE", "minflt,majflt,nswap,inblock,oublock,msgsnd,msgrcv,nsigs,nvcsw,nivcsw"}, /* Digital -o "RUSAGE" */ ++{"SCHED", "user,pcpu,pri,usrpri,nice,psxpri,psr,policy,pset"}, /* Digital -o "SCHED" */ ++{"SFMT", "uid,pid,cursig,sig,sigmask,sigignore,sigcatch,stat,tname,command"}, /* Digital s */ ++ ++{"Std_f", "uid_hack,pid,ppid,c,stime,tname,time,cmd"}, /* new -f */ ++{"Std_fl", "f,s,uid_hack,pid,ppid,c,opri,ni,addr,sz,wchan,stime,tname,time,cmd"}, /* -fl */ ++{"Std_l", "f,s,uid,pid,ppid,c,opri,ni,addr,sz,wchan,tname,time,ucmd"}, /* new -l */ ++ ++{"THREAD", "user,pcpu,pri,scnt,wchan,usertime,systime"}, /* Digital -o "THREAD" */ ++{"UFMT", "uname,pid,pcpu,pmem,vsz,rss,tt,state,start,time,command"}, /* Digital u */ ++{"VFMT", "pid,tt,state,time,sl,pagein,vsz,rss,pcpu,pmem,command"}, /* Digital v */ ++{"~", "~"} /* NULL would ruin alphabetical order */ ++}; ++ ++static const int macro_array_count = sizeof(macro_array)/sizeof(macro_struct); ++ ++ ++/*************************** AIX formats ********************/ ++/* Convert AIX format codes to normal format specifiers. */ ++static const aix_struct aix_array[] = { ++{'C', "pcpu", "%CPU"}, ++{'G', "group", "GROUP"}, ++{'P', "ppid", "PPID"}, ++{'U', "user", "USER"}, ++{'a', "args", "COMMAND"}, ++{'c', "comm", "COMMAND"}, ++{'g', "rgroup", "RGROUP"}, ++{'n', "nice", "NI"}, ++{'p', "pid", "PID"}, ++{'r', "pgid", "PGID"}, ++{'t', "etime", "ELAPSED"}, ++{'u', "ruser", "RUSER"}, ++{'x', "time", "TIME"}, ++{'y', "tty", "TTY"}, ++{'z', "vsz", "VSZ"}, ++{'~', "~", "~"} /* NULL would ruin alphabetical order */ ++}; ++static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct); ++ ++ ++/********************* sorting ***************************/ ++/* Convert short sorting codes to normal format specifiers. */ ++static const shortsort_struct shortsort_array[] = { ++{'C', "pcpu" }, ++{'G', "tpgid" }, ++{'J', "cstime" }, ++/* {'K', "stime" }, */ /* conflict, system vs. start time */ ++{'M', "maj_flt" }, ++{'N', "cmaj_flt" }, ++{'P', "ppid" }, ++{'R', "resident" }, ++{'S', "share" }, ++{'T', "start_time" }, ++{'U', "uid" }, /* euid */ ++{'c', "cmd" }, ++{'f', "flags" }, ++{'g', "pgrp" }, ++{'j', "cutime" }, ++{'k', "utime" }, ++{'m', "min_flt" }, ++{'n', "cmin_flt" }, ++{'o', "session" }, ++{'p', "pid" }, ++{'r', "rss" }, ++{'s', "size" }, ++{'t', "tty" }, ++{'u', "user" }, ++{'v', "vsize" }, ++{'y', "priority" }, /* nice */ ++{'~', "~" } /* NULL would ruin alphabetical order */ ++}; ++static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct); ++ ++ ++/*********** print format_array **********/ ++/* called by the parser in another file */ ++void print_format_specifiers(void){ ++ const format_struct *walk = format_array; ++ while(*(walk->spec) != '~'){ ++ if(walk->pr != pr_nop) printf("%-12.12s %-8.8s\n", walk->spec, walk->head); ++ walk++; ++ } ++} ++ ++/************ comparison functions for bsearch *************/ ++ ++static int compare_format_structs(const void *a, const void *b){ ++ return strcmp(((const format_struct*)a)->spec,((const format_struct*)b)->spec); ++} ++ ++static int compare_macro_structs(const void *a, const void *b){ ++ return strcmp(((const macro_struct*)a)->spec,((const macro_struct*)b)->spec); ++} ++ ++/******** look up structs as needed by the sort & format parsers ******/ ++ ++const shortsort_struct *search_shortsort_array(const int findme){ ++ const shortsort_struct *walk = shortsort_array; ++ while(walk->desc != '~'){ ++ if(walk->desc == findme) return walk; ++ walk++; ++ } ++ return NULL; ++} ++ ++const aix_struct *search_aix_array(const int findme){ ++ const aix_struct *walk = aix_array; ++ while(walk->desc != '~'){ ++ if(walk->desc == findme) return walk; ++ walk++; ++ } ++ return NULL; ++} ++ ++const format_struct *search_format_array(const char *findme){ ++ format_struct key; ++ key.spec = findme; ++ return bsearch(&key, format_array, format_array_count, ++ sizeof(format_struct), compare_format_structs ++ ); ++} ++ ++const macro_struct *search_macro_array(const char *findme){ ++ macro_struct key; ++ key.spec = findme; ++ return bsearch(&key, macro_array, macro_array_count, ++ sizeof(macro_struct), compare_macro_structs ++ ); ++} ++ ++static unsigned int active_cols; /* some multiple of screen_cols */ ++ ++/***** Last chance, avoid needless trunctuation. */ ++static void check_header_width(void){ ++ format_node *walk = format_list; ++ unsigned int total = 0; ++ int was_normal = 0; ++ unsigned int i = 0; ++ unsigned int sigs = 0; ++ while(walk){ ++ switch((walk->flags) & CF_JUST_MASK){ ++ default: ++ total += walk->width; ++ total += was_normal; ++ was_normal = 1; ++ break; ++ case CF_SIGNAL: ++ sigs++; ++ total += walk->width; ++ total += was_normal; ++ was_normal = 1; ++ break; ++ case CF_UNLIMITED: /* could chop this a bit */ ++ if(walk->next) total += walk->width; ++ else total += 3; /* not strlen(walk->name) */ ++ total += was_normal; ++ was_normal = 1; ++ break; ++ case 0: /* AIX */ ++ total += walk->width; ++ was_normal = 0; ++ break; ++ } ++ walk = walk->next; ++ } ++ for(;;){ ++ i++; ++ active_cols = screen_cols * i; ++ if(active_cols>=total) break; ++ if(screen_cols*i >= OUTBUF_SIZE/2) break; /* can't go over */ ++ } ++ wide_signals = (total+sigs*7 <= active_cols); ++} ++ ++ ++/********** show one process (NULL proc prints header) **********/ ++ ++//#define SPACE_AMOUNT page_size ++#define SPACE_AMOUNT 144 ++ ++static char *saved_outbuf; ++ ++void show_one_proc(const proc_t *restrict const p, const format_node *restrict fmt){ ++ /* unknown: maybe set correct & actual to 1, remove +/- 1 below */ ++ int correct = 0; /* screen position we should be at */ ++ int actual = 0; /* screen position we are at */ ++ int amount = 0; /* amount of text that this data is */ ++ int leftpad = 0; /* amount of space this column _could_ need */ ++ int space = 0; /* amount of space we actually need to print */ ++ int dospace = 0; /* previous column determined that we need a space */ ++ int legit = 0; /* legitimately stolen extra space */ ++ int sz = 0; /* real size of data in outbuffer */ ++ int tmpspace = 0; ++ char *restrict const outbuf = saved_outbuf; ++ static int did_stuff = 0; /* have we ever printed anything? */ ++ ++ if(unlikely(-1==(long)p)){ /* true only once, at the end */ ++ if(did_stuff) return; ++ /* have _never_ printed anything, but might need a header */ ++ if(!--lines_to_next_header){ ++ lines_to_next_header = header_gap; ++ show_one_proc(NULL,fmt); ++ } ++ /* fprintf(stderr, "No processes available.\n"); */ /* legal? */ ++ exit(1); ++ } ++ if(likely(p)){ /* not header, maybe we should call ourselves for it */ ++ if(unlikely(!--lines_to_next_header)){ ++ lines_to_next_header = header_gap; ++ show_one_proc(NULL,fmt); ++ } ++ } ++ did_stuff = 1; ++ if(unlikely(active_cols>(int)OUTBUF_SIZE)) fprintf(stderr,"Fix bigness error.\n"); ++ ++ /* print row start sequence */ ++ for(;;){ ++ legit = 0; ++ /* set width suggestion which might be ignored */ ++// if(likely(fmt->next)) max_rightward = fmt->width; ++// else max_rightward = active_cols-((correct>actual) ? correct : actual); ++ ++ if(likely(fmt->next)){ ++ max_rightward = fmt->width; ++ tmpspace = 0; ++ }else{ ++ tmpspace = correct-actual; ++ if (tmpspace<1){ ++ tmpspace = dospace; ++ max_rightward = active_cols-actual-tmpspace; ++ }else{ ++ max_rightward = active_cols - ( (correct>actual) ? correct : actual ); ++ } ++ } ++ max_leftward = fmt->width + actual - correct; /* TODO check this */ ++ ++// fprintf(stderr, "cols: %d, max_rightward: %d, max_leftward: %d, actual: %d, correct: %d\n", ++// active_cols, max_rightward, max_leftward, actual, correct); ++ ++ /* prepare data and calculate leftpad */ ++ if(likely(p) && likely(fmt->pr)) amount = (*fmt->pr)(outbuf,p); ++ else amount = strlen(strcpy(outbuf, fmt->name)); /* AIX or headers */ ++ ++ switch((fmt->flags) & CF_JUST_MASK){ ++ case 0: /* for AIX, assigned outside this file */ ++ leftpad = 0; ++ break; ++ case CF_LEFT: /* bad */ ++ leftpad = 0; ++ break; ++ case CF_RIGHT: /* OK */ ++ leftpad = fmt->width - amount; ++ if(leftpad < 0) leftpad = 0; ++ break; ++ case CF_SIGNAL: ++ /* if the screen is wide enough, use full 16-character output */ ++ if(wide_signals){ ++ leftpad = 16 - amount; ++ legit = 7; ++ }else{ ++ leftpad = 9 - amount; ++ } ++ if(leftpad < 0) leftpad = 0; ++ break; ++ case CF_USER: /* bad */ ++ leftpad = fmt->width - amount; ++ if(leftpad < 0) leftpad = 0; ++ if(!user_is_number) leftpad = 0; ++ break; ++ case CF_WCHAN: /* bad */ ++ if(wchan_is_number){ ++ leftpad = fmt->width - amount; ++ if(leftpad < 0) leftpad = 0; ++ break; ++ }else{ ++ if ((active_cols-actual-tmpspace)<1) ++ outbuf[1] = '\0'; /* oops, we (mostly) lose this column... */ ++ leftpad = 0; ++ break; ++ } ++ case CF_UNLIMITED: ++ { ++ if(active_cols-actual-tmpspace < 1) ++ outbuf[1] = '\0'; /* oops, we (mostly) lose this column... */ ++ leftpad = 0; ++ break; ++ } ++ default: ++ fprintf(stderr, "bad alignment code\n"); ++ break; ++ } ++ /* At this point: ++ * ++ * correct from previous column ++ * actual from previous column ++ * amount not needed (garbage due to chopping) ++ * leftpad left padding for this column alone (not make-up or gap) ++ * space not needed (will recalculate now) ++ * dospace if we require space between this and the prior column ++ * legit space we were allowed to steal, and thus did steal ++ */ ++ space = correct - actual + leftpad; ++ if(space<1) space=dospace; ++ if(unlikely(space>SPACE_AMOUNT)) space=SPACE_AMOUNT; // only so much available ++ ++ /* real size -- don't forget in 'amount' is number of cells */ ++ sz = strlen(outbuf); ++ ++ /* print data, set x position stuff */ ++ if(unlikely(!fmt->next)){ ++ /* Last column. Write padding + data + newline all together. */ ++ outbuf[sz] = '\n'; ++ fwrite(outbuf-space, space+sz+1, 1, stdout); ++ break; ++ } ++ /* Not the last column. Write padding + data together. */ ++ fwrite(outbuf-space, space+sz, 1, stdout); ++ actual += space+amount; ++ correct += fmt->width; ++ correct += legit; /* adjust for SIGNAL expansion */ ++ if(fmt->pr && fmt->next->pr){ /* neither is AIX filler */ ++ correct++; ++ dospace = 1; ++ }else{ ++ dospace = 0; ++ } ++ fmt = fmt->next; ++ /* At this point: ++ * ++ * correct screen position we should be at ++ * actual screen position we are at ++ * amount not needed ++ * leftpad not needed ++ * space not needed ++ * dospace if have determined that we need a space next time ++ * legit not needed ++ */ ++ } ++} ++ ++ ++#ifdef TESTING ++static void sanity_check(void){ ++ format_struct *fs = format_array; ++ while((fs->spec)[0] != '~'){ ++ if(strlen(fs->head) > fs->width) printf("%d %s\n",strlen(fs->head),fs->spec); ++ fs++; ++ } ++} ++#endif ++ ++ ++void init_output(void){ ++ int outbuf_pages; ++ char *outbuf; ++ ++ switch(page_size){ ++ case 65536: page_shift = 16; break; ++ case 32768: page_shift = 15; break; ++ case 16384: page_shift = 14; break; ++ case 8192: page_shift = 13; break; ++ default: fprintf(stderr, "Unknown page size! (assume 4096)\n"); ++ case 4096: page_shift = 12; break; ++ case 2048: page_shift = 11; break; ++ case 1024: page_shift = 10; break; ++ } ++ ++ // add page_size-1 to round up ++ outbuf_pages = (OUTBUF_SIZE+SPACE_AMOUNT+page_size-1)/page_size; ++ outbuf = mmap( ++ 0, ++ page_size * (outbuf_pages+1), // 1 more, for guard page at high addresses ++ PROT_READ | PROT_WRITE, ++ MAP_PRIVATE | MAP_ANONYMOUS, ++ -1, ++ 0 ++ ); ++ memset(outbuf, ' ', SPACE_AMOUNT); ++ if(SPACE_AMOUNT==page_size) mprotect(outbuf, page_size, PROT_READ); ++ mprotect(outbuf + page_size*outbuf_pages, page_size, PROT_NONE); // gaurd page ++ saved_outbuf = outbuf + SPACE_AMOUNT; ++ // available space: page_size*outbuf_pages-SPACE_AMOUNT ++ ++ seconds_since_1970 = time(NULL); ++ time_of_boot = seconds_since_1970 - seconds_since_boot; ++ ++ meminfo(); ++ ++ check_header_width(); ++} diff --git a/patches/procps-3.2.7/generic/10_pmap.1.dpatch b/patches/procps-3.2.7/generic/10_pmap.1.dpatch new file mode 100644 index 000000000..10e9ae44f --- /dev/null +++ b/patches/procps-3.2.7/generic/10_pmap.1.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_pmap.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleanup pmap.1 manual page #282168 + +@DPATCH@ +diff -urNad procps-3.2.7~/pmap.1 procps-3.2.7/pmap.1 +--- procps-3.2.7~/pmap.1 2004-01-29 13:39:08.000000000 +1100 ++++ procps-3.2.7/pmap.1 2006-06-26 11:48:23.000000000 +1000 +@@ -10,25 +10,29 @@ + pmap \- report memory map of a process + + .SH SYNOPSIS +-.nf +-pmap [ -x | -d ] [ -q ] pids... +-pmap -V +-.fi ++.B pmap ++.RB [ \-x | \-d ] ++.RB [ \-q ] ++.I pid ++\& ... ++.br ++.B pmap \-V + + .SH DESCRIPTION + The pmap command reports the memory map of a process or processes. + + .SH "GENERAL OPTIONS" + .TS +-l l l. +--x extended Show the extended format. +--d device Show the device format. +--q quiet Do not display some header/footer lines. +--V show version Displays version of program. ++lB l l. ++\-x extended Show the extended format. ++\-d device Show the device format. ++\-q quiet Do not display some header/footer lines. ++\-V show version Displays version of program. + .TE + + .SH "SEE ALSO" +-ps(1) pgrep(1) ++.BR ps(1), ++.BR pgrep(1) + + .SH STANDARDS + No standards apply, but pmap looks an awful lot like a SunOS command. diff --git a/patches/procps-3.2.7/generic/10_ps.1.dpatch b/patches/procps-3.2.7/generic/10_ps.1.dpatch new file mode 100644 index 000000000..345ad084a --- /dev/null +++ b/patches/procps-3.2.7/generic/10_ps.1.dpatch @@ -0,0 +1,46 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_ps.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: ps.1 normal indent widths +## DP: pri field explained #465761 +## DP: --no-heading comment is an alias for --no-headers + +@DPATCH@ +diff -urNad procps-3.2.7~/ps/ps.1 procps-3.2.7/ps/ps.1 +--- procps-3.2.7~/ps/ps.1 2008-04-07 09:13:00.000000000 +1000 ++++ procps-3.2.7/ps/ps.1 2008-04-07 09:59:52.000000000 +1000 +@@ -18,12 +18,6 @@ + .nh + .if n .ss 12 0 + .\" +-.\" 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 +-.\" + .\" + .\" ColSize is used for the format spec table. + .\" It's the left margin, minus the right, minus +@@ -588,7 +582,8 @@ + repeat header lines, one per page of output + + .opt \-\-no\-headers +-print no header line at all ++print no header line at all. \-\-no\-heading is an alias for this ++option. + + .opt \-\-lines \ n + set screen height +@@ -1139,6 +1134,10 @@ + parent process ID. + T} + ++pri PRI T{ ++priority of the process. Higher number means lower priority ++T} ++ + psr PSR T{ + processor that process is currently assigned to. + T} diff --git a/patches/procps-3.2.7/generic/10_skill.1.dpatch b/patches/procps-3.2.7/generic/10_skill.1.dpatch new file mode 100644 index 000000000..56ca5bc97 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_skill.1.dpatch @@ -0,0 +1,118 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_skill.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleanup man page #282168 + +@DPATCH@ +diff -urNad procps-3.2.7~/skill.1 procps-3.2.7/skill.1 +--- procps-3.2.7~/skill.1 2008-04-07 11:12:27.000000000 +1000 ++++ procps-3.2.7/skill.1 2008-04-07 11:13:03.000000000 +1000 +@@ -11,37 +11,38 @@ + skill, snice \- send a signal or report process status + + .SH SYNOPSIS +-.nf +-skill [signal to send] [options] process selection criteria +-snice [new priority] [options] process selection criteria +-.fi ++.B skill ++.RI [ "signal to send" ] ++.RI [ options ] ++.I process selection criteria ++.br ++.B snice ++.RI [ "new priority" ] ++.RI [ options ] ++.I process selection criteria + + .SH DESCRIPTION + These tools are probably obsolete and unportable. The command + syntax is poorly defined. Consider using the killall, pkill, + and pgrep commands instead. + +-The default signal for skill is TERM. Use -l or -L to list available signals. ++The default signal for skill is TERM. Use \-l or \-L to list available signals. + Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0. +-Alternate signals may be specified in three ways: -9 -SIGKILL -KILL. ++Alternate signals may be specified in three ways: \-9 \-SIGKILL \-KILL. + + The default priority for snice is +4. (snice +4 ...) +-Priority numbers range from +20 (slowest) to -20 (fastest). ++Priority numbers range from +20 (slowest) to \-20 (fastest). + Negative priority numbers are restricted to administrative users. + + .SH "GENERAL OPTIONS" + .TS +-l l l. +--f fast mode This is not currently useful. +--i interactive use T{ +-You will be asked to approve each action. +-T} +--v verbose output T{ +-Display information about selected processes. +-T} +--w warnings enabled This is not currently useful. +--n no action This only displays the process ID. +--V show version Displays version of program. ++lB l l. ++\-f fast mode This is not currently useful. ++\-i interactive use You will be asked to approve each action. ++\-v verbose output Display information about selected processes. ++\-w warnings enabled This is not currently useful. ++\-n no action This only displays the process ID. ++\-V show version Displays version of program. + .TE + + .SH "PROCESS SELECTION OPTIONS" +@@ -49,11 +50,11 @@ + The options below may be used to ensure correct interpretation. + Do not blame Albert for this interesting interface. + .TS +-l l. +--t The next argument is a terminal (tty or pty). +--u The next argument is a username. +--p The next argument is a process ID number. +--c The next argument is a command name. ++lB l. ++\-t The next argument is a terminal (tty or pty). ++\-u The next argument is a username. ++\-p The next argument is a process ID number. ++\-c The next argument is a command name. + .TE + + .SH SIGNALS +@@ -63,7 +64,6 @@ + lB rB lB lB + lfCW r l l. + Name Num Action Description +-.TH + 0 0 n/a exit code indicates if a signal may be sent + ALRM 14 exit + HUP 1 exit +@@ -104,15 +104,20 @@ + lB lB + lfCW l. + Command Description +-.TC + snice seti crack +7 Slow down seti and crack +-skill -KILL -v /dev/pts/* Kill users on new-style PTY devices +-skill -STOP viro lm davem Stop 3 users +-snice -17 root bash Give priority to root's shell ++skill \-KILL \-v /dev/pts/* Kill users on new-style PTY devices ++skill \-STOP viro lm davem Stop 3 users ++snice \-17 root bash Give priority to root's shell + .TE + + .SH "SEE ALSO" +-killall(1) pkill(1) kill(1) renice(1) nice(1) signal(7) kill(2) ++.BR killall (1), ++.BR pkill (1), ++.BR kill (1), ++.BR renice (1), ++.BR nice(1), ++.BR kill(2), ++.BR signal(7) + + .SH STANDARDS + No standards apply. diff --git a/patches/procps-3.2.7/generic/10_skill_perror.dpatch b/patches/procps-3.2.7/generic/10_skill_perror.dpatch new file mode 100644 index 000000000..c88f4d10c --- /dev/null +++ b/patches/procps-3.2.7/generic/10_skill_perror.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_skill_perror.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: kill prints perror #468363 + +@DPATCH@ +diff -urNad procps-3.2.7~/skill.c procps-3.2.7/skill.c +--- procps-3.2.7~/skill.c 2008-04-07 10:07:12.000000000 +1000 ++++ procps-3.2.7/skill.c 2008-04-07 10:07:58.000000000 +1000 +@@ -309,6 +309,7 @@ + pid = strtol(argv[argc],&endp,10); + if(!*endp){ + if(!kill((pid_t)pid,signo)) continue; ++ perror("kill"); + exitvalue = 1; + continue; + } diff --git a/patches/procps-3.2.7/generic/10_slabtop.dpatch b/patches/procps-3.2.7/generic/10_slabtop.dpatch new file mode 100644 index 000000000..6aef08650 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_slabtop.dpatch @@ -0,0 +1,99 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_slabtop.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleanup slabtop man page #282168 + +@DPATCH@ +diff -urNad procps-3.2.7~/slabtop.1 procps-3.2.7/slabtop.1 +--- procps-3.2.7~/slabtop.1 2006-06-18 15:10:24.000000000 +1000 ++++ procps-3.2.7/slabtop.1 2006-06-26 12:31:42.000000000 +1000 +@@ -7,36 +7,39 @@ + slabtop \- display kernel slab cache information in real time + + .SH SYNOPSIS +-.BI "slabtop [ " options " ] " ++.B slabtop ++.RI [ options ] + + .SH DESCRIPTION +-.BR slabtop (1) ++.B slabtop + displays detailed kernel slab cache information in real time. It displays a + listing of the top caches sorted by one of the listed sort criteria. It also + displays a statistics header filled with slab layer information. + + .SH OPTIONS + Normal invocation of +-.BR slabtop (1) ++.B slabtop + does not require any options. The behavior, however, can be fine-tuned by + specifying one or more of the following flags: + .TP +-.B \-\^\-delay=n, \-d n +-Refresh the display every n seconds. By default, +-.BR slabtop (1) ++.B \-\-delay=\fIn\fR, \fB\-d \fIn ++Refresh the display every ++.I n ++in seconds. By default, ++.B slabtop + refreshes the display every three seconds. To exit the program, hit + .BR q. + .TP +-.B \-\^\-sort=S, \-s S +-Sort by S, where S is one of the sort criteria. ++.B \-\-sort=\fIS\fR, \fB\-s\fR \fIS ++Sort by \fIS\fR, where \fIS\fR is one of the sort criteria. + .TP +-.B \-\^\-once, \-o ++.B \-\-once\fR, \fB\-o + Display the output once and then exit. + .TP +-.B \-\^\-version, \-V ++.B \-\-version\fR, \fB\-V + Display version information and exit. + .TP +-.B \-\^\-help ++.B \-\-help + Display usage information and exit. + + .SH SORT CRITERIA +@@ -78,7 +81,7 @@ + sort by cache utilization + + .SH COMMANDS +-.BR slabtop (1) ++.B slabtop + accepts keyboard commands from the user during use. The following are + supported. In the case of letters, both cases are accepted. + +@@ -94,7 +97,9 @@ + Quit the program. + + .SH FILES +-.IR /proc/slabinfo " \-\- slab information" ++.TP ++.I /proc/slabinfo ++slab information + + .SH "SEE ALSO" + .BR free (1), +@@ -104,7 +109,7 @@ + + .SH NOTES + Currently, +-.BR slabtop (1) ++.B slabtop + requires a 2.4 or later kernel (specifically, a version 1.1 or later + .IR /proc/slabinfo ). + Kernel 2.2 should be supported in the future. +@@ -116,7 +121,7 @@ + .SH AUTHORS + Written by Chris Rivera and Robert Love. + +-.BR slabtop (1) ++.B slabtop + was inspired by Martin Bligh's perl script, + .BR vmtop . + The procps package is maintained by Albert Cahalan <albert@users.sf.net>. diff --git a/patches/procps-3.2.7/generic/10_sysctl.8.dpatch b/patches/procps-3.2.7/generic/10_sysctl.8.dpatch new file mode 100644 index 000000000..7d9ec3e6f --- /dev/null +++ b/patches/procps-3.2.7/generic/10_sysctl.8.dpatch @@ -0,0 +1,149 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_sysctl_8.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: -p flag has OPTIONAL filename (#297144) +## DP: cleanup ssysctl man page #282168 + +@DPATCH@ +diff -urNad procps-3.2.7~/sysctl.8 procps-3.2.7/sysctl.8 +--- procps-3.2.7~/sysctl.8 2006-06-26 09:44:20.000000000 +1000 ++++ procps-3.2.7/sysctl.8 2006-06-26 12:42:08.000000000 +1000 +@@ -10,76 +10,108 @@ + .SH NAME + sysctl \- configure kernel parameters at runtime + .SH SYNOPSIS +-.B "sysctl [-n] [-e] variable ..." ++.B sysctl ++.RB [ \-n ] ++.RB [ \-e ] ++.I variable ++\&... + .br +-.B "sysctl [-n] [-e] [-q] -w variable=value ..." ++.B sysctl ++.RB [ \-n ] ++.RB [ \-e ] ++.RB [ \-q ] ++.B \-w ++.IR variable = value ++\&... + .br +-.B "sysctl [-n] [-e] [-q] -p <filename>" ++.B sysctl ++.RB [ \-n ] ++.RB [ \-e ] ++.RB [ \-q ] ++.B \-p ++.RI [ filename ] + .br +-.B "sysctl [-n] [-e] -a" ++.B sysctl ++.RB [ \-n ] ++.RB [ \-e ] ++.B \-a + .br +-.B "sysctl [-n] [-e] -A" ++.B sysctl ++.RB [ \-n ] ++.RB [ \-e ] ++.B \-A + .SH DESCRIPTION + .B sysctl + is used to modify kernel parameters at runtime. The parameters available + are those listed under /proc/sys/. Procfs is required for +-.B sysctl(8) ++.B sysctl + support in Linux. You can use +-.B sysctl(8) ++.B sysctl + to both read and write sysctl data. + .SH PARAMETERS + .TP +-.B "variable" ++.I variable + The name of a key to read from. An example is kernel.ostype. The '/' + separator is also accepted in place of a '.'. + .TP +-.B "variable=value" +-To set a key, use the form variable=value, where variable is the key and +-value is the value to set it to. If the value contains quotes or characters ++.IR variable = value ++To set a key, use the form ++.IR variable = value ++where ++.I variable ++is the key and ++.I value ++is the value to set it to. If the value contains quotes or characters + which are parsed by the shell, you may need to enclose the value in double +-quotes. This requires the -w parameter to use. ++quotes. This requires the ++.B \-w ++parameter to use. + .TP +-.B "-n" ++.B \-n + Use this option to disable printing of the key name when printing values. + .TP +-.B "-e" ++.B \-e + Use this option to ignore errors about unknown keys. + .TP +-.B "-N" ++.B \-N + Use this option to only print the names. It may be useful with shells that + have programmable completion. + .TP +-.B "-q" ++.B \-q + Use this option to not display the values set to stdout. + .TP +-.B "-w" ++.B \-w + Use this option when you want to change a sysctl setting. + .TP +-.B "-p" ++.B \-p + Load in sysctl settings from the file specified or /etc/sysctl.conf if none given. + Specifying \- as filename means reading data from standard input. + .TP +-.B "-a" ++.B \-a + Display all values currently available. + .TP +-.B "-A" ++.B \-A + Display all values currently available in table form. + .SH EXAMPLES +-.TP +-/sbin/sysctl -a +-.TP +-/sbin/sysctl -n kernel.hostname +-.TP +-/sbin/sysctl -w kernel.domainname="example.com" +-.TP +-/sbin/sysctl -p /etc/sysctl.conf ++/sbin/sysctl \-a ++.br ++/sbin/sysctl \-n kernel.hostname ++.br ++/sbin/sysctl \-w kernel.domainname="example.com" ++.br ++/sbin/sysctl \-p /etc/sysctl.conf + .SH FILES + .I /proc/sys ++.br + .I /etc/sysctl.conf + .SH SEE ALSO + .BR sysctl.conf (5) + .SH BUGS +-The -A parameter behaves just as -a does. ++The ++.B \-A ++parameter behaves just as ++.B \-a ++does. + .SH AUTHOR + George Staikos, <staikos@0wned.org> + diff --git a/patches/procps-3.2.7/generic/10_sysctl_malloclen.dpatch b/patches/procps-3.2.7/generic/10_sysctl_malloclen.dpatch new file mode 100644 index 000000000..8f831a32c --- /dev/null +++ b/patches/procps-3.2.7/generic/10_sysctl_malloclen.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_sysctl_malloclen.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Adjust malloc length one more Closes: #423704 + +@DPATCH@ +diff -urNad procps-3.2.7~/sysctl.c procps-3.2.7/sysctl.c +--- procps-3.2.7~/sysctl.c 2006-06-25 10:51:51.000000000 +1000 ++++ procps-3.2.7/sysctl.c 2007-05-16 22:37:40.000000000 +1000 +@@ -135,7 +135,7 @@ + } + + /* used to open the file */ +- tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1); ++ tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2); + strcpy(tmpname, PROC_PATH); + strcat(tmpname, name); + slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */ diff --git a/patches/procps-3.2.7/generic/10_sysctl_options.dpatch b/patches/procps-3.2.7/generic/10_sysctl_options.dpatch new file mode 100644 index 000000000..1616bdb7c --- /dev/null +++ b/patches/procps-3.2.7/generic/10_sysctl_options.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_sysctl_options.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix up some option processing + +@DPATCH@ +diff -urNad procps-3.2.7~/sysctl.c procps-3.2.7/sysctl.c +--- procps-3.2.7~/sysctl.c 2008-08-10 10:57:23.000000000 +1000 ++++ procps-3.2.7/sysctl.c 2008-08-10 10:59:11.000000000 +1000 +@@ -421,6 +421,7 @@ + const char *me = (const char *)basename(argv[0]); + bool SwitchesAllowed = true; + bool WriteMode = false; ++ bool DisplayAllOpt = false; + int ReturnCode = 0; + const char *preloadfile = DEFAULT_PRELOAD; + +@@ -486,8 +487,8 @@ + case 'a': // string and integer values (for Linux, all of them) + case 'A': // same as -a -o + case 'X': // same as -a -x +- SwitchesAllowed = false; +- return DisplayAll(PROC_PATH); ++ DisplayAllOpt = true; ++ break; + case 'V': + fprintf(stdout, "sysctl (%s)\n",procps_version); + exit(0); +@@ -502,6 +503,8 @@ + } else { + if (NameOnly && Quiet) // nonsense + return Usage(me); ++ if (DisplayAllOpt) // We cannot have values with -a ++ return Usage(me); + SwitchesAllowed = false; + if (WriteMode || index(*argv, '=')) + ReturnCode = WriteSetting(*argv); +@@ -509,6 +512,11 @@ + ReturnCode = ReadSetting(*argv); + } + } ++ if (DisplayAllOpt) { ++ if (Quiet) ++ return Usage(me); ++ return DisplayAll(PROC_PATH); ++ } + + return ReturnCode; + } diff --git a/patches/procps-3.2.7/generic/10_tload.1.dpatch b/patches/procps-3.2.7/generic/10_tload.1.dpatch new file mode 100644 index 000000000..ce660d621 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_tload.1.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_tload.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Reword tload.1 man page for the alarm + +@DPATCH@ +diff -urNad procps-3.2.7~/tload.1 procps-3.2.7/tload.1 +--- procps-3.2.7~/tload.1 2002-10-07 07:26:12.000000000 +1000 ++++ procps-3.2.7/tload.1 2006-06-26 12:44:39.000000000 +1000 +@@ -39,7 +39,7 @@ + .BI "\-d" " delay" + option sets the time argument for an + .BR alarm (2); +-if -d 0 is specified, the alarm is set to 0, which will never send the ++if \-d 0 is specified, the alarm is set to 0, which will never send the + .B SIGALRM + and update the display. + diff --git a/patches/procps-3.2.7/generic/10_top_irix.dpatch b/patches/procps-3.2.7/generic/10_top_irix.dpatch new file mode 100644 index 000000000..0d3f49950 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_top_irix.dpatch @@ -0,0 +1,46 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_top_irix.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Change formal of IRix mode when showing threads #459890 + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- procps-3.2.7~/top.c 2008-04-07 08:43:08.000000000 +1000 ++++ procps-3.2.7/top.c 2008-04-07 08:45:23.000000000 +1000 +@@ -1774,7 +1774,8 @@ + confighlp(Winstk[i].rc.fieldscur); + } + +- if(Rc.mode_irixps && smp_num_cpus>1){ ++ if(Rc.mode_irixps && smp_num_cpus>1 && ++ !(CHKw(Curwin, Show_THREADS))) { + // good for 100 CPUs per process + pcpu_max_value = 9999.0; + Fieldstab[P_CPU].fmts = " %4.0f"; +@@ -2561,6 +2562,15 @@ + case 'H': + if (VIZCHKc) { + TOGw(Curwin, Show_THREADS); ++ if(Rc.mode_irixps && smp_num_cpus>1 && ++ !(CHKw(Curwin, Show_THREADS))){ ++ // good for 100 CPUs per process ++ pcpu_max_value = 9999.0; ++ Fieldstab[P_CPU].fmts = " %4.0f"; ++ } else { ++ pcpu_max_value = 99.9; ++ Fieldstab[P_CPU].fmts = " %#4.1f"; ++ } + show_msg(fmtmk("Show threads %s" + , CHKw(Curwin, Show_THREADS) ? "On" : "Off")); + } +@@ -2617,7 +2627,8 @@ + Rc.mode_irixps = !Rc.mode_irixps; + show_msg(fmtmk("Irix mode %s", Rc.mode_irixps ? "On" : "Off")); + #endif +- if(Rc.mode_irixps && smp_num_cpus>1){ ++ if(Rc.mode_irixps && smp_num_cpus>1 && ++ !(CHKw(Curwin, Show_THREADS))){ + // good for 100 CPUs per process + pcpu_max_value = 9999.0; + Fieldstab[P_CPU].fmts = " %4.0f"; diff --git a/patches/procps-3.2.7/generic/10_top_no_openproc.dpatch b/patches/procps-3.2.7/generic/10_top_no_openproc.dpatch new file mode 100644 index 000000000..46d708798 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_top_no_openproc.dpatch @@ -0,0 +1,23 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_top_no_openproc.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Exit top if cannot openproc #378695 + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- procps-3.2.7~/top.c 2009-01-09 17:04:25.000000000 +1100 ++++ procps-3.2.7/top.c 2009-01-09 17:43:06.000000000 +1100 +@@ -1097,6 +1097,12 @@ + else + PT = openproc(flags); + ++ if (PT==NULL) { ++ std_err(strerror(errno)); ++ exit(1); ++ } ++ ++ + // i) Allocated Chunks: *Existing* table; refresh + reuse + if (!(CHKw(Curwin, Show_THREADS))) { + while (curmax < savmax) { diff --git a/patches/procps-3.2.7/generic/10_top_stdineof.dpatch b/patches/procps-3.2.7/generic/10_top_stdineof.dpatch new file mode 100644 index 000000000..2eb50b06e --- /dev/null +++ b/patches/procps-3.2.7/generic/10_top_stdineof.dpatch @@ -0,0 +1,22 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_top_stdineof.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Check for stdin eof if term closes #458986 + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- procps-3.2.7~/top.c 2008-08-10 00:24:40.000000000 +1000 ++++ procps-3.2.7/top.c 2008-08-10 10:09:49.000000000 +1000 +@@ -3382,9 +3382,8 @@ + // check 1st, in case tv zeroed (by sig handler) before it got set + rc = chin(0, &c, 1); + 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, may happen if top ++ * erroneously gets detached from it. */ + fcntl(STDIN_FILENO, F_SETFL, file_flags); + select(1, &fs, NULL, NULL, &tv); + fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags); diff --git a/patches/procps-3.2.7/generic/10_top_uid_length.dpatch b/patches/procps-3.2.7/generic/10_top_uid_length.dpatch new file mode 100644 index 000000000..77befc5e2 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_top_uid_length.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_top_uid_length.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Make the uid length 5 not 4 #426782 + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- procps-3.2.7~/top.c 2009-01-08 10:22:37.000000000 +1100 ++++ procps-3.2.7/top.c 2009-01-08 10:23:07.000000000 +1100 +@@ -1222,7 +1222,7 @@ + { "AaAa", " PID", " %5u", -1, -1, SF(PID), "Process Id", L_NONE }, + { "BbBb", " PPID", " %5u", -1, -1, SF(PPD), "Parent Process Pid", L_EITHER }, + { "CcQq", " RUSER ", " %-8.8s", -1, -1, SF(URR), "Real user name", L_RUSER }, +- { "DdCc", " UID", " %4u", -1, -1, SF(UID), "User Id", L_NONE }, ++ { "DdCc", " UID", " %5u", -1, -1, SF(UID), "User Id", L_NONE }, + { "EeDd", " USER ", " %-8.8s", -1, -1, SF(URE), "User Name", L_EUSER }, + { "FfNn", " GROUP ", " %-8.8s", -1, -1, SF(GRP), "Group Name", L_GROUP }, + { "GgGg", " TTY ", " %-8.8s", 8, -1, SF(TTY), "Controlling Tty", L_stat }, diff --git a/patches/procps-3.2.7/generic/10_uptime.1.dpatch b/patches/procps-3.2.7/generic/10_uptime.1.dpatch new file mode 100644 index 000000000..e9ae0064e --- /dev/null +++ b/patches/procps-3.2.7/generic/10_uptime.1.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_uptime.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleanup uptime man page #282168 + +@DPATCH@ +diff -urNad procps-3.2.7~/uptime.1 procps-3.2.7/uptime.1 +--- procps-3.2.7~/uptime.1 2006-06-26 09:37:50.000000000 +1000 ++++ procps-3.2.7/uptime.1 2006-06-26 12:45:06.000000000 +1000 +@@ -6,7 +6,8 @@ + .SH SYNOPSIS + .B uptime + .br +-.BR uptime " [" "\-V" ] ++.B uptime ++.RB [ \-V ] + .SH DESCRIPTION + .B uptime + gives a one line display of the following information. +@@ -14,13 +15,25 @@ + how long the system has been running, + how many users are currently logged on, + and the system load averages for the past 1, 5, and 15 minutes. +-.sp ++ + This is the same information contained in the header line displayed by + .BR w (1). ++.sp ++System load averages is the average number of processes that are either ++in a runnable or uninterruptable state. A process in a runnable state is ++either using the CPU or waiting to use the CPU. A process in ++uninterruptable state is waiting for some I/O access, eg waiting for ++disk. The averages are taken over the three time intervals. ++Load averages are not normalized for the number of CPUs in a system, so ++a load average of 1 means a single CPU system is loaded all the time ++while on a 4 CPU system it means it was idle 75% of the time. + .SH FILES +-.IR /var/run/utmp " information about who is currently logged on" +-.br +-.IR /proc " process information" ++.TP ++.I /var/run/utmp ++information about who is currently logged on ++.TP ++.I /proc ++process information + .SH AUTHORS + .B uptime + was written by Larry Greenfield <greenfie@gauss.rutgers.edu> and diff --git a/patches/procps-3.2.7/generic/10_vmstat.8.dpatch b/patches/procps-3.2.7/generic/10_vmstat.8.dpatch new file mode 100644 index 000000000..f3cca9627 --- /dev/null +++ b/patches/procps-3.2.7/generic/10_vmstat.8.dpatch @@ -0,0 +1,113 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_vmstat.8.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fixes groff problems +## DP: Removes pslab as it doesnt appear + +@DPATCH@ +diff -urNad procps-3.2.7~/vmstat.8 procps-3.2.7/vmstat.8 +--- procps-3.2.7~/vmstat.8 2009-01-08 10:26:34.000000000 +1100 ++++ procps-3.2.7/vmstat.8 2009-01-09 12:23:21.000000000 +1100 +@@ -1,6 +1,6 @@ + .\" This page Copyright (C) 1994 Henry Ware <al172@yfn.ysu.edu> + .\" Distributed under the GPL, Copyleft 1994. +-.TH VMSTAT 8 "27 July 1994 " "Throatwobbler Ginkgo Labs" "Linux Administrator's Manual" ++.TH VMSTAT 8 "2009 Jan 9" "Throatwobbler Ginkgo Labs" "Linux Administrator's Manual" + .SH NAME + vmstat \- Report virtual memory statistics + .SH SYNOPSIS +@@ -22,32 +22,35 @@ + .RB [ "\-d"] + .br + .B vmstat ++.RB [ "\-D"] ++.br ++.B vmstat + .RB [ "\-p disk partition"] + .br + .B vmstat + .RB [ "\-V" ] + .SH DESCRIPTION + \fBvmstat\fP reports information about processes, memory, paging, +-block IO, traps, and cpu activity. ++block IO, traps, disks and cpu activity. + + The first report produced gives averages since the last reboot. Additional + reports give information on a sampling period of length \fIdelay\fP. + The process and memory reports are instantaneous in either case. + + .SS Options +-The \fB-a\fP switch displays active/inactive memory, given a 2.5.41 kernel or better. ++The \fB\-a\fP switch displays active/inactive memory, given a 2.5.41 kernel or better. + .PP +-The \fB-f\fP switch displays the number of forks since boot. ++The \fB\-f\fP switch displays the number of forks since boot. + This includes the fork, vfork, and clone system calls, and is + equivalent to the total number of tasks created. Each process + 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\-m\fP displays slabinfo. + .PP +-The \fB-n\fP switch causes the header to be displayed only once rather than periodically. ++The \fB\-n\fP switch causes the header to be displayed only once rather than periodically. + .PP +-The \fB-s\fP switch displays a table of various event counters ++The \fB\-s\fP switch displays a table of various event counters + and memory statistics. This display does not repeat. + .PP + .I delay +@@ -58,13 +61,15 @@ + is the number of updates. If no count is specified and delay is + defined, \fIcount\fP defaults to infinity. + .PP +-The \fB-d\fP reports disk statistics (2.5.70 or above required) ++The \fB\-d\fP reports disk statistics (2.5.70 or above required) + .PP +-The \fB-p\fP followed by some partition name for detailed statistics (2.5.70 or above required) ++The \fB-D\fP reports some summary statistics about disk activity. + .PP +-The \fB-S\fP followed by k or K or m or M switches outputs between 1000, 1024, 1000000, or 1048576 bytes ++The \fB\-p\fP followed by some partition name for detailed statistics (2.5.70 or above required) + .PP +-The \fB-V\fP switch results in displaying version information. ++The \fB\-S\fP followed by k or K or m or M switches outputs between 1000, 1024, 1000000, or 1048576 bytes ++.PP ++The \fB\-V\fP switch results in displaying version information. + .PP + .SH FIELD DESCRIPTION FOR VM MODE + .SS +@@ -81,8 +86,8 @@ + free: the amount of idle memory. + buff: the amount of memory used as buffers. + cache: the amount of memory used as cache. +-inact: the amount of inactive memory. (-a option) +-active: the amount of active memory. (-a option) ++inact: the amount of inactive memory. (\-a option) ++active: the amount of active memory. (\-a option) + .fi + .PP + .SS +@@ -110,9 +115,9 @@ + .B "CPU " + These are percentages of total CPU time. + .nf +-us: Time spent running non-kernel code. (user time, including nice time) ++us: Time spent running non\-kernel code. (user time, including nice time) + sy: Time spent running kernel code. (system time) +-id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. ++id: Time spent idle. Prior to Linux 2.5.41, this includes IO\-wait time. + wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. + st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown. + +@@ -161,8 +166,6 @@ + total: Total number of available objects + size: Size of each object + pages: Number of pages with at least one active object +-totpages: Total number of allocated pages +-pslab: Number of pages per slab + .fi + + .SH NOTES diff --git a/patches/procps-3.2.7/generic/10_w_time.dpatch b/patches/procps-3.2.7/generic/10_w_time.dpatch new file mode 100644 index 000000000..c820441ef --- /dev/null +++ b/patches/procps-3.2.7/generic/10_w_time.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_w_time.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Let fprintf print locale-friendly seconds #252575 + +@DPATCH@ +diff -urNad procps-3.2.7~/w.c procps-3.2.7/w.c +--- procps-3.2.7~/w.c 2009-01-09 15:56:04.000000000 +1100 ++++ procps-3.2.7/w.c 2009-01-09 16:14:56.000000000 +1100 +@@ -83,7 +83,7 @@ + else if (t > 60) /* > 1 minute */ + fprintf(fout, " %2lu:%02u ", t/60, (unsigned) t%60); + else +- fprintf(fout, " %2lu.%02us", t, centi_sec); ++ fprintf(fout, " %2lu.%02us", t, centi_sec); + } + + /**** stat the device file to get an idle time */ diff --git a/patches/procps-3.2.7/generic/10_watch.1.dpatch b/patches/procps-3.2.7/generic/10_watch.1.dpatch new file mode 100644 index 000000000..b2a0c467f --- /dev/null +++ b/patches/procps-3.2.7/generic/10_watch.1.dpatch @@ -0,0 +1,101 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10_watch.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleanup of manual page + +@DPATCH@ +diff -urNad procps-3.2.7~/watch.1 procps-3.2.7/watch.1 +--- procps-3.2.7~/watch.1 2008-04-07 11:12:26.000000000 +1000 ++++ procps-3.2.7/watch.1 2008-04-07 11:20:26.000000000 +1000 +@@ -2,44 +2,53 @@ + .SH NAME + watch \- execute a program periodically, showing output fullscreen + .SH SYNOPSIS ++.na + .B watch +-.I [\-dhvt] [\-n <seconds>] [\-\-differences[=cumulative]] [\-\-help] [\-\-interval=<seconds>] [\-\-no\-title] [\-\-version] <command> ++.RB [ \-dhvt ] ++.RB [ \-n ++.IR seconds ] ++.RB [ \-\-differences[=\fIcumulative\fP]] ++.RB [ \-\-help ] ++.RB [ \-\-interval=\fIseconds\fP] ++.RB [ \-\-no\-title ] ++.RB [ \-\-version ] ++.I command + .SH DESCRIPTION +-.BR watch ++.B watch + runs + .I command + repeatedly, displaying its output (the first screenfull). This allows you to + watch the program output change over time. By default, the program is run + every 2 seconds; use +-.I -n ++.B \-n + or +-.I --interval ++.B \-\-interval + to specify a different interval. + .PP + The +-.I -d ++.B \-d + or +-.I --differences ++.B \-\-differences + flag will highlight the differences between successive updates. The +-.I --cumulative ++.B \-\-cumulative + option makes highlighting "sticky", presenting a running display of all + positions that have ever changed. The +-.I -t ++.B \-t + or +-.I --no-title ++.B \-\-no\-title + option turns off the header showing the interval, command, and current + time at the top of the display, as well as the following blank line. + .PP +-.BR watch ++.B watch + will run until interrupted. + .SH NOTE + Note that + .I command +-is given to "sh -c" ++is given to "sh \-c" + which means that you may need to use extra quoting to get the desired effect. + .PP + Note that POSIX option processing is used (i.e., option processing stops at +-the first non-option argument). This means that flags after ++the first non\-option argument). This means that flags after + .I command + don't get interpreted by + .BR watch +@@ -61,20 +70,20 @@ + To see the effects of quoting, try these out + .IP + watch echo $$ +-.IP ++.br + watch echo '$$' +-.IP ++.br + watch echo "'"'$$'"'" + .PP + You can watch for your administrator to install the latest kernel with + .IP +-watch uname -r ++watch uname \-r + .PP + (Just kidding.) + .SH BUGS + Upon terminal resize, the screen will not be correctly repainted until the + next scheduled update. All +-.I --differences ++.B \-\-differences + highlighting is lost on that update as well. + .PP + Non-printing characters are stripped from program output. Use "cat -v" as diff --git a/patches/procps-3.2.7/generic/20_Makefile_lib64.dpatch b/patches/procps-3.2.7/generic/20_Makefile_lib64.dpatch new file mode 100644 index 000000000..6abddb0d9 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_Makefile_lib64.dpatch @@ -0,0 +1,44 @@ +#! /bin/sh -e +## 20_Makefile_lib64.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Removed entry about /lib64 as it breaks the sparc + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +--- procps/Makefile.orig Thu Apr 1 22:07:46 2004 ++++ procps/Makefile Thu Apr 1 22:08:31 2004 +@@ -31,7 +31,7 @@ + install := install -D --owner 0 --group 0 + + # Lame x86-64 /lib64 and /usr/lib64 abomination: +-lib64 := lib$(shell [ -d /lib64 ] && echo 64) ++lib64 := lib + + usr/bin := $(DESTDIR)/usr/bin/ + bin := $(DESTDIR)/bin/ +@@ -110,7 +110,7 @@ + ALL_CFLAGS += $(call check_gcc,-Wpadded,) + + # Be 64-bit if at all possible. +-ALL_CFLAGS += $(call check_gcc,-m64,) ++#ALL_CFLAGS += $(call check_gcc,-m64,) + + endif + endif diff --git a/patches/procps-3.2.7/generic/20_kill.1.dpatch b/patches/procps-3.2.7/generic/20_kill.1.dpatch new file mode 100644 index 000000000..25727d7e2 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_kill.1.dpatch @@ -0,0 +1,167 @@ +#! /bin/sh -e +## 20_kill.1.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix kill.1 manual page +## DP: Changed may to cannot or might #375739 + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +diff -urNad procps-3.2.7~/kill.1 procps-3.2.7/kill.1 +--- procps-3.2.7~/kill.1 2009-01-09 17:04:24.000000000 +1100 ++++ procps-3.2.7/kill.1 2009-01-09 17:11:37.000000000 +1100 +@@ -10,23 +10,18 @@ + kill \- send a signal to a process + + .SH SYNOPSIS +-.TS +-l l. +-kill pid ... Send SIGTERM to every process listed. +-kill -signal pid ... Send a signal to every process listed. +-kill -s signal pid ... Send a signal to every process listed. +-kill -l List all signal names. +-kill -L List all signal names in a nice table. +-kill -l signal Convert a signal number into a name. +-kill -V,--version Show version of program +-.TE ++\fBkill\fR [ \-\fBsignal\fR | \-s \fBsignal\fR ] \fBpid\fR ... ++.br ++\fBkill\fR [ \-L | -V, \-\-version ] ++.br ++\fBkill\fR \-l [ \fBsignal\fR ] + + .SH DESCRIPTION +-The default signal for kill is TERM. Use -l or -L to list available signals. ++The default signal for kill is TERM. Use \-l or \-L to list available signals. + Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0. +-Alternate signals may be specified in three ways: -9 -SIGKILL -KILL. ++Alternate signals may be specified in three ways: \-9 \-SIGKILL \-KILL. + Negative PID values may be used to choose whole process groups; see the +-PGID column in ps command output. A PID of -1 is special; it indicates ++PGID column in ps command output. A PID of \-1 is special; it indicates + all processes except the kill process itself and init. + + .SH SIGNALS +@@ -37,12 +32,11 @@ + lB rB lB lB + lfCW r l l. + Name Num Action Description +-.TH + 0 0 n/a exit code indicates if a signal may be sent + ALRM 14 exit + HUP 1 exit + INT 2 exit +-KILL 9 exit this signal may not be blocked ++KILL 9 exit cannot be blocked + PIPE 13 exit + POLL exit + PROF exit +@@ -50,15 +44,15 @@ + USR1 exit + USR2 exit + VTALRM exit +-STKFLT exit may not be implemented +-PWR ignore may exit on some systems ++STKFLT exit might not be implemented ++PWR ignore might exit on some systems + WINCH ignore + CHLD ignore + URG ignore +-TSTP stop may interact with the shell +-TTIN stop may interact with the shell +-TTOU stop may interact with the shell +-STOP stop this signal may not be blocked ++TSTP stop might interact with the shell ++TTIN stop might interact with the shell ++TTOU stop might interact with the shell ++STOP stop cannot be blocked + CONT restart continue if stopped, otherwise ignore + ABRT 6 core + FPE 8 core +@@ -66,11 +60,11 @@ + QUIT 3 core + SEGV 11 core + TRAP 5 core +-SYS core may not be implemented +-EMT core may not be implemented +-BUS core core dump may fail +-XCPU core core dump may fail +-XFSZ core core dump may fail ++SYS core might not be implemented ++EMT core might not be implemented ++BUS core core dump might fail ++XCPU core core dump might fail ++XFSZ core core dump might fail + .TE + + .SH NOTES +@@ -79,36 +73,30 @@ + the conflict. + + .SH EXAMPLES +- +-.SS +-.B "kill -9 -1" +-.nf ++.TP ++.B kill \-9 \-1 + Kill all processes you can kill. +-.fi +-.PP +-.SS +-.B "kill -l 11" +-.nf ++.TP ++.B kill \-l 11 + Translate number 11 into a signal name. +-.fi +-.PP +-.SS +-.B "kill -L" +-.nf ++.TP ++.B kill -L + List the available signal choices in a nice table. +-.fi +-.PP +-.SS +-.B "kill 123 543 2341 3453" +-.nf ++.TP ++.B kill 123 543 2341 3453 + Send the default signal, SIGTERM, to all those processes. +-.fi +-.PP ++ + .SH "SEE ALSO" +-pkill(1) skill(1) kill(2) renice(1) nice(1) signal(7) killall(1) ++.BR pkill (1), ++.BR skill (1), ++.BR kill (2), ++.BR renice (1), ++.BR nice (1), ++.BR signal (7), ++.BR killall (1). + + .SH STANDARDS +-This command meets appropriate standards. The -L flag is Linux-specific. ++This command meets appropriate standards. The \-L flag is Linux-specific. + + .SH AUTHOR + Albert Cahalan <albert@users.sf.net> wrote kill in 1999 to replace a diff --git a/patches/procps-3.2.7/generic/20_kill_warncr.dpatch b/patches/procps-3.2.7/generic/20_kill_warncr.dpatch new file mode 100644 index 000000000..9efeff1e2 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_kill_warncr.dpatch @@ -0,0 +1,28 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_kill_warncr.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Add CR to warning line #331419 + +@DPATCH@ +diff -urNad procps-3.2.7~/skill.c procps-3.2.7/skill.c +--- procps-3.2.7~/skill.c 2004-09-09 23:49:38.000000000 +1000 ++++ procps-3.2.7/skill.c 2006-06-26 22:40:17.000000000 +1000 +@@ -128,7 +128,7 @@ + sprintf(buf, "/proc/%d/stat", pid); /* pid (cmd) state ppid pgrp session tty */ + fd = open(buf,O_RDONLY); + if(fd==-1){ /* process exited maybe */ +- if(pids && w_flag) printf("WARNING: process %d could not be found.",pid); ++ if(pids && w_flag) printf("WARNING: process %d could not be found.\n",pid); + return; + } + fstat(fd, &statbuf); +@@ -333,7 +333,7 @@ + }else{ + fprintf(stderr, + "Usage: snice [new priority] [options] process selection criteria\n" +- "Example: snice netscape crack +7\n" ++ "Example: snice +7 netscape crack \n" + "\n" + "The default priority is +4. (snice +4 ...)\n" + "Priority numbers range from +20 (slowest) to -20 (fastest).\n" diff --git a/patches/procps-3.2.7/generic/20_module_mk_shared.dpatch b/patches/procps-3.2.7/generic/20_module_mk_shared.dpatch new file mode 100644 index 000000000..7b3cd678c --- /dev/null +++ b/patches/procps-3.2.7/generic/20_module_mk_shared.dpatch @@ -0,0 +1,36 @@ +#! /bin/sh -e +## 20_module_mk_shared.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Made SHARED variable overwritable + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +diff -urNad procps-3.2.7~/proc/module.mk procps-3.2.7/proc/module.mk +--- procps-3.2.7~/proc/module.mk 2006-06-27 08:24:51.000000000 +1000 ++++ procps-3.2.7/proc/module.mk 2006-06-27 08:25:43.000000000 +1000 +@@ -17,7 +17,7 @@ + # numbers for future use, the ELF soname can be set equal to the + # file name until some future date when a stable ABI is declared. + +-SHARED := 1 ++SHARED ?= 1 + + # for lib$(NAME).so and /usr/include/($NAME) and such + NAME := proc diff --git a/patches/procps-3.2.7/generic/20_sysinfo_c.dpatch b/patches/procps-3.2.7/generic/20_sysinfo_c.dpatch new file mode 100644 index 000000000..96e176947 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_sysinfo_c.dpatch @@ -0,0 +1,25 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_sysinfo_c.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Dont find elf note for non-linux Bug #378157 + +@DPATCH@ +diff -urNad procps-3.2.7~/proc/sysinfo.c procps-3.2.7/proc/sysinfo.c +--- procps-3.2.7~/proc/sysinfo.c 2006-06-25 16:41:48.000000000 +1000 ++++ procps-3.2.7/proc/sysinfo.c 2007-10-04 22:07:48.000000000 +1000 +@@ -218,12 +218,13 @@ + // _SC_NPROCESSORS_ONLN returns 1, which should work OK + smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN); + if(smp_num_cpus<1) smp_num_cpus=1; /* SPARC glibc is buggy */ +- ++#ifdef __linux__ + if(linux_version_code > LINUX_VERSION(2, 4, 0)){ + Hertz = find_elf_note(AT_CLKTCK); + if(Hertz!=NOTE_NOT_FOUND) return; + fputs("2.4+ kernel w/o ELF notes? -- report this\n", stderr); + } ++#endif + old_Hertz_hack(); + } + diff --git a/patches/procps-3.2.7/generic/20_top_c_resize.dpatch b/patches/procps-3.2.7/generic/20_top_c_resize.dpatch new file mode 100644 index 000000000..4cc9c6c51 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_top_c_resize.dpatch @@ -0,0 +1,75 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20top_resize_terminal.dpatch by <hesso@pool.math.tu-berlin.de> +## +## DP: Prevent top from segfaulting when the display is shrinked to only +## DP: a few (read: 3 or less) lines. + +@DPATCH@ +--- procps-3.2.7.orig/top.c 2006-06-25 08:41:48.000000000 +0200 ++++ procps-3.2.7/top.c 2007-08-06 03:27:28.000000000 +0200 +@@ -140,7 +140,7 @@ + are exploited in a macro and represent 90% of our optimization. + The Stdout_buf is transparent to our code and regardless of whose + buffer is used, stdout is flushed at frame end or if interactive. */ +-static char *Pseudo_scrn; ++static PSEUDO_SCREEN_t Pseudo_scrn; + static int Pseudo_row, Pseudo_cols, Pseudo_size; + #ifndef STDOUT_IOLBF + // less than stdout's normal buffer but with luck mostly '\n' anyway +@@ -2415,7 +2415,10 @@ + Pseudo_cols = Screen_cols + CLRBUFSIZ + 1; + if (Batch) Pseudo_size = ROWBUFSIZ + 1; + else Pseudo_size = Pseudo_cols * Screen_rows; +- Pseudo_scrn = alloc_r(Pseudo_scrn, Pseudo_size); ++ if( Pseudo_scrn.buf == NULL || Pseudo_size > Pseudo_scrn.mem_size ) { ++ Pseudo_scrn.buf = alloc_r(Pseudo_scrn.buf, Pseudo_size); ++ Pseudo_scrn.mem_size = Pseudo_size; ++ } + + // force rebuild of column headers AND libproc/readproc requirements + Frames_libflags = 0; +@@ -3289,7 +3292,7 @@ + // reframewins(), who also builds each window's column headers + if (!Frames_libflags) { + reframewins(); +- memset(Pseudo_scrn, '\0', Pseudo_size); ++ memset(Pseudo_scrn.buf, '\0', Pseudo_size); + } + Pseudo_row = Msg_row = scrlins = 0; + ppt = summary_show(); +--- procps-3.2.7.orig/top.h 2006-06-25 08:41:48.000000000 +0200 ++++ procps-3.2.7/top.h 2007-08-06 03:27:28.000000000 +0200 +@@ -135,7 +135,7 @@ + int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \ + putp ( Batch ? _str : \ + ({ \ +- char *restrict const _pse = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \ ++ char *restrict const _pse = &Pseudo_scrn.buf[Pseudo_row++ * Pseudo_cols]; \ + memcmp(_pse, _str, _len) ? memcpy(_pse, _str, _len) : "\n"; \ + }) \ + ); \ +@@ -149,7 +149,11 @@ + int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \ + if (Batch) _ptr = _str; \ + else { \ +- _ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \ ++ if (Pseudo_row * Pseudo_cols + _len > Pseudo_size) { \ ++ Pseudo_scrn.buf = realloc(Pseudo_scrn.buf, Pseudo_row * Pseudo_cols + _len); \ ++ Pseudo_scrn.mem_size = Pseudo_size = Pseudo_row * Pseudo_cols + _len; \ ++ } \ ++ _ptr = &Pseudo_scrn.buf[Pseudo_row++ * Pseudo_cols]; \ + if (memcmp(_ptr, _str, _len)) { \ + memcpy(_ptr, _str, _len); \ + } else { \ +@@ -237,6 +241,11 @@ + RCW_t win [4]; // a 'WIN_t.rc' for each of the 4 windows + } RCF_t; + ++typedef struct PSEUDO_SCREEN_t { ++ char *buf; ++ int mem_size; ++} PSEUDO_SCREEN_t; ++ + // The scaling 'type' used with scale_num() -- this is how + // the passed number is interpreted should scaling be necessary + enum scale_num { diff --git a/patches/procps-3.2.7/generic/20_top_manpage.dpatch b/patches/procps-3.2.7/generic/20_top_manpage.dpatch new file mode 100644 index 000000000..901f580f2 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_top_manpage.dpatch @@ -0,0 +1,438 @@ +#! /bin/sh -e +## 20_top_manpage by Randy Hron +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix bold in top manual page +## DP: Fix page fault description because storage may not be disk +## DP{ Used NE and not ME as a defined as it clashes wirh something + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +diff -urNad procps-3.2.7~/top.1 procps-3.2.7/top.1 +--- procps-3.2.7~/top.1 2009-01-09 17:45:51.000000000 +1100 ++++ procps-3.2.7/top.1 2009-01-09 18:07:32.000000000 +1100 +@@ -42,7 +42,7 @@ + .ds EM \ \fB\-\-\ \fR + \# - these two are for chuckles, makes great grammar + .ds Me top +-.ds ME \fBtop\fR ++.ds NE \fBtop\fR + \# - other misc strings for consistent usage/emphasis + .ds F \fIOff\fR + .ds O \fIOn\fR +@@ -85,7 +85,7 @@ + .\" ---------------------------------------------------------------------- + .SH SYNOPSIS + .\" ---------------------------------------------------------------------- +-\*(ME \-\fBhv\fR | \-\fBbcHisS\fR \-\fBd\fI delay\fR \-\fBn\fI ++\*(NE \-\fBhv\fR | \-\fBbcHisS\fR \-\fBd\fI delay\fR \-\fBn\fI + iterations\fR \-\fBp\fI pid\fR [,\fI pid\fR ...] + + The traditional switches '-' and whitespace are optional. +@@ -94,7 +94,7 @@ + .\" ---------------------------------------------------------------------- + .SH DESCRIPTION + .\" ---------------------------------------------------------------------- +-The \*(ME program provides a dynamic real-time view of a running system. ++The \*(NE program provides a dynamic real-time view of a running system. + It can display\fB system\fR summary information as well as a list of\fB + tasks\fR currently being managed by the Linux kernel. + The types of system summary information shown and the types, order and +@@ -104,7 +104,7 @@ + The program provides a limited interactive interface for process + manipulation as well as a much more extensive interface for personal + configuration \*(EM encompassing every aspect of its operation. +-And while \*(ME is referred to throughout this document, you are free ++And while \*(NE is referred to throughout this document, you are free + to name the program anything you wish. + That new name, possibly an alias, will then be reflected on \*(Me's display + and used when reading and writing a \*(CF. +@@ -190,7 +190,7 @@ + 'I' - Irix mode On\ \ (no, 'solaris' smp) + * 'p' - PID monitoring Off + * 's' - Secure mode Off (unsecured) +- 'B' - Bold disable Off ++ 'B' - Bold enable Off + \fISummary_Area_defaults\fR + 'l' - Load Avg/Uptime On\ \ (thus program name) + 't' - Task/Cpu states On\ \ (1+1 lines, see '1') +@@ -413,16 +413,14 @@ + q:\fB RES\fR \*(EM Resident size (kb) + The non-swapped \*(MP a task has used. + +-RES = CODE + DATA. +- + .TP 3 + r:\fB CODE\fR \*(EM Code size (kb) +-The amount of \*(MP devoted to executable code, also known as ++The amount of \*(MV devoted to executable code, also known as + the 'text resident set' size or TRS. + + .TP 3 + s:\fB DATA\fR \*(EM Data+Stack size (kb) +-The amount of \*(MP devoted to other than executable code, also known as ++The amount of \*(MV devoted to other than executable code, also known as + the 'data resident set' size or DRS. + + .TP 3 +@@ -436,8 +434,8 @@ + The number of\fB major\fR page faults that have occurred for a task. + A page fault occurs when a process attempts to read from or write to a virtual + page that is not currently present in its address space. +-A major page fault is when disk access is involved in making that +-page available. ++A major page fault is when backing storage access (such as a disk) is involved ++in making that page available. + + .TP 3 + v:\fB nDRT\fR \*(EM Dirty Pages count +@@ -504,7 +502,7 @@ + .\" ...................................................................... + .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 +578,7 @@ + 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 +587,7 @@ + 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 +597,13 @@ + 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. ++\*(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 +615,7 @@ + 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 +629,32 @@ + 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 +665,24 @@ + 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. +@@ -700,25 +698,25 @@ + of messages and prompts. + + These commands always impact just the \*(CW/field group. +-\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into +-\*(CWs and field groups. ++\*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight ++into \*(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 +748,12 @@ + .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 +763,7 @@ + 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 +772,7 @@ + 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,20 +783,20 @@ + .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 ++\ \ \<\fBS\fR\> :\fICumulative_Time_Mode_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 +@@ -818,7 +816,7 @@ + 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 +829,7 @@ + .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 +837,7 @@ + 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 \<\fB#\fR\> :\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 +876,12 @@ + .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 +892,7 @@ + .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 +905,7 @@ + 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 +982,7 @@ + .\" ...................................................................... + .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 +996,7 @@ + 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 +1007,7 @@ + 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 +1015,7 @@ + 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 +1026,7 @@ + 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 +1035,15 @@ + 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 + + + .\" ---------------------------------------------------------------------- diff --git a/patches/procps-3.2.7/generic/20_w-bassman.dpatch b/patches/procps-3.2.7/generic/20_w-bassman.dpatch new file mode 100644 index 000000000..cc68ab72a --- /dev/null +++ b/patches/procps-3.2.7/generic/20_w-bassman.dpatch @@ -0,0 +1,91 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_w-bassman.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: w-bassman emulation with -o flag +## DP: Was from #45947, corrected for #414906 + +@DPATCH@ +diff -urNad procps-3.2.7~/w.1 procps-3.2.7/w.1 +--- procps-3.2.7~/w.1 2009-01-09 16:24:17.000000000 +1100 ++++ procps-3.2.7/w.1 2009-01-09 16:24:55.000000000 +1100 +@@ -5,7 +5,7 @@ + w \- Show who is logged on and what they are doing. + .SH SYNOPSIS + .B w \- +-.RB [ husfV ] ++.RB [ husfVo ] + .RI [ user ] + .SH DESCRIPTION + .B "w " +@@ -55,6 +55,9 @@ + .B "\-V " + Display version information. + .TP 0.5i ++.B "\-o " ++Old style output. Prints blank space for idle times less than one minute. ++.TP 0.5i + .B "user " + Show information about the specified user only. + +diff -urNad procps-3.2.7~/w.c procps-3.2.7/w.c +--- procps-3.2.7~/w.c 2009-01-09 16:24:54.000000000 +1100 ++++ procps-3.2.7/w.c 2009-01-09 16:25:39.000000000 +1100 +@@ -30,6 +30,7 @@ + #include <termios.h> + + static int ignoreuser = 0; /* for '-u' */ ++static int oldstyle = 0; /* for '-o' */ + static proc_t **procs; /* our snapshot of the process table */ + + typedef struct utmp utmp_t; +@@ -76,6 +77,16 @@ + printf(" ? "); + return; + } ++ if (oldstyle) { ++ if (t >= 48*60*60) /* > 2 days */ ++ fprintf(fout, " %2ludays", t/(24*60*60)); ++ else if (t >= 60*60) /* > 1 hour */ ++ fprintf(fout, " %2lu:%02u ", t/(60*60), (unsigned) ((t/60)%60)); ++ else if (t > 60) /* > 1 minute */ ++ fprintf(fout, " %2lu:%02um", t/60, (unsigned) t%60); ++ else ++ fprintf(fout, " "); ++ } else { + if (t >= 48*60*60) /* > 2 days */ + fprintf(fout, " %2ludays", t/(24*60*60)); + else if (t >= 60*60) /* > 1 hour */ +@@ -84,6 +95,7 @@ + fprintf(fout, " %2lu:%02u ", t/60, (unsigned) t%60); + else + fprintf(fout, " %2lu.%02us", t, centi_sec); ++ } + } + + /**** stat the device file to get an idle time */ +@@ -239,7 +251,7 @@ + #endif + + setlocale(LC_ALL, ""); +- for (args=0; (ch = getopt(argc, argv, "hlusfV")) != EOF; args++) ++ for (args=0; (ch = getopt(argc, argv, "hlusfVo")) != EOF; args++) + switch (ch) { + case 'h': header = 0; break; + case 'l': longform = 1; break; +@@ -247,6 +259,7 @@ + case 'f': from = !from; break; + case 'V': display_version(); exit(0); + case 'u': ignoreuser = 1; break; ++ case 'o': oldstyle = 1; break; + default: + printf("usage: w -hlsufV [user]\n" + " -h skip header\n" +@@ -254,6 +267,7 @@ + " -s short listing\n" + " -u ignore uid of processes\n" + " -f toggle FROM field (default %s)\n" ++ " -o old-style output\n" + " -V display version\n", FROM_STRING); + exit(1); + } diff --git a/patches/procps-3.2.7/generic/20_watch_8bitchar.dpatch b/patches/procps-3.2.7/generic/20_watch_8bitchar.dpatch new file mode 100644 index 000000000..aab1d8e12 --- /dev/null +++ b/patches/procps-3.2.7/generic/20_watch_8bitchar.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_watch_8bitchar.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Make char unsigned + +@DPATCH@ +diff -urNad procps-3.2.7~/watch.c procps-3.2.7/watch.c +--- procps-3.2.7~/watch.c 2006-06-17 19:18:38.000000000 +1000 ++++ procps-3.2.7/watch.c 2006-06-26 08:47:57.000000000 +1000 +@@ -297,7 +297,7 @@ + move(y, x); + if (option_differences) { + int oldch = inch(); +- char oldc = oldch & A_CHARTEXT; ++ unsigned char oldc = oldch & A_CHARTEXT; + attr = !first_screen + && (c != oldc + || diff --git a/patches/procps-3.2.7/generic/30_library_map_freeproc.dpatch b/patches/procps-3.2.7/generic/30_library_map_freeproc.dpatch new file mode 100644 index 000000000..2842c89b6 --- /dev/null +++ b/patches/procps-3.2.7/generic/30_library_map_freeproc.dpatch @@ -0,0 +1,35 @@ +#! /bin/sh -e +## 30_library_map_freeproc.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Added freeproc to library.map + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +--- procps-3.2.0.orig/proc/library.map ++++ procps-3.2.0/proc/library.map +@@ -7,7 +7,7 @@ + + readproc; readtask; readproctab; readproctab2; look_up_our_self; escape_command; + escape_str; escape_strlist; +- openproc; closeproc; ++ openproc; closeproc; freeproc; + tty_to_dev; dev_to_tty; open_psdb_message; open_psdb; lookup_wchan; + display_version; procps_version; linux_version_code; + Hertz; smp_num_cpus; diff --git a/patches/procps-3.2.7/generic/30_pgrep_start_time.dpatch b/patches/procps-3.2.7/generic/30_pgrep_start_time.dpatch new file mode 100644 index 000000000..f68fd569e --- /dev/null +++ b/patches/procps-3.2.7/generic/30_pgrep_start_time.dpatch @@ -0,0 +1,36 @@ +#! /bin/sh -e +## 30_pgrep_start_time.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: pgrep.c saved_start_time was missed + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +--- procps-3.2.0.orig/pgrep.c ++++ procps-3.2.0/pgrep.c +@@ -367,7 +367,8 @@ + preg = do_regcomp (); + + if (opt_newest) saved_start_time = 0ULL; +- if (opt_oldest) saved_start_time = ~0ULL; ++ else ++ saved_start_time = ~0ULL; + if (opt_newest) saved_pid = 0; + if (opt_oldest) saved_pid = INT_MAX; + diff --git a/patches/procps-3.2.7/generic/30_readproc_c.dpatch b/patches/procps-3.2.7/generic/30_readproc_c.dpatch new file mode 100644 index 000000000..8c83e8810 --- /dev/null +++ b/patches/procps-3.2.7/generic/30_readproc_c.dpatch @@ -0,0 +1,45 @@ +#! /bin/sh -e +## 30_readproc_c.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: readproc.c some type conversion help +## DP: return if unable to open /proc + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +--- procps-3.2.0.orig/proc/readproc.c ++++ procps-3.2.0/proc/readproc.c +@@ -162,7 +162,7 @@ + // examine a field name (hash and compare) + base: + if(unlikely(!*S)) break; +- entry = table[63 & (asso[S[3]] + asso[S[2]] + asso[S[0]])]; ++ entry = table[63 & (asso[(int)S[3]] + asso[(int)S[2]] + asso[(int)S[0]])]; + colon = strchr(S, ':'); + if(unlikely(!colon)) break; + if(unlikely(colon[1]!='\t')) break; +@@ -888,6 +888,8 @@ + else + PT = openproc(flags); + va_end(ap); ++ if (!PT) ++ return 0; + do { /* read table: */ + tab = xrealloc(tab, (n+1)*sizeof(proc_t*));/* realloc as we go, using */ + tab[n] = readproc_direct(PT, NULL); /* final null to terminate */ diff --git a/patches/procps-3.2.7/generic/30_sysinfo_7numbers.dpatch b/patches/procps-3.2.7/generic/30_sysinfo_7numbers.dpatch new file mode 100644 index 000000000..b3c95fb16 --- /dev/null +++ b/patches/procps-3.2.7/generic/30_sysinfo_7numbers.dpatch @@ -0,0 +1,39 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_sysctl_7numbers.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Adds up 7 cpu numbers not 4; #460331 + +@DPATCH@ +diff -urNad procps-3.2.7~/proc/sysinfo.c procps-3.2.7/proc/sysinfo.c +--- procps-3.2.7~/proc/sysinfo.c 2008-08-10 10:13:50.000000000 +1000 ++++ procps-3.2.7/proc/sysinfo.c 2008-08-10 10:13:50.000000000 +1000 +@@ -122,24 +122,25 @@ + unsigned long long Hertz; + + static void old_Hertz_hack(void){ +- unsigned long long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */ ++ unsigned long long user_j, nice_j, sys_j, other_j, wait_j, hirq_j, sirq_j, stol_j; /* jiffies (clock ticks) */ + double up_1, up_2, seconds; + unsigned long long jiffies; + unsigned h; + char *restrict savelocale; + ++ wait_j = hirq_j = sirq_j = stol_j = 0; + savelocale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "C"); + do{ + FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1); + /* uptime(&up_1, NULL); */ + FILE_TO_BUF(STAT_FILE,stat_fd); +- sscanf(buf, "cpu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j); ++ sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j, &wait_j, &hirq_j, &sirq_j, &stol_j); + FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_2); + /* uptime(&up_2, NULL); */ + } while((long long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */ + setlocale(LC_NUMERIC, savelocale); +- jiffies = user_j + nice_j + sys_j + other_j; ++ jiffies = user_j + nice_j + sys_j + other_j + wait_j + hirq_j + sirq_j + stol_j ; + seconds = (up_1 + up_2) / 2; + h = (unsigned)( (double)jiffies/seconds/smp_num_cpus ); + /* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */ diff --git a/patches/procps-3.2.7/generic/30_tload_no_optargs.dpatch b/patches/procps-3.2.7/generic/30_tload_no_optargs.dpatch new file mode 100644 index 000000000..02f23cb2f --- /dev/null +++ b/patches/procps-3.2.7/generic/30_tload_no_optargs.dpatch @@ -0,0 +1,36 @@ +#! /bin/sh -e +## 30_tload_no_optargs.dpatch by Craig Small <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Removed unneeded optarg and optind variables form tload.c + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argum +ent" + exit 1;; +esac + +exit 0 +@DPATCH@ +--- procps-3.2.0.orig/tload.c ++++ procps-3.2.0/tload.c +@@ -30,9 +30,6 @@ + static int dly=5; + static jmp_buf jb; + +-extern int optind; +-extern char *optarg; +- + static void alrm(int signo) + { + (void)signo; diff --git a/patches/procps-3.2.7/generic/30_top.1_cpustate.dpatch b/patches/procps-3.2.7/generic/30_top.1_cpustate.dpatch new file mode 100644 index 000000000..24f603ac8 --- /dev/null +++ b/patches/procps-3.2.7/generic/30_top.1_cpustate.dpatch @@ -0,0 +1,53 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_top.1_cpustate.dpatch by <csmall@localhost.localdomain> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: top CPU state descriptions + +@DPATCH@ +diff -urNad procps-3.2.7~/top.1 procps-3.2.7/top.1 +--- procps-3.2.7~/top.1 2007-10-04 22:35:09.000000000 +1000 ++++ procps-3.2.7/top.1 2007-10-04 22:36:45.000000000 +1000 +@@ -539,6 +539,42 @@ + upper case\fR letter and to the\fB right\fR with the\fB lower case\fR + letter. + ++.\" ...................................................................... ++.SS 2c. CPU States ++.\" ---------------------------------------------------------------------- ++The CPU states are shown in the Summary Area. They are always shown as a ++percentage and are for the time between now and the last refresh. ++ ++.TP 3 ++\fB us\fR \*(EM User CPU time ++The time the CPU has spent running users' processes that are not ++niced. ++ ++.TP 3 ++\fB sy\fR \*(EM System CPU time ++The time the CPU has spent running the kernel and its processes. ++ ++.TP 3 ++\fB ni\fR \*(EM Nice CPU time ++The time the CPU has spent running users' proccess that have been ++niced. ++ ++.TP 3 ++\fB wa\fR \*(EM iowait ++Amount of time the CPU has been waiting for I/O to complete. ++ ++.TP 3 ++\fB hi\fR \*(EM Hardware IRQ ++The amount of time the CPU has been servicing hardware interrupts. ++ ++.TP 3 ++\fB si\fR \*(EM Software Interrupts ++The amount of time the CPU has been servicing software interrupts. ++ ++.TP 3 ++\fB st\fR \*(EM Steal Time ++The amount of CPU 'stolen' from this virtual machine by the hypervisor ++for other tasks (such as running another virtual machine). + + .\" ---------------------------------------------------------------------- + .SH 3. INTERACTIVE Commands diff --git a/patches/procps-3.2.7/generic/30_w-columns.dpatch b/patches/procps-3.2.7/generic/30_w-columns.dpatch new file mode 100644 index 000000000..57c94aeda --- /dev/null +++ b/patches/procps-3.2.7/generic/30_w-columns.dpatch @@ -0,0 +1,34 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_w-columns.dpatch by <csmall@localhost.localdomain> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: use COLUMNS environment if TIOCGWINSZ fails + +@DPATCH@ +diff -urNad --exclude=CVS --exclude=.svn ./w.c /tmp/dpep-work.0retPU/procps-3.2.6/w.c +--- ./w.c 2005-10-31 12:41:33.000000000 +1100 ++++ /tmp/dpep-work.0retPU/procps-3.2.6/w.c 2005-10-31 12:41:55.000000000 +1100 +@@ -231,10 +231,10 @@ + + /***** main */ + int main(int argc, char **argv) { +- char *user = NULL; ++ char *user = NULL, *p; + utmp_t *u; + struct winsize win; +- int header=1, longform=1, from=1, args, maxcmd=80, ch; ++ int header=1, longform=1, from=1, args, maxcmd, ch; + + #ifndef W_SHOWFROM + from = 0; +@@ -267,6 +267,10 @@ + + if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_col > 0) + maxcmd = win.ws_col; ++ else if (p = getenv("COLUMNS")) ++ maxcmd = atoi(p); ++ else ++ maxcmd = 80; + if (maxcmd < 71) { + fprintf(stderr, "%d column window is too narrow\n", maxcmd); + exit(1); diff --git a/patches/procps-3.2.7/generic/30_w.1.dpatch b/patches/procps-3.2.7/generic/30_w.1.dpatch new file mode 100644 index 000000000..f92b89ea4 --- /dev/null +++ b/patches/procps-3.2.7/generic/30_w.1.dpatch @@ -0,0 +1,73 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_w.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleaned up the w man page +## DP: Make note of the time formats #414906 + +@DPATCH@ +diff -urNad procps-3.2.7~/w.1 procps-3.2.7/w.1 +--- procps-3.2.7~/w.1 2009-01-09 16:26:36.000000000 +1100 ++++ procps-3.2.7/w.1 2009-01-09 16:33:16.000000000 +1100 +@@ -4,26 +4,26 @@ + .SH NAME + w \- Show who is logged on and what they are doing. + .SH SYNOPSIS +-.B w \- +-.RB [ husfVo ] ++.B w ++.RB [ \-husfVo ] + .RI [ user ] + .SH DESCRIPTION +-.B "w " ++.B w + displays information about the users currently on the machine, + and their processes. + The header shows, in this order, the current time, + how long the system has been running, + how many users are currently logged on, + and the system load averages for the past 1, 5, and 15 minutes. +-.sp ++ + The following entries are displayed for each user: + login name, the tty name, the remote host, login time, idle time, JCPU, PCPU, + and the command line of their current process. +-.sp ++ + The JCPU time is the time used by all processes attached to the tty. It + does not include past background jobs, but does include currently + running background jobs. +-.sp ++ + The PCPU time is the time used by the current process, named in the "what" + field. + +@@ -35,7 +35,7 @@ + .TP 0.5i + .B "\-u " + Ignores the username while figuring out the current process and cpu +-times. To demonstrate this, do a "su" and do a "w" and a "w -u". ++times. To demonstrate this, do a "su" and do a "w" and a "w \-u". + .TP 0.5i + .B "\-s " + Use the short format. +@@ -70,6 +70,19 @@ + process information + .PP + ++.SH NOTES ++The output for Idle, JCPU and PCPU times vaires depending on if you use ++the \-o (old style) option or not. These formats can be confusing if you ++switch between the old style and standard. In the following paragraphs ++days are DD, hours HH, minutes MM, seconds SS and 100ths of seconds CC. ++ ++The standard format is DDdays, HH:MMm, MM:SS or SS.CC if the times are ++greater than 2 days, 1hour, or 1 minute respectively. ++ ++For the \-o option, the output will be either DDdays, HH:MM, MM:SSm or ++blank if the times are greater than 2 days, 1 hour or 1 minute ++respectively. ++ + .SH "SEE ALSO" + .BR free (1), + .BR ps (1), diff --git a/patches/procps-3.2.7/generic/30_watch_exec_beep.dpatch b/patches/procps-3.2.7/generic/30_watch_exec_beep.dpatch new file mode 100644 index 000000000..4fcd1cbbd --- /dev/null +++ b/patches/procps-3.2.7/generic/30_watch_exec_beep.dpatch @@ -0,0 +1,263 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30_watch_exec_beep.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Adds -exec and -beep flags and has better quoting #410967 +## DP: Adds -errexit flag now too #183346 + +@DPATCH@ +diff -urNad procps-3.2.7~/watch.1 procps-3.2.7/watch.1 +--- procps-3.2.7~/watch.1 2009-01-11 12:11:47.000000000 +1100 ++++ procps-3.2.7/watch.1 2009-01-11 12:18:31.000000000 +1100 +@@ -1,13 +1,16 @@ +-.TH WATCH 1 "1999 Apr 3" " " "Linux User's Manual" ++.TH WATCH 1 "2008 Jan 8" " " "Linux User's Manual" + .SH NAME + watch \- execute a program periodically, showing output fullscreen + .SH SYNOPSIS + .na + .B watch +-.RB [ \-dhvt ] ++.RB [ \-bdehvtx ] + .RB [ \-n + .IR seconds ] ++.RB [ \-\-beep ] + .RB [ \-\-differences[=\fIcumulative\fP]] ++.RB [ \-\-errexit ] ++.RB [ \-\-exec ] + .RB [ \-\-help ] + .RB [ \-\-interval=\fIseconds\fP] + .RB [ \-\-no\-title ] +@@ -17,7 +20,8 @@ + .B watch + runs + .I command +-repeatedly, displaying its output (the first screenfull). This allows you to ++repeatedly, displaying its output and errors (the first screenfull). This ++allows you to + watch the program output change over time. By default, the program is run + every 2 seconds; use + .B \-n +@@ -37,15 +41,33 @@ + or + .B \-\-no\-title + option turns off the header showing the interval, command, and current +-time at the top of the display, as well as the following blank line. ++time at the top of the display, as well as the following blank line. The ++.I \-b ++or ++.I \-\-beep ++option causes the command to beep if it has a non-zero exit. + .PP + .B watch +-will run until interrupted. ++will normally run until interrupted. If you want ++.B watch ++to exit on an error from the program running use the ++.I \-e ++or ++.I \-\-errexit ++options, which will cause ++.B watch ++to exit if the return value from the program is non-zero. ++ + .SH NOTE + Note that + .I command + is given to "sh \-c" + which means that you may need to use extra quoting to get the desired effect. ++You can disable this with the ++.I -x ++or ++.I --exec ++option, which passes the command to exec(2) instead. + .PP + Note that POSIX option processing is used (i.e., option processing stops at + the first non\-option argument). This means that flags after +@@ -93,4 +115,5 @@ + .B watch + was written by Tony Rems <rembo@unisoft.com> in 1991, with mods and + corrections by Francois Pinard. It was reworked and new features added by +-Mike Coleman <mkc@acm.org> in 1999. ++Mike Coleman <mkc@acm.org> in 1999. The beep, exec, and error handling ++features were added by Morty Abzug <morty@frakir.org> in 2008. +diff -urNad procps-3.2.7~/watch.c procps-3.2.7/watch.c +--- procps-3.2.7~/watch.c 2009-01-11 12:11:47.000000000 +1100 ++++ procps-3.2.7/watch.c 2009-01-11 12:21:50.000000000 +1100 +@@ -8,6 +8,7 @@ + * Mike Coleman <mkc@acm.org>. + * + * Changes by Albert Cahalan, 2002-2003. ++ * stderr handling, exec, and beep option added by Morty Abzug, 2008 + */ + + #define VERSION "0.2.0" +@@ -35,13 +36,16 @@ + {"differences", optional_argument, 0, 'd'}, + {"help", no_argument, 0, 'h'}, + {"interval", required_argument, 0, 'n'}, ++ {"beep", no_argument, 0, 'b'}, ++ {"errexit", no_argument, 0, 'e'}, ++ {"exec", no_argument, 0, 'x'}, + {"no-title", no_argument, 0, 't'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0} + }; + + static char usage[] = +- "Usage: %s [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>\n"; ++ "Usage: %s [-bdhntvx] [--beep] [--differences[=cumulative]] [--exec] [--help] [--interval=<n>] [--no-title] [--version] <command>\n"; + + static char *progname; + +@@ -140,28 +144,44 @@ + int optc; + int option_differences = 0, + option_differences_cumulative = 0, ++ option_exec = 0, ++ option_beep = 0, ++ option_errexit = 0, + option_help = 0, option_version = 0; + double interval = 2; + char *command; ++ char **command_argv; + int command_length = 0; /* not including final \0 */ ++ int pipefd[2]; ++ int status; ++ pid_t child; + + setlocale(LC_ALL, ""); + progname = argv[0]; + +- while ((optc = getopt_long(argc, argv, "+d::hn:vt", longopts, (int *) 0)) ++ while ((optc = getopt_long(argc, argv, "+bed::hn:vtx", longopts, (int *) 0)) + != EOF) { + switch (optc) { ++ case 'b': ++ option_beep = 1; ++ break; + case 'd': + option_differences = 1; + if (optarg) + option_differences_cumulative = 1; + break; ++ case 'e': ++ option_errexit = 1; ++ break; + case 'h': + option_help = 1; + break; + case 't': + show_title = 0; + break; ++ case 'x': ++ option_exec = 1; ++ break; + case 'n': + { + char *str; +@@ -191,18 +211,23 @@ + + if (option_help) { + fprintf(stderr, usage, progname); ++ fputs(" -b, --beep\t\t\t\tbeep if the command has a non-zero exit\n", stderr); + fputs(" -d, --differences[=cumulative]\thighlight changes between updates\n", stderr); + fputs("\t\t(cumulative means highlighting is cumulative)\n", stderr); ++ fputs(" -e, --errexit\t\t\t\texit watch if the command has a non-zero exit\n", stderr); + fputs(" -h, --help\t\t\t\tprint a summary of the options\n", stderr); + fputs(" -n, --interval=<seconds>\t\tseconds to wait between updates\n", stderr); + fputs(" -v, --version\t\t\t\tprint the version number\n", stderr); + fputs(" -t, --no-title\t\t\tturns off showing the header\n", stderr); ++ fputs(" -x, --exec\t\t\t\tpass command to exec instead of sh\n", stderr); + exit(0); + } + + if (optind >= argc) + do_usage(); + ++ command_argv=&(argv[optind]); /* save for later */ ++ + command = strdup(argv[optind++]); + command_length = strlen(command); + for (; optind < argc; optind++) { +@@ -261,11 +286,57 @@ + free(header); + } + +- if (!(p = popen(command, "r"))) { +- perror("popen"); ++ /* allocate pipes */ ++ if (pipe(pipefd)<0) { ++ perror("pipe"); ++ do_exit(7); ++ } ++ ++ /* flush stdout and stderr, since we're about to do fd stuff */ ++ fflush(stdout); ++ fflush(stderr); ++ ++ /* fork to prepare to run command */ ++ child=fork(); ++ ++ if (child<0) { /* fork error */ ++ perror("fork"); + do_exit(2); ++ } else if (child==0) { /* in child */ ++ close (pipefd[0]); /* child doesn't need read side of pipe */ ++ close (1); /* prepare to replace stdout with pipe */ ++ if (dup2 (pipefd[1], 1)<0) { /* replace stdout with write side of pipe */ ++ perror("dup2"); ++ exit(3); ++ } ++ dup2(1, 2); /* stderr should default to stdout */ ++ ++ if (option_exec) { /* pass command to exec instead of system */ ++ if (execvp(command_argv[0], command_argv)==-1) { ++ perror("exec"); ++ exit(4); ++ } ++ } else { ++ status=system(command); /* watch manpage promises sh quoting */ ++ ++ /* propagate command exit status as child exit status */ ++ if (!WIFEXITED(status)) { /* child exits nonzero if command does */ ++ exit(1); ++ } else { ++ exit(WEXITSTATUS(status)); ++ } ++ } ++ ++ } ++ ++ /* otherwise, we're in parent */ ++ close(pipefd[1]); /* close write side of pipe */ ++ if ((p=fdopen(pipefd[0], "r"))==NULL) { ++ perror("fdopen"); ++ do_exit(5); + } + ++ + for (y = show_title; y < height; y++) { + int eolseen = 0, tabpending = 0; + for (x = 0; x < width; x++) { +@@ -313,7 +384,19 @@ + oldeolseen = eolseen; + } + +- pclose(p); ++ fclose(p); ++ ++ /* harvest child process and get status, propagated from command */ ++ if (waitpid(child, &status, 0)<0) { ++ perror("waitpid"); ++ do_exit(8); ++ }; ++ ++ /* if child process exited in error, beep if option_beep is set */ ++ if ((!WIFEXITED(status) || WEXITSTATUS(status))) { ++ if (option_beep) beep(); ++ if (option_errexit) do_exit(8); ++ } + + first_screen = 0; + refresh(); diff --git a/patches/procps-3.2.7/generic/35_path_max.dpatch b/patches/procps-3.2.7/generic/35_path_max.dpatch new file mode 100644 index 000000000..e41727648 --- /dev/null +++ b/patches/procps-3.2.7/generic/35_path_max.dpatch @@ -0,0 +1,75 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 35_path_max.dpatch by Madhusudan.C.S <madhusudancs@gmail.com> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Uses alloc instead of fixed PATH_MAX value #496274 + +@DPATCH@ +diff -urNad procps-3.2.7~/proc/readproc.c procps-3.2.7/proc/readproc.c +--- procps-3.2.7~/proc/readproc.c 2008-09-09 15:01:09.000000000 +1000 ++++ procps-3.2.7/proc/readproc.c 2008-09-09 15:01:36.000000000 +1000 +@@ -1034,7 +1034,7 @@ + * and filled out proc_t structure. + */ + proc_t * get_proc_stats(pid_t pid, proc_t *p) { +- static char path[PATH_MAX], sbuf[1024]; ++ static char path[32], sbuf[1024]; + struct stat statbuf; + + sprintf(path, "/proc/%d", pid); +diff -urNad procps-3.2.7~/pwdx.c procps-3.2.7/pwdx.c +--- procps-3.2.7~/pwdx.c 2006-06-17 19:29:06.000000000 +1000 ++++ procps-3.2.7/pwdx.c 2008-09-09 15:01:36.000000000 +1000 +@@ -35,7 +35,6 @@ + + int main(int argc, char* argv[]) + { +- char buf[PATH_MAX+1]; + regex_t re; + int i; + +@@ -59,6 +58,7 @@ + + for (i = 1; i < argc; i++) { + if (regexec(&re, argv[i], 0, NULL, 0) != 0) { ++ char buf[27 + strlen (argv[i]) + 1]; // Constant 27 is the length of the error string "pwdx: ... " + snprintf(buf, sizeof buf, "pwdx: invalid process id: %s\n", argv[i]); + die(buf); + } +@@ -68,9 +68,13 @@ + + regfree(&re); + ++ int alloclen = 128; ++ char *pathbuf = malloc(alloclen); ++ + for (i = 1; i < argc; i++) { +- char * s = buf; ++ char * s; + int len; ++ char buf[10 + strlen(argv[i]) + 1]; // Constant 10 is the length of strings "/proc/" + "/cwd" + 1 + + // At this point, all arguments are in the form /proc/nnnn + // or nnnn, so a simple check based on the first char is +@@ -82,7 +86,12 @@ + + // buf contains /proc/nnnn/cwd symlink name on entry, the + // target of that symlink on return +- if ((len = readlink(buf, buf, PATH_MAX)) < 0) { ++ while ((len = readlink(buf, pathbuf, alloclen) == alloclen)) { ++ alloclen *= 2; ++ s = pathbuf = realloc(pathbuf, alloclen); ++ } ++ ++ if (len < 0) { + s = strerror(errno == ENOENT ? ESRCH : errno); + } else { + buf[len] = 0; +@@ -91,5 +100,7 @@ + printf("%s: %s\n", argv[i], s); + } + ++ free(pathbuf); ++ + return 0; + } diff --git a/patches/procps-3.2.7/generic/40_gnu-kbsd-version.dpatch b/patches/procps-3.2.7/generic/40_gnu-kbsd-version.dpatch new file mode 100644 index 000000000..79c3ff991 --- /dev/null +++ b/patches/procps-3.2.7/generic/40_gnu-kbsd-version.dpatch @@ -0,0 +1,40 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_gnu-kbsd-version.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Rework version parsing so its ok with other OSes + +@DPATCH@ +diff -urNad procps-3.2.7~/proc/version.c procps-3.2.7/proc/version.c +--- procps-3.2.7~/proc/version.c 2006-06-27 08:55:32.000000000 +1000 ++++ procps-3.2.7/proc/version.c 2006-06-27 09:02:25.000000000 +1000 +@@ -35,15 +35,23 @@ + + static void init_Linux_version(void) __attribute__((constructor)); + static void init_Linux_version(void) { +- static struct utsname uts; + int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ ++ FILE *fp; ++ char buf[256]; + +- if (uname(&uts) == -1) /* failure implies impending death */ +- exit(1); +- if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3) ++ if ( (fp=fopen("/proc/version","r")) == NULL) /* failure implies impending death */ ++ exit(1); ++ if (fgets(buf, 256, fp) == NULL) { ++ fprintf(stderr, "Cannot read kernel version from /proc/version\n"); ++ fclose(fp); ++ exit(1); ++ } ++ fclose(fp); ++ if (sscanf(buf, "Linux version %d.%d.%d", &x, &y, &z) < 3) + fprintf(stderr, /* *very* unlikely to happen by accident */ + "Non-standard uts for running kernel:\n" +- "release %s=%d.%d.%d gives version code %d\n", +- uts.release, x, y, z, LINUX_VERSION(x,y,z)); ++ "release %s=%d.%d.%d gives version code %d\n", ++ buf, ++ x, y, z, LINUX_VERSION(x,y,z)); + linux_version_code = LINUX_VERSION(x, y, z); + } diff --git a/patches/procps-3.2.7/generic/40_pgrep_coption.dpatch b/patches/procps-3.2.7/generic/40_pgrep_coption.dpatch new file mode 100644 index 000000000..778690f1d --- /dev/null +++ b/patches/procps-3.2.7/generic/40_pgrep_coption.dpatch @@ -0,0 +1,87 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_pgrep-coption.dpatch by <csmall@localhost.localdomain> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: c option for pgrep for counting number of matched proceesses + +@DPATCH@ +diff -urNad procps-3.2.7~/pgrep.1 procps-3.2.7/pgrep.1 +--- procps-3.2.7~/pgrep.1 2007-10-05 22:32:40.000000000 +1000 ++++ procps-3.2.7/pgrep.1 2007-10-05 22:36:42.000000000 +1000 +@@ -7,7 +7,7 @@ + pgrep, pkill \- look up or signal processes based on name and other attributes + + .SH SYNOPSIS +-pgrep [\-flvx] [\-d \fIdelimiter\fP] [\-n|\-o] [\-P \fIppid\fP,...] [\-g \fIpgrp\fP,...] ++pgrep [\-cflvx] [\-d \fIdelimiter\fP] [\-n|\-o] [\-P \fIppid\fP,...] [\-g \fIpgrp\fP,...] + .br + [\-s \fIsid\fP,...] [\-u \fIeuid\fP,...] [\-U \fIuid\fP,...] [\-G \fIgid\fP,...] + .br +@@ -38,6 +38,9 @@ + + .SH OPTIONS + .TP ++\-c ++Suppress normal output; instead print a count of matching processes. ++.TP + \-d \fIdelimiter\fP + Sets the string used to delimit each process ID in the output (by + default a newline). (\fBpgrep\fP only.) +diff -urNad procps-3.2.7~/pgrep.c procps-3.2.7/pgrep.c +--- procps-3.2.7~/pgrep.c 2007-10-05 22:35:52.000000000 +1000 ++++ procps-3.2.7/pgrep.c 2007-10-05 22:35:52.000000000 +1000 +@@ -54,6 +54,7 @@ + static int opt_newest = 0; + static int opt_negate = 0; + static int opt_exact = 0; ++static int opt_count = 0; + static int opt_signal = SIGTERM; + static int opt_lock = 0; + static int opt_case = 0; +@@ -77,7 +78,7 @@ + if (i_am_pkill) + fprintf (stderr, "Usage: pkill [-SIGNAL] [-fvx] "); + else +- fprintf (stderr, "Usage: pgrep [-flvx] [-d DELIM] "); ++ fprintf (stderr, "Usage: pgrep [-cflvx] [-d DELIM] "); + fprintf (stderr, "[-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]\n" + "\t[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] " + "[PATTERN]\n"); +@@ -562,7 +563,7 @@ + strcat (opts, "ld:"); + } + +- strcat (opts, "LF:fnovxP:g:s:u:U:G:t:?V"); ++ strcat (opts, "LF:cfnovxP:g:s:u:U:G:t:?V"); + + while ((opt = getopt (argc, argv, opts)) != -1) { + switch (opt) { +@@ -610,6 +611,9 @@ + exit(EXIT_SUCCESS); + // case 'c': // Solaris: match by contract ID + // break; ++ case 'c': ++ opt_count = 1; ++ break; + case 'd': // Solaris: change the delimiter + opt_delim = strdup (optarg); + break; +@@ -721,10 +725,14 @@ + procs[i].num, strerror (errno)); + } + } else { +- if (opt_long) +- output_strlist(procs,num); +- else +- output_numlist(procs,num); ++ if (opt_count) { ++ fprintf(stdout, "%ld\n", num); ++ } else { ++ if (opt_long) ++ output_strlist (procs,num); ++ else ++ output_numlist (procs,num); ++ } + } + return !num; // exit(EXIT_SUCCESS) if match, otherwise exit(EXIT_FAILURE) + } diff --git a/patches/procps-3.2.7/generic/40_ps_cgroup_display.dpatch b/patches/procps-3.2.7/generic/40_ps_cgroup_display.dpatch new file mode 100644 index 000000000..93f4a8767 --- /dev/null +++ b/patches/procps-3.2.7/generic/40_ps_cgroup_display.dpatch @@ -0,0 +1,162 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_ps_cgroup_display.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: ps displays cgroup #469669 + +@DPATCH@ +diff -urNad procps-3.2.7~/proc/readproc.c procps-3.2.7/proc/readproc.c +--- procps-3.2.7~/proc/readproc.c 2009-01-07 18:20:19.000000000 +1100 ++++ procps-3.2.7/proc/readproc.c 2009-01-07 18:24:51.000000000 +1100 +@@ -598,6 +598,17 @@ + p->environ = file2strvec(path, "environ"); + else + p->environ = NULL; ++ ++ if(linux_version_code>=LINUX_VERSION(2,6,24) && (flags & PROC_FILLCGROUP)) { ++ p->cgroup = file2strvec(path, "cgroup"); /* read /proc/#/cgroup */ ++ if(p->cgroup && *p->cgroup) { ++ int i = strlen(*p->cgroup); ++ if( (*p->cgroup)[i-1]=='\n' ) ++ (*p->cgroup)[i-1] = ' '; //little hack to remove trailing \n ++ } ++ } ++ else ++ p->cgroup = NULL; + + return p; + next_proc: +@@ -686,7 +697,7 @@ + t->cmdline = p->cmdline; // better not free these until done with all threads! + t->environ = p->environ; + #endif +- ++ t->cgroup = p->cgroup; + t->ppid = p->ppid; // ought to put the per-task ppid somewhere + + return t; +@@ -896,6 +907,8 @@ + free((void*)*p->cmdline); + if (p->environ) + free((void*)*p->environ); ++ if (p->cgroup) ++ free((void*)*p->cgroup); + free(p); + } + +diff -urNad procps-3.2.7~/proc/readproc.h procps-3.2.7/proc/readproc.h +--- procps-3.2.7~/proc/readproc.h 2006-06-16 18:01:21.000000000 +1000 ++++ procps-3.2.7/proc/readproc.h 2009-01-07 18:24:56.000000000 +1100 +@@ -139,6 +139,7 @@ + tpgid, // stat terminal process group id + exit_signal, // stat might not be SIGCHLD + processor; // stat current (or most recent?) CPU ++ char **cgroup; // cgroup current cgroup, looks like a classic filepath + } proc_t; + + // PROCTAB: data structure holding the persistent information readproc needs +@@ -239,6 +240,8 @@ + + #define PROC_LOOSE_TASKS 0x0200 // threat threads as if they were processes + ++#define PROC_FILLCGROUP 0x0400 // alloc and fill in `cgroup` ++ + // Obsolete, consider only processes with one of the passed: + #define PROC_PID 0x1000 // process id numbers ( 0 terminated) + #define PROC_UID 0x4000 // user id numbers ( length needed ) +diff -urNad procps-3.2.7~/ps/display.c procps-3.2.7/ps/display.c +--- procps-3.2.7~/ps/display.c 2005-01-06 10:44:37.000000000 +1100 ++++ procps-3.2.7/ps/display.c 2009-01-07 18:24:32.000000000 +1100 +@@ -223,8 +223,7 @@ + + #define needs_for_format (proc_format_needs|task_format_needs) + +-#define PROC_ONLY_FLAGS (PROC_FILLENV|PROC_FILLARG|PROC_FILLCOM|PROC_FILLMEM) +- ++#define PROC_ONLY_FLAGS (PROC_FILLENV|PROC_FILLARG|PROC_FILLCOM|PROC_FILLMEM|PROC_FILLCGROUP) + /***** munge lists and determine openproc() flags */ + static void lists_and_needs(void){ + check_headers(); +@@ -342,6 +341,7 @@ + } + if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse + if(buf.environ) free((void*)*buf.environ); // ought to reuse ++ if(buf.cgroup) free((void*)*buf.cgroup); + } + break; + case TF_show_proc|TF_loose_tasks: // H option +@@ -354,6 +354,7 @@ + } + if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse + if(buf.environ) free((void*)*buf.environ); // ought to reuse ++ if(buf.cgroup) free((void*)*buf.cgroup); + } + break; + case TF_show_proc|TF_show_task: // m and -m options +@@ -366,7 +367,8 @@ + } + if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse + if(buf.environ) free((void*)*buf.environ); // ought to reuse +- } ++ if(buf.cgroup) free((void*)*buf.cgroup); ++ } + break; + case TF_show_task: // -L and -T options + while(readproc(ptp,&buf)){ +@@ -377,7 +379,8 @@ + } + if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse + if(buf.environ) free((void*)*buf.environ); // ought to reuse +- } ++ if(buf.cgroup) free((void*)*buf.cgroup); ++ } + break; + } + closeproc(ptp); +diff -urNad procps-3.2.7~/ps/output.c procps-3.2.7/ps/output.c +--- procps-3.2.7~/ps/output.c 2006-06-19 09:27:02.000000000 +1000 ++++ procps-3.2.7/ps/output.c 2009-01-07 18:24:43.000000000 +1100 +@@ -359,6 +359,26 @@ + return max_rightward-rightward; + } + ++static int pr_cgroup(char *restrict const outbuf,const proc_t *restrict const pp) { ++ if(pp->cgroup && *pp->cgroup) { ++ char *endp = outbuf; ++ int rightward=max_rightward; ++ if(forest_prefix){ ++ int fh = forest_helper(outbuf); ++ endp += fh; ++ rightward -= fh; ++ } ++ if(rightward>1){ ++ *endp++ = ' '; ++ rightward--; ++ endp += escape_str(endp, *pp->cgroup, OUTBUF_SIZE, &rightward); ++ } ++ return max_rightward-rightward; ++ } ++ else ++ return pr_nop(outbuf,pp); ++} ++ + /* "ucomm" is the same thing: short unless -f */ + static int pr_comm(char *restrict const outbuf, const proc_t *restrict const pp){ + char *endp = outbuf; +@@ -1248,7 +1268,7 @@ + #define GRP PROC_FILLGRP /* gid_t -> group names */ + #define WCH PROC_FILLWCHAN /* do WCHAN lookup */ + +- ++#define CGRP PROC_FILLCGROUP /* read cgroup */ + /* TODO + * pull out annoying BSD aliases into another table (to macro table?) + * add sorting functions here (to unify names) +@@ -1284,6 +1304,7 @@ + {"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, 27, CGRP, LNX, PO|UNLIMITED}, + {"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 --git a/patches/procps-3.2.7/generic/40_watch_precision_time.dpatch b/patches/procps-3.2.7/generic/40_watch_precision_time.dpatch new file mode 100644 index 000000000..16f885673 --- /dev/null +++ b/patches/procps-3.2.7/generic/40_watch_precision_time.dpatch @@ -0,0 +1,217 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 40_watch_precision_time.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Add precision wait time option -p #183486 + +@DPATCH@ +diff -urNad procps-3.2.7~/watch.1 procps-3.2.7/watch.1 +--- procps-3.2.7~/watch.1 2009-01-11 12:27:23.000000000 +1100 ++++ procps-3.2.7/watch.1 2009-01-11 12:28:49.000000000 +1100 +@@ -4,7 +4,7 @@ + .SH SYNOPSIS + .na + .B watch +-.RB [ \-bdehvtx ] ++.RB [ \-bdehpvtx ] + .RB [ \-n + .IR seconds ] + .RB [ \-\-beep ] +@@ -14,6 +14,7 @@ + .RB [ \-\-help ] + .RB [ \-\-interval=\fIseconds\fP] + .RB [ \-\-no\-title ] ++.RB [ \-\-precise ] + .RB [ \-\-version ] + .I command + .SH DESCRIPTION +@@ -27,7 +28,24 @@ + .B \-n + or + .B \-\-interval +-to specify a different interval. ++to specify a different interval. Normally, this interval is interpreted ++as the amout of time between the completion of one run of ++.I command ++and the beginning of the next run. However, with the ++.I \-p ++or ++.I \-\-precise ++option, you can make ++.BR watch ++attempt to run ++.I command ++every ++.I interval ++seconds. Try it with ++.B ntptime ++and notice how the fractional seconds stays ++(nearly) the same, as opposed to normal mode where they continuously ++increase. + .PP + The + .B \-d +@@ -97,11 +115,21 @@ + .br + watch echo "'"'$$'"'" + .PP ++To see the effect of precision time keeping, try adding ++.I \-p ++to ++.IP ++watch \-n 10 sleep 1 ++.PP + You can watch for your administrator to install the latest kernel with + .IP + watch uname \-r + .PP +-(Just kidding.) ++(Note that ++.I \-p ++isn't guaranteed to work across reboots, especially in the face of ++.B ntpdate ++or other bootup time-changing mechanisms) + .SH BUGS + Upon terminal resize, the screen will not be correctly repainted until the + next scheduled update. All +@@ -110,6 +138,22 @@ + .PP + Non-printing characters are stripped from program output. Use "cat -v" as + part of the command pipeline if you want to see them. ++.PP ++.I \-\-precise ++mode doesn't yet have advanced temporal distortion technology to ++compensate for a ++.I command ++that takes more than ++.I interval ++seconds to execute. ++.B watch ++also can get into a state where it rapid-fires as many executions of ++.I command ++as it can to catch up from a previous executions running longer than ++.I interval ++(for example, ++.B netstat ++taking ages on a DNS lookup). + .SH AUTHORS + The original + .B watch +@@ -117,3 +161,7 @@ + corrections by Francois Pinard. It was reworked and new features added by + Mike Coleman <mkc@acm.org> in 1999. The beep, exec, and error handling + features were added by Morty Abzug <morty@frakir.org> in 2008. ++On a not so dark and stormy morning ++in March of 2003, Anthony DeRobertis <asd@suespammers.org> got sick of ++his watches that should update every minute eventually updating many ++seconds after the minute started, and added microsecond precision. +diff -urNad procps-3.2.7~/watch.c procps-3.2.7/watch.c +--- procps-3.2.7~/watch.c 2009-01-11 12:27:23.000000000 +1100 ++++ procps-3.2.7/watch.c 2009-01-11 12:28:37.000000000 +1100 +@@ -21,6 +21,7 @@ + #include <stdlib.h> + #include <string.h> + #include <sys/ioctl.h> ++#include <sys/time.h> + #include <time.h> + #include <unistd.h> + #include <termios.h> +@@ -39,13 +40,14 @@ + {"beep", no_argument, 0, 'b'}, + {"errexit", no_argument, 0, 'e'}, + {"exec", no_argument, 0, 'x'}, ++ {"precise", no_argument, 0, 'p'}, + {"no-title", no_argument, 0, 't'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0} + }; + + static char usage[] = +- "Usage: %s [-bdhntvx] [--beep] [--differences[=cumulative]] [--exec] [--help] [--interval=<n>] [--no-title] [--version] <command>\n"; ++ "Usage: %s [-bdhnptvx] [--beep] [--differences[=cumulative]] [--exec] [--help] [--interval=<n>] [--no-title] [--version] <command>\n"; + + static char *progname; + +@@ -54,6 +56,7 @@ + static int screen_size_changed = 0; + static int first_screen = 1; + static int show_title = 2; // number of lines used, 2 or 0 ++static int precise_timekeeping = 0; + + #define min(x,y) ((x) > (y) ? (y) : (x)) + +@@ -138,6 +141,15 @@ + } + } + ++/* get current time in usec */ ++typedef unsigned long long watch_usec_t; ++#define USECS_PER_SEC (1000000ull) ++watch_usec_t get_time_usec() { ++ struct timeval now; ++ gettimeofday(&now, NULL); ++ return USECS_PER_SEC*now.tv_sec + now.tv_usec; ++} ++ + int + main(int argc, char *argv[]) + { +@@ -152,6 +164,8 @@ + char *command; + char **command_argv; + int command_length = 0; /* not including final \0 */ ++ watch_usec_t next_loop; /* next loop time in us, used for precise time ++ keeping only */ + int pipefd[2]; + int status; + pid_t child; +@@ -159,7 +173,7 @@ + setlocale(LC_ALL, ""); + progname = argv[0]; + +- while ((optc = getopt_long(argc, argv, "+bed::hn:vtx", longopts, (int *) 0)) ++ while ((optc = getopt_long(argc, argv, "+bed::hn:pvtx", longopts, (int *) 0)) + != EOF) { + switch (optc) { + case 'b': +@@ -194,6 +208,9 @@ + interval = ~0u/1000000; + } + break; ++ case 'p': ++ precise_timekeeping = 1; ++ break; + case 'v': + option_version = 1; + break; +@@ -217,6 +234,7 @@ + fputs(" -e, --errexit\t\t\t\texit watch if the command has a non-zero exit\n", stderr); + fputs(" -h, --help\t\t\t\tprint a summary of the options\n", stderr); + fputs(" -n, --interval=<seconds>\t\tseconds to wait between updates\n", stderr); ++ fputs(" -p, --precise\t\t\t\tprecise timing, ignore command run time\n", stderr); + fputs(" -v, --version\t\t\t\tprint the version number\n", stderr); + fputs(" -t, --no-title\t\t\tturns off showing the header\n", stderr); + fputs(" -x, --exec\t\t\t\tpass command to exec instead of sh\n", stderr); +@@ -256,6 +274,9 @@ + noecho(); + cbreak(); + ++ if (precise_timekeeping) ++ next_loop = get_time_usec(); ++ + for (;;) { + time_t t = time(NULL); + char *ts = ctime(&t); +@@ -400,6 +421,12 @@ + + first_screen = 0; + refresh(); ++ if (precise_timekeeping) { ++ watch_usec_t cur_time = get_time_usec(); ++ next_loop += USECS_PER_SEC*interval; ++ if (cur_time < next_loop) ++ usleep(next_loop - cur_time); ++ } else + usleep(interval * 1000000); + } + diff --git a/patches/procps-3.2.7/generic/45_proc_complain_unmounted_proc.dpatch b/patches/procps-3.2.7/generic/45_proc_complain_unmounted_proc.dpatch new file mode 100644 index 000000000..c34e618b4 --- /dev/null +++ b/patches/procps-3.2.7/generic/45_proc_complain_unmounted_proc.dpatch @@ -0,0 +1,21 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 45_proc_complain_unmounted_proc.dpatch by <hesso@hesso.pool.math.tu-berlin.de> +## +## DP: Complain when /proc/version cannot be found instead of +## DP: exiting silently. + +@DPATCH@ +--- procps-3.2.7/proc/version.cO 2007-08-06 16:18:41.000000000 +0200 ++++ procps-3.2.7/proc/version.c 2007-08-06 16:19:28.000000000 +0200 +@@ -39,8 +39,10 @@ + FILE *fp; + char buf[256]; + +- if ( (fp=fopen("/proc/version","r")) == NULL) /* failure implies impending death */ ++ if ( (fp=fopen("/proc/version","r")) == NULL) { ++ fprintf(stderr, "Cannot find /proc/version - is /proc mounted?\n"); + exit(1); ++ } + if (fgets(buf, 256, fp) == NULL) { + fprintf(stderr, "Cannot read kernel version from /proc/version\n"); + fclose(fp); diff --git a/patches/procps-3.2.7/generic/45_top_exitcode.dpatch b/patches/procps-3.2.7/generic/45_top_exitcode.dpatch new file mode 100644 index 000000000..3aefb7e38 --- /dev/null +++ b/patches/procps-3.2.7/generic/45_top_exitcode.dpatch @@ -0,0 +1,28 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 45_top_exitcode.dpatch by <hesso@pool.math.tu-berlin.de> +## +## DP: Make top exit with return code 0 if the program was closed +## DP: cleanly ('q' or end of iteration loop). + +@DPATCH@ +--- procps-3.2.7/top.cO 2007-08-06 15:57:04.000000000 +0200 ++++ procps-3.2.7/top.c 2007-08-06 16:04:07.000000000 +0200 +@@ -402,14 +402,13 @@ + + + /* +- * Normal end of execution. ++ * Normal end of execution. Exit with 1 if signaled, else 0. + * catches: + * SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */ +-static void end_pgm (int dont_care_sig) NORETURN; +-static void end_pgm (int dont_care_sig) ++static void end_pgm (int sig) NORETURN; ++static void end_pgm (int sig) + { +- (void)dont_care_sig; +- bye_bye(stdout, 1, NULL); ++ bye_bye(stdout, !!sig, NULL); + } + + diff --git a/patches/procps-3.2.7/generic/45_vmstat_exitcode.dpatch b/patches/procps-3.2.7/generic/45_vmstat_exitcode.dpatch new file mode 100644 index 000000000..4503d3951 --- /dev/null +++ b/patches/procps-3.2.7/generic/45_vmstat_exitcode.dpatch @@ -0,0 +1,26 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 45_vmstat_exitcode.dpatch by <gnufreedom100@gmail.com> +## +## DP: Make vmstat exit with return code of non-zero if there is a problem +@DPATCH@ +diff -ur procps-3.2.7/vmstat.c procps-FIX/vmstat.c +--- procps-3.2.7/vmstat.c 2006-06-24 23:41:48.000000000 -0700 ++++ procps-FIX/vmstat.c 2007-05-21 19:48:47.000000000 -0700 +@@ -290,7 +290,7 @@ + fDiskstat=fopen("/proc/diskstats","rb"); + if(!fDiskstat){ + fprintf(stderr, "Your kernel doesn't support diskstat. (2.5.70 or above required)\n"); +- exit(0); ++ exit(EXIT_FAILURE); + } + + fclose(fDiskstat); +@@ -400,7 +400,7 @@ + } + }else{ + fprintf(stderr, "Your kernel doesn't support diskstat (2.5.70 or above required)\n"); +- exit(0); ++ exit(EXIT_FAILURE); + } + } + diff --git a/patches/procps-3.2.7/generic/50_dev_null_makefile_fix.dpatch b/patches/procps-3.2.7/generic/50_dev_null_makefile_fix.dpatch new file mode 100644 index 000000000..7132b0f88 --- /dev/null +++ b/patches/procps-3.2.7/generic/50_dev_null_makefile_fix.dpatch @@ -0,0 +1,19 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## dev_null_makefile_fix.dpatch by <xaiki@gonzo> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Make sure Makefile doesnt zot random files while checking GCC + +@DPATCH@ +diff -urNad procps-3.2.6~/Makefile procps-3.2.6/Makefile +--- procps-3.2.6~/Makefile 2005-10-30 07:27:04.000000000 +0100 ++++ procps-3.2.6/Makefile 2005-12-20 02:57:41.000000000 +0100 +@@ -119,7 +119,7 @@ + # Unlike the kernel one, this check_gcc goes all the way to + # producing an executable. There might be a -m64 that works + # until you go looking for a 64-bit curses library. +-check_gcc = $(shell if $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) dummy.c $(ALL_LDFLAGS) $(1) -o /dev/null $(CURSES) > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) ++check_gcc = $(shell if $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) dummy.c $(ALL_LDFLAGS) $(1) -o will_this_file_really_exist.tmp $(CURSES) > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ; rm -f will_this_file_really_exist.tmp) + + # Be 64-bit if at all possible. In a cross-compiling situation, one may + # do "make m64=-m32 lib64=lib" to produce 32-bit executables. DO NOT diff --git a/patches/procps-3.2.7/generic/50_pgrep.1.dpatch b/patches/procps-3.2.7/generic/50_pgrep.1.dpatch new file mode 100644 index 000000000..33c9e2ac4 --- /dev/null +++ b/patches/procps-3.2.7/generic/50_pgrep.1.dpatch @@ -0,0 +1,211 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_pgrep.1.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Cleanup pgrep manual page #282168 +## DP: Uses .BR for see also section #437678 + +@DPATCH@ +diff -urNad procps-3.2.7~/pgrep.1 procps-3.2.7/pgrep.1 +--- procps-3.2.7~/pgrep.1 2008-04-07 11:22:03.000000000 +1000 ++++ procps-3.2.7/pgrep.1 2008-04-07 11:22:16.000000000 +1000 +@@ -2,35 +2,39 @@ + .\" Licensed under version 2 of the GNU General Public License. + .\" Copyright 2000 Kjetil Torgrim Homme + .\" +-.TH PGREP 1 "June 25, 2000" "Linux" "Linux User's Manual" ++.TH PGREP 1 "October 5, 2007" "Linux" "Linux User's Manual" + .SH NAME + pgrep, pkill \- look up or signal processes based on name and other attributes + + .SH SYNOPSIS +-pgrep [\-cflvx] [\-d \fIdelimiter\fP] [\-n|\-o] [\-P \fIppid\fP,...] [\-g \fIpgrp\fP,...] +-.br +- [\-s \fIsid\fP,...] [\-u \fIeuid\fP,...] [\-U \fIuid\fP,...] [\-G \fIgid\fP,...] +-.br +- [\-t \fIterm\fP,...] [\fIpattern\fP] ++.na ++\fBpgrep\fR [\fB\-cflvx\fR] [\fB\-d\ \fIdelimiter\fR] [\fB\-n\fR|\fB\-o\fR] \ ++[\fB\-P\ \fIppid\fR,...] [\fB\-g\ \fIpgrp\fR,...] [\fB\-s\ \fIsid\fR,...] \ ++[\fB\-u\ \fIeuid\fR,...] [\fB\-U\ \fIuid\fR,...] [\fB\-G\ \fIgid\fR,...] \ ++[\fB\-t\ \fIterm\fR,...] [\fIpattern\fR] + +-pkill [\-\fIsignal\fP] [\-fvx] [\-n|\-o] [\-P \fIppid\fP,...] [\-g \fIpgrp\fP,...] +-.br +- [\-s \fIsid\fP,...] [\-u \fIeuid\fP,...] [\-U \fIuid\fP,...] [\-G \fIgid\fP,...] +-.br +- [\-t \fIterm\fP,...] [\fIpattern\fP] ++.HP ++\fBpkill\fR [\fB\-\fIsignal\fR] [\fB\-fvx\fR] [\fB\-n\fR|\fB\-o\fR] \ ++[\fB\-P\ \fIppid\fR,...] [\fB\-g\ \fIpgrp\fR,...] [\fB\-s\ \fIsid\fR,...] \ ++[\fB\-u\ \fIeuid\fR,...] [\fB\-U\ \fIuid\fR,...] [\fB\-G\ \fIgid\fR,...] \ ++[\fB\-t\ \fIterm\fR,...] [\fIpattern\fR] + + .SH DESCRIPTION + \fBpgrep\fP looks through the currently running processes and lists the + process IDs which matches the selection criteria to stdout. All + the criteria have to match. For example, + +-pgrep -u root sshd ++.IP ++$ pgrep \-u root sshd + ++.PP + will only list the processes called \fBsshd\fP AND owned by \fBroot\fP. + On the other hand, + +-pgrep -u root,daemon ++.IP ++$ pgrep \-u root,daemon + ++.PP + will list the processes owned by \fBroot\fP OR \fBdaemon\fP. + + \fBpkill\fP will send the specified signal (by default \fBSIGTERM\fP) +@@ -38,18 +42,18 @@ + + .SH OPTIONS + .TP +-\-c ++\fB\-c\fR + Suppress normal output; instead print a count of matching processes. + .TP +-\-d \fIdelimiter\fP ++\fB\-d \fIdelimiter\fP + Sets the string used to delimit each process ID in the output (by + default a newline). (\fBpgrep\fP only.) + .TP +-\-f ++\fB\-f\fR + The \fIpattern\fP is normally only matched against the process name. +-When \-f is set, the full command line is used. ++When \fB\-f\fR is set, the full command line is used. + .TP +-\-g \fIpgrp\fP,... ++\fB\-g \fIpgrp\fP,... + Only match processes in the process group IDs listed. Process group 0 + is translated into \fBpgrep\fP's or \fBpkill\fP's own process group. + .TP +@@ -57,40 +61,40 @@ + Only match processes whose real group ID is listed. Either the + numerical or symbolical value may be used. + .TP +-\-l ++\fB\-l\fR + List the process name as well as the process ID. (\fBpgrep\fP only.) + .TP +-\-n ++\fB\-n\fR + Select only the newest (most recently started) of the matching + processes. + .TP +-\-o ++\fB\-o\fR + Select only the oldest (least recently started) of the matching + processes. + .TP +-\-P \fIppid\fP,... ++\fB\-P \fIppid\fP,... + Only match processes whose parent process ID is listed. + .TP +-\-s \fIsid\fP,... ++\fB\-s \fIsid\fP,... + Only match processes whose process session ID is listed. Session ID 0 + is translated into \fBpgrep\fP's or \fBpkill\fP's own session ID. + .TP +-\-t \fIterm\fP,... ++\fB\-t \fIterm\fP,... + Only match processes whose controlling terminal is listed. The + terminal name should be specified without the "/dev/" prefix. + .TP +-\-u \fIeuid\fP,... ++\fB\-u \fIeuid\fP,... + Only match processes whose effective user ID is listed. Either the + numerical or symbolical value may be used. + .TP +-\-U \fIuid\fP,... ++\fB\-U \fIuid\fP,... + Only match processes whose real user ID is listed. Either the + numerical or symbolical value may be used. + .TP +-\-v ++\fB\-v\fR + Negates the matching. + .TP +-\-x ++\fB\-x\fR + Only match processes whose name (or command line if \-f is specified) + \fBexactly\fP match the \fIpattern\fP. + .TP +@@ -107,32 +111,40 @@ + .SH EXAMPLES + Example 1: Find the process ID of the \fBnamed\fP daemon: + +-unix$ pgrep \-u root named ++.IP ++$ pgrep \-u root named + ++.PP + Example 2: Make \fBsyslog\fP reread its configuration file: + +-unix$ pkill \-HUP syslogd ++.IP ++$ pkill \-HUP syslogd + ++.PP + Example 3: Give detailed information on all \fBxterm\fP processes: + +-unix$ ps \-fp $(pgrep \-d, \-x xterm) ++.IP ++$ ps \-fp $(pgrep \-d, \-x xterm) + ++.PP + Example 4: Make all \fBnetscape\fP processes run nicer: + +-unix$ renice +4 `pgrep netscape` ++.IP ++$ renice +4 `pgrep netscape` + + .SH "EXIT STATUS" ++.PD 0 + .TP +-.I "0" ++.I 0 + One or more processes matched the criteria. + .TP +-.I "1" ++.I 1 + No processes matched. + .TP +-.I "2" ++.I 2 + Syntax error in the command line. + .TP +-.I "3" ++.I 3 + Fatal error: out of memory etc. + + .SH NOTES +@@ -144,13 +156,19 @@ + itself as a match. + + .SH BUGS +-The options \-n and \-o and \-v can not be combined. Let me know if +-you need to do this. ++The options \fB\-n\fP and \fB\-o\fP and \fB\-v\fP can not be combined. ++Let me know if you need to do this. + + Defunct processes are reported. + + .SH "SEE ALSO" +-ps(1) regex(7) signal(7) killall(1) skill(1) kill(1) kill(2) ++.BR ps (1), ++.BR regex (7), ++.BR signal (7), ++.BR killall (1), ++.BR skill (1), ++.BR kill (1), ++.BR kill (2) + + .SH STANDARDS + \fBpkill\fP and \fBpgrep\fP were introduced in Sun's Solaris 7. This diff --git a/patches/procps-3.2.7/generic/50_top_mintime.dpatch b/patches/procps-3.2.7/generic/50_top_mintime.dpatch new file mode 100644 index 000000000..c38f889b8 --- /dev/null +++ b/patches/procps-3.2.7/generic/50_top_mintime.dpatch @@ -0,0 +1,20 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_top_mintime.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Checks minimum time is valid + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- procps-3.2.7~/top.c 2007-10-04 21:58:56.000000000 +1000 ++++ procps-3.2.7/top.c 2007-10-04 21:59:24.000000000 +1000 +@@ -2535,7 +2535,8 @@ + else { + float tmp = + get_float(fmtmk("Change delay from %.1f to", Rc.delay_time)); +- if (tmp > -1) Rc.delay_time = tmp; ++ if (tmp == 0.0) show_msg("\aNot valid"); ++ else if (tmp > 0) Rc.delay_time = tmp; + } + break; + diff --git a/patches/procps-3.2.7/generic/50_vmstat_headers.dpatch b/patches/procps-3.2.7/generic/50_vmstat_headers.dpatch new file mode 100644 index 000000000..13fa4bf61 --- /dev/null +++ b/patches/procps-3.2.7/generic/50_vmstat_headers.dpatch @@ -0,0 +1,149 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_vmstat_headers.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Headers for disk and slab info Debian bug #436805 +## DP: getopt replacement #408088 + +@DPATCH@ +diff -urNad procps-3.2.7~/vmstat.c procps-3.2.7/vmstat.c +--- procps-3.2.7~/vmstat.c 2007-10-04 22:26:49.000000000 +1000 ++++ procps-3.2.7/vmstat.c 2007-10-04 22:27:07.000000000 +1000 +@@ -29,14 +29,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 +@@ -354,6 +355,7 @@ + if ((fDiskstat=fopen("/proc/diskstats", "rb"))){ + fclose(fDiskstat); + ndisks=getdiskstat(&disks,&partitions); ++ if (!moreheaders) diskheader(); + for(k=0; k<ndisks; k++){ + if (moreheaders && ((k%height)==0)) diskheader(); + printf(format, +@@ -424,6 +426,7 @@ + return; + } + ++ if (!moreheaders) slabheader(); + nSlab = getslabinfo(&slabs); + for(k=0; k<nSlab; k++){ + if (moreheaders && ((k%height)==0)) slabheader(); +@@ -582,12 +585,10 @@ + //////////////////////////////////////////////////////////////////////////// + + 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); +@@ -603,7 +604,7 @@ + fork_format(); + exit(0); + case 'm': +- statMode |= SLABSTAT; ++ statMode |= SLABSTAT; + break; + case 'D': + statMode |= DISKSUMSTAT; +@@ -614,53 +615,40 @@ + 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; ++ statMode |= VMSUMSTAT; + break; + default: + /* no other aguments defined yet. */ + usage(); +- } +- }else{ +- argc++; +- switch (argc) { +- case 1: +- if ((sleep_time = atoi(*argv)) == 0) ++ } ++ ++ if (optind < argc) { ++ if ((sleep_time = atoi(argv[optind++])) == 0) + usage(); +- num_updates = ULONG_MAX; +- break; +- case 2: +- num_updates = atol(*argv); +- break; +- default: +- usage(); +- } /* switch */ ++ 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); diff --git a/patches/procps-3.2.7/generic/55_pgrep_usage_exitcode.dpatch b/patches/procps-3.2.7/generic/55_pgrep_usage_exitcode.dpatch new file mode 100644 index 000000000..c6dabb5d7 --- /dev/null +++ b/patches/procps-3.2.7/generic/55_pgrep_usage_exitcode.dpatch @@ -0,0 +1,17 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 55_pgrep_usage_exitcode.dpatch by <hesso@pool.math.tu-berlin.de> +## +## DP: Distinguish between invalid commandline parameters and '-?'. + +@DPATCH@ +--- procps-3.2.7.orig/pgrep.c 2007-08-06 16:35:30.000000000 +0200 ++++ procps-3.2.7/pgrep.c 2007-08-06 16:35:06.000000000 +0200 +@@ -678,7 +678,7 @@ + // case 'z': // Solaris: match by zone ID + // break; + case '?': +- usage (opt); ++ usage (optopt?optopt:opt); + break; + } + } diff --git a/patches/procps-3.2.7/generic/55_top_highlight.dpatch b/patches/procps-3.2.7/generic/55_top_highlight.dpatch new file mode 100644 index 000000000..df53c1399 --- /dev/null +++ b/patches/procps-3.2.7/generic/55_top_highlight.dpatch @@ -0,0 +1,22 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 55_top_highlight.dpatch by <csmall@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix highlighting problem Closes: #351065 + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- procps-3.2.7~/top.c 2008-01-08 20:13:02.000000000 +1100 ++++ procps-3.2.7/top.c 2008-01-08 20:13:47.000000000 +1100 +@@ -3027,9 +3027,10 @@ + snprintf(_z, sizeof(_z), f, ## va); \ + snprintf(cbuf, sizeof(cbuf), "%s%s%s", \ + q->capclr_rowhigh, \ +- _z, \ ++ _z+advance, \ + !(CHKw(q, Show_HIROWS) && 'R' == p->state) ? q->capclr_rownorm : "" \ + ); \ ++ advance=0; \ + pad += q->len_rowhigh; \ + if (!(CHKw(q, Show_HIROWS) && 'R' == p->state)) pad += q->len_rownorm; \ + } \ diff --git a/patches/procps-3.2.7/generic/60_top_nohz.dpatch b/patches/procps-3.2.7/generic/60_top_nohz.dpatch new file mode 100644 index 000000000..6b7390fdd --- /dev/null +++ b/patches/procps-3.2.7/generic/60_top_nohz.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 60_top_nohz.dpatch by <fabbione@sunfire.int.fabbione.net> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Handle idle time calculations correctly when running with NOHZ. + +@DPATCH@ +diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c +--- 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; diff --git a/patches/procps-3.2.7/generic/README b/patches/procps-3.2.7/generic/README new file mode 100644 index 000000000..0e453eaf5 --- /dev/null +++ b/patches/procps-3.2.7/generic/README @@ -0,0 +1,8 @@ +From: Marc Kleine-Budde <mkl@pengutronix.de> +Subject: import patches from debian's procps + +this is basially the patches from: +http://ftp.de.debian.org/debian/pool/main/p/procps/procps_3.2.7-11.diff.gz +taken dpatch squeezed into quilt :) + +Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> diff --git a/patches/procps-3.2.7/generic/series b/patches/procps-3.2.7/generic/series index 82add274a..4e50d6a83 100644 --- a/patches/procps-3.2.7/generic/series +++ b/patches/procps-3.2.7/generic/series @@ -1 +1,51 @@ +10_free.1.dpatch +10_pmap.1.dpatch +10_ps.1.dpatch +10_skill.1.dpatch +10_skill_perror.dpatch +10_slabtop.dpatch +10_sysctl.8.dpatch +10_sysctl_malloclen.dpatch +10_sysctl_options.dpatch +10_tload.1.dpatch +10_top_irix.dpatch +10_top_no_openproc.dpatch +10_top_stdineof.dpatch +10_top_uid_length.dpatch +10_uptime.1.dpatch +10_vmstat.8.dpatch +10_watch.1.dpatch +10_w_time.dpatch +20_kill.1.dpatch +20_kill_warncr.dpatch +20_module_mk_shared.dpatch +20_sysinfo_c.dpatch +20_top_manpage.dpatch +20_top_c_resize.dpatch +20_w-bassman.dpatch +30_top.1_cpustate.dpatch +20_watch_8bitchar.dpatch +30_library_map_freeproc.dpatch +30_pgrep_start_time.dpatch +30_readproc_c.dpatch +30_sysinfo_7numbers.dpatch +30_tload_no_optargs.dpatch +30_w.1.dpatch +30_w-columns.dpatch +30_watch_exec_beep.dpatch +35_path_max.dpatch +40_gnu-kbsd-version.dpatch +40_pgrep_coption.dpatch +40_ps_cgroup_display.dpatch +40_watch_precision_time.dpatch +45_proc_complain_unmounted_proc.dpatch +45_top_exitcode.dpatch +45_vmstat_exitcode.dpatch +50_dev_null_makefile_fix.dpatch +50_pgrep.1.dpatch +50_top_mintime.dpatch +50_vmstat_headers.dpatch +55_pgrep_usage_exitcode.dpatch +55_top_highlight.dpatch +60_top_nohz.dpatch remove-rename-registers.diff |