Dr. Werner Fink 2014-05-20 16:01:01 +00:00 committed by Git OBS Bridge
parent 6bb1b29906
commit 3ad5493500
71 changed files with 4763 additions and 2990 deletions

View File

@ -1,42 +0,0 @@
From b55f9b97db9101e8fb1903d03f7bc7e9c8476572 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 6 Jun 2013 00:00:00 -0500
Subject: [PATCH] top: add the major version to dlopen of libnuma soname
When the plug-in approach to NUMA support was added, I
carelessly employed the compile-time linker convention
for naming the library. Technically this then required
the 'devel' package for NUMA support to be present for
the unqualified soname symlink to be available. Either
that or one must have manually created such a symlink.
This commit adds the missing major version to dlopen()
of libnuma.so.1 so simply having a more likely package
such as 'numactl' will enable both '2' & '3' commands.
References(s):
http://www.freelists.org/post/procps/top-NUMA-node-CPU-utilization-support,25
. initial dlopen support
commit edba932a7e9b950dd91bc486e107788e977a5186
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git top/top.c top/top.c
index 2b05a60..0d7ee2d 100644
--- top/top.c
+++ top/top.c
@@ -3246,7 +3246,7 @@ static void before (char *me) {
#if defined(PRETEND_NUMA) || defined(PRETEND8CPUS)
Numa_node_tot = Numa_max_node() + 1;
#else
- Libnuma_handle = dlopen("libnuma.so", RTLD_LAZY);
+ Libnuma_handle = dlopen("libnuma.so.1", RTLD_LAZY);
if (Libnuma_handle) {
Numa_max_node = dlsym(Libnuma_handle, "numa_max_node");
Numa_node_of_cpu = dlsym(Libnuma_handle, "numa_node_of_cpu");
--
1.7.9.2

View File

@ -1,570 +0,0 @@
From b79b927f9781c02c82f906bf8bc5aa16c5df2a87 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 20 Jun 2013 00:00:00 -0500
Subject: [PATCH] top: trade two groff_mdoc macros for groff equivalents
The .Bd and .Ed macros, from the mdoc collection, have
caused a few raised eyebrows (lintian, doclifter, etc)
in the past. With this commit, we will trade their use
for the standard existing groff .nf & .fi equivalents.
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.1 | 155 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 78 insertions(+), 77 deletions(-)
diff --git top/top.1 top/top.1
index 53ebaf2..0a753a8 100644
--- top/top.1
+++ top/top.1
@@ -118,7 +118,7 @@ display and used when reading and writing a \*(CF.
.\" ----------------------------------------------------------------------
The remaining Table of Contents
-.Bd -literal
+.nf
1. COMMAND\-LINE Options
2. SUMMARY Display
a. UPTIME and LOAD Averages
@@ -152,7 +152,7 @@ The remaining Table of Contents
c. The Big Bird Window
d. The Ol' Switcheroo
8. BUGS, 9. HISTORY Former top, 10. AUTHOR, 11. SEE Also
-.Ed
+.fi
.\" ......................................................................
.SS Operation
@@ -181,19 +181,19 @@ Following any re-size operation, if a \*(We screen is corrupted, appears
incomplete or disordered, simply typing something innocuous like a
punctuation character or cursor motion key will usually restore it.
In extreme cases, the following sequence almost certainly will:
-.Bd -literal -compact
+.nf
\fIkey/cmd objective \fR
^Z \fBsuspend\fR \*(We
fg \fBresume\fR \*(We
<Left> force a screen \fBredraw\fR (if necessary)
-.Ed
+.fi
But if the display is still corrupted, there is one more step you could try.
Insert this command after \*(We has been suspended but before resuming it.
-.Bd -literal -compact
+.nf
\fIkey/cmd objective \fR
reset restore your \fBterminal settings\fR
-.Ed
+.fi
\*(NT the width of \*(We's display will be limited to \*(WX positions.
Displaying all fields requires \*(WF characters.
@@ -208,7 +208,7 @@ Lastly, some of \*(We's screens or functions require the use of cursor
motion keys like the standard \*(KAs plus the Home, End, PgUp and PgDn keys.
If your terminal or emulator does not provide those keys, the following
combinations are accepted as alternatives:
-.Bd -literal -compact
+.nf
\fI key equivalent-key-combinations \fR
Up alt +\fB \\\fR or alt +\fB k \fR
Down alt +\fB /\fR or alt +\fB j \fR
@@ -218,14 +218,14 @@ combinations are accepted as alternatives:
PgDn alt +\fB Down\fR or alt + ctrl +\fB j \fR
Home alt +\fB Left\fR or alt + ctrl +\fB h \fR
End alt +\fB Right\fR or alt + ctrl +\fB l \fR
-.Ed
+.fi
The \fBUp\fR and \fBDown\fR \*(KAs have special significance when prompted
for line input terminated with the <Enter> key.
Those keys, or their aliases, can be used to retrieve previous input lines
which can then be edited and re-input.
And there are four additional keys available with line oriented input.
-.Bd -literal -compact
+.nf
\fI key special-significance \fR
Up recall \fBolder\fR strings for re-editing
Down recall \fBnewer\fR strings or \fBerase\fR entire line
@@ -233,7 +233,7 @@ And there are four additional keys available with line oriented input.
Delete character \fBremoved\fR at cursor, moving others left
Home jump to \fBbeginning\fR of input line
End jump to \fBend\fR of input line
-.Ed
+.fi
.\" ......................................................................
.SS Startup Defaults
@@ -243,7 +243,7 @@ Even so, items shown with an \*(AK could be overridden through the
command-line.
All are explained in detail in the sections that follow.
-.Bd -literal
+.nf
\fIGlobal-defaults\fR
'A' - Alt display Off (full-screen)
* 'd' - Delay time 3.0 seconds
@@ -270,7 +270,7 @@ All are explained in detail in the sections that follow.
'x' - Column hilite Off (no, sort field)
'y' - Row hilite On\ \ (yes, running tasks)
'z' - color/mono Off (no, colors)
-.Ed
+.fi
.\" ----------------------------------------------------------------------
.SH 1. COMMAND-LINE Options
@@ -417,12 +417,12 @@ these provisions.
.SS 2a. UPTIME and LOAD Averages
.\" ----------------------------------------------------------------------
This portion consists of a single line containing:
-.Bd -literal -compact
+.nf
\fBprogram\fR or\fB window\fR name, depending on display mode
current time and length of time since last boot
total number of users
system load avg over the last 1, 5 and 15 minutes
-.Ed
+.fi
.\" ......................................................................
.SS 2b. TASK and CPU States
@@ -434,14 +434,14 @@ state percentages.
Line 1 shows total\fB tasks\fR or\fB threads\fR, depending on the state
of the Threads-mode toggle.
That total is further classified as:
-.Bd -literal -compact
+.nf
running; sleeping; stopped; zombie
-.Ed
+.fi
Line 2 shows \*(PU state percentages based on the interval since the
last refresh. Where two labels are shown below, those for more recent
kernel versions are shown first.
-.Bd -literal -compact
+.nf
\fBus\fR,\fB user\fR : time running un-niced user processes
\fBsy\fR,\fB system\fR : time running kernel processes
\fBni\fR,\fB nice\fR : time running niced user processes
@@ -449,7 +449,7 @@ kernel versions are shown first.
\fBhi\fR : time spent servicing hardware interrupts
\fBsi\fR : time spent servicing software interrupts
\fBst\fR : time stolen from this vm by the hypervisor
-.Ed
+.fi
.\" ......................................................................
.SS 2c. MEMORY Usage
@@ -459,24 +459,24 @@ through exbibytes (EiB) depending on the scaling factor enforced
with the 'E' \*(CI.
Line 1 reflects \*(MP, classified as:
-.Bd -literal -compact
+.nf
total, used, free and buffers
-.Ed
+.fi
Line 2 reflects mostly \*(MV, classified as:
-.Bd -literal -compact
+.nf
total, used, free and cached (which is \*(MP)
-.Ed
+.fi
This table may help in interpreting the scaled values displayed:
-.Bd -literal -compact
+.nf
KiB = kibibyte = 1024 bytes
MiB = mebibyte = 1024 KiB = 1,048,576 bytes
GiB = gibibyte = 1024 MiB = 1,073,741,824 bytes
TiB = tebibyte = 1024 GiB = 1,099,511,627,776 bytes
PiB = pebibyte = 1024 TiB = 1,125,899,906,842,624 bytes
EiB = exbibyte = 1024 PiB = 1,152,921,504,606,846,976 bytes
-.Ed
+.fi
.\" ----------------------------------------------------------------------
.SH 3. FIELDS / Columns
@@ -893,7 +893,7 @@ Listed below is a brief index of commands within categories.
Some commands appear more than once \*(Em their meaning or scope may vary
depending on the context in which they are issued.
-.Bd -literal
+.nf
4a.\fI Global-Commands \fR
<Ent/Sp> ?, =, 0,
A, B, d, E, e, g, h, H, I, k, q, r, s, W, X, Y, Z
@@ -912,7 +912,7 @@ depending on the context in which they are issued.
C, Up, Dn, Left, Right, PgUp, PgDn, Home, End
5d.\fI Searching-in-a-Window \fR
L, &
-.Ed
+.fi
.\" ......................................................................
.SS 4a. GLOBAL Commands
@@ -1053,10 +1053,10 @@ However, you can send any signal, via number or name.
If you wish to abort the kill process, do one of the following
depending on your progress:
-.Bd -literal
+.nf
1) at the pid prompt, type an invalid number
2) at the signal prompt, type 0 (or any invalid signal)
-.Ed
+.fi
.TP 7
\ \ \ \fBq\fR\ \ :\fIQuit \fR
@@ -1077,10 +1077,10 @@ and are prevented from lowering it.
If you wish to abort the renice process, do one of the following
depending on your progress:
-.Bd -literal
+.nf
1) at the pid prompt, type an invalid number
2) at the nice prompt, type <Enter> with no input
-.Ed
+.fi
.TP 7
\ \ \ \fBW\fR\ \ :\fIWrite-the-Configuration-File \fR
@@ -1097,14 +1097,14 @@ by a '+' in the last position.
This \*(CI can be used to alter the widths of the following fields:
-.Bd -literal
+.nf
\fI field default field default field default \fR
GID 5 GROUP 8 WCHAN 10
RUID 5 RUSER 8
SUID 5 SUSER 8
UID 5 USER 8
TTY 8
-.Ed
+.fi
You will be prompted for the amount to be added to the default
widths shown above.
@@ -1137,7 +1137,7 @@ particular file or command.
They are familiar to anyone who has used the pager 'less' and are
summarized here for future reference.
-.Bd -literal
+.nf
\fI key function \fR
'=' alternate status\-line, file or pipeline
'/' find, equivalent to 'L' locate
@@ -1146,7 +1146,7 @@ summarized here for future reference.
'b' scroll up, equivalent to <PgUp>
'g' first line, equivalent to <Home>
'G' last line, equivalent to <End>
-.Ed
+.fi
.TP 7
\ \ \ \fBZ\fR\ \ :\fIChange-Color-Mapping \fR
@@ -1391,14 +1391,14 @@ simply decrease the size of the \*(TD(s) above it.
For compatibility, this \*(We supports most of the former \*(We sort keys.
Since this is primarily a service to former \*(We users, these commands do
not appear on any help screen.
-.Bd -literal -compact
+.nf
\fI command sorted-field supported \fR
A start time (non-display) \fB No \fR
M %MEM Yes
N PID Yes
P %CPU Yes
T TIME+ Yes
-.Ed
+.fi
Before using any of the following sort provisions, \*(We suggests that you
temporarily turn on column highlighting using the 'x' \*(CI.
@@ -1452,7 +1452,7 @@ in all four windows before returning to the \*(We display.
.P
The following \*(CIs are available.
-.Bd -literal -compact
+.nf
\fB4\fR upper case letters to select a\fB target \fR
\fB8\fR numbers to select a\fB color \fR
normal toggles available \fR
@@ -1463,7 +1463,7 @@ The following \*(CIs are available.
'a'/'w' :apply, then go to next/prior
<Enter> :apply and exit
'q' :abandon current changes and exit
-.Ed
+.fi
If you use 'a' or 'w' to cycle the targeted window, you will
have applied the color scheme that was displayed when you left that window.
@@ -1577,11 +1577,11 @@ It does not require that the window name be visible
.IP "*" 3
The \*(CIs shown with an \*(AK have use beyond \*(AM.
-.Bd -literal -compact
+.nf
'=', 'A', 'g' are always available
'a', 'w' act the same with color mapping
\ and fields management
-.Ed
+.fi
.\" ......................................................................
.SS 5c. SCROLLING a Window
@@ -1641,10 +1641,10 @@ line is not otherwise being used.
That message will take one of two forms depending on whether or not a
variable width column has also been scrolled.
-.Bd -literal
+.nf
\fBscroll coordinates: y = n/n (tasks), x = n/n (fields)\fR
\fRscroll coordinates: y = n/n (tasks), x = n/n (fields)\fB + nn\fR
-.Ed
+.fi
The coordinates shown as \fBn\fR/\fBn\fR are relative to the upper left
corner of the \*(CW.
@@ -1806,12 +1806,12 @@ When prompted for selection criteria, the data you provide must take one
of two forms.
There are 3 required pieces of information, with a 4th as optional.
These examples use spaces for clarity but your input generally would not.
-.Bd -literal
+.nf
#1 \fB#2\fR #3 ( required )
Field\-Name ? include\-if\-value
\fB!\fR Field\-Name ? \fBexclude\fR\-if\-value
#4 ( optional )
-.Ed
+.fi
Items #1, #3 and #4 should be self\-explanatory.
Item \fB#2\fR represents both a required \fIdelimiter\fR and the \fIoperator\fR
@@ -1843,25 +1843,26 @@ See the 'j', 'J' and 'e' \*(CIs for additional information.
.P
These \fBGROUP\fR filters could produce the exact same results or the
second one might not display anything at all, just a blank \*(TW.
-.Bd -literal
+.nf
GROUP=root ( only the same results when )
GROUP=ROOT ( invoked via lower case 'o' )
-.Ed
+.fi
Either of these \fBRES\fR filters might yield inconsistent and/or
misleading results, depending on the current memory scaling factor.
Or both filters could produce the exact same results.
+.nf
RES>9999 ( only the same results when )
!RES<10000 ( memory scaling is at 'KiB' )
-.Ed
+.fi
This \fBnMin\fR filter illustrates a problem unique to scalable fields.
This particular field can display a maximum of 4 digits, beyond which values
are automatically scaled to KiB or above.
So while amounts greater than 9999 exist, they will appear as 2.6m, 197k, etc.
-.Bd -literal
+.nf
nMin>9999 ( always a blank \*(TW )
-.Ed
+.fi
.RE
.B Potential Solutions
@@ -1877,16 +1878,16 @@ Assuming field \fBnTH\fR is displayed, the first filter will result in
only multi-threaded processes being shown.
It also reminds us that a trailing space is part of every displayed field.
The second filter achieves the exact same results with less typing.
-.Bd -literal
+.nf
!nTH=' 1 ' ( ' for clarity only )
nTH>1 ( same with less i/p )
-.Ed
+.fi
With Forest View mode active and the \fBCOMMAND\fR column in view, this
filter effectively collapses child processes so that just 3 levels are shown.
-.Bd -literal
+.nf
!COMMAND=' `- ' ( ' for clarity only )
-.Ed
+.fi
The final two filters appear as in response to the status request key (^O).
In reality, each filter would have required separate input.
@@ -1894,10 +1895,10 @@ The \fBPR\fR example shows the two concurrent filters necessary to display
tasks with priorities of 20 or more, since some might be negative.
Then by exploiting trailing spaces, the \fBnMin\fR series of filters could
achieve the failed '9999' objective discussed above.
-.Bd -literal
+.nf
'PR>20' + '!PR=-' ( 2 for right result )
'!nMin=0 ' + '!nMin=1 ' + '!nMin=2 ' + '!nMin=3 ' ...
-.Ed
+.fi
.RE
\*(NT When 'Other Filtering' is active, \*(We turns column highlighting
@@ -1917,11 +1918,11 @@ is shown to an ordinary user.
More importantly, it will limit what ordinary users are allowed
to do when \*(We is running.
They will not be able to issue the following commands.
-.Bd -literal -compact
+.nf
k Kill a task
r Renice a task
d or s Change delay/sleep interval
-.Ed
+.fi
The system \*(CF is\fB not\fR created by \*(We.
Rather, you create this file manually and place it in the \fI/etc \fR
@@ -1930,10 +1931,10 @@ Its name must be 'toprc' and must have no leading '.' (period).
It must have only two lines.
Here is an example of the contents of\fI /etc/toprc\fR:
-.Bd -literal -compact
+.nf
s # line 1: 'secure' mode switch
5.0 # line 2: 'delay'\ \ interval in seconds
-.Ed
+.fi
.\" ......................................................................
.SS 6b. PERSONAL Configuration File
@@ -1942,7 +1943,7 @@ This file is written as '$HOME/.your\-name\-4\-\*(We' + 'rc'.
Use the 'W' \*(CI to create it or update it.
Here is the general layout:
-.Bd -literal -compact
+.nf
global # line 1: the program name/alias notation
" # line 2: id,altscr,irixps,delay,curwin
per ea # line a: winname,fieldscur
@@ -1952,7 +1953,7 @@ Here is the general layout:
" # any remaining lines are devoted to the
" # generalized 'inspect' provisions
" # discussed below
-.Ed
+.fi
If the $HOME variable is not present, \*(We will try to write the
personal \*(CF to the current directory, subject to permissions.
@@ -1980,11 +1981,11 @@ of content.
Otherwise they consist of the following 3 elements, each of which\fI must\fR
be separated by a tab character (thus 2 '\\t' total):
-.Bd -literal -compact
+.nf
.type: literal 'file' or 'pipe'
.name: selection shown on the Inspect screen
.fmts: string representing a path or command
-.Ed
+.fi
The two types of Inspect entries are\fI not\fR interchangeable.
Those designated '\fBfile\fR' will be accessed using fopen and
@@ -1996,31 +1997,31 @@ If the file or pipeline represented in your '.fmts' deals with the specific PID
input or accepted when prompted, then the format string must also contain
the '\fB%d\fR' specifier, as these examples illustrate.
-.Bd -literal -compact
+.nf
.fmts= /proc/\fI%d\fR/numa_maps
.fmts= lsof -P -p\fI %d\fR
-.Ed
+.fi
For '\fBpipe\fR' type entries only, you may also wish to redirect stderr to
stdout for a more comprehensive result.
Thus the format string becomes:
-.Bd -literal -compact
+.nf
.fmts= pmap -x %d\fI 2>&1\fR
-.Ed
+.fi
Here are examples of both types of Inspect entries as they might appear
in the rcfile.
The first entry will be ignored due to the initial '#' character.
For clarity, the pseudo tab depictions (^I) are surrounded by an
extra space but the actual tabs would not be.
-.Bd -literal -compact
+.nf
# pipe ^I Sockets ^I lsof -n -P -i 2>&1
pipe ^I Open Files ^I lsof -P -p %d 2>&1
file ^I NUMA Info ^I /proc/%d/numa_maps
pipe ^I Log ^I tail -n100 /var/log/syslog | sort -Mr
-.Ed
+.fi
Except for the commented entry above, these next examples show what could
be echoed to achieve similar results, assuming the rcfile name was '.toprc'.
@@ -2028,11 +2029,11 @@ However, due to the embedded tab characters, each of these lines should be
preceded by '\fB/bin/echo \-e\fR', not just a simple an 'echo', to
enable backslash interpretation regardless of which shell you use.
-.Bd -literal -compact
+.nf
"pipe\\tOpen Files\\tlsof -P -p %d 2>&1" >> ~/.toprc
"file\\tNUMA Info\\t/proc/%d/numa_maps" >> ~/.toprc
"pipe\\tLog\\ttail -n200 /var/log/syslog | sort -Mr" >> ~/.toprc
-.Ed
+.fi
\fBCaution\fR:
If any inspect entry you create produces output with unprintable characters
@@ -2041,12 +2042,12 @@ depending on their value.
This applies to tab characters as well, which will show as '^I'.
If you want a truer representation, any embedded tabs should be expanded.
-.Bd -literal -compact
+.nf
# next would have contained '\\t' ...
# file ^I <your_name> ^I /proc/%d/status
# but this will eliminate embedded '\\t' ...
pipe ^I <your_name> ^I cat /proc/%d/status | expand -
-.Ed
+.fi
The above example takes what could have been a 'file' entry but employs
a 'pipe' instead so as to expand the embedded tabs.
@@ -2063,11 +2064,11 @@ That does not affect operation other than to make some selections invisible.
However, if some choices are lost to truncation but you want to see more options,
there is an easy solution hinted at below.
-.Bd -literal -compact
+.nf
Inspection Pause at pid ...
Use: left/right then <Enter> ...
Options: help 1 2 3 4 5 6 7 8 9 10 11 ...
-.Ed
+.fi
The entries in the \*(We rcfile would have a number for the '.name' element and
the 'help' entry would identify a shell script you've written explaining what
@@ -2099,7 +2100,7 @@ seconds or less.
For this experiment, under x-windows open an xterm and maximize it.
Then do the following:
-.Bd -literal -compact
+.nf
. provide a scheduling boost and tiny delay via:
nice -n -10 \*(We -d.09
. keep sorted column highlighting \*F so as to
@@ -2108,7 +2109,7 @@ Then do the following:
. try various sort columns (TIME/MEM work well),
and normal or reverse sorts to bring the most
active processes into view
-.Ed
+.fi
What you'll see is a very busy Linux doing what he's always done for you,
but there was no program available to illustrate this.
--
1.7.9.2

View File

@ -1,42 +0,0 @@
From ce5e995921e770bfcda25e42fe090aeccdbf1291 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Tue, 25 Jun 2013 00:00:00 -0500
Subject: [PATCH] library: for atexit() support, fix fileutils for EPIPE
When fileutils with stream error checking was borrowed
from GNU lib, an omission was also propagated where an
errno of EPIPE wouldn't be preserved in close_stream()
making a test for EPIPE in close_stdout() meaningless.
This patch corrects such oversight so that an errno of
EPIPE no longer produces 'write error' at program end.
( gnulib provides for optionally ignoring EPIPE, but )
( if a program chooses to ignore it, then their code )
( appears to suffer from this close_stream oversight )
Reference(s):
. original fileutilis addition
commit c7cf98b0e03780f78abe5275c6fb282f71a2369f
. bugzilla report
https://bugzilla.redhat.com/show_bug.cgi?id=976199
---
lib/fileutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git lib/fileutils.c lib/fileutils.c
index a9ef2ff..1ade3d8 100644
--- lib/fileutils.c
+++ lib/fileutils.c
@@ -24,7 +24,7 @@ int close_stream(FILE * stream)
const int prev_fail = (ferror(stream) != 0);
const int fclose_fail = (fclose(stream) != 0);
if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) {
- if (!fclose_fail)
+ if (!fclose_fail && errno != EPIPE)
errno = 0;
return EOF;
}
--
1.7.9.2

View File

@ -1,150 +0,0 @@
From 5c974ff44da4fbbb9170dd15bdd81555c62c31a9 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 28 Jun 2013 00:00:00 -0500
Subject: [PATCH] top: enable screen contents preservation at end-of-job
The title of this commit is actually quite misleading.
Were it more accurate, it would at least mention a tty
emulator's scrollback buffer, which was the cumulation
of a long pursuit to reduce the SIGWINCH overhead when
a window manager carelessly floods an application with
that signal *while* a user is still resizing a window!
Disabling and enabling that scrollback buffer resulted
in the final top display replaced with original screen
contents, a phenomenon acknowledged at the time but it
also represented a user interface change which has now
produced the first request for return to old behavior.
After the SIGWINCH dust settled, another problem arose
regarding behaviors under the 'screen' window manager.
In response, top was refactored a bit to avoid display
corruption. That was before discovering 'screen' could
duplicate the scrollback buffer behavior top expected.
As it turns out, the 'screen' refactoring had probably
made scrollback buffer manipulation unnecessary. Still
one could argue that a window should not be allowed to
scroll while a constantly updating program was active.
The solution represented in this commit returns former
behavior at program end (retaining top's last screen).
And if we ever wish to disable scrollback buffers, the
associated logic was retained but made conditional. It
is not reflected in configure.ac but might be someday.
Lastly, this commit corrects cursor positioning when a
^C is issued under 'Fields Management' at any terminal
that didn't have a scrollback buffer (i.e. a console).
Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=977561
http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,1
. screen program refactor
commit 0fe393ff270922cd4f6edbcaabba006314e73a37
. scrollback buffer disabled
commit dedaf6e1a81738ff08ee8e8523871e12f555ad6d
. sigwinch management defines
commit adca737758e5afc7be344a736953931894cbc19f
commit 4f33b6b8c56464b4044deb29a3bb0e32622e108f
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 18 +++++++++++-------
top/top.h | 1 +
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git top/top.c top/top.c
index 0d7ee2d..07217c8 100644
--- top/top.c
+++ top/top.c
@@ -72,8 +72,9 @@ static struct termios Tty_original, // our inherited terminal definition
Tty_raw; // for unsolicited input
static int Ttychanged = 0;
- /* Last established cursor state/shape */
+ /* Last established cursor state/shape, and is re-position needed */
static const char *Cursor_state = "";
+static int Cursor_repos;
/* Program name used in error messages and local 'rc' file name */
static char *Myname;
@@ -350,12 +351,15 @@ static void at_eoj (void) {
if (Ttychanged) {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_original);
if (keypad_local) putp(keypad_local);
+ if (Cursor_repos) putp(tg2(0, Screen_rows));
putp("\n");
+#ifdef OFF_SCROLLBK
if (exit_ca_mode) {
// this next will also replace top's most recent screen with the
// original display contents that were visible at our invocation
putp(exit_ca_mode);
}
+#endif
putp(Cap_curs_norm);
putp(Cap_clr_eol);
#ifndef RMAN_IGNORED
@@ -591,17 +595,13 @@ static void sig_endpgm (int dont_care_sig) {
/*
* Catches:
- * SIGTSTP, SIGTTIN and SIGTTOU
- * note:
- * we don't fiddle with with those enter/exit_ca_mode strings
- * because we want to retain most of the last screen contents
- * as a visual reminder this program is suspended, not ended! */
+ * SIGTSTP, SIGTTIN and SIGTTOU */
static void sig_paused (int dont_care_sig) {
// POSIX.1-2004 async-signal-safe: tcsetattr, tcdrain, raise
if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_original))
error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno)));
if (keypad_local) putp(keypad_local);
- putp(tg2(0, Screen_rows));
+ if (Cursor_repos) putp(tg2(0, Screen_rows));
putp(Cap_curs_norm);
#ifndef RMAN_IGNORED
putp(Cap_smam);
@@ -2120,6 +2120,7 @@ static void fields_utility (void) {
int i, key;
FLG_t f;
+ Cursor_repos = 1;
spewFI
signify_that:
putp(Cap_clr_scr);
@@ -2180,6 +2181,7 @@ signify_that:
break;
}
} while (key != 'q' && key != kbd_ESC);
+ Cursor_repos = 0;
#undef unSCRL
#undef swapEM
#undef spewFI
@@ -3768,8 +3770,10 @@ static void whack_terminal (void) {
// thanks anyway stdio, but we'll manage buffering at the frame level...
setbuffer(stdout, Stdout_buf, sizeof(Stdout_buf));
#endif
+#ifdef OFF_SCROLLBK
// this has the effect of disabling any troublesome scrollback buffer...
if (enter_ca_mode) putp(enter_ca_mode);
+#endif
// and don't forget to ask iokey to initialize his tinfo_tab
iokey(0);
} // end: whack_terminal
diff --git top/top.h top/top.h
index f356798..a8a7357 100644
--- top/top.h
+++ top/top.h
@@ -41,6 +41,7 @@
//#define INSP_SAVEBUF /* preserve 'Insp_buf' contents in a file */
//#define INSP_SLIDE_1 /* when scrolling left/right don't move 8 */
//#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */
+//#define OFF_SCROLLBK /* disable tty emulators scrollback buffer */
//#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */
//#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */
//#define PRETEND8CPUS /* pretend we're smp with 8 ticsers (sic) */
--
1.7.9.2

View File

@ -1,232 +0,0 @@
From 25ed080eaa9cec603bc486b47b4a96d6438cf94f Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sun, 30 Jun 2013 00:00:00 -0500
Subject: [PATCH] top: refine some miscellaneous signals interrupt stuff
This commit mostly justs renames a few identifiers but
it also will now suppress any end-of-job report if top
wasn't ended via the 'q' key convention (i.e. signal).
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 48 +++++++++++++++++++++++++-----------------------
top/top.h | 4 ++--
2 files changed, 27 insertions(+), 25 deletions(-)
diff --git top/top.c top/top.c
index 07217c8..cb7f3b8 100644
--- top/top.c
+++ top/top.c
@@ -174,7 +174,7 @@ static WIN_t *Curwin;
and/or that are simply more efficiently handled as globals
[ 'Frames_...' (plural) stuff persists beyond 1 frame ]
[ or are used in response to async signals received ! ] */
-static volatile int Frames_resize; // time to rebuild all column headers
+static volatile int Frames_signal; // time to rebuild all column headers
static int Frames_libflags; // PROC_FILLxxx flags
static int Frame_maxtask; // last known number of active tasks
// ie. current 'size' of proc table
@@ -377,7 +377,7 @@ static void bye_bye (const char *str) {
at_eoj(); // restore tty in preparation for exit
#ifdef ATEOJ_RPTSTD
{ proc_t *p;
- if (!str && Ttychanged) { fprintf(stderr,
+ if (!str && !Frames_signal && Ttychanged) { fprintf(stderr,
"\n%s's Summary report:"
"\n\tProgram"
"\n\t Linux version = %u.%u.%u, %s"
@@ -447,7 +447,7 @@ static void bye_bye (const char *str) {
#ifndef OFF_HST_HASH
#ifdef ATEOJ_RPTHSH
- if (!str && Ttychanged) {
+ if (!str && !Frames_signal && Ttychanged) {
int i, j, pop, total_occupied, maxdepth, maxdepth_sav, numdepth
, cross_foot, sz = HHASH_SIZ * (unsigned)sizeof(int);
int depths[HHASH_SIZ];
@@ -588,6 +588,7 @@ static void sig_endpgm (int dont_care_sig) {
// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask
sigfillset(&ss);
sigprocmask(SIG_BLOCK, &ss, NULL);
+ Frames_signal = BREAK_sig;
bye_bye(NULL);
(void)dont_care_sig;
} // end: sig_endpgm
@@ -619,7 +620,7 @@ static void sig_paused (int dont_care_sig) {
#endif
if (keypad_xmit) putp(keypad_xmit);
putp(Cursor_state);
- Frames_resize = RESIZ_sig;
+ Frames_signal = BREAK_sig;
(void)dont_care_sig;
} // end: sig_paused
@@ -630,7 +631,7 @@ static void sig_paused (int dont_care_sig) {
static void sig_resize (int dont_care_sig) {
// POSIX.1-2004 async-signal-safe: tcdrain
tcdrain(STDOUT_FILENO);
- Frames_resize = RESIZ_sig;
+ Frames_signal = BREAK_sig;
(void)dont_care_sig;
} // end: sig_resize
@@ -928,12 +929,13 @@ static inline int ioa (struct timespec *ts) {
FD_ZERO(&fs);
FD_SET(STDIN_FILENO, &fs);
-#ifndef SIGNALS_LESS // conditional comments are silly, but help in documenting
- // hold here until we've got keyboard input, any signal (including SIGWINCH)
-#else
+#ifdef SIGNALS_LESS // conditional comments are silly, but help in documenting
// hold here until we've got keyboard input, any signal except SIGWINCH
-#endif
// or (optionally) we timeout with nanosecond granularity
+#else
+ // hold here until we've got keyboard input, any signal (including SIGWINCH)
+ // or (optionally) we timeout with nanosecond granularity
+#endif
rc = pselect(STDIN_FILENO + 1, &fs, NULL, NULL, ts, &Sigwinch_set);
if (rc < 0) rc = 0;
@@ -1263,7 +1265,7 @@ static float get_float (const char *prompt) {
float f;
line = ioline(prompt);
- if (!line[0] || Frames_resize) return -1.0;
+ if (!line[0] || Frames_signal) return -1.0;
// note: we're not allowing negative floats
if (strcspn(line, "+,.0123456789")) {
show_msg(N_txt(BAD_numfloat_txt));
@@ -1284,7 +1286,7 @@ static int get_int (const char *prompt) {
int n;
line = ioline(prompt);
- if (Frames_resize) return GET_INT_BAD;
+ if (Frames_signal) return GET_INT_BAD;
if (!line[0]) return GET_INTNONE;
// note: we've got to allow negative ints (renice)
if (strcspn(line, "-+0123456789")) {
@@ -1822,7 +1824,7 @@ static void adj_geometry (void) {
PSU_CLREOS(0);
fflush(stdout);
- Frames_resize = RESIZ_clr;
+ Frames_signal = BREAK_off;
} // end: adj_geometry
@@ -2134,7 +2136,7 @@ signify_that:
display_fields(i, (p != NULL));
fflush(stdout);
- if (Frames_resize) goto signify_that;
+ if (Frames_signal) goto signify_that;
key = iokey(1);
if (key < 1) goto signify_that;
@@ -3053,7 +3055,7 @@ signify_that:
lest repeated <Enter> keys produce immediate re-selection in caller */
tcflush(STDIN_FILENO, TCIFLUSH);
- if (Frames_resize) goto signify_that;
+ if (Frames_signal) goto signify_that;
key = iokey(1);
if (key < 1) goto signify_that;
@@ -3158,7 +3160,7 @@ signify_that:
, pid, p->cmd, p->euser, sels));
INSP_MKSL(0, " ");
- if (Frames_resize) goto signify_that;
+ if (Frames_signal) goto signify_that;
if (key == INT_MAX) key = iokey(1);
if (key < 1) goto signify_that;
@@ -3903,7 +3905,7 @@ signify_that:
putp(Cap_clr_eos);
fflush(stdout);
- if (Frames_resize) goto signify_that;
+ if (Frames_signal) goto signify_that;
key = iokey(1);
if (key < 1) goto signify_that;
@@ -4135,7 +4137,7 @@ signify_that:
putp(Cap_clr_eos);
fflush(stdout);
- if (Frames_resize) goto signify_that;
+ if (Frames_signal) goto signify_that;
key = iokey(1);
if (key < 1) goto signify_that;
@@ -4151,7 +4153,7 @@ signify_that:
, Winstk[2].rc.winname, Winstk[3].rc.winname));
putp(Cap_clr_eos);
fflush(stdout);
- if (Frames_resize || (key = iokey(1)) < 1) {
+ if (Frames_signal || (key = iokey(1)) < 1) {
adj_geometry();
putp(Cap_clr_scr);
} else w = win_select(key);
@@ -4341,7 +4343,7 @@ static void keys_global (int ch) {
if (0 > pid) pid = def;
str = ioline(fmtmk(N_fmt(GET_sigs_num_fmt), pid, SIGTERM));
if (*str) sig = signal_name_to_number(str);
- if (Frames_resize) break;
+ if (Frames_signal) break;
if (0 < sig && kill(pid, sig))
show_msg(fmtmk(N_fmt(FAIL_signals_fmt)
, pid, sig, strerror(errno)));
@@ -4909,12 +4911,12 @@ static void do_key (int ch) {
for (i = 0; i < MAXTBL(key_tab); ++i)
if (strchr(key_tab[i].keys, ch)) {
key_tab[i].func(ch);
- Frames_resize = RESIZ_kbd;
+ Frames_signal = BREAK_kbd;
putp((Cursor_state = Cap_curs_hide));
return;
}
};
- /* Frames_resize above will force a rebuild of all column headers and
+ /* Frames_signal above will force a rebuild of all column headers and
the PROC_FILLxxx flags. It's NOT simply lazy programming. Here are
some keys that COULD require new column headers and/or libproc flags:
'A' - likely
@@ -5458,7 +5460,7 @@ static void frame_make (void) {
int i, scrlins;
// deal with potential signal(s) since the last time around...
- if (Frames_resize)
+ if (Frames_signal)
zap_fieldstab();
// whoa either first time or thread/task mode change, (re)prime the pump...
@@ -5549,7 +5551,7 @@ int main (int dont_care_argc, char **argv) {
produce a screen refresh. in this main loop frame_make
assumes responsibility for such refreshes. other logic
in contact with users must deal more obliquely with an
- interrupt/refresh (hint: Frames_resize + return code)!
+ interrupt/refresh (hint: Frames_signal + return code)!
(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)
diff --git top/top.h top/top.h
index a8a7357..43d1ebc 100644
--- top/top.h
+++ top/top.h
@@ -208,9 +208,9 @@ enum scale_enum {
SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb, SK_SENTINEL
};
- /* Used to manipulate (and document) the Frames_resize states */
+ /* Used to manipulate (and document) the Frames_signal states */
enum resize_states {
- RESIZ_clr, RESIZ_kbd, RESIZ_sig
+ BREAK_off = 0, BREAK_kbd, BREAK_sig
};
/* This typedef just ensures consistent 'process flags' handling */
--
1.7.9.2

View File

@ -1,60 +0,0 @@
From 33104a2bcc321495107d72e4cfee4090b1d90f76 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Mon, 1 Jul 2013 00:00:00 -0500
Subject: [PATCH] top: cursor repositioning includes line oriented input
A recent patch introduced the ability to recognize the
need to reposition the cursor at suspension or program
end. There remained unmet 1 additional potential need.
This commit extends that ability to embrace line input
so that if a user issues ^Z or ^C while being prompted
the resulting shell output will no longer be embedded.
Reference(s):
http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,7
commit 5c974ff44da4fbbb9170dd15bdd81555c62c31a9
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git top/top.c top/top.c
index cb7f3b8..223ed70 100644
--- top/top.c
+++ top/top.c
@@ -1081,12 +1081,14 @@ static char *ioline (const char *prompt) {
static char buf[MEDBUFSIZ];
char *p;
+ Cursor_repos = 1;
show_pmt(prompt);
memset(buf, '\0', sizeof(buf));
ioch(1, buf, sizeof(buf)-1);
if ((p = strpbrk(buf, ws))) *p = '\0';
// note: we DO produce a vaid 'string'
+ Cursor_repos = 0;
return buf;
} // end: ioline
@@ -1117,6 +1119,7 @@ static char *ioline (const char *prompt) {
};
static struct lin_s *anchor, *plin;
+ Cursor_repos = 1;
if (!anchor) {
anchor = alloc_c(sizeof(struct lin_s));
anchor->str = alloc_s(""); // top-of-stack == empty str
@@ -1182,6 +1185,7 @@ static char *ioline (const char *prompt) {
putp(tg2(beg+pos, Msg_row));
} while (key && key != kbd_ENTER && key != kbd_ESC);
+ Cursor_repos = 0;
// weed out duplicates, including empty strings (top-of-stack)...
for (i = 0, plin = anchor; ; i++) {
#ifdef RECALL_FIXED
--
1.7.9.2

View File

@ -1,63 +0,0 @@
From 6967bf80a61fa42d8b02b08c358ea582a02f6856 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 4 Jul 2013 00:00:00 -0500
Subject: [PATCH] top: correct, improve or otherwise tweak some comments
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git top/top.c top/top.c
index 223ed70..978071c 100644
--- top/top.c
+++ top/top.c
@@ -2794,7 +2794,7 @@ static void insp_cnt_nl (void) {
Insp_p[0] = Insp_buf;
Insp_p[Insp_nl++] = cur;
Insp_p[Insp_nl] = end;
- if ((end - cur) == 1) // if there's a eof null delimiter,
+ if ((end - cur) == 1) // if there's an eof null delimiter,
--Insp_nl; // don't count it as a new line
} // end: insp_cnt_nl
@@ -3824,12 +3824,12 @@ static WIN_t *win_select (int ch) {
if (1 > (ch = iokey(1))) return w;
}
switch (ch) {
- case 'a': // we don't carry 'a' / 'w' in our
- w = w->next; // pmt - they're here for a good
- break; // friend of ours -- wins_colors.
- case 'w': // (however those letters work via
- w = w->prev; // the pmt too but gee, end-loser
- break; // should just press the darn key)
+ case 'a': // we don't carry 'a' / 'w' in our
+ w = w->next; // pmt - they're here for a good
+ break; // friend of ours -- wins_colors.
+ case 'w': // (however those letters work via
+ w = w->prev; // the pmt too but gee, end-loser
+ break; // should just press the darn key)
case '1': case '2' : case '3': case '4':
w = &Winstk[ch - '1'];
break;
@@ -5483,6 +5483,7 @@ static void frame_make (void) {
Max_lines = (Screen_rows - Msg_row) - 1;
OFFw(w, INFINDS_xxx);
+ // one way or another, rid us of any prior frame's msg
if (VIZISw(w) && CHKw(w, View_SCROLL)) show_scroll();
else PUTT("%s%s", tg2(0, Msg_row), Cap_clr_eol);
@@ -5501,8 +5502,7 @@ static void frame_make (void) {
}
}
- /* clear to end-of-screen (critical if last window is 'idleps off'),
- then put the cursor in-its-place, and rid us of any prior frame's msg
+ /* clear to end-of-screen - critical if last window is 'idleps off'
(main loop must iterate such that we're always called before sleep) */
if (scrlins < Max_lines) {
putp(Cap_nl_clreos);
--
1.7.9.2

View File

@ -1,66 +0,0 @@
From 30e90e426980c3122c668dd2a6b9236d4db6e048 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 5 Jul 2013 00:00:00 -0500
Subject: [PATCH] top: tweak cursor state code to swat an obscure buglet
An obscure bug has been discovered where a 'W' with an
old rcfile, warning against overwrite, would display a
cursor that should normally be hidden. This followed a
user's reply. So some logic was rearranged just a bit.
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git top/top.c top/top.c
index 978071c..8978cd1 100644
--- top/top.c
+++ top/top.c
@@ -3104,6 +3104,7 @@ signify_that:
case '/':
case 'n':
insp_find_str(key, &curcol, &curlin);
+ // must re-hide cursor in case a prompt for a string makes it huge
putp((Cursor_state = Cap_curs_hide));
break;
case '=':
@@ -4901,23 +4902,21 @@ static void do_key (int ch) {
};
int i;
- putp((Cursor_state = Cap_curs_hide));
switch (ch) {
case 0: // ignored (always)
case kbd_ESC: // ignored (sometimes)
- return;
+ goto all_done;
case 'q': // no return from this guy
bye_bye(NULL);
case 'W': // no need for rebuilds
write_rcfile();
- return;
+ goto all_done;
default: // and now, the real work...
for (i = 0; i < MAXTBL(key_tab); ++i)
if (strchr(key_tab[i].keys, ch)) {
key_tab[i].func(ch);
Frames_signal = BREAK_kbd;
- putp((Cursor_state = Cap_curs_hide));
- return;
+ goto all_done;
}
};
/* Frames_signal above will force a rebuild of all column headers and
@@ -4943,6 +4942,8 @@ static void do_key (int ch) {
*/
show_msg(N_txt(UNKNOWN_cmds_txt));
+all_done:
+ putp((Cursor_state = Cap_curs_hide));
} // end: do_key
--
1.7.9.2

View File

@ -1,130 +0,0 @@
From 46a1356219cfab67240704af9cd73b58a20d4232 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sat, 6 Jul 2013 00:00:00 -0500
Subject: [PATCH] top: correct cursor positioning for all ^Z or ^C cases
Some more (very obscure) conditions where a suspension
or program end might embed the shell prompt within top
output have been uncovered beyond the 2 already known.
We had already covered some suspend/end contingencies:
1. the users were using the 'fields management' screen
2. the users were prompted for any line oriented input
However, there remained some situations where ^Z or ^C
could still produce a misplaced cursor + shell prompt:
3. the 'g' command while waiting for the window choice
4. the 'W' command if about to overwrite an old rcfile
5. the '=' command when exploiting the Inspect feature
6. the period during which any error message was shown
But, even when all those bases are covered there still
remains a remote possibility that such interrupts will
occur during a top repaint cycle. So rather than throw
yet more code at these self-inflicted problems perhaps
it is better if we just throw in the proverbial towel.
Thus, I'll take the only sane approach and restore the
results expected ever since top's inception and before
scrollback buffers entered the picture. Namely, with a
^Z or ^C the cursor will be placed on the final screen
row. That usually means it will immediately follow the
last output line but it may follow many blank lines if
the user interrupts top when *not* on the main screen.
Reference(s):
. expanded repositioning (for line oriented input)
commit 33104a2bcc321495107d72e4cfee4090b1d90f76
. introduced repositioning (for fields management)
commit 5c974ff44da4fbbb9170dd15bdd81555c62c31a9
. scrollback buffers (the cursor handling changes)
commit dedaf6e1a81738ff08ee8e8523871e12f555ad6d
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git top/top.c top/top.c
index 8978cd1..e2451f5 100644
--- top/top.c
+++ top/top.c
@@ -72,9 +72,8 @@ static struct termios Tty_original, // our inherited terminal definition
Tty_raw; // for unsolicited input
static int Ttychanged = 0;
- /* Last established cursor state/shape, and is re-position needed */
+ /* Last established cursor state/shape */
static const char *Cursor_state = "";
-static int Cursor_repos;
/* Program name used in error messages and local 'rc' file name */
static char *Myname;
@@ -351,7 +350,7 @@ static void at_eoj (void) {
if (Ttychanged) {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_original);
if (keypad_local) putp(keypad_local);
- if (Cursor_repos) putp(tg2(0, Screen_rows));
+ putp(tg2(0, Screen_rows));
putp("\n");
#ifdef OFF_SCROLLBK
if (exit_ca_mode) {
@@ -602,7 +601,7 @@ static void sig_paused (int dont_care_sig) {
if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &Tty_original))
error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno)));
if (keypad_local) putp(keypad_local);
- if (Cursor_repos) putp(tg2(0, Screen_rows));
+ putp(tg2(0, Screen_rows));
putp(Cap_curs_norm);
#ifndef RMAN_IGNORED
putp(Cap_smam);
@@ -1081,14 +1080,12 @@ static char *ioline (const char *prompt) {
static char buf[MEDBUFSIZ];
char *p;
- Cursor_repos = 1;
show_pmt(prompt);
memset(buf, '\0', sizeof(buf));
ioch(1, buf, sizeof(buf)-1);
if ((p = strpbrk(buf, ws))) *p = '\0';
// note: we DO produce a vaid 'string'
- Cursor_repos = 0;
return buf;
} // end: ioline
@@ -1119,7 +1116,6 @@ static char *ioline (const char *prompt) {
};
static struct lin_s *anchor, *plin;
- Cursor_repos = 1;
if (!anchor) {
anchor = alloc_c(sizeof(struct lin_s));
anchor->str = alloc_s(""); // top-of-stack == empty str
@@ -1185,7 +1181,6 @@ static char *ioline (const char *prompt) {
putp(tg2(beg+pos, Msg_row));
} while (key && key != kbd_ENTER && key != kbd_ESC);
- Cursor_repos = 0;
// weed out duplicates, including empty strings (top-of-stack)...
for (i = 0, plin = anchor; ; i++) {
#ifdef RECALL_FIXED
@@ -2126,7 +2121,6 @@ static void fields_utility (void) {
int i, key;
FLG_t f;
- Cursor_repos = 1;
spewFI
signify_that:
putp(Cap_clr_scr);
@@ -2187,7 +2181,6 @@ signify_that:
break;
}
} while (key != 'q' && key != kbd_ESC);
- Cursor_repos = 0;
#undef unSCRL
#undef swapEM
#undef spewFI
--
1.7.9.2

View File

@ -1,33 +0,0 @@
From 7c4894dd222ff951e9b8a7efce00a9d9ab9ee586 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 7 Aug 2013 12:58:57 -0500
Subject: [PATCH] ps: address a potential 'newline' quirk the libselinux
Sometimes with libselinux present but SELinux inactive
the context reported is "unconfined" which contains an
embedded newline. This then causes misalignment of any
subsequent data. So, ps will now protect against that.
Reference(s):
http://www.freelists.org/post/procps/enablelibselinux-switch,14
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
ps/output.c | 1 +
1 file changed, 1 insertion(+)
diff --git ps/output.c ps/output.c
index b7b21d1..d457a89 100644
--- ps/output.c
+++ ps/output.c
@@ -1339,6 +1339,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const
len = strlen(context);
if(len > max_len) len = max_len;
memcpy(outbuf, context, len);
+ if (outbuf[len-1] == '\n') --len;
outbuf[len] = '\0';
free(context);
}else{
--
1.7.9.2

View File

@ -1,33 +0,0 @@
From 739effd90701d5d327624cd833d20c7f35981613 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 9 Aug 2013 00:00:00 -0500
Subject: [PATCH] top: hint that Summary Area 'cached' is Mem (not Swap)
This patch just provides a visual clue to separate the
values reported for cached Memory from other values on
the Swapped line (which is being shared due to space).
Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718670
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top_nls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git top/top_nls.c top/top_nls.c
index fa6969e..25c7f56 100644
--- top/top_nls.c
+++ top/top_nls.c
@@ -618,7 +618,7 @@ static void build_uniq_nlstab (void) {
. words: total, used, free, buffers, cached */
Uniq_nlstab[MEMORY_lines_fmt] = _(""
"%s Mem: ~3 %9.9s~2total,~3 %9.9s~2used,~3 %9.9s~2free,~3 %9.9s~2buffers~3\n"
- "%s Swap:~3 %9.9s~2total,~3 %9.9s~2used,~3 %9.9s~2free,~3 %9.9s~2cached~3\n");
+ "%s Swap:~3 %9.9s~2total,~3 %9.9s~2used,~3 %9.9s~2free.~3 %9.9s~2cached Mem~3\n");
Uniq_nlstab[INSP_hdrsels_fmt] = _(""
"Inspection~2 Pause at: pid ~1%d~6 running ~1%s~6 as user ~1%s~6\n"
--
1.7.9.2

View File

@ -1,97 +0,0 @@
From 80e678343653ccadaaf66bf719b3da9d6168d9ec Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 15 Aug 2013 00:00:00 -0500
Subject: [PATCH] top: modest efficiency change to message line handling
When the final solution for cursor positioning for all
^Z or ^C cases was introduced the revised placement of
message line management introduced with the window mgr
'screen' refactor was retained. Those two commits mean
that a former tgoto was no longer needed when clearing
that msg line or displaying the scroll coordinate msg.
This patch eliminates the tgoto employed by frame_make
while assimilating a now defunct show_scroll function.
Reference(s):
. final cursor positioning for ^Z or ^C
commit 46a1356219cfab67240704af9cd73b58a20d4232
. 'screen' window manager refactor
commit 0fe393ff270922cd4f6edbcaabba006314e73a37
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 22 ++++++++++------------
top/top.h | 1 -
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git top/top.c top/top.c
index e2451f5..c29bb07 100644
--- top/top.c
+++ top/top.c
@@ -751,13 +751,6 @@ static int show_pmt (const char *str) {
/*
- * Show a special coordinate message, in support of scrolling */
-static inline void show_scroll (void) {
- PUTT(Scroll_fmts, tg2(0, Msg_row), Frame_maxtask);
-} // end: show_scroll
-
-
- /*
* Show lines with specially formatted elements, but only output
* what will fit within the current screen width.
* Our special formatting consists of:
@@ -857,7 +850,7 @@ static void show_special (int interact, const char *glob) {
/*
* Create a nearly complete scroll coordinates message, but still
- * a format string since we'll be missing a tgoto and total tasks. */
+ * a format string since we'll be missing the current total tasks. */
static void updt_scroll_msg (void) {
char tmp1[SMLBUFSIZ], tmp2[SMLBUFSIZ];
int totpflgs = Curwin->totpflgs;
@@ -878,8 +871,10 @@ static void updt_scroll_msg (void) {
if (Curwin->varcolbeg)
snprintf(tmp2, sizeof(tmp2), "%s + %d", tmp1, Curwin->varcolbeg);
#endif
+ // this Scroll_fmts string no longer provides for termcap tgoto so that
+ // the usage timing is critical -- see frame_make() for additional info
snprintf(Scroll_fmts, sizeof(Scroll_fmts)
- , "%%s%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol);
+ , "%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol);
} // end: updt_scroll_msg
/*###### Low Level Memory/Keyboard/File I/O support ####################*/
@@ -5477,9 +5472,12 @@ static void frame_make (void) {
Max_lines = (Screen_rows - Msg_row) - 1;
OFFw(w, INFINDS_xxx);
- // one way or another, rid us of any prior frame's msg
- if (VIZISw(w) && CHKw(w, View_SCROLL)) show_scroll();
- else PUTT("%s%s", tg2(0, Msg_row), Cap_clr_eol);
+ /* one way or another, rid us of any prior frame's msg
+ [ now that this is positioned after the call to summary_show(), ]
+ [ we no longer need or employ tg2(0, Msg_row) since all summary ]
+ [ lines end with a newline, and header lines begin with newline ] */
+ if (VIZISw(w) && CHKw(w, View_SCROLL)) PUTT(Scroll_fmts, Frame_maxtask);
+ else putp(Cap_clr_eol);
if (!Rc.mode_altscr) {
// only 1 window to show so, piece o' cake
diff --git top/top.h top/top.h
index 43d1ebc..017644f 100644
--- top/top.h
+++ top/top.h
@@ -658,7 +658,6 @@ typedef struct WIN_t {
//atic void capsmk (WIN_t *q);
//atic void show_msg (const char *str);
//atic int show_pmt (const char *str);
-//atic inline void show_scroll (void);
//atic void show_special (int interact, const char *glob);
//atic void updt_scroll_msg (void);
/*------ Low Level Memory/Keyboard/File I/O support --------------------*/
--
1.7.9.2

View File

@ -1,104 +0,0 @@
From 819ede1a6bc25d732cf84d15c48be9ca86f336a2 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Tue, 20 Aug 2013 00:00:00 -0500
Subject: [PATCH] top: correct, improve and otherwise tweak configs_read
This patch addresses the four '-Wunused-result' errors
generated whenever an optimized compile is invoked. It
also made the configs_read() guy a little more robust.
In the process, some logic was rearranged slightly and
some comments were re-indented simply for consistency.
Reference(s):
warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git top/top.c top/top.c
index c29bb07..bdfcf20 100644
--- top/top.c
+++ top/top.c
@@ -3394,26 +3394,25 @@ static void configs_read (void) {
fp = fopen(SYS_RCFILESPEC, "r");
if (fp) {
- fbuf[0] = '\0';
- fgets(fbuf, sizeof(fbuf), fp); // sys rc file, line 1
- if (strchr(fbuf, 's')) Secure_mode = 1;
- fbuf[0] = '\0';
- fgets(fbuf, sizeof(fbuf), fp); // sys rc file, line 2
- sscanf(fbuf, "%f", &Rc.delay_time);
+ if (fgets(fbuf, sizeof(fbuf), fp)) { // sys rc file, line 1
+ Secure_mode = 1;
+ if (fgets(fbuf, sizeof(fbuf), fp)) // sys rc file, line 2
+ sscanf(fbuf, "%f", &Rc.delay_time);
+ }
fclose(fp);
}
fp = fopen(Rc_name, "r");
if (fp) {
int tmp_whole, tmp_fract;
- fbuf[0] = '\0';
- fgets(fbuf, sizeof(fbuf), fp); // ignore eyecatcher
+ if (fgets(fbuf, sizeof(fbuf), fp)) // ignore eyecatcher
+ ; // avoid -Wunused-result
if (6 != fscanf(fp
, "Id:%c, Mode_altscr=%d, Mode_irixps=%d, Delay_time=%d.%d, Curwin=%d\n"
, &Rc.id, &Rc.mode_altscr, &Rc.mode_irixps, &tmp_whole, &tmp_fract, &i)) {
p = fmtmk(N_fmt(RC_bad_files_fmt), Rc_name);
Rc_questions = -1;
- goto try_inspect_entries; // maybe a faulty 'inspect' echo
+ goto try_inspect_entries; // maybe a faulty 'inspect' echo
}
// you saw that, right? (fscanf stickin' it to 'i')
Curwin = &Winstk[i];
@@ -3442,20 +3441,20 @@ static void configs_read (void) {
goto default_or_error;
switch (Rc.id) {
- case 'f': // 3.3.0 thru 3.3.3 (procps-ng)
- SETw(w, Show_JRNUMS); // fall through !
- case 'g': // current RCF_VERSION_ID
- default: // and future versions?
+ case 'a': // 3.2.8 (former procps)
+ if (config_cvt(w))
+ goto default_or_error;
+ break;
+ case 'f': // 3.3.0 thru 3.3.3 (procps-ng)
+ SETw(w, Show_JRNUMS); // fall through !
+ case 'g': // current RCF_VERSION_ID
+ default: // and future versions?
if (strlen(w->rc.fieldscur) != sizeof(DEF_FIELDS) - 1)
goto default_or_error;
for (x = 0; x < P_MAXPFLGS; ++x)
if (P_MAXPFLGS <= FLDget(w, x))
goto default_or_error;
break;
- case 'a': // 3.2.8 (former procps)
- if (config_cvt(w))
- goto default_or_error;
- break;
}
#ifndef USE_X_COLHDR
OFFw(w, NOHIFND_xxx | NOHISEL_xxx);
@@ -3463,8 +3462,9 @@ static void configs_read (void) {
} // end: for (GROUPSMAX)
// any new addition(s) last, for older rcfiles compatibility...
- fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"
- , &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress);
+ if (fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"
+ , &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress))
+ ; // avoid -Wunused-result
try_inspect_entries:
// we'll start off Inspect stuff with 1 'potential' blank line
--
1.7.9.2

View File

@ -1,39 +0,0 @@
From 06c19f5ba4e8fcb704936609e8ef7d328ca54a28 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 29 Aug 2013 00:00:00 -0500
Subject: [PATCH] top: swat bug affecting batch mode and width provision
Normally, the internally tracked 'Screen_cols' can not
exceed the lessor of 512 or actual screen width. There
was one case, however, where that 512 byte upper limit
was no longer properly imposed as it should have been.
When operating in 'Batch' mode the actual screen width
was allowed to be exceeded when the optional -w switch
was also used. But, it should never have exceeded 512.
This patch ensures the upper limit is always observed.
Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721204
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 1 +
1 file changed, 1 insertion(+)
diff --git top/top.c top/top.c
index bdfcf20..9996fbf 100644
--- top/top.c
+++ top/top.c
@@ -1792,6 +1792,7 @@ static void adj_geometry (void) {
if (w_cols && w_cols < W_MIN_COL) w_cols = W_MIN_COL;
if (w_rows && w_rows < W_MIN_ROW) w_rows = W_MIN_ROW;
}
+ if (w_cols > SCREENMAX) w_cols = SCREENMAX;
w_set = 1;
}
--
1.7.9.2

View File

@ -1,32 +0,0 @@
From 4141efaf13254564f0377289bcf5a1a1389f60af Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Tue, 17 Sep 2013 00:00:00 -0500
Subject: [PATCH] top: restore the lost final newline when in Batch mode
This patch adds the final newline when exiting 'Batch'
mode. Interestingly, it has been missing since release
3.3.5 but undetected until the Redhat bugzilla report.
Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=1008674
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 1 +
1 file changed, 1 insertion(+)
diff --git top/top.c top/top.c
index 6f4f728..44bc380 100644
--- top/top.c
+++ top/top.c
@@ -527,6 +527,7 @@ static void bye_bye (const char *str) {
fputs(str, stderr);
exit(EXIT_FAILURE);
}
+ if (Batch) putp("\n");
exit(EXIT_SUCCESS);
} // end: bye_bye
--
1.7.9.2

View File

@ -1,62 +0,0 @@
From e6a78f2745ca6c7ceed4406d3ce5397e77518b11 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 27 Sep 2013 12:12:12 -0500
Subject: [PATCH] top: swat bug impacting 'idle' mode & 'user' filtering
When Other filtering was introduced the nature of what
constituted a displayed row changed. No longer would a
task_show() call guarantee that another line is shown.
Rather, a non-empty string must have also been tested.
Unfortunately, when any task window was being filtered
for 'idle' mode or a particular 'user', the proc index
was incremented twice due to the perils of copy/paste.
Combining such an index increment with the new test of
task_show results works fine if filtering is inactive.
This was a particularly insidious bug which meant that
an adjacent task would be skipped whenever the current
task met 'idle' and/or 'user' filter criteria, and was
not otherwise excluded due to 'Other' filter criteria.
And, since it was the very next task that was ignored,
the bug was very susceptible to a window's sort order.
This could be illustrated when filtering on some user,
while sorting on PID. Then, toggling Forest View could
make otherwise unseen tasks appear and then disappear.
User workarounds are possible via interactive commands
trading the 'i' and 'u'/'U' provisions for the 'o'/'O'
other filtering capability thus avoiding an extra i++.
But that is certainly less than ideal and doesn't help
the 3.3.7 and 3.3.8 distorted command line provisions.
( this little buggie may end up costing me my pocket )
( protector, my coding badge & maybe even my cubicle )
Reference(s):
http://www.freelists.org/post/procps/Idle-elides-nonidle-processes
. bug originated with 'Other' filtering
commit 5edc6fb3174f1fd02bbfca61ec6d8a3a2e12f71c
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git top/top.c top/top.c
index 44bc380..aa2777b 100644
--- top/top.c
+++ top/top.c
@@ -5399,7 +5399,7 @@ static int window_show (WIN_t *q, int wmax) {
while (i < Frame_maxtask && lwin < wmax) {
if ((CHKw(q, Show_IDLEPS) || isBUSY(q->ppt[i]))
&& user_matched(q, q->ppt[i])
- && *task_show(q, q->ppt[i++]))
+ && *task_show(q, q->ppt[i]))
++lwin;
++i;
}
--
1.7.9.2

View File

@ -1,83 +0,0 @@
From 35dc6dcc49cc9cf8cff4300cb03a38dbe44c05db Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sun, 3 Nov 2013 00:00:00 -0500
Subject: [PATCH] top: address some potential libnuma display corruption
There is a chance that the libnuma library may corrupt
top's display with some stderr warning messages in the
event something under /sys/devices/system/node/ cannot
be accessed. And, while 2 overridable 'weak' functions
are provided to alter such behavior, we can't use them
since top dynamically links to the library via dlopen.
This commit will redirect stderr to '/dev/null' during
just the first screen display cycle. Thus we can avoid
the corruption which would have remained visible until
the underlining screen row's data had finally changed.
Lastly, this patch should allow such a library warning
to actually appear when one finally exits our program.
[ i think the libnuma folks should consider changing ]
[ the error/warning interfaces to accommodate dlopen ]
[ rather than forcing something like the ugly kludge ]
[ we have employed or libnuma dependency on everyone ]
Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=998678
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git top/top.c top/top.c
index aa2777b..a48a5b9 100644
--- top/top.c
+++ top/top.c
@@ -220,6 +220,7 @@ static int Numa_node_tot;
static int Numa_node_sel = -1;
#ifndef NUMA_DISABLE
static void *Libnuma_handle;
+static int stderr_save = -1;
#if defined(PRETEND_NUMA) || defined(PRETEND8CPUS)
static int Numa_max_node(void) { return 3; }
static int Numa_node_of_cpu(int num) { return (num % 4); }
@@ -4043,6 +4044,17 @@ static void wins_stage_2 (void) {
// fill in missing Fieldstab members and build each window's columnhdr
zap_fieldstab();
+#ifndef NUMA_DISABLE
+ /* there's a chance that damn libnuma may spew to stderr so we gotta
+ make sure he does not corrupt poor ol' top's first output screen!
+ Yes, he provides some overridable 'weak' functions to change such
+ behavior but we can't exploit that since we don't follow a normal
+ ld route to symbol resolution (we use that dlopen() guy instead)! */
+ stderr_save = dup(fileno(stderr));
+ if (-1 < stderr_save && freopen("/dev/null", "w", stderr))
+ ; // avoid -Wunused-result
+#endif
+
// lastly, initialize a signal set used to throttle one troublesome signal
sigemptyset(&Sigwinch_set);
#ifdef SIGNALS_LESS
@@ -5508,6 +5520,16 @@ static void frame_make (void) {
the normal non-interactive output optimization... */
if (!Cap_can_goto) PSU_CLREOS(0);
+#ifndef NUMA_DISABLE
+ /* we gotta reverse the stderr redirect which was employed in wins_stage_2
+ and needed because the two libnuma 'weak' functions were useless to us! */
+ if (-1 < stderr_save) {
+ dup2(stderr_save, fileno(stderr));
+ close(stderr_save);
+ stderr_save = -1;
+ }
+#endif
+
/* lastly, check auto-sized width needs for the next iteration */
if (AUTOX_MODE && Autox_found)
widths_resize();
--
1.7.9.2

View File

@ -1,76 +0,0 @@
From 5a8adee659524ef72583d8ea494721d279b5bea1 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Tue, 5 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: fix miscellaneous spelling errors in man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
procps-ng-3.3.8/top/top.1 | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--- top/top.1
+++ top/top.1 2014-05-15 10:27:04.482756345 +0000
@@ -383,8 +383,8 @@ Display only processes with a user id or
The '\-u' option matches on \fI effective\fR user whereas the '\-U' option
matches on\fI any\fR user (real, effective, saved, or filesystem).
-Prepending an exclamation point ('!') to the user id or name instucts top to
-display only processes with users not matching the one provided.
+Prepending an exclamation point ('!') to the user id or name instructs top
+to display only processes with users not matching the one provided.
The 'p', 'u' and 'U' \*(COs are mutually exclusive.
@@ -650,8 +650,8 @@ If you see 'rt' in this field, it means
'real time' scheduling priority.
Under linux, real time priority is somewhat misleading since traditionally
-the operating itself was not preemptable.
-And while the 2.6 kernel can be made mostly preemptable, it is not always so.
+the operating itself was not preemptible.
+And while the 2.6 kernel can be made mostly preemptible, it is not always so.
.TP 4
17.\fB RES \*(Em Resident Memory Size (KiB) \fR
@@ -1337,10 +1337,10 @@ matches on\fB any\fR user (real, effecti
Thereafter, in that \*(TW only matching users will be shown, or possibly
no processes will be shown.
-Prepending an exclamation point ('!') to the user id or name instucts top
+Prepending an exclamation point ('!') to the user id or name instructs top
to display only processes with users not matching the one provided.
-Different \*(TWs can can be used to filter different users.
+Different \*(TWs can be used to filter different users.
Later, if you wish to monitor all users again in the \*(CW, re-issue this
command but just press <Enter> at the prompt.
@@ -1349,7 +1349,7 @@ command but just press <Enter> at the pr
In this mode, processes are reordered according to their parents and
the layout of the COMMAND column resembles that of a tree.
In forest view mode it is still possible to toggle between program
-name and commamd line (\*(Xc 'c' \*(CI) or between processes and
+name and command line (\*(Xc 'c' \*(CI) or between processes and
threads (\*(Xc 'H' \*(CI).
\*(NT Typing any key affecting the sort order will exit forest view
@@ -1673,8 +1673,8 @@ The above \*(CIs are\fB always\fR availa
available in \*(AM if the \*(CW's \*(TD has been toggled \*F.
\*(NT When any form of filtering is active, you can expect some slight
-abberations when scrolling since not all tasks will be visible.
-This is paticularly apparent when using the Up/Down \*(KAs.
+aberrations when scrolling since not all tasks will be visible.
+This is particularly apparent when using the Up/Down \*(KAs.
.\" ......................................................................
.SS 5d. SEARCHING in a Window
@@ -2037,7 +2037,7 @@ enable backslash interpretation regardle
\fBCaution\fR:
If any inspect entry you create produces output with unprintable characters
-they will be displayed in either the ^C notation or hexidecimal <FF> form,
+they will be displayed in either the ^C notation or hexadecimal <FF> form,
depending on their value.
This applies to tab characters as well, which will show as '^I'.
If you want a truer representation, any embedded tabs should be expanded.

View File

@ -0,0 +1,31 @@
From 14ef47af57f48d1e51ab91e80fd8f132fabb665a Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Tue, 3 Dec 2013 15:00:00 -0600
Subject: [PATCH] top: do not forget the fscanf %s terminating null byte
Reference(s):
http://www.freelists.org/post/procps/procpsng-339-defects-found
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git top/top.c top/top.c
index 4d1d912..bb15d01 100644
--- top/top.c
+++ top/top.c
@@ -3445,8 +3445,8 @@ static void configs_read (void) {
WIN_t *w = &Winstk[i];
p = fmtmk(N_fmt(RC_bad_entry_fmt), i+1, Rc_name);
- // note: "fieldscur=%__s" on next line should equal PFLAGSSIZ !
- if (2 != fscanf(fp, "%3s\tfieldscur=%80s\n"
+ // note: "fieldscur=%__s" on next line should equal (PFLAGSSIZ -1) !
+ if (2 != fscanf(fp, "%3s\tfieldscur=%79s\n"
, w->rc.winname, w->rc.fieldscur))
goto default_or_error;
#if PFLAGSSIZ > 80
--
1.7.9.2

View File

@ -1,39 +0,0 @@
From 9c776bbcde2260f454b51b86d46aafcc2f7dc71c Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 6 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: expand on column highlight quirks in man document
Confession is supposed to be good for the sole, right?
After a senior moment regarding the 'x' toggle quirks,
and thinking top had somehow regressed, I concluded an
additional explanatory note might well be appropriate.
Those quirks were already documented under the 5d & 5e
topics. But there was no such caution documented under
the 'x' command explanation itself, found in topic 4c.
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.1 | 5 +++++
1 file changed, 5 insertions(+)
diff --git top/top.1 top/top.1
index 64a6a36..87659be 100644
--- top/top.1
+++ top/top.1
@@ -1270,6 +1270,11 @@ The sort field might\fI not\fR be visible because:
1) there is insufficient\fI Screen Width \fR
2) the 'f' \*(CI turned it \*F
+\*(NT Whenever 'Searching' and/or 'Other Filtering' is active in a window,
+column highlighting is temporarily disabled.
+\*(XC notes at the end of topics 5d. SEARCHING and 5e. FILTERING for an
+explanation why.
+
.TP 7
\ \ \ \fBy\fR\ \ :\fIRow-Highlight\fR toggle \fR
Changes highlighting for "running" tasks.
--
1.7.9.2

View File

@ -0,0 +1,41 @@
From 7f6efed9bb85d1e212e06985ea3e06720f6ca949 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Fri, 27 Dec 2013 23:08:14 +1100
Subject: [PATCH] sysctl --system loads default config file
Commit cdca71e94506fbb921ab2c626be3ad05c4287498 fixed
the loading the sysctl.conf file, but had the logic
for checking the file exists reversed incorrectly.
---
NEWS | 4 ++++
sysctl.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git NEWS NEWS
index 287f867..1c710a3 100644
--- NEWS
+++ NEWS
@@ -1,3 +1,7 @@
+procps-ng-3.3.10
+----------------
+ * sysctl --system loads default config file - Debian #732920
+
procps-ng-3.3.9
---------------
* kernel namespaces support added to skill, pgrep, ps and top
diff --git sysctl.c sysctl.c
index bb3e6b7..33c9403 100644
--- sysctl.c
+++ sysctl.c
@@ -640,7 +640,7 @@ static int PreloadSystem(void)
}
- if (stat(DEFAULT_PRELOAD, &ts) < 0 && S_ISREG(ts.st_mode)) {
+ if (stat(DEFAULT_PRELOAD, &ts) < 0 || S_ISREG(ts.st_mode)) {
if (!Quiet)
printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD);
rc |= Preload(DEFAULT_PRELOAD);
--
1.7.9.2

View File

@ -1,60 +0,0 @@
From bdb2fe005616bb40f2da53da02b01f91cabf9a87 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 7 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: add some flexibility to dlopen() for numa support
A recent libnuma potential corruption problem solution
suggests that libnuma could change in the future so as
to not spew to stderr. This then raises a question how
top could exploit any such library change since we are
currently locked into version #1 of the library by way
of our dlopen("libnuma.so.1", RTLD_LAZY) runtime call.
While not an ultimate solution, this commit will first
try for the most recent version of that library during
top's startup before trying the original libnuma.so.1.
We do this via the unqualified library soname symlink.
For this new dlopen() call to succeed, technically the
numa 'devel' package would usually have been required,
but that's not always true with every distro. And when
the libnuma.so symlink isn't present, it can always be
manually added should a newer & better behaved library
arrive & users tire of the stderr warning at top exit.
Reference(s):
commit 24bd950cb2e1722d459461f0f9c0c30a4b9ffdaa
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git top/top.c top/top.c
index a48a5b9..e619ddd 100644
--- top/top.c
+++ top/top.c
@@ -3246,8 +3246,9 @@ static void before (char *me) {
#if defined(PRETEND_NUMA) || defined(PRETEND8CPUS)
Numa_node_tot = Numa_max_node() + 1;
#else
- Libnuma_handle = dlopen("libnuma.so.1", RTLD_LAZY);
- if (Libnuma_handle) {
+ // we'll try for the most recent version, then a version we know works...
+ if ((Libnuma_handle = dlopen("libnuma.so", RTLD_LAZY))
+ || (Libnuma_handle = dlopen("libnuma.so.1", RTLD_LAZY))) {
Numa_max_node = dlsym(Libnuma_handle, "numa_max_node");
Numa_node_of_cpu = dlsym(Libnuma_handle, "numa_node_of_cpu");
if (Numa_max_node && Numa_node_of_cpu)
@@ -3265,7 +3266,7 @@ static void before (char *me) {
#endif
// lastly, establish a robust signals environment
sigemptyset(&sa.sa_mask);
- // with user position perserved through SIGWINCH, we must avoid SA_RESTART
+ // with user position preserved through SIGWINCH, we must avoid SA_RESTART
sa.sa_flags = 0;
for (i = SIGRTMAX; i; i--) {
switch (i) {
--
1.7.9.2

View File

@ -0,0 +1,371 @@
From 8a38cd5eb449c47450e31aa093635e8cfaaf2f73 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Sat, 28 Dec 2013 09:25:39 +1100
Subject: [PATCH] Split help lines to help translators
To assist translators, the help lines are split so that each translation
chunk has one option. This gives bonus of if we add or change an option,
only that option remains untranslated rather than the entire help block.
Reference:
http://www.freelists.org/post/procps/procpsng-for-Translation-Project,1
Signed-off-by: Craig Small <csmall@enc.com.au>
---
pidof.c | 8 ++--
pmap.c | 26 ++++++------
ps/help.c | 131 +++++++++++++++++++++++++++++--------------------------------
skill.c | 42 ++++++++++----------
slabtop.c | 28 ++++++-------
watch.c | 20 +++++-----
6 files changed, 125 insertions(+), 130 deletions(-)
diff --git pidof.c pidof.c
index 2e0911d..6a38675 100644
--- pidof.c
+++ pidof.c
@@ -60,10 +60,10 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
fputs(USAGE_HEADER, fp);
fprintf(fp, _(" %s [options] [program [...]]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, fp);
- fputs(_(" -s, --single-shot return one PID only\n"
- " -c, --check-root omit processes with different root\n"
- " -x scripts too\n"
- " -o, --omit-pid <PID,...> omit processes with PID\n"), fp);
+ fputs(_(" -s, --single-shot return one PID only\n"), fp);
+ fputs(_(" -c, --check-root omit processes with different root\n"), fp);
+ fputs(_(" -x scripts too\n"), fp);
+ fputs(_(" -o, --omit-pid <PID,...> omit processes with PID\n"), fp);
fputs(USAGE_SEPARATOR, fp);
fputs(USAGE_HELP, fp);
fputs(USAGE_VERSION, fp);
diff --git pmap.c pmap.c
index 8f111a0..4ecabce 100644
--- pmap.c
+++ pmap.c
@@ -108,19 +108,19 @@ usage(FILE * out)
fprintf(out,
_(" %s [options] pid [pid ...]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
- fputs(_(" -x, --extended show details\n"
- " -X show even more details\n"
- " WARNING: format changes according to /proc/PID/smaps\n"
- " -XX show everything the kernel provides\n"
- " -c, --read-rc read the default rc\n"
- " -C, --read-rc-from=<file> read the rc from file\n"
- " -n, --create-rc create new default rc\n"
- " -N, --create-rc-to=<file> create new rc to file\n"
- " NOTE: pid arguments are not allowed with -n, -N\n"
- " -d, --device show the device format\n"
- " -q, --quiet do not display header and footer\n"
- " -p, --show-path show path in the mapping\n"
- " -A, --range=<low>[,<high>] limit results to the given range\n"), out);
+ fputs(_(" -x, --extended show details\n"), out);
+ fputs(_(" -X show even more details\n"), out);
+ fputs(_(" WARNING: format changes according to /proc/PID/smaps\n"), out);
+ fputs(_(" -XX show everything the kernel provides\n"), out);
+ fputs(_(" -c, --read-rc read the default rc\n"), out);
+ fputs(_(" -C, --read-rc-from=<file> read the rc from file\n"), out);
+ fputs(_(" -n, --create-rc create new default rc\n"), out);
+ fputs(_(" -N, --create-rc-to=<file> create new rc to file\n"), out);
+ fputs(_(" NOTE: pid arguments are not allowed with -n, -N\n"), out);
+ fputs(_(" -d, --device show the device format\n"), out);
+ fputs(_(" -q, --quiet do not display header and footer\n"), out);
+ fputs(_(" -p, --show-path show path in the mapping\n"), out);
+ fputs(_(" -A, --range=<low>[,<high>] limit results to the given range\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
diff --git ps/help.c ps/help.c
index b536f1a..9133903 100644
--- ps/help.c
+++ ps/help.c
@@ -96,85 +96,80 @@ void do_help (const char *opt, int rc) {
" %s [options]\n"), myname);
if (section == HELP_SMP || section == HELP_ALL) {
- fprintf(out, _("\n"
- "Basic options:\n"
- " -A, -e all processes\n"
- " -a all with tty, except session leaders\n"
- " a all with tty, including other users\n"
- " -d all except session leaders\n"
- " -N, --deselect negate selection\n"
- " r only running processes\n"
- " T all processes on this terminal\n"
- " x processes without controlling ttys\n"));
+ fputs(_("\nBasic options:\n"), out);
+ fputs(_(" -A, -e all processes\n"), out);
+ fputs(_(" -a all with tty, except session leaders\n"), out);
+ fputs(_(" a all with tty, including other users\n"), out);
+ fputs(_(" -d all except session leaders\n"), out);
+ fputs(_(" -N, --deselect negate selection\n"), out);
+ fputs(_(" r only running processes\n"), out);
+ fputs(_(" T all processes on this terminal\n"), out);
+ fputs(_(" x processes without controlling ttys\n"), out);
}
if (section == HELP_LST || section == HELP_ALL) {
- fprintf(out, _("\n"
- "Selection by list:\n"
- " -C <command> command name\n"
- " -G, --Group <gid> real group id or name\n"
- " -g, --group <group> session or effective group name\n"
- " -p, --pid <pid> process id\n"
- " --ppid <pid> select by parent process id\n"
- " -s, --sid <session> session id\n"
- " -t, t, --tty <tty> terminal\n"
- " -u, U, --user <uid> effective user id or name\n"
- " -U, --User <uid> real user id or name\n"
- "\n"
+ fputs(_("\nSelection by list:\n"), out);
+ fputs(_(" -C <command> command name\n"), out);
+ fputs(_(" -G, --Group <gid> real group id or name\n"), out);
+ fputs(_(" -g, --group <group> session or effective group name\n"), out);
+ fputs(_(" -p, --pid <pid> process id\n"), out);
+ fputs(_(" --ppid <pid> select by parent process id\n"), out);
+ fputs(_(" -s, --sid <session> session id\n"), out);
+ fputs(_(" -t, t, --tty <tty> terminal\n"), out);
+ fputs(_(" -u, U, --user <uid> effective user id or name\n"), out);
+ fputs(_(" -U, --User <uid> real user id or name\n"), out);
+ fputs(_("\n"
" selection <arguments> take either:\n"
" comma-separated list e.g. '-u root,nobody' or\n"
- " blank-separated list e.g. '-p 123 4567'\n"));
+ " blank-separated list e.g. '-p 123 4567'\n"), out);
}
if (section == HELP_OUT || section == HELP_ALL) {
- fprintf(out, _("\n"
- "Output formats:\n"
- " -F extra full\n"
- " -f full-format, including command lines\n"
- " f, --forest ascii art process tree\n"
- " -H show process hierarchy\n"
- " -j jobs format\n"
- " j BSD job control format\n"
- " -l long format\n"
- " l BSD long format\n"
- " -M, Z add security data (for SELinux)\n"
- " -O <format> preloaded with default columns\n"
- " O <format> as -O, with BSD personality\n"
- " -o, o, --format <format>\n"
- " user defined format\n"
- " s signal format\n"
- " u user-oriented format\n"
- " v virtual memory format\n"
- " X register format\n"
- " -y do not show flags, show rrs vs. addr (used with -l)\n"
- " --context display security context (for SELinux)\n"
- " --headers repeat header lines, one per page\n"
- " --no-headers do not print header at all\n"
- " --cols, --columns, --width <num>\n"
- " set screen width\n"
- " --rows, --lines <num>\n"
- " set screen height\n"));
+ fputs(_("\nOutput formats:\n"), out);
+ fputs(_(" -F extra full\n"), out);
+ fputs(_(" -f full-format, including command lines\n"), out);
+ fputs(_(" f, --forest ascii art process tree\n"), out);
+ fputs(_(" -H show process hierarchy\n"), out);
+ fputs(_(" -j jobs format\n"), out);
+ fputs(_(" j BSD job control format\n"), out);
+ fputs(_(" -l long format\n"), out);
+ fputs(_(" l BSD long format\n"), out);
+ fputs(_(" -M, Z add security data (for SELinux)\n"), out);
+ fputs(_(" -O <format> preloaded with default columns\n"), out);
+ fputs(_(" O <format> as -O, with BSD personality\n"), out);
+ fputs(_(" -o, o, --format <format>\n"
+ " user defined format\n"), out);
+ fputs(_(" s signal format\n"), out);
+ fputs(_(" u user-oriented format\n"), out);
+ fputs(_(" v virtual memory format\n"), out);
+ fputs(_(" X register format\n"), out);
+ fputs(_(" -y do not show flags, show rrs vs. addr (used with -l)\n"), out);
+ fputs(_(" --context display security context (for SELinux)\n"), out);
+ fputs(_(" --headers repeat header lines, one per page\n"), out);
+ fputs(_(" --no-headers do not print header at all\n"), out);
+ fputs(_(" --cols, --columns, --width <num>\n"
+ " set screen width\n"), out);
+ fputs(_(" --rows, --lines <num>\n"
+ " set screen height\n"), out);
}
if (section == HELP_THD || section == HELP_ALL) {
- fprintf(out, _("\n"
- "Show threads:\n"
- " H as if they where processes\n"
- " -L possibly with LWP and NLWP columns\n"
- " -m, m after processes\n"
- " -T possibly with SPID column\n"));
+ fputs(_("\nShow threads:\n"), out);
+ fputs(_(" H as if they where processes\n"), out);
+ fputs(_(" -L possibly with LWP and NLWP columns\n"), out);
+ fputs(_(" -m, m after processes\n"), out);
+ fputs(_(" -T possibly with SPID column\n"), out);
}
if (section == HELP_MSC || section == HELP_ALL) {
+ fputs(_("\nMiscellaneous options:\n"), out);
+ fputs(_(" -c show scheduling class with -l option\n"), out);
+ fputs(_(" c show true command name\n"), out);
+ fputs(_(" e show the environment after command\n"), out);
+ fputs(_(" k, --sort specify sort order as: [+|-]key[,[+|-]key[,...]]\n"), out);
+ fputs(_(" L list format specifiers\n"), out);
+ fputs(_(" n display numeric uid and wchan\n"), out);
+ fputs(_(" S, --cumulative include some dead child process data\n"), out);
+ fputs(_(" -y do not show flags, show rss (only with -l)\n"), out);
+ fputs(_(" -V, V, --version display version information and exit\n"), out);
+ fputs(_(" -w, w unlimited output width\n"), out);
fprintf(out, _("\n"
- "Miscellaneous options:\n"
- " -c show scheduling class with -l option\n"
- " c show true command name\n"
- " e show the environment after command\n"
- " k, --sort specify sort order as: [+|-]key[,[+|-]key[,...]]\n"
- " L list format specifiers\n"
- " n display numeric uid and wchan\n"
- " S, --cumulative include some dead child process data\n"
- " -y do not show flags, show rss (only with -l)\n"
- " -V, V, --version display version information and exit\n"
- " -w, w unlimited output width\n"
- "\n"
" --%s <%s|%s|%s|%s|%s|%s>\n"
" display help and exit\n")
, the_word_help
diff --git skill.c skill.c
index 01b29cb..5c8192a 100644
--- skill.c
+++ skill.c
@@ -324,11 +324,11 @@ static void __attribute__ ((__noreturn__)) kill_usage(FILE * out)
fprintf(out,
_(" %s [options] <pid> [...]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
- fputs(_(" <pid> [...] send signal to every <pid> listed\n"
- " -<signal>, -s, --signal <signal>\n"
- " specify the <signal> to be sent\n"
- " -l, --list=[<signal>] list all signal names, or convert one to a name\n"
- " -L, --table list all signal names in a nice table\n"), out);
+ fputs(_(" <pid> [...] send signal to every <pid> listed\n"), out);
+ fputs(_(" -<signal>, -s, --signal <signal>\n"
+ " specify the <signal> to be sent\n"), out);
+ fputs(_(" -l, --list=[<signal>] list all signal names, or convert one to a name\n"), out);
+ fputs(_(" -L, --table list all signal names in a nice table\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
@@ -351,25 +351,25 @@ static void __attribute__ ((__noreturn__)) skillsnice_usage(FILE * out)
program_invocation_short_name);
}
fputs(USAGE_OPTIONS, out);
- fputs(_(" -f, --fast fast mode (not implemented)\n"
- " -i, --interactive interactive\n"
- " -l, --list list all signal names\n"
- " -L, --table list all signal names in a nice table\n"
- " -n, --no-action no action\n"
- " -v, --verbose explain what is being done\n"
- " -w, --warnings enable warnings (not implemented)\n"), out);
+ fputs(_(" -f, --fast fast mode (not implemented)\n"), out);
+ fputs(_(" -i, --interactive interactive\n"), out);
+ fputs(_(" -l, --list list all signal names\n"), out);
+ fputs(_(" -L, --table list all signal names in a nice table\n"), out);
+ fputs(_(" -n, --no-action no action\n"), out);
+ fputs(_(" -v, --verbose explain what is being done\n"), out);
+ fputs(_(" -w, --warnings enable warnings (not implemented)\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Expression can be: terminal, user, pid, command.\n"
- "The options below may be used to ensure correct interpretation.\n"
- " -c, --command <command> expression is a command name\n"
- " -p, --pid <pid> expression is a process id number\n"
- " -t, --tty <tty> expression is a terminal\n"
- " -u, --user <username> expression is a username\n"), out);
+ "The options below may be used to ensure correct interpretation.\n"), out);
+ fputs(_(" -c, --command <command> expression is a command name\n"), out);
+ fputs(_(" -p, --pid <pid> expression is a process id number\n"), out);
+ fputs(_(" -t, --tty <tty> expression is a terminal\n"), out);
+ fputs(_(" -u, --user <username> expression is a username\n"), out);
fputs(USAGE_SEPARATOR, out);
- fputs(_("Alternatively, expression can be:\n"
- " --ns <pid> match the processes that belong to the same\n"
- " namespace as <pid>\n"
- " --nslist <ns,...> list which namespaces will be considered for\n"
+ fputs(_("Alternatively, expression can be:\n"), out);
+ fputs(_(" --ns <pid> match the processes that belong to the same\n"
+ " namespace as <pid>\n"), out);
+ fputs(_(" --nslist <ns,...> list which namespaces will be considered for\n"
" the --ns option.\n"
" Available namespaces: ipc, mnt, net, pid, user, uts\n"), out);
diff --git slabtop.c slabtop.c
index dc89c4d..c135ec5 100644
--- slabtop.c
+++ slabtop.c
@@ -188,24 +188,24 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
- fputs(_(" -d, --delay <secs> delay updates\n"
- " -o, --once only display once, then exit\n"
- " -s, --sort <char> specify sort criteria by character (see below)\n"), out);
+ fputs(_(" -d, --delay <secs> delay updates\n"), out);
+ fputs(_(" -o, --once only display once, then exit\n"), out);
+ fputs(_(" -s, --sort <char> specify sort criteria by character (see below)\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
- fputs(_("\nThe following are valid sort criteria:\n"
- " a: sort by number of active objects\n"
- " b: sort by objects per slab\n"
- " c: sort by cache size\n"
- " l: sort by number of slabs\n"
- " v: sort by number of active slabs\n"
- " n: sort by name\n"
- " o: sort by number of objects (the default)\n"
- " p: sort by pages per slab\n"
- " s: sort by object size\n"
- " u: sort by cache utilization\n"), out);
+ fputs(_("\nThe following are valid sort criteria:\n"), out);
+ fputs(_(" a: sort by number of active objects\n"), out);
+ fputs(_(" b: sort by objects per slab\n"), out);
+ fputs(_(" c: sort by cache size\n"), out);
+ fputs(_(" l: sort by number of slabs\n"), out);
+ fputs(_(" v: sort by number of active slabs\n"), out);
+ fputs(_(" n: sort by name\n"), out);
+ fputs(_(" o: sort by number of objects (the default)\n"), out);
+ fputs(_(" p: sort by pages per slab\n"), out);
+ fputs(_(" s: sort by object size\n"), out);
+ fputs(_(" u: sort by cache utilization\n"), out);
fprintf(out, USAGE_MAN_TAIL("slabtop(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
diff --git watch.c watch.c
index 436d213..032dfb7 100644
--- watch.c
+++ watch.c
@@ -88,16 +88,16 @@ static void __attribute__ ((__noreturn__))
fprintf(out,
_(" %s [options] command\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
- fputs(_(" -b, --beep beep if command has a non-zero exit\n"
- " -c, --color interpret ANSI color sequences\n"
- " -d, --differences[=<permanent>]\n"
- " highlight changes between updates\n"
- " -e, --errexit exit if command has a non-zero exit\n"
- " -g, --chgexit exit when output from command changes\n"
- " -n, --interval <secs> seconds to wait between updates\n"
- " -p, --precise attempt run command in precise intervals\n"
- " -t, --no-title turn off header\n"
- " -x, --exec pass command to exec instead of \"sh -c\"\n"), out);
+ fputs(_(" -b, --beep beep if command has a non-zero exit\n"), out);
+ fputs(_(" -c, --color interpret ANSI color sequences\n"), out);
+ fputs(_(" -d, --differences[=<permanent>]\n"
+ " highlight changes between updates\n"), out);
+ fputs(_(" -e, --errexit exit if command has a non-zero exit\n"), out);
+ fputs(_(" -g, --chgexit exit when output from command changes\n"), out);
+ fputs(_(" -n, --interval <secs> seconds to wait between updates\n"), out);
+ fputs(_(" -p, --precise attempt run command in precise intervals\n"), out);
+ fputs(_(" -t, --no-title turn off header\n"), out);
+ fputs(_(" -x, --exec pass command to exec instead of \"sh -c\"\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(_(" -v, --version output version information and exit\n"), out);
--
1.7.9.2

View File

@ -1,109 +0,0 @@
From f12c0d5c6e84f9409ac3a73c066841a8ff5aab0b Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 8 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: minimize the statistics overhead for numa support
A recent libnuma potential corruption problem solution
has caused me to reevaluate some associated numa logic
for efficiency. Here is a summary of the problems that
exist with current libnuma/user possible interactions:
. Whenever the numa library was present extra overhead
would always be incurred in maintaining the node stats
even when the '2' or '3' commands were not being used.
. As part of such overhead a separate loop was used to
reinitialize each cpu/node structure with each display
cycle so that prior accumulated totals were preserved.
Again, it didn't matter if numa data was really shown.
This commit attempts to refocus on the 'critical path'
costs in a running top by optimizing for the occasions
when numa node data is not being displayed. Under such
conditions, no extra overhead will be incurred whether
or not a distribution has the libnuma library present.
To achieve this goal, some additional overhead will be
incurred, but only when actually displaying numa data.
And all such new costs have been minimized in spite of
the gcc inclination to duplicate subscript resolution.
Reference(s):
commit 24bd950cb2e1722d459461f0f9c0c30a4b9ffdaa
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git top/top.c top/top.c
index e619ddd..9d12693 100644
--- top/top.c
+++ top/top.c
@@ -2361,18 +2361,9 @@ static CPU_t *cpus_refresh (CPU_t *cpus) {
#endif
#ifndef NUMA_DISABLE
- for (i = 0; i < Numa_node_tot; i++) {
- node = sumSLOT + 1 + i;
- // remember from last time around
- memcpy(&cpus[node].sav, &cpus[node].cur, sizeof(CT_t));
- // initialize current node statistics
- memset(&cpus[node].cur, 0, sizeof(CT_t));
-#ifndef CPU_ZEROTICS
- cpus[node].edge = cpus[sumSLOT].edge;
- // this is for symmetry only, it's not currently required
- cpus[node].cur.tot = cpus[sumSLOT].cur.tot;
-#endif
- }
+ // forget all of the prior node statistics (maybe)
+ if (CHKw(Curwin, View_CPUNOD))
+ memset(&cpus[sumSLOT + 1], 0, Numa_node_tot * sizeof(CPU_t));
#endif
// now value each separate cpu's tics...
@@ -2400,21 +2391,30 @@ static CPU_t *cpus_refresh (CPU_t *cpus) {
cpus[i].id = i;
#endif
#ifndef NUMA_DISABLE
- if (Numa_node_tot
+ /* henceforth, with just a little more arithmetic we can avoid
+ maintaining *any* node stats unless they're actually needed */
+ if (CHKw(Curwin, View_CPUNOD)
+ && Numa_node_tot
&& -1 < (node = Numa_node_of_cpu(cpus[i].id))) {
+ // use our own pointer to avoid gcc subscript bloat
+ CPU_t *nod_ptr = &cpus[sumSLOT + 1 + node];
+ nod_ptr->cur.u += cpus[i].cur.u; nod_ptr->sav.u += cpus[i].sav.u;
+ nod_ptr->cur.n += cpus[i].cur.n; nod_ptr->sav.n += cpus[i].sav.n;
+ nod_ptr->cur.s += cpus[i].cur.s; nod_ptr->sav.s += cpus[i].sav.s;
+ nod_ptr->cur.i += cpus[i].cur.i; nod_ptr->sav.i += cpus[i].sav.i;
+ nod_ptr->cur.w += cpus[i].cur.w; nod_ptr->sav.w += cpus[i].sav.w;
+ nod_ptr->cur.x += cpus[i].cur.x; nod_ptr->sav.x += cpus[i].sav.x;
+ nod_ptr->cur.y += cpus[i].cur.y; nod_ptr->sav.y += cpus[i].sav.y;
+ nod_ptr->cur.z += cpus[i].cur.z; nod_ptr->sav.z += cpus[i].sav.z;
+#ifndef CPU_ZEROTICS
+ /* yep, we re-value this repeatedly for each cpu encountered, but we
+ can then avoid a prior loop to selectively initialize each node */
+ nod_ptr->edge = cpus[sumSLOT].edge;
+#endif
cpus[i].node = node;
- node += (sumSLOT + 1);
- cpus[node].cur.u += cpus[i].cur.u;
- cpus[node].cur.n += cpus[i].cur.n;
- cpus[node].cur.s += cpus[i].cur.s;
- cpus[node].cur.i += cpus[i].cur.i;
- cpus[node].cur.w += cpus[i].cur.w;
- cpus[node].cur.x += cpus[i].cur.x;
- cpus[node].cur.y += cpus[i].cur.y;
- cpus[node].cur.z += cpus[i].cur.z;
}
#endif
- }
+ } // end: for each cpu
Cpu_faux_tot = i; // tolerate cpus taken offline
--
1.7.9.2

View File

@ -0,0 +1,25 @@
From 38cbeedeb7dc94c95482343e547addc1748344b0 Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Thu, 2 Jan 2014 18:21:31 +0100
Subject: [PATCH] library: fixing uninitialized variable 'pos' in whattime.c
---
proc/whattime.c | 2 ++
1 file changed, 2 insertions(+)
diff --git proc/whattime.c proc/whattime.c
index 9d6abb3..eb345fb 100644
--- proc/whattime.c
+++ proc/whattime.c
@@ -58,6 +58,8 @@ char *sprint_uptime(int human_readable) {
realtime = localtime(&realseconds);
pos = sprintf(buf, " %02d:%02d:%02d ",
realtime->tm_hour, realtime->tm_min, realtime->tm_sec);
+ } else {
+ pos = 0;
}
/* read and calculate the amount of uptime */
--
1.7.9.2

View File

@ -1,149 +0,0 @@
From 89c2f28e393830d899e3e91b60c830a6f07d38d5 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sat, 9 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: eliminate yet more gcc subscript resolution bloat
This patch is inspired by the 'minimize numa overhead'
patch. It trades the use of subscripts for pointers to
avoid gcc repeated subscript offset calculation bloat.
Now, throughout the cpus_refresh function, a subscript
will be resolved just once & this will (dramatically?)
reduce the path-length taken for each and every frame!
For example, a non-optimized compilation could produce
400+ fewer machine instructions through pointer usage.
[ ok, optimized compiles only save 18+ instructions! ]
Lastly, any residual 'symmetry only' crap is now gone!
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 65 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 33 insertions(+), 32 deletions(-)
diff --git top/top.c top/top.c
index 9d12693..151693d 100644
--- top/top.c
+++ top/top.c
@@ -2298,6 +2298,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) {
static FILE *fp = NULL;
static int siz, sav_slot = -1;
static char *buf;
+ CPU_t *sum_ptr; // avoid gcc subscript bloat
int i, num, tot_read;
#ifndef NUMA_DISABLE
int node;
@@ -2342,76 +2343,76 @@ static CPU_t *cpus_refresh (CPU_t *cpus) {
#undef buffGRW
// remember from last time around
- memcpy(&cpus[sumSLOT].sav, &cpus[sumSLOT].cur, sizeof(CT_t));
+ sum_ptr = &cpus[sumSLOT];
+ memcpy(&sum_ptr->sav, &sum_ptr->cur, sizeof(CT_t));
// then value the last slot with the cpu summary line
if (4 > sscanf(bp, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu"
- , &cpus[sumSLOT].cur.u, &cpus[sumSLOT].cur.n, &cpus[sumSLOT].cur.s
- , &cpus[sumSLOT].cur.i, &cpus[sumSLOT].cur.w, &cpus[sumSLOT].cur.x
- , &cpus[sumSLOT].cur.y, &cpus[sumSLOT].cur.z))
+ , &sum_ptr->cur.u, &sum_ptr->cur.n, &sum_ptr->cur.s
+ , &sum_ptr->cur.i, &sum_ptr->cur.w, &sum_ptr->cur.x
+ , &sum_ptr->cur.y, &sum_ptr->cur.z))
error_exit(N_txt(FAIL_statget_txt));
#ifndef CPU_ZEROTICS
- cpus[sumSLOT].cur.tot = cpus[sumSLOT].cur.u + cpus[sumSLOT].cur.s
- + cpus[sumSLOT].cur.n + cpus[sumSLOT].cur.i + cpus[sumSLOT].cur.w
- + cpus[sumSLOT].cur.x + cpus[sumSLOT].cur.y + cpus[sumSLOT].cur.z;
+ sum_ptr->cur.tot = sum_ptr->cur.u + sum_ptr->cur.s
+ + sum_ptr->cur.n + sum_ptr->cur.i + sum_ptr->cur.w
+ + sum_ptr->cur.x + sum_ptr->cur.y + sum_ptr->cur.z;
/* if a cpu has registered substantially fewer tics than those expected,
we'll force it to be treated as 'idle' so as not to present misleading
percentages. */
- cpus[sumSLOT].edge =
- ((cpus[sumSLOT].cur.tot - cpus[sumSLOT].sav.tot) / smp_num_cpus()) / (100 / TICS_EDGE);
+ sum_ptr->edge =
+ ((sum_ptr->cur.tot - sum_ptr->sav.tot) / smp_num_cpus()) / (100 / TICS_EDGE);
#endif
#ifndef NUMA_DISABLE
// forget all of the prior node statistics (maybe)
if (CHKw(Curwin, View_CPUNOD))
- memset(&cpus[sumSLOT + 1], 0, Numa_node_tot * sizeof(CPU_t));
+ memset(sum_ptr + 1, 0, Numa_node_tot * sizeof(CPU_t));
#endif
// now value each separate cpu's tics...
for (i = 0; i < sumSLOT; i++) {
+ CPU_t *cpu_ptr = &cpus[i]; // avoid gcc subscript bloat
#ifdef PRETEND8CPUS
bp = buf;
#endif
bp = 1 + strchr(bp, '\n');
// remember from last time around
- memcpy(&cpus[i].sav, &cpus[i].cur, sizeof(CT_t));
- if (4 > sscanf(bp, "cpu%d %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &cpus[i].id
- , &cpus[i].cur.u, &cpus[i].cur.n, &cpus[i].cur.s
- , &cpus[i].cur.i, &cpus[i].cur.w, &cpus[i].cur.x
- , &cpus[i].cur.y, &cpus[i].cur.z)) {
- memmove(&cpus[i], &cpus[sumSLOT], sizeof(CPU_t));
+ memcpy(&cpu_ptr->sav, &cpu_ptr->cur, sizeof(CT_t));
+ if (4 > sscanf(bp, "cpu%d %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &cpu_ptr->id
+ , &cpu_ptr->cur.u, &cpu_ptr->cur.n, &cpu_ptr->cur.s
+ , &cpu_ptr->cur.i, &cpu_ptr->cur.w, &cpu_ptr->cur.x
+ , &cpu_ptr->cur.y, &cpu_ptr->cur.z)) {
+ memmove(cpu_ptr, sum_ptr, sizeof(CPU_t));
break; // tolerate cpus taken offline
}
#ifndef CPU_ZEROTICS
- cpus[i].edge = cpus[sumSLOT].edge;
- // this is for symmetry only, it's not currently required
- cpus[i].cur.tot = cpus[sumSLOT].cur.tot;
+ cpu_ptr->edge = sum_ptr->edge;
#endif
#ifdef PRETEND8CPUS
- cpus[i].id = i;
+ cpu_ptr->id = i;
#endif
#ifndef NUMA_DISABLE
/* henceforth, with just a little more arithmetic we can avoid
maintaining *any* node stats unless they're actually needed */
if (CHKw(Curwin, View_CPUNOD)
&& Numa_node_tot
- && -1 < (node = Numa_node_of_cpu(cpus[i].id))) {
+ && -1 < (node = Numa_node_of_cpu(cpu_ptr->id))) {
// use our own pointer to avoid gcc subscript bloat
- CPU_t *nod_ptr = &cpus[sumSLOT + 1 + node];
- nod_ptr->cur.u += cpus[i].cur.u; nod_ptr->sav.u += cpus[i].sav.u;
- nod_ptr->cur.n += cpus[i].cur.n; nod_ptr->sav.n += cpus[i].sav.n;
- nod_ptr->cur.s += cpus[i].cur.s; nod_ptr->sav.s += cpus[i].sav.s;
- nod_ptr->cur.i += cpus[i].cur.i; nod_ptr->sav.i += cpus[i].sav.i;
- nod_ptr->cur.w += cpus[i].cur.w; nod_ptr->sav.w += cpus[i].sav.w;
- nod_ptr->cur.x += cpus[i].cur.x; nod_ptr->sav.x += cpus[i].sav.x;
- nod_ptr->cur.y += cpus[i].cur.y; nod_ptr->sav.y += cpus[i].sav.y;
- nod_ptr->cur.z += cpus[i].cur.z; nod_ptr->sav.z += cpus[i].sav.z;
+ CPU_t *nod_ptr = sum_ptr + 1 + node;
+ nod_ptr->cur.u += cpu_ptr->cur.u; nod_ptr->sav.u += cpu_ptr->sav.u;
+ nod_ptr->cur.n += cpu_ptr->cur.n; nod_ptr->sav.n += cpu_ptr->sav.n;
+ nod_ptr->cur.s += cpu_ptr->cur.s; nod_ptr->sav.s += cpu_ptr->sav.s;
+ nod_ptr->cur.i += cpu_ptr->cur.i; nod_ptr->sav.i += cpu_ptr->sav.i;
+ nod_ptr->cur.w += cpu_ptr->cur.w; nod_ptr->sav.w += cpu_ptr->sav.w;
+ nod_ptr->cur.x += cpu_ptr->cur.x; nod_ptr->sav.x += cpu_ptr->sav.x;
+ nod_ptr->cur.y += cpu_ptr->cur.y; nod_ptr->sav.y += cpu_ptr->sav.y;
+ nod_ptr->cur.z += cpu_ptr->cur.z; nod_ptr->sav.z += cpu_ptr->sav.z;
#ifndef CPU_ZEROTICS
/* yep, we re-value this repeatedly for each cpu encountered, but we
can then avoid a prior loop to selectively initialize each node */
- nod_ptr->edge = cpus[sumSLOT].edge;
+ nod_ptr->edge = sum_ptr->edge;
#endif
- cpus[i].node = node;
+ cpu_ptr->node = node;
}
#endif
} // end: for each cpu
--
1.7.9.2

View File

@ -0,0 +1,26 @@
From 69de8db3e27b63fdcd8e3dce4d63e725d80bf05b Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Thu, 2 Jan 2014 18:39:27 +0100
Subject: [PATCH] pgrep: Fixing memory leak in do_regcomp()
---
pgrep.c | 3 +++
1 file changed, 3 insertions(+)
diff --git pgrep.c pgrep.c
index 6290ec5..93a7c89 100644
--- pgrep.c
+++ pgrep.c
@@ -460,6 +460,9 @@ static regex_t * do_regcomp (void)
}
re_err = regcomp (preg, re, REG_EXTENDED | REG_NOSUB | opt_case);
+
+ if (opt_exact) free(re);
+
if (re_err) {
regerror (re_err, preg, errbuf, sizeof(errbuf));
fputs(errbuf,stderr);
--
1.7.9.2

View File

@ -0,0 +1,30 @@
From 8622b582da06fb93a8f06d302215269835fca9a9 Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Thu, 2 Jan 2014 19:49:36 +0100
Subject: [PATCH] sysctl: Fixing memory leaks in PreloadSystem()
---
sysctl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git sysctl.c sysctl.c
index 33c9403..51af15d 100644
--- sysctl.c
+++ sysctl.c
@@ -645,6 +645,13 @@ static int PreloadSystem(void)
printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD);
rc |= Preload(DEFAULT_PRELOAD);
}
+
+ /* cleaning */
+ for (i = 0; i < ncfgs; ++i) {
+ free(cfgs[i]);
+ }
+ if (cfgs) free(cfgs);
+
return rc;
}
--
1.7.9.2

View File

@ -0,0 +1,47 @@
From d06aaaaf2bd8f3b5f0235e75f4f04c0ad69c7d6d Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Tue, 14 Jan 2014 22:23:58 +1100
Subject: [PATCH] ps: ignore SIGCONT
SIGCONT is a continue signal. It seems that some zsh setups can send
this signal, causing ps to abort. This is not what "continue" means.
This change just uses the default handler which will continue a stopped
process.
References:
http://bugs.debian.org/732410
http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=32251
Signed-off-by: Craig Small <csmall@enc.com.au>
---
NEWS | 1 +
ps/display.c | 1 +
2 files changed, 2 insertions(+)
diff --git NEWS NEWS
index 1c710a3..a2afaa3 100644
--- NEWS
+++ NEWS
@@ -1,6 +1,7 @@
procps-ng-3.3.10
----------------
* sysctl --system loads default config file - Debian #732920
+ * ps doesn't exit on SIGCONT
procps-ng-3.3.9
---------------
diff --git ps/display.c ps/display.c
index c20285d..693154b 100644
--- ps/display.c
+++ ps/display.c
@@ -563,6 +563,7 @@ int main(int argc, char *argv[]){
default:
sigaction(i,&sa,NULL);
case 0:
+ case SIGCONT:
case SIGINT: /* ^C */
case SIGTSTP: /* ^Z */
case SIGTTOU: /* see stty(1) man page */
--
1.7.9.2

View File

@ -0,0 +1,47 @@
From 1baf31be9bbfd6fb82629176e595d2d2cef85ef3 Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Mon, 20 Jan 2014 19:59:39 +0100
Subject: [PATCH] vmstat: wide output still not wide enough?
8 digits per memory column is apparently still too low
for systems with 128TB of RAM. Anyway, setting the limit
to 999TB (12 digits) must be sufficient for now as it
produces wide gaps on "regular" computers.
This commit also increases the number of digits per cpu
columns from 2 to 3 as some of them can hit the 100%
maximum in corner cases.
---
vmstat.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git vmstat.c vmstat.c
index 67515c1..c01351d 100644
--- vmstat.c
+++ vmstat.c
@@ -187,12 +187,12 @@ static void new_header(void)
const char header[] =
"procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n";
const char wide_header[] =
- "procs ---------------memory-------------- ---swap-- -----io---- -system-- ------cpu-----\n";
+ "procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu--------\n";
const char format[] =
"%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n";
const char wide_format[] =
- "%2s %2s %8s %8s %8s %8s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n";
+ "%2s %2s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s\n";
printf(w_option ? _(wide_header) : _(header));
printf(
@@ -249,7 +249,7 @@ static void new_format(void)
const char format[] =
"%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
const char wide_format[] =
- "%2u %2u %8lu %8lu %8lu %8lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
+ "%2u %2u %12lu %12lu %12lu %12lu %4u %4u %5u %5u %4u %4u %3u %3u %3u %3u %3u\n";
unsigned int tog = 0; /* toggle switch for cleaner code */
unsigned int i;
--
1.7.9.2

View File

@ -0,0 +1,43 @@
From ae9676a337e38526b994d189444f3fd02ab800ad Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Fri, 24 Jan 2014 18:07:34 +0100
Subject: [PATCH] library: skip replacement of trailing '\0' in
read_unvectored()
Under some circumstances the ksh shell doesn't fork new processes
when executing scripts and the script is interpreted by the
parent process. That makes the execution faster, but it means
ksh needs to reuse the /proc/PID/cmdline for the new script name
and arguments while the file length needs to stay untouched.
The fork is skipped only when the new cmdline is shorter than
the parent's cmdline and the rest of the file is filled
with '\0'. This is perfectly ok until we try to read the cmdline
of such process. As the read_unvectored() function replaces
all zeros with chosen separator, these trailing zeros are replaced
with spaces in case of the ps tool. Consequently it appends
multiple spaces at the end of the arguments string even when these
zeros do not represent any separators and therefore shouldn't
be replaced.
With this commit the read_unvectored() function skips the
replacement of trailing zeros and separates valid content only.
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1057600
---
proc/readproc.c | 1 +
1 file changed, 1 insertion(+)
diff --git proc/readproc.c proc/readproc.c
index 286e173..46dfa10 100644
--- proc/readproc.c
+++ proc/readproc.c
@@ -686,6 +686,7 @@ static int read_unvectored(char *restrict const dst, unsigned sz, const char* wh
close(fd);
if(n){
int i=n;
+ while(i && dst[i-1]=='\0') --i; // skip trailing zeroes
while(i--)
if(dst[i]=='\n' || dst[i]=='\0') dst[i]=sep;
if(dst[n-1]==' ') dst[n-1]='\0';
--
1.7.9.2

View File

@ -1,63 +0,0 @@
Based on 57ab5eed15a577fda6ce24753948ab29f30de2d4 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 29 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: do not lie about purported alphabetical orderings
Excluding those special X_XON/X_XOF enums, which might
not even be present, restore strict collating order of
all the case labels in the task_show switch statement.
Also, adjust a few sort callbacks for the same reason.
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git top/top.c top/top.c
index 70eaa4a..59dcb3f 100644
--- top/top.c
+++ top/top.c
@@ -246,9 +246,9 @@ SCB_NUM1(CPU, pcpu)
SCB_NUM1(DAT, drs)
SCB_NUM1(DRT, dt)
SCB_STRS(ENV, environ[0])
-SCB_NUM1(FLG, flags)
SCB_NUM1(FL1, maj_flt)
SCB_NUM1(FL2, min_flt)
+SCB_NUM1(FLG, flags)
SCB_NUM1(FV1, maj_delta)
SCB_NUM1(FV2, min_delta)
SCB_NUMx(GID, egid)
@@ -5220,15 +5220,15 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
case P_ENV:
makeVAR(p->environ[0]);
break;
- case P_FLG:
- cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO);
- break;
case P_FL1:
cp = scale_num(p->maj_flt, W, Jn);
break;
case P_FL2:
cp = scale_num(p->min_flt, W, Jn);
break;
+ case P_FLG:
+ cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO);
+ break;
case P_FV1:
cp = scale_num(p->maj_delta, W, Jn);
break;
@@ -5308,8 +5308,8 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
case P_THD:
cp = make_num(p->nlwp, W, Jn, AUTOX_NO);
break;
- case P_TME:
case P_TM2:
+ case P_TME:
{ TIC_t t = p->utime + p->stime;
if (CHKw(q, Show_CTIMES)) t += (p->cutime + p->cstime);
cp = scale_tics(t, W, Jn);
--
1.7.9.2

View File

@ -0,0 +1,41 @@
From 4359cf069819d9fb53493933e00d9af5c37bced5 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Tue, 28 Jan 2014 22:35:26 +1100
Subject: [PATCH] kill for PID -1 restored
Both the man page and the shell builtin kill mention you can
use PID -1, which means nuke everything you can get at.
Alas this "fun" option was missing and the only way to get
around it was with "kill -HUP -- -1".
This small change means kill -HUP -1 is back for all those
destructive types. The error was introduced when the argument
parser was fixed for other problems.
Thanks to Mike for pointing this out.
Signed-off-by: Craig Small <csmall@enc.com.au>
---
skill.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git skill.c skill.c
index 5c8192a..1c99985 100644
--- skill.c
+++ skill.c
@@ -477,6 +477,12 @@ static void __attribute__ ((__noreturn__))
display_kill_version();
exit(EXIT_SUCCESS);
case '?':
+ /* Special case is -1 which means all except init */
+ if (optopt == '1') {
+ if (kill(-1, signo) != 0)
+ exitvalue = EXIT_FAILURE;
+ exit(exitvalue);
+ }
if (!isdigit(optopt)) {
xwarnx(_("invalid argument %c"), optopt);
kill_usage(stderr);
--
1.7.9.2

View File

@ -1,60 +0,0 @@
From 4c464acf283b83f052af075f1190f146550c77a5 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sat, 30 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: follow usual name conventions for global variable
A recent change involving a one cycle stderr redirect,
to handle a libnuma potential transgression, failed to
follow normal global variable naming conventions. This
patch will capitalize the 1st letter of 'Stderr_save'.
Reference(s):
commit 35dc6dcc49cc9cf8cff4300cb03a38dbe44c05db
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git top/top.c top/top.c
index 59dcb3f..4d1d912 100644
--- top/top.c
+++ top/top.c
@@ -220,7 +220,7 @@ static int Numa_node_tot;
static int Numa_node_sel = -1;
#ifndef NUMA_DISABLE
static void *Libnuma_handle;
-static int stderr_save = -1;
+static int Stderr_save = -1;
#if defined(PRETEND_NUMA) || defined(PRETEND8CPUS)
static int Numa_max_node(void) { return 3; }
static int Numa_node_of_cpu(int num) { return (num % 4); }
@@ -4069,8 +4069,8 @@ static void wins_stage_2 (void) {
Yes, he provides some overridable 'weak' functions to change such
behavior but we can't exploit that since we don't follow a normal
ld route to symbol resolution (we use that dlopen() guy instead)! */
- stderr_save = dup(fileno(stderr));
- if (-1 < stderr_save && freopen("/dev/null", "w", stderr))
+ Stderr_save = dup(fileno(stderr));
+ if (-1 < Stderr_save && freopen("/dev/null", "w", stderr))
; // avoid -Wunused-result
#endif
@@ -5553,10 +5553,10 @@ static void frame_make (void) {
#ifndef NUMA_DISABLE
/* we gotta reverse the stderr redirect which was employed in wins_stage_2
and needed because the two libnuma 'weak' functions were useless to us! */
- if (-1 < stderr_save) {
- dup2(stderr_save, fileno(stderr));
- close(stderr_save);
- stderr_save = -1;
+ if (-1 < Stderr_save) {
+ dup2(Stderr_save, fileno(stderr));
+ close(Stderr_save);
+ Stderr_save = -1;
}
#endif
--
1.7.9.2

View File

@ -0,0 +1,79 @@
From 5a34ff0a99a3c5e7ba4f7982d5de3d0dcc9e3045 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Wed, 29 Jan 2014 22:22:11 +1100
Subject: [PATCH] Check for presence of disks in vmstat
vmstat -d or vmstat -p would crash mysteriously under different
circumstances. The problem was eventually tracked down to /sys not
being mounted which meant is_disk() always returned false.
The partition would then be attempted to be linked to a non-existent
disk causing a segfault.
vmstat will now not link to a disk if none exists.
The change in testing will skip those tests when /sys/block doesn't
exist.
Many thanks to Daniel Schepler for his analysis and suggestions.
Bug-Debian: http://bugs.debian.org/736628
---
proc/sysinfo.c | 7 +++++--
testsuite/vmstat.test/vmstat.exp | 22 +++++++++++++++-------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git proc/sysinfo.c proc/sysinfo.c
index f318376..1680cc4 100644
--- proc/sysinfo.c
+++ proc/sysinfo.c
@@ -938,8 +938,11 @@ unsigned int getdiskstat(struct disk_stat **disks, struct partition_stat **parti
&(*partitions)[cPartition].writes,
&(*partitions)[cPartition].requested_writes
);
- (*partitions)[cPartition++].parent_disk = cDisk-1;
- (*disks)[cDisk-1].partitions++;
+
+ if (cDisk > 0) {
+ (*partitions)[cPartition++].parent_disk = cDisk-1;
+ (*disks)[cDisk-1].partitions++;
+ }
}
}
diff --git testsuite/vmstat.test/vmstat.exp testsuite/vmstat.test/vmstat.exp
index fb5de14..f470afc 100644
--- testsuite/vmstat.test/vmstat.exp
+++ testsuite/vmstat.test/vmstat.exp
@@ -26,15 +26,23 @@ expect_pass "$test" "^Cache\\s+Num\\s+Total\\s+Size\\s+Pages\\s+\(\[\(\)A-Za-z0-
}
set test "vmstat disk information (-d option)"
-spawn $vmstat -d
-expect_pass "$test" "^disk\[ -\]+reads\[ -\]+writes\[ -\]+IO\[ -\]+\\s+total\\s+merged\\s+sectors\\s+ms\\s+total\\s+merged\\s+sectors\\s+ms\\s+cur\\s+sec\\s+"
+if { [ file readable "/sys/block" ] == 0 } {
+ unsupported "$test /sys/block not readable"
+} else {
+ spawn $vmstat -d
+ expect_pass "$test" "^disk\[ -\]+reads\[ -\]+writes\[ -\]+IO\[ -\]+\\s+total\\s+merged\\s+sectors\\s+ms\\s+total\\s+merged\\s+sectors\\s+ms\\s+cur\\s+sec\\s+"
+}
# Need a partition
set diskstats [ exec cat /proc/diskstats ]
-if [ regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] {
- set test "vmstat partition (using $partition)"
- spawn $vmstat -p $partition
- expect_pass "$test" "^${partition}\\s+reads"
+if { [ file readable "/sys/block" ] == 0 } {
+ unsupported "vmstat partition /sys/block not readable"
} else {
- unsupported "vmstat partition (cannot find partition)"
+ if [ regexp "\\s+\\d+\\s+\\d+\\s+\(\[a-z\]+\\d+\)\\s+\[0-9\]\[0-9\]+" $diskstats line partition == 1 ] {
+ set test "vmstat partition (using $partition)"
+ spawn $vmstat -p $partition
+ expect_pass "$test" "^${partition}\\s+reads"
+ } else {
+ unsupported "vmstat partition (cannot find partition)"
+ }
}
--
1.7.9.2

View File

@ -0,0 +1,53 @@
From 39210a89debaff023fa97250bee63c57fe9dfcfb Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Wed, 29 Jan 2014 22:28:02 +1100
Subject: [PATCH] PID -2 to -9 for kill too
Commit 4359cf069819d9fb53493933e00d9af5c37bced5 restored kill's ability
to kill PID -1. This however left PIDs -2 to -9 (or rather process
groups 2 to 9) still having this problem. The check is now generically
looking for a digit and parses it correctly.
---
skill.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git skill.c skill.c
index 1c99985..60ed274 100644
--- skill.c
+++ skill.c
@@ -195,7 +195,8 @@ static void check_proc(int pid, struct run_time_conf_t *run_time)
if (i == -1)
goto closure;
}
- read(fd, buf, 128);
+ if (read(fd, buf, 128) <= 0)
+ goto closure;
buf[127] = '\0';
tmp = strrchr(buf, ')');
*tmp++ = '\0';
@@ -477,15 +478,16 @@ static void __attribute__ ((__noreturn__))
display_kill_version();
exit(EXIT_SUCCESS);
case '?':
- /* Special case is -1 which means all except init */
- if (optopt == '1') {
- if (kill(-1, signo) != 0)
- exitvalue = EXIT_FAILURE;
- exit(exitvalue);
- }
if (!isdigit(optopt)) {
xwarnx(_("invalid argument %c"), optopt);
kill_usage(stderr);
+ } else {
+ /* Special case for signal digit negative
+ * PIDs */
+ pid = (long)('0' - optopt);
+ if (kill((pid_t)pid, signo) != 0)
+ exitvalue = EXIT_FAILURE;
+ exit(exitvalue);
}
loop=0;
break;
--
1.7.9.2

View File

@ -81,13 +81,13 @@ index bb15d01..cb1a063 100644
Msg_row += 1;
// display each cpu node's states
for (i = 0; i < Numa_node_tot; i++) {
+ CPU_t *nod_ptr = &smpcpu[1 + smp_num_cpus() + i];
+ CPU_t *nod_ptr = &smpcpu[1 + smp_num_cpus + i];
if (!isROOM(anyFLG, 1)) break;
+#ifndef OFF_NUMASKIP
+ if (nod_ptr->id) {
+#endif
snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), i);
- summary_hlp(&smpcpu[1 + smp_num_cpus() + i], tmp);
- summary_hlp(&smpcpu[1 + smp_num_cpus + i], tmp);
+ summary_hlp(nod_ptr, tmp);
Msg_row += 1;
+#ifndef OFF_NUMASKIP

View File

@ -0,0 +1,42 @@
From 6f1c04259d979ff04d129f235c950e48e94c7e76 Mon Sep 17 00:00:00 2001
From: Elliott Forney <elliott.forney@gmail.com>
Date: Thu, 30 Jan 2014 21:36:26 +1100
Subject: [PATCH] pgrep fails to show full command line with -au
pgrep does not show the full command line when the -a and -u flags are
combined. The -a flag is ignored when the -u flag is used as well.
In addition, the supplied patch by Elliot did not fix the problem
when invert flag ( -v ) was used; a very small tweak to the patch
fixed this problem as well. This problem existed before.
Signed-off-by: Craig Small <csmall@enc.com.au>
---
pgrep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git pgrep.c pgrep.c
index 93a7c89..2a0ee19 100644
--- pgrep.c
+++ pgrep.c
@@ -417,7 +417,7 @@ static PROCTAB *do_openproc (void)
PROCTAB *ptp;
int flags = 0;
- if (opt_pattern || opt_full)
+ if (opt_pattern || opt_full || opt_longlong)
flags |= PROC_FILLCOM;
if (opt_ruid || opt_rgid)
flags |= PROC_FILLSTATUS;
@@ -538,7 +538,7 @@ static struct el * select_procs (int *num)
match = match_strlist (tty, opt_term);
}
}
- if (task.cmdline && (opt_longlong || opt_full) && match && opt_pattern) {
+ if (task.cmdline && (opt_longlong || opt_full) ) {
int i = 0;
int bytes = sizeof (cmdline) - 1;
--
1.7.9.2

View File

@ -0,0 +1,38 @@
From c304ffa994c2beacf3eabf9986a67d2065b60cc4 Mon Sep 17 00:00:00 2001
From: Ryan Cox <ryan_cox@byu.edu>
Date: Mon, 28 Oct 2013 21:05:35 -0600
Subject: [PATCH] fail on null string for arguments
---
pgrep.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git pgrep.c pgrep.c
index 6290ec5..38c380b 100644
--- pgrep.c
+++ pgrep.c
@@ -142,13 +142,19 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
static struct el *split_list (const char *restrict str, int (*convert)(const char *, struct el *))
{
- char *copy = xstrdup (str);
- char *ptr = copy;
+ char *copy;
+ char *ptr;
char *sep_pos;
int i = 0;
int size = 0;
struct el *list = NULL;
+ if (str[0] == '\0')
+ return NULL;
+
+ copy = xstrdup (str);
+ ptr = copy;
+
do {
if (i == size) {
size = size * 5 / 4 + 4;
--
1.7.9.2

View File

@ -23,13 +23,15 @@ http://www.freelists.org/post/procps/top-wont-compile-anymore
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 274 +++++++++++++++++++++++++++++-----------------------------
top/top.h | 44 ++++-----
top/top_nls.c | 186 +++++++++++++++++++--------------------
3 files changed, 252 insertions(+), 252 deletions(-)
top/top.c | 290 +++++++++++++++++++++++++++++-----------------------------
top/top.h | 46 ++++-----
top/top_nls.c | 210 +++++++++++++++++++++---------------------
3 files changed, 273 insertions(+), 273 deletions(-)
diff --git top/top.c top/top.c
index 23dad92..ca3d24a 100644
--- top/top.c
+++ top/top.c 2014-05-15 11:24:26.438236477 +0000
+++ top/top.c
@@ -18,12 +18,6 @@
* Sami Kerola, <kerolasa@iki.fi>
*/
@ -79,7 +81,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#define AUTOX_MODE (0 > Rc.fixed_widest)
/* Support for scale_mem and scale_num (to avoid duplication. */
@@ -1681,9 +1681,9 @@ static FLD_t Fieldstab[] = {
@@ -1688,9 +1688,9 @@ static FLD_t Fieldstab[] = {
a -1 width represents variable width columns
a 0 width represents columns set once at startup (see zap_fieldstab)
.lflg anomalies:
@ -92,7 +94,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
L_EITHER - must L_status, else L_stat == 64-bit math (__udivdi3) on 32-bit !
.width .scale .align .sort .lflg
@@ -1708,11 +1708,11 @@ static FLD_t Fieldstab[] = {
@@ -1715,11 +1715,11 @@ static FLD_t Fieldstab[] = {
{ 0, -1, A_right, SF(CPN), L_stat },
{ 0, -1, A_right, SF(CPU), L_stat },
{ 6, -1, A_right, SF(TME), L_stat },
@ -107,7 +109,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
#ifndef NOBOOST_MEMS
{ 7, SK_Kb, A_right, SF(VRT), L_statm },
@@ -1866,10 +1866,10 @@ static void build_headers (void) {
@@ -1879,10 +1879,10 @@ static void build_headers (void) {
w->hdrcaplen += strlen(Caps_off) + strlen(w->capclr_msg);
}
#else
@ -121,7 +123,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
Frames_libflags |= Fieldstab[w->procflgs[i]].lflg;
s = scat(s, justify_pad(N_col(f)
, VARcol(f) ? w->varcolsz : Fieldstab[f].width
@@ -1892,7 +1892,7 @@ static void build_headers (void) {
@@ -1905,7 +1905,7 @@ static void build_headers (void) {
// we must also accommodate an out of view sort field...
f = w->rc.sortindx;
Frames_libflags |= Fieldstab[f].lflg;
@ -130,7 +132,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
} // end: VIZISw(w)
if (Rc.mode_altscr) w = w->next;
@@ -1945,16 +1945,16 @@ static void calibrate_fields (void) {
@@ -1958,16 +1958,16 @@ static void calibrate_fields (void) {
if (VIZISw(w)) {
w->hdrcaplen = 0; // really only used with USE_X_COLHDR
// build window's pflgsall array, establish upper bounds for maxpflgs
@ -150,7 +152,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
} else
w->pflgsall[w->totpflgs++] = f;
#endif
@@ -1970,7 +1970,7 @@ static void calibrate_fields (void) {
@@ -1983,7 +1983,7 @@ static void calibrate_fields (void) {
f = w->pflgsall[i + w->begpflg];
w->procflgs[i] = f;
#ifndef USE_X_COLHDR
@ -159,7 +161,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
h = N_col(f);
len = (VARcol(f) ? (int)strlen(h) : Fieldstab[f].width) + COLPADSIZ;
@@ -1980,7 +1980,7 @@ static void calibrate_fields (void) {
@@ -1993,7 +1993,7 @@ static void calibrate_fields (void) {
s = scat(s, fmtmk("%*.*s", len, len, h));
}
#ifndef USE_X_COLHDR
@ -168,7 +170,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
/* establish the final maxpflgs and prepare to grow the variable column
@@ -1997,7 +1997,7 @@ static void calibrate_fields (void) {
@@ -2010,7 +2010,7 @@ static void calibrate_fields (void) {
for (i = w->totpflgs - 1; -1 < i; i--) {
f = w->pflgsall[i];
#ifndef USE_X_COLHDR
@ -177,7 +179,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
h = N_col(f);
len = (VARcol(f) ? (int)strlen(h) : Fieldstab[f].width) + COLPADSIZ;
@@ -2006,7 +2006,7 @@ static void calibrate_fields (void) {
@@ -2019,7 +2019,7 @@ static void calibrate_fields (void) {
w->endpflg = i;
}
#ifndef USE_X_COLHDR
@ -186,7 +188,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
} // end: if (VIZISw(w))
@@ -2063,10 +2063,10 @@ static void display_fields (int focus, i
@@ -2076,10 +2076,10 @@ static void display_fields (int focus, i
int rmax = Screen_rows - yRSVD; // total useable rows
static int col_sav, row_sav;
@ -201,7 +203,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
if (i > 1) { cmax /= i; xadd = 1; }
if (cmax > xTOTL) cmax = xTOTL;
smax = cmax - xPRFX;
@@ -2081,7 +2081,7 @@ static void display_fields (int focus, i
@@ -2094,7 +2094,7 @@ static void display_fields (int focus, i
}
fflush(stdout);
@ -210,7 +212,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
int b = FLDviz(w, i), x = (i / rmax) * cmax, y = (i % rmax) + yRSVD;
const char *e = (i == focus && extend) ? w->capclr_hdr : "";
FLG_t f = FLDget(w, i);
@@ -2156,7 +2156,7 @@ signify_that:
@@ -2169,7 +2169,7 @@ signify_that:
if (i > 0) { --i; if (p) swapEM }
break;
case kbd_DOWN:
@ -219,7 +221,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
break;
case kbd_LEFT:
case kbd_ENTER:
@@ -2171,7 +2171,7 @@ signify_that:
@@ -2184,7 +2184,7 @@ signify_that:
break;
case kbd_END:
case kbd_PGDN:
@ -228,7 +230,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
break;
case kbd_SPACE:
case 'd':
@@ -2209,7 +2209,7 @@ static inline void widths_resize (void)
@@ -2222,7 +2222,7 @@ static inline void widths_resize (void)
// next var may also be set by the guys that actually truncate stuff
Autox_found = 0;
@ -237,7 +239,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
if (Autox_array[i]) {
Fieldstab[i].width++;
Autox_array[i] = 0;
@@ -2229,58 +2229,58 @@ static void zap_fieldstab (void) {
@@ -2242,58 +2242,58 @@ static void zap_fieldstab (void) {
char buf[8];
if (!once) {
@ -263,7 +265,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
- Fieldstab[P_CPN].width = 1;
+ Fieldstab[EU_CPN].width = 1;
if (1 < (digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)smp_num_cpus()))) {
if (1 < (digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)smp_num_cpus))) {
if (5 < digits) error_exit(N_txt(FAIL_widecpu_txt));
- Fieldstab[P_CPN].width = digits;
+ Fieldstab[EU_CPN].width = digits;
@ -273,17 +275,17 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
Cpu_pmax = 99.9;
- Fieldstab[P_CPU].width = 5;
+ Fieldstab[EU_CPU].width = 5;
if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus();
if (smp_num_cpus() > 1000) {
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
if (smp_num_cpus > 1000) {
if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
- Fieldstab[P_CPU].width = 8;
+ Fieldstab[EU_CPU].width = 8;
} else if (smp_num_cpus() > 100) {
} else if (smp_num_cpus > 100) {
if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
- Fieldstab[P_CPU].width = 7;
+ Fieldstab[EU_CPU].width = 7;
} else if (smp_num_cpus() > 10) {
} else if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
- Fieldstab[P_CPU].width = 6;
+ Fieldstab[EU_CPU].width = 6;
@ -295,27 +297,27 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
Cpu_pmax = 99.9;
- Fieldstab[P_CPU].width = 4;
+ Fieldstab[EU_CPU].width = 4;
if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus();
if (smp_num_cpus() > 1000) {
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
if (smp_num_cpus > 1000) {
if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
- Fieldstab[P_CPU].width = 7;
+ Fieldstab[EU_CPU].width = 7;
} else if (smp_num_cpus() > 100) {
} else if (smp_num_cpus > 100) {
if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
- Fieldstab[P_CPU].width = 6;
+ Fieldstab[EU_CPU].width = 6;
} else if (smp_num_cpus() > 10) {
} else if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
- Fieldstab[P_CPU].width = 5;
+ Fieldstab[EU_CPU].width = 5;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
}
@@ -2289,23 +2289,23 @@ static void zap_fieldstab (void) {
@@ -2303,26 +2303,26 @@ static void zap_fieldstab (void) {
/* and accommodate optional wider non-scalable columns (maybe) */
if (!AUTOX_MODE) {
int i;
- Fieldstab[P_UED].width = Fieldstab[P_URD].width
- = Fieldstab[P_USD].width = Fieldstab[P_GID].width
+ Fieldstab[EU_UED].width = Fieldstab[EU_URD].width
@ -332,6 +334,10 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
- Fieldstab[P_WCH].width
+ Fieldstab[EU_WCH].width
= Rc.fixed_widest ? 10 + Rc.fixed_widest : 10;
- for (i = P_NS1; i < P_NS1 + NUM_NS; i++)
+ for (i = EU_NS1; i < EU_NS1 + NUM_NS; i++)
Fieldstab[i].width
= Rc.fixed_widest ? 10 + Rc.fixed_widest : 10;
}
/* plus user selectable scaling */
@ -346,7 +352,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
// lastly, ensure we've got proper column headers...
calibrate_fields();
@@ -3491,8 +3491,8 @@ static void configs_read (void) {
@@ -3510,8 +3510,8 @@ static void configs_read (void) {
default: // and future versions?
if (strlen(w->rc.fieldscur) != sizeof(DEF_FIELDS) - 1)
goto default_or_error;
@ -357,7 +363,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
goto default_or_error;
break;
}
@@ -3671,16 +3671,16 @@ static void parse_args (char **args) {
@@ -3690,16 +3690,16 @@ static void parse_args (char **args) {
else error_exit(fmtmk(N_fmt(MISSING_args_fmt), ch));
if (*cp == '+') { SETw(Curwin, Qsrt_NORMAL); ++cp; }
else if (*cp == '-') { OFFw(Curwin, Qsrt_NORMAL); ++cp; }
@ -377,7 +383,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
puts(N_col(i));
bye_bye(NULL);
case 'p':
@@ -4244,9 +4244,9 @@ static void other_selection (int ch) {
@@ -4263,9 +4263,9 @@ static void other_selection (int ch) {
}
ops = *(pval);
*(pval++) = '\0';
@ -389,7 +395,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
show_msg(fmtmk(N_fmt(XTRA_badflds_fmt), glob));
return;
}
@@ -4521,7 +4521,7 @@ static void keys_task (int ch) {
@@ -4540,7 +4540,7 @@ static void keys_task (int ch) {
if (*p == w->rc.sortindx) {
--p;
#ifndef USE_X_COLHDR
@ -398,7 +404,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
if (p >= w->procflgs) {
w->rc.sortindx = *p;
@@ -4542,7 +4542,7 @@ static void keys_task (int ch) {
@@ -4561,7 +4561,7 @@ static void keys_task (int ch) {
if (*p == w->rc.sortindx) {
++p;
#ifndef USE_X_COLHDR
@ -407,7 +413,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
if (p < w->procflgs + w->maxpflgs) {
w->rc.sortindx = *p;
@@ -4611,7 +4611,7 @@ static void keys_task (int ch) {
@@ -4630,7 +4630,7 @@ static void keys_task (int ch) {
case 'V':
if (VIZCHKw(w)) {
TOGw(w, Show_FOREST);
@ -416,7 +422,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
show_msg(fmtmk(N_fmt(FOREST_modes_fmt) , CHKw(w, Show_FOREST)
? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt)));
}
@@ -4731,13 +4731,13 @@ static void keys_window (int ch) {
@@ -4750,13 +4750,13 @@ static void keys_window (int ch) {
w->varcolbeg -= SCROLLAMT;
else if (0 < w->begpflg) {
w->begpflg -= 1;
@ -432,7 +438,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
}
#endif
break;
@@ -4748,14 +4748,14 @@ static void keys_window (int ch) {
@@ -4767,14 +4767,14 @@ static void keys_window (int ch) {
w->varcolbeg += SCROLLAMT;
if (0 > w->varcolbeg) w->varcolbeg = 0;
} else if (w->begpflg + 1 < w->totpflgs) {
@ -449,7 +455,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
w->begpflg += (w->begpflg + 3 < w->totpflgs) ? 3 : 0;
else w->begpflg += 1;
}
@@ -4812,19 +4812,19 @@ static void keys_xtra (int ch) {
@@ -4831,19 +4831,19 @@ static void keys_xtra (int ch) {
we would just whack do_key's key_tab entry and this function... */
switch (ch) {
case 'M':
@ -473,7 +479,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
// xmsg = "Time";
break;
default: // keep gcc happy
@@ -5204,30 +5204,30 @@ static const char *task_show (const WIN_
@@ -5223,30 +5223,30 @@ static const char *task_show (const WIN_
switch (i) {
#ifndef USE_X_COLHDR
// these 2 aren't real procflgs, they're used in column highlighting!
@ -512,7 +518,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
{ float u = (float)p->pcpu * Frame_etscale;
/* process can't use more %cpu than number of threads it has
( thanks Jaromir Capik <jcapik@redhat.com> ) */
@@ -5236,139 +5236,139 @@ static const char *task_show (const WIN_
@@ -5255,150 +5255,150 @@ static const char *task_show (const WIN_
cp = scale_pcnt(u, W, Jn);
}
break;
@ -566,6 +572,24 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
+ case EU_NCE:
cp = make_num(p->nice, W, Jn, AUTOX_NO);
break;
- case P_NS1: // IPCNS
- case P_NS2: // MNTNS
- case P_NS3: // NETNS
- case P_NS4: // PIDNS
- case P_NS5: // USERNS
- case P_NS6: // UTSNS
- { long ino = p->ns[i - P_NS1];
+ case EU_NS1: // IPCNS
+ case EU_NS2: // MNTNS
+ case EU_NS3: // NETNS
+ case EU_NS4: // PIDNS
+ case EU_NS5: // USERNS
+ case EU_NS6: // UTSNS
+ { long ino = p->ns[i - EU_NS1];
if (ino > 0) cp = make_num(ino, W, Jn, i);
else cp = make_str("-", W, Js, i);
}
break;
#ifdef OOMEM_ENABLE
- case P_OOA:
+ case EU_OOA:
@ -703,8 +727,8 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
break;
default: // keep gcc happy
--- top/top.h
+++ top/top.h 2014-05-15 11:25:39.890735226 +0000
@@ -181,27 +181,27 @@ char *strcasestr(const char *haystack, c
+++ top/top.h
@@ -181,28 +181,28 @@ char *strcasestr(const char *haystack, const char *needle);
/* Flags for each possible field (and then some) --
these MUST be kept in sync with the FLD_t Fieldstab[] array !! */
enum pflag {
@ -733,9 +757,11 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
- P_ENV,
- P_FV1, P_FV2,
- P_USE,
- P_NS1, P_NS2, P_NS3, P_NS4, P_NS5, P_NS6,
+ EU_ENV,
+ EU_FV1, EU_FV2,
+ EU_USE,
+ EU_NS1, EU_NS2, EU_NS3, EU_NS4, EU_NS5, EU_NS6,
#ifdef USE_X_COLHDR
// not really pflags, used with tbl indexing
- P_MAXPFLGS
@ -743,11 +769,11 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#else
// not really pflags, used with tbl indexing & col highlighting
- P_MAXPFLGS, X_XON, X_XOF
+ EU_MAXPFLGS, X_XON, X_XOF
+ EU_MAXPFLGS, EU_XON, EU_XOF
#endif
};
@@ -445,7 +445,7 @@ typedef struct WIN_t {
@@ -446,7 +446,7 @@ typedef struct WIN_t {
#define VARright(w) (1 == w->maxpflgs && VARcol(w->procflgs[0]))
#else
#define VARright(w) ((1 == w->maxpflgs && VARcol(w->procflgs[0])) || \
@ -756,7 +782,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#endif
#define VARleft(w) (w->varcolbeg && VARright(w))
#define SCROLLAMT 8
@@ -475,7 +475,7 @@ typedef struct WIN_t {
@@ -476,7 +476,7 @@ typedef struct WIN_t {
/* Used to create *most* of the sort callback functions
note: some of the callbacks are NOT your father's callbacks, they're
highly optimized to save them ol' precious cycles! */
@ -765,7 +791,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
#define SCB_NUM1(f,n) \
static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
if ( (*P)->n < (*Q)->n ) return SORT_lt; \
@@ -596,16 +596,16 @@ typedef struct WIN_t {
@@ -598,16 +598,16 @@ typedef struct WIN_t {
/* The default values for the local config file */
#define DEF_RCFILE { \
RCF_VERSION_ID, 0, 1, DEF_DELAY, 0, { \
@ -786,7 +812,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \
"Usr", USR_FIELDS } \
}, 0, SK_Kb, SK_Kb, 0 }
@@ -645,7 +645,7 @@ typedef struct WIN_t {
@@ -647,7 +647,7 @@ typedef struct WIN_t {
/* ( see the find_string function for the one true required protoype ) */
/*------ Sort callbacks ------------------------------------------------*/
/* for each possible field, in the form of: */
@ -795,8 +821,10 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
/*------ Tiny useful routine(s) ----------------------------------------*/
//atic const char *fmtmk (const char *fmts, ...);
//atic inline char *scat (char *dst, const char *src);
diff --git top/top_nls.c top/top_nls.c
index 1dd6d46..0f37d89 100644
--- top/top_nls.c
+++ top/top_nls.c 2014-05-15 11:26:38.222235592 +0000
+++ top/top_nls.c
@@ -94,8 +94,8 @@
* + none of the important translator only comments will
* clutter and obscure the main program
@ -808,7 +836,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
const char *Norm_nlstab[norm_MAX];
const char *Uniq_nlstab[uniq_MAX];
@@ -121,144 +121,144 @@ static void build_two_nlstabs (void) {
@@ -121,162 +121,162 @@ static void build_two_nlstabs (void) {
. */
/* Translation Hint: maximum 'PID' = 5 */
@ -1040,10 +1068,40 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
- Desc_nlstab[P_USE] = _("Res+Swap Size (KiB)");
+ Head_nlstab[EU_USE] = _("USED");
+ Desc_nlstab[EU_USE] = _("Res+Swap Size (KiB)");
/* Translation Hint: maximum 'nsIPC' = 10 */
- Head_nlstab[P_NS1] = _("nsIPC");
- Desc_nlstab[P_NS1] = _("IPC namespace Inode");
+ Head_nlstab[EU_NS1] = _("nsIPC");
+ Desc_nlstab[EU_NS1] = _("IPC namespace Inode");
/* Translation Hint: maximum 'nsMNT' = 10 */
- Head_nlstab[P_NS2] = _("nsMNT");
- Desc_nlstab[P_NS2] = _("MNT namespace Inode");
+ Head_nlstab[EU_NS2] = _("nsMNT");
+ Desc_nlstab[EU_NS2] = _("MNT namespace Inode");
/* Translation Hint: maximum 'nsNET' = 10 */
- Head_nlstab[P_NS3] = _("nsNET");
- Desc_nlstab[P_NS3] = _("NET namespace Inode");
+ Head_nlstab[EU_NS3] = _("nsNET");
+ Desc_nlstab[EU_NS3] = _("NET namespace Inode");
/* Translation Hint: maximum 'nsPID' = 10 */
- Head_nlstab[P_NS4] = _("nsPID");
- Desc_nlstab[P_NS4] = _("PID namespace Inode");
+ Head_nlstab[EU_NS4] = _("nsPID");
+ Desc_nlstab[EU_NS4] = _("PID namespace Inode");
/* Translation Hint: maximum 'nsUSER' = 10 */
- Head_nlstab[P_NS5] = _("nsUSER");
- Desc_nlstab[P_NS5] = _("USER namespace Inode");
+ Head_nlstab[EU_NS5] = _("nsUSER");
+ Desc_nlstab[EU_NS5] = _("USER namespace Inode");
/* Translation Hint: maximum 'nsUTS' = 10 */
- Head_nlstab[P_NS6] = _("nsUTS");
- Desc_nlstab[P_NS6] = _("UTS namespace Inode");
+ Head_nlstab[EU_NS6] = _("nsUTS");
+ Desc_nlstab[EU_NS6] = _("UTS namespace Inode");
}
@@ -663,7 +663,7 @@ void initialize_nls (void) {
@@ -681,7 +681,7 @@ void initialize_nls (void) {
memset(Head_nlstab, 0, sizeof(Head_nlstab));
memset(Desc_nlstab, 0, sizeof(Desc_nlstab));
build_two_nlstabs();
@ -1052,3 +1110,6 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
if (!Head_nlstab[i]) {
fprintf(stderr, nls_err, "Head", i);
exit(1);
--
1.7.9.2

View File

@ -0,0 +1,176 @@
From 8e7ef322e21b2232d2a1ff9482ec8ce2808fc5c3 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Sun, 2 Feb 2014 18:13:01 +1100
Subject: [PATCH] Update help files
Benno Schulenberg suggested some changes to the help messages
to provide some consistency and clarity for both the users and
translators of procps.
The test needed to be updated as the pmap output changed too.
Signed-off-by: Craig Small <csmall@enc.com.au>
---
pgrep.c | 14 +++++++-------
pidof.c | 2 +-
pmap.c | 2 +-
ps/help.c | 22 +++++++++++-----------
skill.c | 6 +++---
testsuite/pmap.test/pmap.exp | 2 +-
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git pgrep.c pgrep.c
index fda7924..d8d3dcb 100644
--- pgrep.c
+++ pgrep.c
@@ -115,19 +115,19 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
}
fputs(_(" -c, --count count of matching processes\n"), fp);
fputs(_(" -f, --full use full process name to match\n"), fp);
- fputs(_(" -g, --pgroup <id,...> match listed process group IDs\n"), fp);
- fputs(_(" -G, --group <gid,...> match real group IDs\n"), fp);
+ fputs(_(" -g, --pgroup <PGID,...> match listed process group IDs\n"), fp);
+ fputs(_(" -G, --group <GID,...> match real group IDs\n"), fp);
fputs(_(" -n, --newest select most recently started\n"), fp);
fputs(_(" -o, --oldest select least recently started\n"), fp);
- fputs(_(" -P, --parent <ppid,...> match only child processes of the given parent\n"), fp);
- fputs(_(" -s, --session <sid,...> match session IDs\n"), fp);
+ fputs(_(" -P, --parent <PPID,...> match only child processes of the given parent\n"), fp);
+ fputs(_(" -s, --session <SID,...> match session IDs\n"), fp);
fputs(_(" -t, --terminal <tty,...> match by controlling terminal\n"), fp);
- fputs(_(" -u, --euid <id,...> match by effective IDs\n"), fp);
- fputs(_(" -U, --uid <id,...> match by real IDs\n"), fp);
+ fputs(_(" -u, --euid <ID,...> match by effective IDs\n"), fp);
+ fputs(_(" -U, --uid <ID,...> match by real IDs\n"), fp);
fputs(_(" -x, --exact match exactly with the command name\n"), fp);
fputs(_(" -F, --pidfile <file> read PIDs from file\n"), fp);
fputs(_(" -L, --logpidfile fail if PID file is not locked\n"), fp);
- fputs(_(" --ns <pid> match the processes that belong to the same\n"
+ fputs(_(" --ns <PID> match the processes that belong to the same\n"
" namespace as <pid>\n"), fp);
fputs(_(" --nslist <ns,...> list which namespaces will be considered for\n"
" the --ns option.\n"
diff --git pidof.c pidof.c
index 6a38675..d1a9f31 100644
--- pidof.c
+++ pidof.c
@@ -62,7 +62,7 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
fputs(USAGE_OPTIONS, fp);
fputs(_(" -s, --single-shot return one PID only\n"), fp);
fputs(_(" -c, --check-root omit processes with different root\n"), fp);
- fputs(_(" -x scripts too\n"), fp);
+ fputs(_(" -x also find shells running the named scripts\n"), fp);
fputs(_(" -o, --omit-pid <PID,...> omit processes with PID\n"), fp);
fputs(USAGE_SEPARATOR, fp);
fputs(USAGE_HELP, fp);
diff --git pmap.c pmap.c
index 4ecabce..66c1c2d 100644
--- pmap.c
+++ pmap.c
@@ -106,7 +106,7 @@ usage(FILE * out)
{
fputs(USAGE_HEADER, out);
fprintf(out,
- _(" %s [options] pid [pid ...]\n"), program_invocation_short_name);
+ _(" %s [options] PID [PID ...]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(_(" -x, --extended show details\n"), out);
fputs(_(" -X show even more details\n"), out);
diff --git ps/help.c ps/help.c
index 9133903..1b98b73 100644
--- ps/help.c
+++ ps/help.c
@@ -109,18 +109,18 @@ void do_help (const char *opt, int rc) {
if (section == HELP_LST || section == HELP_ALL) {
fputs(_("\nSelection by list:\n"), out);
fputs(_(" -C <command> command name\n"), out);
- fputs(_(" -G, --Group <gid> real group id or name\n"), out);
+ fputs(_(" -G, --Group <GID> real group id or name\n"), out);
fputs(_(" -g, --group <group> session or effective group name\n"), out);
- fputs(_(" -p, --pid <pid> process id\n"), out);
- fputs(_(" --ppid <pid> select by parent process id\n"), out);
+ fputs(_(" -p, --pid <PID> process id\n"), out);
+ fputs(_(" --ppid <PID> select by parent process id\n"), out);
fputs(_(" -s, --sid <session> session id\n"), out);
fputs(_(" -t, t, --tty <tty> terminal\n"), out);
- fputs(_(" -u, U, --user <uid> effective user id or name\n"), out);
- fputs(_(" -U, --User <uid> real user id or name\n"), out);
+ fputs(_(" -u, U, --user <UID> effective user id or name\n"), out);
+ fputs(_(" -U, --User <UID> real user id or name\n"), out);
fputs(_("\n"
- " selection <arguments> take either:\n"
- " comma-separated list e.g. '-u root,nobody' or\n"
- " blank-separated list e.g. '-p 123 4567'\n"), out);
+ " The selection options take as their argument either:\n"
+ " a comma-separated list e.g. '-u root,nobody' or\n"
+ " or a blank-separated list e.g. '-p 123 4567'\n"), out);
}
if (section == HELP_OUT || section == HELP_ALL) {
fputs(_("\nOutput formats:\n"), out);
@@ -136,7 +136,7 @@ void do_help (const char *opt, int rc) {
fputs(_(" -O <format> preloaded with default columns\n"), out);
fputs(_(" O <format> as -O, with BSD personality\n"), out);
fputs(_(" -o, o, --format <format>\n"
- " user defined format\n"), out);
+ " user-defined format\n"), out);
fputs(_(" s signal format\n"), out);
fputs(_(" u user-oriented format\n"), out);
fputs(_(" v virtual memory format\n"), out);
@@ -152,7 +152,7 @@ void do_help (const char *opt, int rc) {
}
if (section == HELP_THD || section == HELP_ALL) {
fputs(_("\nShow threads:\n"), out);
- fputs(_(" H as if they where processes\n"), out);
+ fputs(_(" H as if they were processes\n"), out);
fputs(_(" -L possibly with LWP and NLWP columns\n"), out);
fputs(_(" -m, m after processes\n"), out);
fputs(_(" -T possibly with SPID column\n"), out);
@@ -163,7 +163,7 @@ void do_help (const char *opt, int rc) {
fputs(_(" c show true command name\n"), out);
fputs(_(" e show the environment after command\n"), out);
fputs(_(" k, --sort specify sort order as: [+|-]key[,[+|-]key[,...]]\n"), out);
- fputs(_(" L list format specifiers\n"), out);
+ fputs(_(" L show format specifiers\n"), out);
fputs(_(" n display numeric uid and wchan\n"), out);
fputs(_(" S, --cumulative include some dead child process data\n"), out);
fputs(_(" -y do not show flags, show rss (only with -l)\n"), out);
diff --git skill.c skill.c
index 60ed274..9f3b4fc 100644
--- skill.c
+++ skill.c
@@ -356,7 +356,7 @@ static void __attribute__ ((__noreturn__)) skillsnice_usage(FILE * out)
fputs(_(" -i, --interactive interactive\n"), out);
fputs(_(" -l, --list list all signal names\n"), out);
fputs(_(" -L, --table list all signal names in a nice table\n"), out);
- fputs(_(" -n, --no-action no action\n"), out);
+ fputs(_(" -n, --no-action do not actually kill processes; just print what would happen\n"), out);
fputs(_(" -v, --verbose explain what is being done\n"), out);
fputs(_(" -w, --warnings enable warnings (not implemented)\n"), out);
fputs(USAGE_SEPARATOR, out);
@@ -371,8 +371,8 @@ static void __attribute__ ((__noreturn__)) skillsnice_usage(FILE * out)
fputs(_(" --ns <pid> match the processes that belong to the same\n"
" namespace as <pid>\n"), out);
fputs(_(" --nslist <ns,...> list which namespaces will be considered for\n"
- " the --ns option.\n"
- " Available namespaces: ipc, mnt, net, pid, user, uts\n"), out);
+ " the --ns option; available namespaces are\n:"
+ " ipc, mnt, net, pid, user, uts\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_SEPARATOR, out);
diff --git testsuite/pmap.test/pmap.exp testsuite/pmap.test/pmap.exp
index bc2550a..5a9e603 100644
--- testsuite/pmap.test/pmap.exp
+++ testsuite/pmap.test/pmap.exp
@@ -22,7 +22,7 @@ set pmap_ext_footer "\[ -\]+\\s+total kB\\s+\\d+(\\s+\[\\d-\]+){2,3}\\s*\$"
set test "pmap with no arguments"
spawn $pmap
#expect_pass "$test" "^\(lt-\)\?pmap: argument missing"
-expect_pass "$test" "Usage:\\s+\(lt-\)?pmap \\\[options\\\] pid \\\[pid \.\.\.\\\]"
+expect_pass "$test" "Usage:\\s+\(lt-\)?pmap \\\[options\\\] PID \\\[PID \.\.\.\\\]"
set test "pmap standard output"
spawn $pmap $mypid
--
1.7.9.2

View File

@ -1,4 +1,4 @@
Based on 22e658297494e11ef92a81069b49a40420b8d824 Mon Sep 17 00:00:00 2001
From 22e658297494e11ef92a81069b49a40420b8d824 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 25 Apr 2014 00:00:00 -0500
Subject: [PATCH] top: protect against distortion when system time reset
@ -49,9 +49,11 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git top/top.c top/top.c
index d767495..cbcb152 100644
--- top/top.c
+++ top/top.c 2014-05-15 00:00:00.000000000 +0000
@@ -2514,17 +2514,14 @@ static void procs_hlp (proc_t *this) {
+++ top/top.c
@@ -2518,17 +2518,14 @@ static void procs_hlp (proc_t *this) {
HST_t *h;
if (!this) {
@ -73,4 +75,7 @@ Signed-off-by: Jim Warner <james.warner@comcast.net>
+ uptime_sav = uptime_cur;
// if in Solaris mode, adjust our scaling for all cpus
Frame_etscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : smp_num_cpus()));
Frame_etscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : smp_num_cpus));
--
1.7.9.2

View File

@ -0,0 +1,386 @@
Based on 4fcd56bf582ee2ef5b205625ca3d1bfed90364e9 Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Tue, 4 Feb 2014 19:10:42 +0100
Subject: [PATCH] vmstat: Support for timestamps with '-t' & fix for '-wd'
From now the vmstat can append a timestamp to each line in the
VMSTAT and DISKSTAT mode. You can achieve that with the '-t'
switch.
The '-w' switch now works in the DISKSTAT mode too.
---
vmstat.8 | 3 +
vmstat.c | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 167 insertions(+), 33 deletions(-)
diff --git vmstat.8 vmstat.8
index ef6cbe9..420d9f3 100644
--- vmstat.8
+++ vmstat.8
@@ -74,6 +74,9 @@ or 1048576
bytes. Note this does not change the swap (si/so) or block (bi/bo)
fields.
.TP
+\fB\-t\fR, \fB\-\-timestamp\fR
+Append timestamp to each line
+.TP
\fB\-w\fR, \fB\-\-wide\fR
Wide output mode (useful for systems with higher amount of memory,
where the default output mode suffers from unwanted column breakage).
diff --git vmstat.c vmstat.c
index c01351d..a84d2d2 100644
--- vmstat.c
+++ vmstat.c
@@ -43,6 +43,7 @@
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
+#include <time.h>
#include "c.h"
#include "fileutils.h"
#include "nls.h"
@@ -75,6 +76,9 @@ static int a_option;
/* "-w" means "wide output" */
static int w_option;
+/* "-t" means "show timestamp" */
+static int t_option;
+
static unsigned sleep_time = 1;
static int infinite_updates = 0;
static unsigned long num_updates;
@@ -100,6 +104,7 @@ static void __attribute__ ((__noreturn__))
fputs(_(" -p, --partition <dev> partition specific statistics\n"), out);
fputs(_(" -S, --unit <char> define display unit\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
+ fputs(_(" -t, --timestamp show timestamp\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
@@ -180,21 +185,33 @@ static int format_1000(unsigned long long val64, char *restrict dst)
static void new_header(void)
{
+ struct tm *tm_ptr;
+ time_t the_time;
+ char timebuf[32];
+
/* Translation Hint: Translating folloging header & fields
* that follow (marked with max x chars) might not work,
* unless manual page is translated as well. */
-
- const char header[] =
- "procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n";
- const char wide_header[] =
- "procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu--------\n";
+ const char *header =
+ _("procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----");
+ const char *wide_header =
+ _("procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu--------");
+ const char *timestamp_header = _(" -----timestamp-----");
const char format[] =
- "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n";
+ "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s";
const char wide_format[] =
- "%2s %2s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s\n";
+ "%2s %2s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s";
+
+
+ printf(w_option ? wide_header : header);
+
+ if (t_option) {
+ printf(timestamp_header);
+ }
+
+ printf("\n");
- printf(w_option ? _(wide_header) : _(header));
printf(
w_option ? wide_format : format,
/* Translation Hint: max 2 chars */
@@ -235,6 +252,19 @@ static void new_header(void)
_("wa"),
/* Translation Hint: max 2 chars */
_("st"));
+
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ if (strftime(timebuf, sizeof(timebuf), "%Z", tm_ptr)) {
+ timebuf[strlen(timestamp_header) - 1] = '\0';
+ } else {
+ timebuf[0] = '\0';
+ }
+ printf(" %*s", (int)(strlen(timestamp_header) - 1), timebuf);
+ }
+
+ printf("\n");
}
static unsigned long unitConvert(unsigned long size)
@@ -247,9 +277,9 @@ static unsigned long unitConvert(unsigned long size)
static void new_format(void)
{
const char format[] =
- "%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
+ "%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u";
const char wide_format[] =
- "%2u %2u %12lu %12lu %12lu %12lu %4u %4u %5u %5u %4u %4u %3u %3u %3u %3u %3u\n";
+ "%2u %2u %12lu %12lu %12lu %12lu %4u %4u %5u %5u %4u %4u %3u %3u %3u %3u %3u";
unsigned int tog = 0; /* toggle switch for cleaner code */
unsigned int i;
@@ -263,6 +293,9 @@ static void new_format(void)
unsigned int sleep_half;
unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
long long debt = 0; /* handle idle ticks running backwards */
+ struct tm *tm_ptr;
+ time_t the_time;
+ char timebuf[32];
sleep_half = (sleep_time / 2);
new_header();
@@ -272,6 +305,12 @@ static void new_format(void)
cpu_zzz, pgpgin, pgpgout, pswpin, pswpout, intr, ctxt, &running,
&blocked, &dummy_1, &dummy_2);
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
+ }
+
duse = *cpu_use + *cpu_nic;
dsys = *cpu_sys + *cpu_xxx + *cpu_yyy;
didl = *cpu_idl;
@@ -298,6 +337,12 @@ static void new_format(void)
(unsigned)( (100*dstl + divo2) / Div )
);
+ if (t_option) {
+ printf(" %s", timebuf);
+ }
+
+ printf("\n");
+
/* main loop */
for (i = 1; infinite_updates || i < num_updates; i++) {
sleep(sleep_time);
@@ -313,6 +358,12 @@ static void new_format(void)
pgpgout + tog, pswpin + tog, pswpout + tog, intr + tog,
ctxt + tog, &running, &blocked, &dummy_1, &dummy_2);
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
+ }
+
duse =
cpu_use[tog] - cpu_use[!tog] + cpu_nic[tog] - cpu_nic[!tog];
dsys =
@@ -364,6 +415,12 @@ static void new_format(void)
/* st */
(unsigned)( (100*dstl+divo2)/Div )
);
+
+ if (t_option) {
+ printf(" %s", timebuf);
+ }
+
+ printf("\n");
}
}
@@ -453,11 +510,33 @@ static int diskpartition_format(const char *partition_name)
static void diskheader(void)
{
+ struct tm *tm_ptr;
+ time_t the_time;
+ char timebuf[32];
+
/* Translation Hint: Translating folloging header & fields
* that follow (marked with max x chars) might not work,
* unless manual page is translated as well. */
- printf(_("disk- ------------reads------------ ------------writes----------- -----IO------\n"));
- printf("%5s %6s %6s %7s %7s %6s %6s %7s %7s %6s %6s\n",
+ const char *header =
+ _("disk- ------------reads------------ ------------writes----------- -----IO------");
+ const char *wide_header =
+ _("disk- -------------------reads------------------- -------------------writes------------------ ------IO-------");
+ const char *timestamp_header = _(" -----timestamp-----");
+
+ const char format[] =
+ "%5s %6s %6s %7s %7s %6s %6s %7s %7s %6s %6s";
+ const char wide_format[] =
+ "%5s %9s %9s %11s %11s %9s %9s %11s %11s %7s %7s";
+
+ printf(w_option ? wide_header : header);
+
+ if (t_option) {
+ printf(timestamp_header);
+ }
+
+ printf("\n");
+
+ printf(w_option ? wide_format : format,
" ",
/* Translation Hint: max 6 chars */
_("total"),
@@ -479,25 +558,53 @@ static void diskheader(void)
_("cur"),
/* Translation Hint: max 6 chars */
_("sec"));
+
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ if (strftime(timebuf, sizeof(timebuf), "%Z", tm_ptr)) {
+ timebuf[strlen(timestamp_header) - 1] = '\0';
+ } else {
+ timebuf[0] = '\0';
+ }
+ printf(" %*s", (int)(strlen(timestamp_header) - 1), timebuf);
+ }
+
+ printf("\n");
}
static void diskformat(void)
{
+ const char format[] =
+ "%-5s %6u %6u %7llu %7u %6u %6u %7llu %7u %6u %6u";
+ const char wide_format[] =
+ "%-5s %9u %9u %11llu %11u %9u %9u %11llu %11u %7u %7u";
+
FILE *fDiskstat;
struct disk_stat *disks;
struct partition_stat *partitions;
unsigned long ndisks, i, j, k;
- const char format[] = "%-5s %6u %6u %7llu %7u %6u %6u %7llu %7u %6u %6u\n";
+ struct tm *tm_ptr;
+ time_t the_time;
+ char timebuf[32];
+
if ((fDiskstat = fopen("/proc/diskstats", "rb"))) {
fclose(fDiskstat);
ndisks = getdiskstat(&disks, &partitions);
+
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
+ }
+
if (!moreheaders)
diskheader();
for (k = 0; k < ndisks; k++) {
if (moreheaders && ((k % height) == 0))
diskheader();
- printf(format,
+ printf(w_option ? wide_format : format,
disks[k].disk_name,
disks[k].reads,
disks[k].merged_reads,
@@ -510,31 +617,51 @@ static void diskformat(void)
disks[k].inprogress_IO ? disks[k].inprogress_IO / 1000 : 0,
disks[k].milli_spent_IO ? disks[k].
milli_spent_IO / 1000 : 0);
+
+ if (t_option) {
+ printf(" %s", timebuf);
+ }
+
+ printf("\n");
fflush(stdout);
}
free(disks);
free(partitions);
+
for (j = 1; infinite_updates || j < num_updates; j++) {
sleep(sleep_time);
ndisks = getdiskstat(&disks, &partitions);
- for (i = 0; i < ndisks; i++, k++) {
- if (moreheaders && ((k % height) == 0))
- diskheader();
- printf(format,
- disks[i].disk_name,
- disks[i].reads,
- disks[i].merged_reads,
- disks[i].reads_sectors,
- disks[i].milli_reading,
- disks[i].writes,
- disks[i].merged_writes,
- disks[i].written_sectors,
- disks[i].milli_writing,
- disks[i].inprogress_IO ? disks[i].inprogress_IO / 1000 : 0,
- disks[i].milli_spent_IO ? disks[i].
- milli_spent_IO / 1000 : 0);
- fflush(stdout);
- }
+
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
+ }
+
+ for (i = 0; i < ndisks; i++, k++) {
+ if (moreheaders && ((k % height) == 0))
+ diskheader();
+ printf(w_option ? wide_format : format,
+ disks[i].disk_name,
+ disks[i].reads,
+ disks[i].merged_reads,
+ disks[i].reads_sectors,
+ disks[i].milli_reading,
+ disks[i].writes,
+ disks[i].merged_writes,
+ disks[i].written_sectors,
+ disks[i].milli_writing,
+ disks[i].inprogress_IO ? disks[i].inprogress_IO / 1000 : 0,
+ disks[i].milli_spent_IO ? disks[i].
+ milli_spent_IO / 1000 : 0);
+
+ if (t_option) {
+ printf(" %s", timebuf);
+ }
+
+ printf("\n");
+ fflush(stdout);
+ }
free(disks);
free(partitions);
}
@@ -740,6 +867,7 @@ int main(int argc, char *argv[])
{"partition", required_argument, NULL, 'p'},
{"unit", required_argument, NULL, 'S'},
{"wide", no_argument, NULL, 'w'},
+ {"timestamp", no_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
@@ -754,7 +882,7 @@ int main(int argc, char *argv[])
atexit(close_stdout);
while ((c =
- getopt_long(argc, argv, "afmnsdDp:S:whV", longopts,
+ getopt_long(argc, argv, "afmnsdDp:S:wthV", longopts,
NULL)) != EOF)
switch (c) {
case 'V':
@@ -820,6 +948,9 @@ int main(int argc, char *argv[])
case 'w':
w_option = 1;
break;
+ case 't':
+ t_option = 1;
+ break;
default:
/* no other aguments defined yet. */
usage(stderr);
--
1.7.9.2

View File

@ -0,0 +1,34 @@
From 835b6294d18a6ad79ff56aaeb0038bc6d006384b Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Tue, 4 Feb 2014 09:46:58 -0800
Subject: [PATCH] watch: Don't leak extra fds to the child
Once the write side of the pipe has been duped to stdout for the child,
the original pipefd is no longer needed, so it can be closed to avoid
leaking to the child.
The leak can easily be seen with "watch ls -l /proc/self/fd", but I
found this due to "watch lvs" diagnosing itself:
File descriptor 4 (pipe:[3163616]) leaked on lvs invocation.
Signed-off-by: Josh Stone <jistone@redhat.com>
---
watch.c | 1 +
1 file changed, 1 insertion(+)
diff --git watch.c watch.c
index 032dfb7..f0a3ec3 100644
--- watch.c
+++ watch.c
@@ -387,6 +387,7 @@ static int run_command(char *restrict command, char **restrict command_argv)
if (dup2(pipefd[1], 1) < 0) { /* replace stdout with write side of pipe */
xerr(3, _("dup2 failed"));
}
+ close(pipefd[1]); /* once duped, the write fd isn't needed */
dup2(1, 2); /* stderr should default to stdout */
if (flags & WATCH_EXEC) { /* pass command to exec instead of system */
--
1.7.9.2

View File

@ -0,0 +1,46 @@
From dc072aced7250fed9b01fb05f0d672678752a63e Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Wed, 5 Feb 2014 17:09:45 +0100
Subject: [PATCH] vmstat: Fixing format-security flaws
Previously the headers were printed directly without
the format specifier. That way is considered insecure
and leads to build errors with -Werror=format-security
flag set.
---
vmstat.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git vmstat.c vmstat.c
index a84d2d2..a2fd351 100644
--- vmstat.c
+++ vmstat.c
@@ -204,10 +204,10 @@ static void new_header(void)
"%2s %2s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s";
- printf(w_option ? wide_header : header);
+ printf("%s", w_option ? wide_header : header);
if (t_option) {
- printf(timestamp_header);
+ printf("%s", timestamp_header);
}
printf("\n");
@@ -528,10 +528,10 @@ static void diskheader(void)
const char wide_format[] =
"%5s %9s %9s %11s %11s %9s %9s %11s %11s %7s %7s";
- printf(w_option ? wide_header : header);
+ printf("%s", w_option ? wide_header : header);
if (t_option) {
- printf(timestamp_header);
+ printf("%s", timestamp_header);
}
printf("\n");
--
1.7.9.2

View File

@ -0,0 +1,27 @@
From 2ade4b082b8c970bb1e1a6711d79f82b90075431 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Sat, 22 Feb 2014 11:34:53 +1100
Subject: [PATCH] Added get-trans target to Makefile
The get-trans target rsyncs the latest copies of translation files
from the translation project. I put this target in because I always
forget the exact syntax of the command.
Signed-off-by: Craig Small <csmall@enc.com.au>
---
Makefile.am | 2 ++
1 file changed, 2 insertions(+)
diff --git Makefile.am Makefile.am
index 7075e67..335fbc5 100644
--- Makefile.am
+++ Makefile.am
@@ -123,3 +123,5 @@ $(top_srcdir)/.version:
dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
+get-trans:
+ rsync -Lrtvz translationproject.org::tp/latest/procps/ po
--
1.7.9.2

View File

@ -0,0 +1,155 @@
Based on 3569c0351fae7797e8d62feae7229d2d6d2aa0a1 Mon Sep 17 00:00:00 2001
From: Jakob Unterwurzacher <jakobunt@gmail.com>
Date: Tue, 18 Feb 2014 22:12:21 +0100
Subject: [PATCH] library: properly handle memory used by tmpfs
tmpfs has become much more widely used since distributions use it for
/tmp (Fedora 18+). In /proc/meminfo, memory used by tmpfs is accounted
into "Cached" (aka "NR_FILE_PAGES",
http://lxr.free-electrons.com/source/mm/shmem.c#L301 ).
The tools just pass it on, so what top, free and vmstat report as
"cached" is the sum of page cache and tmpfs.
free has the extremely useful "-/+ buffers/cache" output. However, now
that tmpfs is accounted into "cached", those numbers are way off once
you have big files in /tmp.
Fortunately, kernel 2.6.32 introduces "Shmem", which makes tmpfs memory
usage accessible from userspace (
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4b02108ac1b3354a22b0d83c684797692efdc395 ).
This patch substracts Shmem from Cached to get the actual page cache
memory. This makes both issues mentioned above disappear. For older
kernels, Shmem is not available (hence zero) and this patch is no-op.
Additionally:
* Update the man pages of free and vmstat to explain what is happening
* Finally drop "MemShared" from the /proc/meminfo parser, it has been
dead for 10+ years and is only causing confusion ( removed in kernel
2.5.54, see
https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/?id=fe04e9451e5a159247cf9f03c615a4273ac0c571 )
---
free.1 | 29 ++++++++++++++++++++++++-----
proc/sysinfo.c | 8 ++++----
proc/sysinfo.h | 3 +--
vmstat.8 | 3 ++-
4 files changed, 31 insertions(+), 12 deletions(-)
diff --git free.1 free.1
index 1e8e7ef..21cce28 100644
--- free.1
+++ free.1
@@ -11,11 +11,30 @@ free \- Display amount of free and used memory in the system
.SH DESCRIPTION
.B free
displays the total amount of free and used physical and swap memory in the
-system, as well as the buffers used by the kernel.
-The shared memory column represents either the MemShared value (2.4 series
-kernels) or the Shmem value (2.6 series kernels and later) taken from the
-/proc/meminfo file. The value is zero if none of the entries is exported
-by the kernel.
+system, as well as the buffers and caches used by the kernel. The
+information is gathered by parsing /proc/meminfo. The displayed
+columns are:
+.TP
+\fBtotal\fR
+Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
+.TP
+\fBused\fR
+Used memory (calculated as total - free)
+.TP
+\fBfree\fR
+Unused memory (MemFree and SwapFree in /proc/meminfo)
+.TP
+\fBshared\fR
+Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on
+kernels 2.6.32, displayed as zero if not available)
+.TP
+\fBbuffers\fR
+Memory used by kernel buffers (Buffers in /proc/meminfo)
+.TP
+\fBcached\fR
+Memory used by the page cache (calculated as Cached - Shmem in
+/proc/meminfo - the Cached value is actually the sum of page cache and
+tmpfs memory)
.SH OPTIONS
.TP
\fB\-b\fR, \fB\-\-bytes\fR
diff --git proc/sysinfo.c proc/sysinfo.c
index 1680cc4..e07ca86 100644
--- proc/sysinfo.c
+++ proc/sysinfo.c
@@ -531,7 +531,6 @@ static int compare_mem_table_structs(const void *a, const void *b){
*
* MemTotal: 61768 kB old
* MemFree: 1436 kB old
- * MemShared: 0 kB old (now always zero; not calculated)
* Buffers: 1312 kB old
* Cached: 20932 kB old
* Active: 12464 kB new
@@ -560,7 +559,7 @@ static int compare_mem_table_structs(const void *a, const void *b){
* Hugepagesize: 4096 kB 2.5.??+
*/
-/* obsolete since 2.6.x, but reused for shmem in 2.6.32+ */
+/* Shmem in 2.6.32+ */
unsigned long kb_main_shared;
/* old but still kicking -- the important stuff */
unsigned long kb_main_buffers;
@@ -631,14 +630,13 @@ void meminfo(void){
{"LowTotal", &kb_low_total},
{"Mapped", &kb_mapped}, // kB version of vmstat nr_mapped
{"MemFree", &kb_main_free}, // important
- {"MemShared", &kb_main_shared}, // obsolete since kernel 2.6! (sharing the variable with Shmem replacement)
{"MemTotal", &kb_main_total}, // important
{"NFS_Unstable", &kb_nfs_unstable},
{"PageTables", &kb_pagetables}, // kB version of vmstat nr_page_table_pages
{"ReverseMaps", &nr_reversemaps}, // same as vmstat nr_page_table_pages
{"SReclaimable", &kb_swap_reclaimable}, // "swap reclaimable" (dentry and inode structures)
{"SUnreclaim", &kb_swap_unreclaimable},
- {"Shmem", &kb_main_shared}, // kernel 2.6 and later (sharing the output variable with obsolete MemShared)
+ {"Shmem", &kb_main_shared}, // kernel 2.6.32 and later
{"Slab", &kb_slab}, // kB version of vmstat nr_slab
{"SwapCached", &kb_swap_cached},
{"SwapFree", &kb_swap_free}, // important
@@ -690,6 +688,8 @@ nextline:
kb_main_used = 0;
}
kb_main_cached += kb_swap_reclaimable + kb_swap_cached + kb_nfs_unstable;
+ /* "Cached" includes "Shmem" - we want only the page cache here */
+ kb_main_cached -= kb_main_shared;
}
/*****************************************************************/
diff --git proc/sysinfo.h proc/sysinfo.h
index 1eb3472..2291631 100644
--- proc/sysinfo.h
+++ proc/sysinfo.h
@@ -20,8 +20,7 @@ extern int uptime (double *uptime_secs, double *idle_secs);
extern unsigned long getbtime(void);
extern void loadavg(double *av1, double *av5, double *av15);
-
-/* obsolete */
+/* Shmem in 2.6.32+ */
extern unsigned long kb_main_shared;
/* old but still kicking -- the important stuff */
extern unsigned long kb_main_buffers;
diff --git vmstat.8 vmstat.8
index 420d9f3..2782a42 100644
--- vmstat.8
+++ vmstat.8
@@ -102,7 +102,8 @@ b: The number of processes in uninterruptible sleep.
swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
-cache: the amount of memory used as cache.
+cache: the amount of memory used as cache (excluding tmpfs memory for
+kernels 2.6.32+)
inact: the amount of inactive memory. (\-a option)
active: the amount of active memory. (\-a option)
.fi
--
1.7.9.2

106
0046-Minor-i18n-fixes.patch Normal file
View File

@ -0,0 +1,106 @@
From 2ec9f5c22e3eeaf4da514e0e6ec9374cfdbb9a99 Mon Sep 17 00:00:00 2001
From: Yuri Chornoivan <yurchor@ukr.net>
Date: Mon, 3 Mar 2014 21:58:56 +1100
Subject: [PATCH] Minor i18n fixes
Minor fixes that the translator (Yuri) has found in some of the
strings. You only know how many typos and thinkos you have when
someone is trying to translate it.
Signed-off-by: Craig Small <csmall@enc.com.au>
---
ps/help.c | 4 ++--
skill.c | 2 +-
slabtop.c | 4 ++++
top/top.c | 2 +-
top/top_nls.c | 2 +-
5 files changed, 9 insertions(+), 5 deletions(-)
diff --git ps/help.c ps/help.c
index 1b98b73..8bde12b 100644
--- ps/help.c
+++ ps/help.c
@@ -120,7 +120,7 @@ void do_help (const char *opt, int rc) {
fputs(_("\n"
" The selection options take as their argument either:\n"
" a comma-separated list e.g. '-u root,nobody' or\n"
- " or a blank-separated list e.g. '-p 123 4567'\n"), out);
+ " a blank-separated list e.g. '-p 123 4567'\n"), out);
}
if (section == HELP_OUT || section == HELP_ALL) {
fputs(_("\nOutput formats:\n"), out);
@@ -141,7 +141,7 @@ void do_help (const char *opt, int rc) {
fputs(_(" u user-oriented format\n"), out);
fputs(_(" v virtual memory format\n"), out);
fputs(_(" X register format\n"), out);
- fputs(_(" -y do not show flags, show rrs vs. addr (used with -l)\n"), out);
+ fputs(_(" -y do not show flags, show rss vs. addr (used with -l)\n"), out);
fputs(_(" --context display security context (for SELinux)\n"), out);
fputs(_(" --headers repeat header lines, one per page\n"), out);
fputs(_(" --no-headers do not print header at all\n"), out);
diff --git skill.c skill.c
index 9f3b4fc..2b1ce2f 100644
--- skill.c
+++ skill.c
@@ -751,7 +751,7 @@ int main(int argc, char ** argv)
kill_main(argc, argv);
break;
default:
- fprintf(stderr, _("skill: \"%s\" is not support\n"),
+ fprintf(stderr, _("skill: \"%s\" is not supported\n"),
program_invocation_short_name);
fprintf(stderr, USAGE_MAN_TAIL("skill(1)"));
return EXIT_FAILURE;
diff --git slabtop.c slabtop.c
index c135ec5..4be35b9 100644
--- slabtop.c
+++ slabtop.c
@@ -376,15 +376,19 @@ int main(int argc, char *argv[])
" %-35s: %.2fK / %.2fK / %.2fK\n\n",
/* Translation Hint: Next five strings must not
* exceed 35 length in characters. */
+ /* xgettext:no-c-format */
_("Active / Total Objects (% used)"),
stats.nr_active_objs, stats.nr_objs,
100.0 * stats.nr_active_objs / stats.nr_objs,
+ /* xgettext:no-c-format */
_("Active / Total Slabs (% used)"),
stats.nr_active_slabs, stats.nr_slabs,
100.0 * stats.nr_active_slabs / stats.nr_slabs,
+ /* xgettext:no-c-format */
_("Active / Total Caches (% used)"),
stats.nr_active_caches, stats.nr_caches,
100.0 * stats.nr_active_caches / stats.nr_caches,
+ /* xgettext:no-c-format */
_("Active / Total Size (% used)"),
stats.active_size / 1024.0, stats.total_size / 1024.0,
100.0 * stats.active_size / stats.total_size,
diff --git top/top.c top/top.c
index ca3d24a..d767495 100644
--- top/top.c
+++ top/top.c
@@ -779,7 +779,7 @@ static int show_pmt (const char *str) {
* Our special formatting consists of:
* "some text <_delimiter_> some more text <_delimiter_>...\n"
* Where <_delimiter_> is a two byte combination consisting of a
- * tilde followed by an ascii digit in the the range of 1 - 8.
+ * tilde followed by an ascii digit in the range of 1 - 8.
* examples: ~1, ~5, ~8, etc.
* The tilde is effectively stripped and the next digit
* converted to an index which is then used to select an
diff --git top/top_nls.c top/top_nls.c
index 0f37d89..b47459a 100644
--- top/top_nls.c
+++ top/top_nls.c
@@ -404,7 +404,7 @@ static void build_norm_nlstab (void) {
Norm_nlstab[YINSP_demo01_txt] = _("Open Files");
Norm_nlstab[YINSP_demo02_txt] = _("NUMA Info");
Norm_nlstab[YINSP_demo03_txt] = _("Log");
- Norm_nlstab[YINSP_deqfmt_txt] = _("the '=' key will eventually show the actual file read or command(s) excuted ...");
+ Norm_nlstab[YINSP_deqfmt_txt] = _("the '=' key will eventually show the actual file read or command(s) executed ...");
Norm_nlstab[YINSP_deqtyp_txt] = _("demo");
Norm_nlstab[YINSP_dstory_txt] = _(""
"This is simulated output representing the contents of some file or the output\n"
--
1.7.9.2

View File

@ -1,4 +1,4 @@
Based on 0caa6d6e676c8d28b933066d19c112b02ed59245 Mon Sep 17 00:00:00 2001
From 0caa6d6e676c8d28b933066d19c112b02ed59245 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 7 May 2014 00:00:00 -0500
Subject: [PATCH] top: miscellaneous accumulated changes to program code
@ -8,8 +8,9 @@ Subject: [PATCH] top: miscellaneous accumulated changes to program code
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
top/top.c | 5 ++---
top/top_nls.c | 28 ++++++++++++++--------------
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git top/top.c top/top.c
index 9f33a05..bc755f3 100644
@ -31,3 +32,111 @@ index 9f33a05..bc755f3 100644
break;
default: // what we REALLY wanted (maybe)
if (isprint(key) && logCOL < bufMAX && phyCOL < Screen_cols) {
@@ -4624,7 +4624,6 @@ static void keys_task (int ch) {
if (*str != kbd_ESC
&& (errmsg = user_certify(w, str, ch)))
show_msg(errmsg);
-
}
break;
case 'V':
diff --git top/top_nls.c top/top_nls.c
index 01c8d1e..ea1c088 100644
--- top/top_nls.c
+++ top/top_nls.c
@@ -129,31 +129,31 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'UID' = 5 */
Head_nlstab[EU_UED] = _("UID");
Desc_nlstab[EU_UED] = _("Effective User Id");
-/* Translation Hint: maximum 'USER' = 8 */
+/* Translation Hint: maximum 'USER' = 7 */
Head_nlstab[EU_UEN] = _("USER");
Desc_nlstab[EU_UEN] = _("Effective User Name");
/* Translation Hint: maximum 'RUID' = 5 */
Head_nlstab[EU_URD] = _("RUID");
Desc_nlstab[EU_URD] = _("Real User Id");
-/* Translation Hint: maximum 'RUSER' = 8 */
+/* Translation Hint: maximum 'RUSER' = 7 */
Head_nlstab[EU_URN] = _("RUSER");
Desc_nlstab[EU_URN] = _("Real User Name");
/* Translation Hint: maximum 'SUID' = 5 */
Head_nlstab[EU_USD] = _("SUID");
Desc_nlstab[EU_USD] = _("Saved User Id");
-/* Translation Hint: maximum 'SUSER' = 8 */
+/* Translation Hint: maximum 'SUSER' = 7 */
Head_nlstab[EU_USN] = _("SUSER");
Desc_nlstab[EU_USN] = _("Saved User Name");
/* Translation Hint: maximum 'GID' = 5 */
Head_nlstab[EU_GID] = _("GID");
Desc_nlstab[EU_GID] = _("Group Id");
-/* Translation Hint: maximum 'GROUP' = 8 */
+/* Translation Hint: maximum 'GROUP' = 7 */
Head_nlstab[EU_GRP] = _("GROUP");
Desc_nlstab[EU_GRP] = _("Group Name");
/* Translation Hint: maximum 'PGRP' = 5 */
Head_nlstab[EU_PGD] = _("PGRP");
Desc_nlstab[EU_PGD] = _("Process Group Id");
-/* Translation Hint: maximum 'TTY' = 8 */
+/* Translation Hint: maximum 'TTY' = 7 */
Head_nlstab[EU_TTY] = _("TTY");
Desc_nlstab[EU_TTY] = _("Controlling Tty");
/* Translation Hint: maximum 'TPGID' = 5 */
@@ -180,7 +180,7 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum '' = 6 */
Head_nlstab[EU_TME] = _("TIME");
Desc_nlstab[EU_TME] = _("CPU Time");
-/* Translation Hint: maximum 'TIME+' = 9 */
+/* Translation Hint: maximum 'TIME+' = 7 */
Head_nlstab[EU_TM2] = _("TIME+");
Desc_nlstab[EU_TM2] = _("CPU Time, hundredths");
/* Translation Hint: maximum '%MEM' = 4 */
@@ -222,7 +222,7 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'WCHAN' = 7 */
Head_nlstab[EU_WCH] = _("WCHAN");
Desc_nlstab[EU_WCH] = _("Sleeping in Function");
-/* Translation Hint: maximum 'Flags' = 8 */
+/* Translation Hint: maximum 'Flags' = 7 */
Head_nlstab[EU_FLG] = _("Flags");
Desc_nlstab[EU_FLG] = _("Task Flags <sched.h>");
/* Translation Hint: maximum 'CGROUPS' = 7 */
@@ -241,7 +241,7 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'Adj' = 3 */
Head_nlstab[EU_OOA] = _("Adj");
Desc_nlstab[EU_OOA] = _("oom_adjustment (2^X)");
-/* Translation Hint: maximum 'Badness' = 8 */
+/* Translation Hint: maximum 'Badness' = 7 */
Head_nlstab[EU_OOM] = _("Badness");
Desc_nlstab[EU_OOM] = _("oom_score (badness)");
#endif
@@ -259,22 +259,22 @@ static void build_two_nlstabs (void) {
/* Translation Hint: maximum 'USED' = 4 */
Head_nlstab[EU_USE] = _("USED");
Desc_nlstab[EU_USE] = _("Res+Swap Size (KiB)");
-/* Translation Hint: maximum 'nsIPC' = 10 */
+/* Translation Hint: maximum 'nsIPC' = 7 */
Head_nlstab[EU_NS1] = _("nsIPC");
Desc_nlstab[EU_NS1] = _("IPC namespace Inode");
-/* Translation Hint: maximum 'nsMNT' = 10 */
+/* Translation Hint: maximum 'nsMNT' = 7 */
Head_nlstab[EU_NS2] = _("nsMNT");
Desc_nlstab[EU_NS2] = _("MNT namespace Inode");
-/* Translation Hint: maximum 'nsNET' = 10 */
+/* Translation Hint: maximum 'nsNET' = 7 */
Head_nlstab[EU_NS3] = _("nsNET");
Desc_nlstab[EU_NS3] = _("NET namespace Inode");
-/* Translation Hint: maximum 'nsPID' = 10 */
+/* Translation Hint: maximum 'nsPID' = 7 */
Head_nlstab[EU_NS4] = _("nsPID");
Desc_nlstab[EU_NS4] = _("PID namespace Inode");
-/* Translation Hint: maximum 'nsUSER' = 10 */
+/* Translation Hint: maximum 'nsUSER' = 7 */
Head_nlstab[EU_NS5] = _("nsUSER");
Desc_nlstab[EU_NS5] = _("USER namespace Inode");
-/* Translation Hint: maximum 'nsUTS' = 10 */
+/* Translation Hint: maximum 'nsUTS' = 7 */
Head_nlstab[EU_NS6] = _("nsUTS");
Desc_nlstab[EU_NS6] = _("UTS namespace Inode");
}
--
1.7.9.2

View File

@ -0,0 +1,43 @@
From 9c7e8b82f872e2d46ce866255ff132e0e6a0f937 Mon Sep 17 00:00:00 2001
From: Sami Farin <hvtaifwkbgefbaei@gmail.com>
Date: Fri, 14 Mar 2014 00:00:00 -0600
Subject: [PATCH] sysctl: increase max supported line length of the conf file
I ran into this limit with net.ipv4.ip_local_reserved_ports ,
sysctl complained about the line after the long line, further
slowing down my error hunting.
Due to fgets usage, increase buffer size to 4096 chars with
minimum amount of code changes.
Signed-off-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
---
sysctl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git sysctl.c sysctl.c
index 51af15d..fc224e5 100644
--- sysctl.c
+++ sysctl.c
@@ -483,14 +483,16 @@ static int pattern_match(const char *string, const char *pat)
return (1);
}
+#define LINELEN 4096
+
/*
* Preload the sysctl's from the conf file. We parse the file and then
* reform it (strip out whitespace).
*/
static int Preload(const char *restrict const filename)
{
- char oneline[256];
- char buffer[256];
+ char oneline[LINELEN];
+ char buffer[LINELEN];
FILE *fp;
char *t;
int n = 0;
--
1.7.9.2

View File

@ -0,0 +1,27 @@
From 0b3f63456a1265e13274fd7c6ba0903e4cb3db5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=E1=BA=A7n=20Ng=E1=BB=8Dc=20Qu=C3=A2n?=
<vnwildman@gmail.com>
Date: Thu, 17 Apr 2014 14:12:01 +0700
Subject: [PATCH] fix url for rsync
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git Makefile.am Makefile.am
index 335fbc5..b32e9ce 100644
--- Makefile.am
+++ Makefile.am
@@ -124,4 +124,4 @@ dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version
get-trans:
- rsync -Lrtvz translationproject.org::tp/latest/procps/ po
+ rsync -Lrtvz translationproject.org::tp/latest/procps-ng/ po
--
1.7.9.2

View File

@ -0,0 +1,73 @@
From e2868da34e6d2085fdafcd9b28cdbf01c69361c5 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 25 Apr 2014 00:00:00 -0600
Subject: [PATCH] top: update copyright dates plus 1 preprocessor change
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 4 ++--
top/top.h | 2 +-
top/top_nls.c | 2 +-
top/top_nls.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git top/top.c top/top.c
index cbcb152..0428496 100644
--- top/top.c
+++ top/top.c
@@ -1,6 +1,6 @@
/* top.c - Source file: show Linux processes */
/*
- * Copyright (c) 2002-2013, by: James C. Warner
+ * Copyright (c) 2002-2014, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
@@ -3464,7 +3464,7 @@ static void configs_read (void) {
if (2 != fscanf(fp, "%3s\tfieldscur=%79s\n"
, w->rc.winname, w->rc.fieldscur))
goto default_or_error;
-#if PFLAGSSIZ > 80
+#if PFLAGSSIZ != 80
// too bad fscanf is not as flexible with his format string as snprintf
# error Hey, fix the above fscanf 'PFLAGSSIZ' dependency !
#endif
diff --git top/top.h top/top.h
index 5d1aead..836b9fb 100644
--- top/top.h
+++ top/top.h
@@ -1,6 +1,6 @@
/* top.h - Header file: show Linux processes */
/*
- * Copyright (c) 2002-2013, by: James C. Warner
+ * Copyright (c) 2002-2014, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
diff --git top/top_nls.c top/top_nls.c
index b47459a..01c8d1e 100644
--- top/top_nls.c
+++ top/top_nls.c
@@ -1,6 +1,6 @@
/* top_nls.c - provide the basis for future nls translations */
/*
- * Copyright (c) 2011-2013, by: James C. Warner
+ * Copyright (c) 2011-2014, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
diff --git top/top_nls.h top/top_nls.h
index 1b6d575..9010263 100644
--- top/top_nls.h
+++ top/top_nls.h
@@ -1,6 +1,6 @@
/* top_nls.h - provide the basis for future nls translations */
/*
- * Copyright (c) 2011-2013, by: James C. Warner
+ * Copyright (c) 2011-2014, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
--
1.7.9.2

View File

@ -0,0 +1,464 @@
From f3e55ee661d54bb667b3c0cf07411094ad7fc980 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 23 Apr 2014 00:00:01 -0500
Subject: [PATCH] top: refactor man document so as to allow translations
The majority of changes in this commit are intended to
enable translation of top's man page. There were three
kinds of errors as seen by that po4a-updatepo program.
. a valid but unrecognized request concerning no-break
. an internally defined macro with a groff .de request
. occasional apostrophe at the beginning of some lines
With respect to the apostrophe, some have been changed
to back-tic since line placement could not be assured.
And other parts were re-flowed to avoid temptations to
escape as \' (technically an acute accent). Of course,
the opening back-tic with closing apostrophe looks odd
when ASCII, but should be rendered correctly as UTF-8.
It may yet be necessary to change the remaining single
'opening' quotes to back-tics as translation proceeds.
Should that become necessary, I intend to reduce quote
usage to the bare minimum throughout the man document.
There were also some formatting changes to enhance the
man2html output and then to other formats via htmldoc.
And, I wish to acknowledge that my meager groff skills
do not serve those programs very well at all. In other
words groff yet remains mostly incomprehensible to me.
Lastly a few content plus copyright updates were made.
Message(s):
. Unknown macro '.c2 `'. Remove it from the document, or refer to the Locale::Po4a::Man manpage to see how po4a can handle new macros.
. This page defines a new macro with '.de'. Since po4a is not a real groff parser, this is not supported.
. Unknown macro ''real time' scheduling priority.'. Remove it from the document, or refer to the Locale::Po4a::Man manpage to see how po4a can handle new macros.
Reference(s):
. oriiginal post/patch
http://www.freelists.org/post/procps/Translations-for-man-pages
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.1 | 138 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 69 insertions(+), 69 deletions(-)
diff --git top/top.1 top/top.1
index f25acff..644ae46 100644
--- top/top.1
+++ top/top.1
@@ -1,7 +1,7 @@
.ig
. manual page for NEW and IMPROVED linux top
.
-. Copyright (c) 2002-2013, by: James C. Warner
+. Copyright (c) 2002-2014, by: James C. Warner
. All rights reserved. 8921 Hilloway Road
. Eden Prairie, Minnesota 55347 USA
.
@@ -13,14 +13,6 @@
.
.ll +(\n[half_xtra] + \n[half_xtra])
.
-\# ** we use single quote char (') a lot, so change the no-break ctrl char
-.c2 `
-.
-\# Our own Bullet style(s) --------------------------
-.de jBu
-.IP "o" 3
-..
-.
\# Commonly used strings (for consistency) ----------
\# - our em-dashes
.ds Em \fR\ \-\-\ \fR
@@ -32,11 +24,11 @@
.ds F \fIOff\fR
.ds O \fIOn\fR
.
-.ds AK asterisk (\'*\')
+.ds AK asterisk (`*')
.ds AM alternate\-display mode
.ds AS auxiliary storage
.ds CF configuration file
-.ds CG \'current\' window/field group
+.ds CG `current' window/field group
.ds CI interactive command
\# - Note: our 'Command Line' used in 2 places
\# ( and managed to fit in an 80x24 terminal )
@@ -44,7 +36,7 @@
\-\fBu\fR|\fBU\fR user \-\fBp\fR pid \-\fBo\fR fld \-\fBw\fR [cols] \fR
.ds CO command\-line option
.ds CT command toggle
-.ds CW \'current\' window
+.ds CW `current' window
.ds FG field group
.ds FM full\-screen mode
.ds KA arrow key
@@ -76,7 +68,7 @@
.
.\" Document /////////////////////////////////////////////////////////////
.\" ----------------------------------------------------------------------
-.TH TOP 1 "November 2013" "procps-ng" "User Commands"
+.TH TOP 1 "April 2014" "procps-ng" "User Commands"
.\" ----------------------------------------------------------------------
.\" ----------------------------------------------------------------------
@@ -646,8 +638,8 @@ The process ID (pid) of a task's parent.
.TP 4
16.\fB PR \*(Em Priority \fR
The scheduling priority of the task.
-If you see 'rt' in this field, it means the task is running under
-'real time' scheduling priority.
+If you see 'rt' in this field, it means the task is running
+under 'real time' scheduling priority.
Under linux, real time priority is somewhat misleading since traditionally
the operating itself was not preemptible.
@@ -880,27 +872,27 @@ Entries marked with an asterisk are the currently displayed fields,
screen width permitting.
.RS +4
-.jBu
+.IP \(bu 3
As the on screen instructions indicate, you navigate among the fields with
the\fB Up\fR and\fB Down\fR \*(KAs.
The PgUp, PgDn, Home and End keys can also be used to quickly reach the
first or last available field.
-.jBu
+.IP \(bu 3
The\fB Right\fR \*(KA selects a field for repositioning and
the\fB Left\fR \*(KA or the <\fBEnter\fR> key commits that field's
placement.
-.jBu
+.IP \(bu 3
The '\fBd\fR' key or the <\fBSpace\fR> bar toggles a field's display
status, and thus the presence or absence of the asterisk.
-.jBu
+.IP \(bu 3
The '\fBs\fR' key designates a field as the sort field.
\*(XT 4c. TASK AREA Commands, SORTING for additional information regarding
your selection of a sort field.
-.jBu
+.IP \(bu 3
The '\fBa\fR' and '\fBw\fR' keys can be used to cycle through all available
windows and the '\fBq\fR' or <\fBEsc\fR> keys exit Fields Management.
.RS -4
@@ -982,8 +974,8 @@ those \*(CIs applicable to \*(AM.
Removes restrictions on which tasks are shown.
This command will reverse any 'i' (idle tasks) and 'n' (max tasks)
commands that might be active.
-It also provides for an exit from pid monitoring, 'user' filtering and
-'other' filtering.
+It also provides for an exit from pid monitoring, 'user' filtering
+and 'other' filtering.
See the '\-p' \*(CO for a discussion of PID monitoring, the 'U' or 'u'
\*(CIs for user filtering and the 'O' or 'o' \*(CIs for 'other' filtering.
@@ -1138,7 +1130,7 @@ This \*(CI can be used to alter the widths of the following fields:
SUID 5 SUSER 8 nsMNT 10
UID 5 USER 8 nsNET 10
TTY 8 nsPID 10
- nsUSR 10
+ nsUSER 10
nsUTS 10
.fi
@@ -1268,10 +1260,10 @@ The \*(TA \*(CIs are\fB always\fR available in \*(FM.
The \*(TA \*(CIs are\fB never available\fR in \*(AM\fI if\fR the \*(CW's
\*(TD has been toggled \*F (\*(Xt 5. ALTERNATE\-DISPLAY Provisions).
-.TP 2
+.PP
.\" ..................................................
.B APPEARANCE\fR of \*(TW
-.PD 0
+
.TP 7
\ \ \ \fBJ\fR\ \ :\fIJustify-Numeric-Columns\fR toggle \fR
Alternates between right-justified (the default) and
@@ -1330,7 +1322,7 @@ the state of the 'x', 'y' or 'b' toggles.
.PP
.\" ..................................................
.B CONTENT\fR of \*(TW
-.PD 0
+
.TP 7
\ \ \ \fBc\fR\ \ :\fICommand-Line/Program-Name\fR toggle \fR
This command will be honored whether or not the 'COMMAND' column
@@ -1400,7 +1392,7 @@ mode in the \*(CW.
.PP
.\" ..................................................
.B SIZE\fR of \*(TW
-.PD 0
+
.TP 7
\ \ \ \fBi\fR\ \ :\fIIdle-Process\fR toggle \fR
Displays all tasks or just active tasks.
@@ -1425,10 +1417,12 @@ already been painted.
\*(NT If you wish to increase the size of the last visible \*(TD when in \*(AM,
simply decrease the size of the \*(TD(s) above it.
+.PP
-.TP 2
.\" ..................................................
.B SORTING\fR of \*(TW
+.PP
+.RS +3
For compatibility, this \*(We supports most of the former \*(We sort keys.
Since this is primarily a service to former \*(We users, these commands do
not appear on any help screen.
@@ -1462,10 +1456,8 @@ Moves the sort column to the right unless the current sort field is
the last field being displayed.
.PP
-.in +2
The following \*(CIs will\fB always\fR be honored whether or not
the current sort field is visible.
-.in
.TP 7
\ \ \ \fBf\fR | \fBF\fR\ \ :\fIFields-Management \fR
@@ -1479,10 +1471,9 @@ when running \*(We with column highlighting turned \*F.
Using this \*(CI you can alternate between high-to-low and low-to-high sorts.
.PP
-.in +2
\*(NT Field sorting uses internal values, not those in column display.
Thus, the TTY and WCHAN fields will violate strict ASCII collating sequence.
-.in
+.RE
.\" ......................................................................
.SS 4d. COLOR Mapping
@@ -1515,6 +1506,7 @@ The Color Mapping screen can also be used to change the \*(CG in
either \*(FM or \*(AM.
Whatever was targeted when 'q' or <Enter> was pressed will be made current
as you return to the \*(We display.
+.PP
.\" ----------------------------------------------------------------------
.SH 5. ALTERNATE\-DISPLAY Provisions
@@ -1537,6 +1529,7 @@ The \*(SA will always exist, even if it's only the message line.
At any given time only\fI one\fR \*(SA can be displayed.
However, depending on your commands, there could be from\fI zero \fR
to\fI four\fR separate \*(TDs currently showing on the screen.
+.PP
.TP 3
.B Current Window\fR:
@@ -1578,9 +1571,9 @@ and horizontal scrolling.
The '+' key does the same for all windows.
The four \*(TDs will reappear, evenly balanced.
-They will also have retained any customizations you had previously applied,
-except for the 'i' (idle tasks), 'n' (max tasks), 'u'/'U' (user filter),
-'o'/'O' (other filter) and scrolling \*(CIs.
+They will also have retained any customizations you had previously
+applied, except for the 'i' (idle tasks), 'n' (max tasks), 'u'/'U'
+(user filter), 'o'/'O' (other filter) and scrolling \*(CIs.
.TP 7
*\ \ \fBA\fR\ \ :\fIAlternate-Display-Mode\fR toggle \fR
@@ -1619,9 +1612,9 @@ It does not require that the window name be visible
.IP "*" 3
The \*(CIs shown with an \*(AK have use beyond \*(AM.
.nf
- \'=', 'A', 'g' are always available
- \'a', 'w' act the same with color mapping
- \ and fields management
+ '=', 'A', 'g' are always available
+ 'a', 'w' act the same with color mapping
+ and fields management
.fi
.\" ......................................................................
@@ -1790,28 +1783,31 @@ a mistake, command recall will be your friend.
Remember the Up/Down \*(KAs or their aliases when prompted for input.
.B Filter Basics
-.IP " . " 6
-field names are case sensitive and spelled as in the header
-.IP " . " 6
-selection values need not comprise the full displayed field
-.IP " . " 6
-a selection is either case insensitive or sensitive to case
-.IP " . " 6
-the default is inclusion, prepending '!' denotes exclusions
-.IP " . " 6
-multiple selection criteria can be applied to a \*(TW
-.IP " . " 6
-inclusion and exclusion criteria can be used simultaneously
-.IP " . " 6
-the 1 equality and 2 relational filters can be freely mixed
-.IP " . " 6
-separate unique filters are maintained for each \*(TW
-.RE
+.RS +3
+.TP 3
+1. field names are case sensitive and spelled as in the header
+.TP 3
+2. selection values need not comprise the full displayed field
+.TP 3
+3. a selection is either case insensitive or sensitive to case
+.TP 3
+4. the default is inclusion, prepending '!' denotes exclusions
+.TP 3
+5. multiple selection criteria can be applied to a \*(TW
+.TP 3
+6. inclusion and exclusion criteria can be used simultaneously
+.TP 3
+7. the 1 equality and 2 relational filters can be freely mixed
+.TP 3
+8. separate unique filters are maintained for each \*(TW
+.PP
If a field is not turned on or is not currently in view, then your selection
criteria will not affect the display.
Later, should a filtered field become visible, the selection criteria will
then be applied.
+.PP
+.RE
.B Keyboard Summary
.TP 6
@@ -1838,6 +1834,7 @@ It also has additional impact so please \*(Xt 4a. GLOBAL Commands.
This clears the selection criteria in all windows, assuming you are in \*(AM.
As with the '=' \*(CI, it too has additional consequences so you might wish to
\*(Xt 5b. COMMANDS for Windows.
+.PP
.RE
.B Input Requirements
@@ -1867,16 +1864,17 @@ with homogeneous data.
When some field's numeric amounts have been subjected to \fIscaling\fR
while others have not, that data is no longer homogeneous.
-If you establish a relational filter and you \fBhave\fR changed the default
-'Numeric' or 'Character' \fIjustification\fR, that filter is likely to fail.
+If you establish a relational filter and you \fBhave\fR changed the
+default 'Numeric' or 'Character' \fIjustification\fR, that filter is likely to fail.
When a relational filter is applied to a memory field and you \fBhave not\fR
changed the \fIscaling\fR, it may produce misleading results.
-This happens, for example, because '100.0m' (MiB) would appear greater than
-'1.000g' (GiB) when compared as strings.
+This happens, for example, because '100.0m' (MiB) would appear greater
+than '1.000g' (GiB) when compared as strings.
If your filtered results appear suspect, simply altering justification or
scaling may yet achieve the desired objective.
See the 'j', 'J' and 'e' \*(CIs for additional information.
+.PP
.RE
.B Potential Problems
@@ -1904,6 +1902,7 @@ So while amounts greater than 9999 exist, they will appear as 2.6m, 197k, etc.
.nf
nMin>9999 ( always a blank \*(TW )
.fi
+.PP
.RE
.B Potential Solutions
@@ -1940,13 +1939,14 @@ achieve the failed '9999' objective discussed above.
'PR>20' + '!PR=-' ( 2 for right result )
'!nMin=0 ' + '!nMin=1 ' + '!nMin=2 ' + '!nMin=3 ' ...
.fi
-.RE
+.RS -3
\*(NT When 'Other Filtering' is active, \*(We turns column highlighting
\*F to prevent false matches on internal non-display escape sequences.
Such highlighting will be restored when a window is no longer subject
to filtering.
\*(XC 'x' \*(CI for additional information on sort column highlighting.
+.RE
.\" ----------------------------------------------------------------------
.SH 6. FILES
@@ -1990,7 +1990,7 @@ Here is the general layout:
per ea # line a: winname,fieldscur
window # line b: winflags,sortindx,maxtasks
" # line c: summclr,msgsclr,headclr,taskclr
- global # line 15: fixed-width incr
+ global # line 15: width, memory scaling & zeroes overrides
" # any remaining lines are devoted to the
" # generalized 'inspect' provisions
" # discussed below
@@ -2132,7 +2132,7 @@ the authority.
For these stupid tricks, \*(We needs \*(FM.
.\" ( apparently AM static was a potential concern )
-.jBu
+.IP \(bu 3
The user interface, through prompts and help, intentionally implies
that the delay interval is limited to tenths of a second.
However, you're free to set any desired delay.
@@ -2155,7 +2155,7 @@ Then do the following:
What you'll see is a very busy Linux doing what he's always done for you,
but there was no program available to illustrate this.
-.jBu
+.IP \(bu 3
Under an xterm using 'white-on-black' colors, on \*(We's Color Mapping screen
set the task color to black and be sure that task highlighting is set to bold,
not reverse.
@@ -2164,7 +2164,7 @@ Then set the delay interval to around .3 seconds.
After bringing the most active processes into view, what you'll see are
the ghostly images of just the currently running tasks.
-.jBu
+.IP \(bu 3
Delete the existing rcfile, or create a new symlink.
Start this new version then type 'T' (a secret key,
\*(Xt 4c. Task Area Commands, SORTING) followed by 'W' and 'q'.
@@ -2180,19 +2180,19 @@ on whether or not \*(We will ever reach the \*(We.
.\" ----------------------------------------------------------------------
For these stupid tricks, \*(We needs \*(AM.
-.jBu
+.IP \(bu 3
With 3 or 4 \*(TDs visible, pick any window other than the last
and turn idle processes \*F using the 'i' \*(CT.
Depending on where you applied 'i', sometimes several \*(TDs are bouncing and
sometimes it's like an accordion, as \*(We tries his best to allocate space.
-.jBu
+.IP \(bu 3
Set each window's summary lines differently: one with no memory ('m'); another
with no states ('t'); maybe one with nothing at all, just the message line.
Then hold down 'a' or 'w' and watch a variation on bouncing windows \*(Em
hopping windows.
-.jBu
+.IP \(bu 3
Display all 4 windows and for each, in turn, set idle processes to \*F using
the 'i' \*(CT.
You've just entered the "extreme bounce" zone.
@@ -2202,7 +2202,7 @@ You've just entered the "extreme bounce" zone.
.\" ----------------------------------------------------------------------
This stupid trick also requires \*(AM.
-.jBu
+.IP \(bu 3
Display all 4 windows and make sure that 1:Def is the \*(CW.
Then, keep increasing window size with the 'n' \*(CI until all the other
\*(TDs are "pushed out of the nest".
@@ -2219,7 +2219,7 @@ Then ponder this:
This stupid trick works best without \*(AM, since justification is active
on a per window basis.
-.jBu
+.IP \(bu 3
Start \*(We and make COMMAND the last (rightmost) column displayed.
If necessary, use the 'c' \*(CT to display command lines and ensure
that forest view mode is active with the 'V' \*(CT.
--
1.7.9.2

View File

@ -0,0 +1,614 @@
From c9f7cc70251f9496c4dc908e26c273eb3a480e11 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 23 Apr 2014 00:00:02 -0500
Subject: [PATCH] top: minimize the usage of apostrophes in man document
In addition to eliminating numerous single quote usage
this commit also escaped '\' a few overlooked hyphens.
And some 'unformatted' spacings were adjusted as well.
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.1 | 216 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 109 insertions(+), 107 deletions(-)
diff --git top/top.1 top/top.1
index 644ae46..d5df21c 100644
--- top/top.1
+++ top/top.1
@@ -149,9 +149,9 @@ The remaining Table of Contents
.\" ......................................................................
.SS Operation
.\" ----------------------------------------------------------------------
-When operating \*(We, the two most important keys are the help ('h' or '?')
+When operating \*(We, the two most important keys are the help (h or ?)
key and quit ('q') key.
-Alternatively, you could simply use the traditional interrupt key ('^C')
+Alternatively, you could simply use the traditional interrupt key (^C)
when you're done.
When started for the first time, you'll be presented with these traditional
@@ -237,31 +237,31 @@ All are explained in detail in the sections that follow.
.nf
\fIGlobal-defaults\fR
- 'A' - Alt display Off (full-screen)
- * 'd' - Delay time 3.0 seconds
- * 'H' - Threads mode Off (summarize as tasks)
- 'I' - Irix mode On\ \ (no, 'solaris' smp)
- * 'p' - PID monitoring Off (show all processes)
- * 's' - Secure mode Off (unsecured)
- 'B' - Bold enable On\ \ (yes, bold globally)
+ A \- Alt display Off (full-screen)
+ * d \- Delay time 3.0 seconds
+ * H \- Threads mode Off (summarize as tasks)
+ I \- Irix mode On (no, 'solaris' smp)
+ * p \- PID monitoring Off (show all processes)
+ * s \- Secure mode Off (unsecured)
+ B \- Bold enable On (yes, bold globally)
\fISummary-Area-defaults\fR
- 'l' - Load Avg/Uptime On\ \ (thus program name)
- 't' - Task/Cpu states On\ \ (1+1 lines, see '1')
- 'm' - Mem/Swap usage On\ \ (2 lines worth)
- '1' - Single Cpu On\ \ (thus 1 line if smp)
+ l \- Load Avg/Uptime On (thus program name)
+ t \- Task/Cpu states On (1+1 lines, see '1')
+ m \- Mem/Swap usage On (2 lines worth)
+ 1 \- Single Cpu On (thus 1 line if smp)
\fITask-Area-defaults\fR
- 'b' - Bold hilite On\ \ (not 'reverse')
- * 'c' - Command line Off (name, not cmdline)
- * 'i' - Idle tasks On\ \ (show all tasks)
- 'J' - Num align right On\ \ (not left justify)
- 'j' - Str align right Off (not right justify)
- 'R' - Reverse sort On\ \ (pids high-to-low)
- * 'S' - Cumulative time Off (no, dead children)
- * 'u' - User filter Off (show euid only)
- * 'U' - User filter Off (show any uid)
- 'x' - Column hilite Off (no, sort field)
- 'y' - Row hilite On\ \ (yes, running tasks)
- 'z' - color/mono Off (no, colors)
+ b \- Bold hilite On (not 'reverse')
+ * c \- Command line Off (name, not cmdline)
+ * i \- Idle tasks On (show all tasks)
+ J \- Num align right On (not left justify)
+ j \- Str align right Off (not right justify)
+ R \- Reverse sort On (pids high-to-low)
+ * S \- Cumulative time Off (no, dead children)
+ * u \- User filter Off (show euid only)
+ * U \- User filter Off (show any uid)
+ x \- Column hilite Off (no, sort field)
+ y \- Row hilite On (yes, running tasks)
+ z \- color/mono Off (no, colors)
.fi
.\" ----------------------------------------------------------------------
@@ -271,7 +271,7 @@ The command-line syntax for \*(We consists of:
\*(CL
-The typically mandatory switches ('\-') and even whitespace are completely
+The typically mandatory switch ('\-') and even whitespace are completely
optional.
.TP 5
@@ -280,7 +280,7 @@ Show library version and the usage prompt, then quit.
.TP 5
\-\fBb\fR\ \ :\fIBatch-mode\fR operation \fR
-Starts \*(We in 'Batch' mode, which could be useful for sending output
+Starts \*(We in Batch mode, which could be useful for sending output
from \*(We to other programs or to a file.
In this mode, \*(We will not accept input and runs until the iterations
limit you've set with the '\-n' \*(CO or until killed.
@@ -300,8 +300,8 @@ Later this can be changed with the 'd' or 's' \*(CIs.
Fractional seconds are honored, but a negative number is not allowed.
In all cases, however, such changes are prohibited if \*(We is running
-in 'Secure mode', except for root (unless the 's' \*(CO was used).
-For additional information on 'Secure mode' \*(Xt 6a. SYSTEM Configuration File.
+in Secure mode, except for root (unless the 's' \*(CO was used).
+For additional information on Secure mode \*(Xt 6a. SYSTEM Configuration File.
.TP 5
\-\fBH\fR\ \ :\fIThreads-mode\fR operation \fR
@@ -365,7 +365,7 @@ This mode is far better controlled through the system \*(CF
.TP 5
\-\fBS\fR\ \ :\fICumulative-time\fR toggle \fR
Starts \*(We with the last remembered 'S' state reversed.
-When 'Cumulative time' mode is \*O, each process is listed with the \*(Pu
+When Cumulative time mode is \*O, each process is listed with the \*(Pu
time that it and its dead children have used.
\*(XC 'S' \*(CI for additional information regarding this mode.
@@ -382,7 +382,7 @@ The 'p', 'u' and 'U' \*(COs are mutually exclusive.
.TP 5
\-\fBw\fR\ \ :\fIOutput-width-override\fR as:\ \ \fB-w\fR [\fB number\fR ] \fR
-In 'Batch' mode, when used without an argument \*(We will format
+In Batch mode, when used without an argument \*(We will format
output using the COLUMNS= and LINES= environment variables, if set.
Otherwise, width will be fixed at the maximum \*(WX columns.
With an argument, output width can be decreased or increased (up to \*(WX)
@@ -392,10 +392,10 @@ In normal display mode, when used without an argument \*(We will\fI attempt\fR
to format output using the COLUMNS= and LINES= environment variables, if set.
With an argument, output width can only be decreased, not increased.
Whether using environment variables or an argument with \-w, when\fI not\fR
-in 'Batch' mode actual terminal dimensions can never be exceeded.
+in Batch mode actual terminal dimensions can never be exceeded.
\*(NT Without the use of this \*(CO, output width is always based on the
-terminal at which \*(We was invoked whether or not in 'Batch' mode.
+terminal at which \*(We was invoked whether or not in Batch mode.
.\" ----------------------------------------------------------------------
.SH 2. SUMMARY Display
@@ -500,10 +500,10 @@ In a true SMP environment, if a process is multi-threaded and \*(We is
reported.
You toggle Threads mode with the 'H' \*(CI.
-Also for multi-processor environments, if 'Irix mode' is \*F, \*(We
-will operate in 'Solaris mode' where a task's \*(Pu usage will be
+Also for multi-processor environments, if Irix mode is \*F, \*(We
+will operate in Solaris mode where a task's \*(Pu usage will be
divided by the total number of \*(PUs.
-You toggle 'Irix/Solaris' modes with the 'I' \*(CI.
+You toggle Irix/Solaris modes with the 'I' \*(CI.
.TP 4
2.\fB %MEM \*(Em Memory Usage (RES) \fR
@@ -523,7 +523,7 @@ Many different hierarchies of cgroups can exist simultaneously on a system
and each hierarchy is attached to one or more subsystems.
A subsystem represents a single resource.
-\*(NT The 'CGROUPS' field, unlike most columns, is not fixed-width.
+\*(NT The CGROUPS field, unlike most columns, is not fixed-width.
When displayed, it plus any other variable width columns will be allocated
all remaining screen width (up to the maximum \*(WX characters).
Even so, such variable width fields could still suffer truncation.
@@ -533,7 +533,7 @@ any truncated data.
.TP 4
4.\fB CODE \*(Em Code Size (KiB) \fR
The amount of \*(MP devoted to executable code, also known as
-the 'text resident set' size or TRS.
+the Text Resident Set size or TRS.
.TP 4
5.\fB COMMAND \*(Em Command\fB Name\fR or Command\fB Line \fR
@@ -547,10 +547,10 @@ line (like kernel threads) will be shown with only the program name in
brackets, as in this example:
\fR[kthreadd]
-This field may also be impacted by the 'forest view' display mode.
+This field may also be impacted by the forest view display mode.
\*(XC 'V' \*(CI for additional information regarding that mode.
-\*(NT The 'COMMAND' field, unlike most columns, is not fixed-width.
+\*(NT The COMMAND field, unlike most columns, is not fixed-width.
When displayed, it plus any other variable width columns will be allocated
all remaining screen width (up to the maximum \*(WX characters).
Even so, such variable width fields could still suffer truncation.
@@ -562,7 +562,7 @@ any truncated data.
.TP 4
6.\fB DATA \*(Em Data + Stack Size (KiB) \fR
The amount of \*(MP devoted to other than executable code, also known as
-the 'data resident set' size or DRS.
+the Data Resident Set size or DRS.
.TP 4
7.\fB ENVIRON \*(Em Environment variables \fR
@@ -571,7 +571,7 @@ respective processes.
These variables will be displayed in their raw native order, not the
sorted order you are accustomed to seeing with an unqualified 'set'.
-\*(NT The 'ENVIRON' field, unlike most columns, is not fixed-width.
+\*(NT The ENVIRON field, unlike most columns, is not fixed-width.
When displayed, it plus any other variable width columns will be allocated
all remaining screen width (up to the maximum \*(WX characters).
Even so, such variable width fields could still suffer truncation.
@@ -624,7 +624,7 @@ member of a process group, called the process group leader.
14.\fB PID \*(Em Process Id \fR
The task's unique process ID, which periodically wraps, though never
restarting at zero.
-In kernel terms, it is a dispatchable entity defined by a 'task_struct'.
+In kernel terms, it is a dispatchable entity defined by a task_struct.
This value may also be used as: a process group ID (\*(Xa PGRP);
a session ID for the session leader (\*(Xa SID);
@@ -639,7 +639,7 @@ The process ID (pid) of a task's parent.
16.\fB PR \*(Em Priority \fR
The scheduling priority of the task.
If you see 'rt' in this field, it means the task is running
-under 'real time' scheduling priority.
+under real time scheduling priority.
Under linux, real time priority is somewhat misleading since traditionally
the operating itself was not preemptible.
@@ -666,7 +666,7 @@ The status of the task which can be one of:
\fBT\fR = traced or stopped
\fBZ\fR = zombie
-Tasks shown as running should be more properly thought of as 'ready to run'
+Tasks shown as running should be more properly thought of as ready to run
\*(Em their task_struct is simply represented on the Linux run-queue.
Even without a true SMP machine, you may see numerous tasks in this state
depending on \*(We's delay interval and nice value.
@@ -697,7 +697,7 @@ The IDs of any supplementary group(s) established at login or
inherited from a task's parent.
They are displayed in a comma delimited list.
-\*(NT The 'SUPGIDS' field, unlike most columns, is not fixed-width.
+\*(NT The SUPGIDS field, unlike most columns, is not fixed-width.
When displayed, it plus any other variable width columns will be allocated
all remaining screen width (up to the maximum \*(WX characters).
Even so, such variable width fields could still suffer truncation.
@@ -710,7 +710,7 @@ The names of any supplementary group(s) established at login or
inherited from a task's parent.
They are displayed in a comma delimited list.
-\*(NT The 'SUPGRPS' field, unlike most columns, is not fixed-width.
+\*(NT The SUPGRPS field, unlike most columns, is not fixed-width.
When displayed, it plus any other variable width columns will be allocated
all remaining screen width (up to the maximum \*(WX characters).
Even so, such variable width fields could still suffer truncation.
@@ -729,19 +729,19 @@ The non-resident portion of a task's address space.
28.\fB TGID \*(Em Thread Group Id \fR
The ID of the thread group to which a task belongs.
It is the PID of the thread group leader.
-In kernel terms, it represents those tasks that share an 'mm_struct'.
+In kernel terms, it represents those tasks that share an mm_struct.
.TP 4
29.\fB TIME \*(Em \*(PU Time \fR
Total \*(PU time the task has used since it started.
-When 'Cumulative mode' is \*O, each process is listed with the \*(Pu
+When Cumulative mode is \*O, each process is listed with the \*(Pu
time that it and its dead children have used.
-You toggle 'Cumulative mode' with 'S', which is both a \*(CO and an \*(CI.
+You toggle Cumulative mode with 'S', which is both a \*(CO and an \*(CI.
\*(XC 'S' \*(CI for additional information regarding this mode.
.TP 4
30.\fB TIME+ \*(Em \*(PU Time, hundredths \fR
-The same as 'TIME', but reflecting more granularity through hundredths
+The same as TIME, but reflecting more granularity through hundredths
of a second.
.TP 4
@@ -780,7 +780,7 @@ swapped out and pages that have been mapped but not used.
.TP 4
37.\fB WCHAN \*(Em Sleeping in Function \fR
-Depending on the availability of the kernel link map ('System.map'), this
+Depending on the availability of the kernel link map (System.map), this
field will show the name or the address of the kernel function in which the
task is currently sleeping.
Running tasks will display a dash ('\-') in this column.
@@ -931,9 +931,9 @@ depending on the context in which they are issued.
Size: #, i, n
Sorting: <, >, f, F, R
4d.\fI Color-Mapping \fR
- <Ret>, a, B, b, H, M, q, S, T, w, z, 0 - 7
+ <Ret>, a, B, b, H, M, q, S, T, w, z, 0 \- 7
5b.\fI Commands-for-Windows \fR
- -, _, =, +, A, a, g, G, w
+ \-, _, =, +, A, a, g, G, w
5c.\fI Scrolling-a-Window \fR
C, Up, Dn, Left, Right, PgUp, PgDn, Home, End
5d.\fI Searching-in-a-Window \fR
@@ -945,7 +945,7 @@ depending on the context in which they are issued.
.\" ----------------------------------------------------------------------
The global \*(CIs are\fB always\fR available\fR in both \*(FM and \*(AM.
However, some of these \*(CIs are\fB not available\fR when running
-in 'Secure mode'.
+in Secure mode.
If you wish to know in advance whether or not your \*(We has been
secured, simply ask for help and view the system summary on the second
@@ -974,10 +974,10 @@ those \*(CIs applicable to \*(AM.
Removes restrictions on which tasks are shown.
This command will reverse any 'i' (idle tasks) and 'n' (max tasks)
commands that might be active.
-It also provides for an exit from pid monitoring, 'user' filtering
-and 'other' filtering.
+It also provides for an exit from PID monitoring, User filtering
+and Other filtering.
See the '\-p' \*(CO for a discussion of PID monitoring, the 'U' or 'u'
-\*(CIs for user filtering and the 'O' or 'o' \*(CIs for 'other' filtering.
+\*(CIs for User filtering and the 'O' or 'o' \*(CIs for Other filtering.
Additionally, any window that has been scrolled will be reset with
this command.
@@ -1000,7 +1000,7 @@ into \*(CWs and \*(FGs.
.TP 7
\ \ \ \fBB\fR\ \ :\fIBold-Disable/Enable\fR toggle \fR
-This command will influence use of the 'bold' terminfo capability and
+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
applied anytime.
@@ -1062,7 +1062,7 @@ Otherwise, \*(We displays a summation of all threads in each process.
.TP 7
\ \ \ \fBI\fR\ \ :\fIIrix/Solaris-Mode\fR toggle \fR
-When operating in 'Solaris mode' ('I' toggled \*F), a task's \*(Pu usage
+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 told the new state of this toggle.
@@ -1167,13 +1167,13 @@ summarized here for future reference.
.nf
\fI key function \fR
- '=' alternate status\-line, file or pipeline
- '/' find, equivalent to 'L' locate
- 'n' find next, equivalent to '&' locate next
+ = alternate status\-line, file or pipeline
+ / find, equivalent to 'L' locate
+ n find next, equivalent to '&' locate next
<Space> scroll down, equivalent to <PgDn>
- 'b' scroll up, equivalent to <PgUp>
- 'g' first line, equivalent to <Home>
- 'G' last line, equivalent to <End>
+ b scroll up, equivalent to <PgUp>
+ g first line, equivalent to <Home>
+ G last line, equivalent to <End>
.fi
.TP 7
@@ -1183,7 +1183,7 @@ colors for the \*(CW, or for all windows.
For details regarding this \*(CI \*(Xt 4d. COLOR Mapping.
.IP "*" 3
-The commands shown with an \*(AK are not available in 'Secure mode',
+The commands shown with an \*(AK are not available in Secure mode,
nor will they be shown on the level-1 help screen.
.\" ......................................................................
@@ -1215,7 +1215,7 @@ of the '1', '2' or '3' \*(CTs and whether or not \*(We is running under
true SMP.
This portion of the \*(SA is also influenced by the 'H' \*(CI toggle,
-as reflected in the total label which shows either 'Tasks' or 'Threads'.
+as reflected in the total label which shows either Tasks or Threads.
.TP 7
\ \ \ \fBm\fR\ \ :\fIMemory/Swap-Usage\fR toggle \fR
@@ -1298,7 +1298,7 @@ The sort field might\fI not\fR be visible because:
1) there is insufficient\fI Screen Width \fR
2) the 'f' \*(CI turned it \*F
-\*(NT Whenever 'Searching' and/or 'Other Filtering' is active in a window,
+\*(NT Whenever Searching and/or Other Filtering is active in a window,
column highlighting is temporarily disabled.
\*(XC notes at the end of topics 5d. SEARCHING and 5e. FILTERING for an
explanation why.
@@ -1325,7 +1325,7 @@ the state of the 'x', 'y' or 'b' toggles.
.TP 7
\ \ \ \fBc\fR\ \ :\fICommand-Line/Program-Name\fR toggle \fR
-This command will be honored whether or not the 'COMMAND' column
+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.
@@ -1348,7 +1348,7 @@ related \*(CIs.
.TP 7
\ \ \ \fBS\fR\ \ :\fICumulative-Time-Mode\fR toggle \fR
-When 'Cumulative mode' is \*O, each process is listed with the \*(Pu
+When Cumulative mode is \*O, each process is listed with the \*(Pu
time that it and its dead children have used.
When \*F, programs that fork into many separate tasks will appear
@@ -1359,13 +1359,13 @@ Experiment with two \*(TWs sharing the same sort field but with different 'S'
states and see which representation you prefer.
After issuing this command, you'll be informed of the new state of this toggle.
-If you wish to know in advance whether or not 'Cumulative mode' is in
+If you wish to know in advance whether or not Cumulative mode is in
effect, simply ask for help and view the window summary on the second line.
.TP 7
\ \ \ \fBu\fR | \fBU\fR\ \ :\fIShow-Specific-User-Only \fR
You will be prompted for the\fB uid\fR or\fB name\fR of the user to display.
-The '\-u' option matches on \fB effective\fR user whereas the '\-U' option
+The \-u option matches on \fB effective\fR user whereas the \-U option
matches on\fB any\fR user (real, effective, saved, or filesystem).
Thereafter, in that \*(TW only matching users will be shown, or possibly
@@ -1427,12 +1427,12 @@ For compatibility, this \*(We supports most of the former \*(We sort keys.
Since this is primarily a service to former \*(We users, these commands do
not appear on any help screen.
.nf
- \fI command sorted-field supported \fR
- A start time (non-display) \fB No \fR
- M %MEM Yes
- N PID Yes
- P %CPU Yes
- T TIME+ Yes
+ \fI command sorted-field supported \fR
+ A start time (non-display) \fB No \fR
+ M %MEM Yes
+ N PID Yes
+ P %CPU Yes
+ T TIME+ Yes
.fi
Before using any of the following sort provisions, \*(We suggests that you
@@ -1442,8 +1442,8 @@ That will help ensure that the actual sort environment matches your intent.
The following \*(CIs will\fB only\fR be honored when the current sort field
is\fB visible\fR.
The sort field might\fI not\fR be visible because:
- 1) there is insufficient\fI Screen Width \fR
- 2) the 'f' \*(CI turned it \*F
+ 1) there is insufficient\fI Screen Width \fR
+ 2) the 'f' \*(CI turned it \*F
.TP 7
\ \ \ \fB<\fR\ \ :\fIMove-Sort-Field-Left \fR
@@ -1488,13 +1488,13 @@ The following \*(CIs are available.
\fB4\fR upper case letters to select a\fB target \fR
\fB8\fR numbers to select a\fB color \fR
normal toggles available \fR
- 'B' :bold disable/enable
- 'b' :running tasks "bold"/reverse
- 'z' :color/mono
+ B :bold disable/enable
+ b :running tasks "bold"/reverse
+ z :color/mono
other commands available \fR
- 'a'/'w' :apply, then go to next/prior
+ a/w :apply, then go to next/prior
<Enter> :apply and exit
- 'q' :abandon current changes and exit
+ q :abandon current changes and exit
.fi
If you use 'a' or 'w' to cycle the targeted window, you will
@@ -1563,8 +1563,8 @@ as the only display element.
.TP 7
*\ \ \fB=\fR | \fB+\fR\ \ :\fIEqualize-(reinitialize)-Window(s) \fR
The '=' key forces the \*(CW's \*(TD to be visible.
-It also reverses any 'i' (idle tasks), 'n' (max tasks), 'u'/'U' (user filter)
-and 'o'/'O' (other filter) commands that might be active.
+It also reverses any 'i' (idle tasks), 'n' (max tasks), 'u/U' (user filter)
+and 'o/O' (other filter) commands that might be active.
Also, if the window had been scrolled, it will be reset with this command.
\*(XT 5c. SCROLLING a Window for additional information regarding vertical
and horizontal scrolling.
@@ -1572,8 +1572,8 @@ and horizontal scrolling.
The '+' key does the same for all windows.
The four \*(TDs will reappear, evenly balanced.
They will also have retained any customizations you had previously
-applied, except for the 'i' (idle tasks), 'n' (max tasks), 'u'/'U'
-(user filter), 'o'/'O' (other filter) and scrolling \*(CIs.
+applied, except for the 'i' (idle tasks), 'n' (max tasks), 'u/U'
+(user filter), 'o/O' (other filter) and scrolling \*(CIs.
.TP 7
*\ \ \fBA\fR\ \ :\fIAlternate-Display-Mode\fR toggle \fR
@@ -1587,7 +1587,7 @@ chosen to make visible.
*\ \ \fBa\fR | \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
+These keys act in a circular fashion so you can reach any desired window
using either key.
Assuming the window name is visible (you have not toggled 'l' \*F),
@@ -1612,9 +1612,9 @@ It does not require that the window name be visible
.IP "*" 3
The \*(CIs shown with an \*(AK have use beyond \*(AM.
.nf
- '=', 'A', 'g' are always available
- 'a', 'w' act the same with color mapping
- and fields management
+ =, A, g are always available
+ a, w act the same with color mapping
+ and fields management
.fi
.\" ......................................................................
@@ -1765,15 +1765,16 @@ could yet produce a successful '&' search.
The above \*(CIs are\fB always\fR available in \*(FM but\fB never\fR
available in \*(AM if the \*(CW's \*(TD has been toggled \*F.
-\*(NT Whenever a search key is typed, \*(We will turn column highlighting
-\*F to prevent false matches on internal non-display escape sequences.
+\*(NT Whenever a Search is active in a window, \*(We will turn
+column highlighting \*F to prevent false matches on internal non-display
+escape sequences.
Such highlighting will be restored when a window's search string is empty.
\*(XC 'x' \*(CI for additional information on sort column highlighting.
.\" ......................................................................
.SS 5e. FILTERING in a Window
.\" ----------------------------------------------------------------------
-You can use the 'Other Filter' feature to establish selection criteria which
+You can use this Other Filter feature to establish selection criteria which
will then determine which tasks are shown in the \*(CW.
Establishing a filter requires: 1) a field name; 2) an operator; and
@@ -1865,7 +1866,7 @@ When some field's numeric amounts have been subjected to \fIscaling\fR
while others have not, that data is no longer homogeneous.
If you establish a relational filter and you \fBhave\fR changed the
-default 'Numeric' or 'Character' \fIjustification\fR, that filter is likely to fail.
+default Numeric or Character \fIjustification\fR, that filter is likely to fail.
When a relational filter is applied to a memory field and you \fBhave not\fR
changed the \fIscaling\fR, it may produce misleading results.
This happens, for example, because '100.0m' (MiB) would appear greater
@@ -1908,7 +1909,7 @@ So while amounts greater than 9999 exist, they will appear as 2.6m, 197k, etc.
.B Potential Solutions
.RS +3
.P
-These examples illustrate how 'Other Filtering' can be creatively
+These examples illustrate how Other Filtering can be creatively
applied to achieve almost any desired result.
Single quotes are sometimes shown to delimit the spaces which are part of
a filter or to represent a request for status (^O) accurately.
@@ -1941,8 +1942,9 @@ achieve the failed '9999' objective discussed above.
.fi
.RS -3
-\*(NT When 'Other Filtering' is active, \*(We turns column highlighting
-\*F to prevent false matches on internal non-display escape sequences.
+\*(NT Whenever Other Filtering is active in a window, \*(We will turn
+column highlighting \*F to prevent false matches on internal non-display
+escape sequences.
Such highlighting will be restored when a window is no longer subject
to filtering.
\*(XC 'x' \*(CI for additional information on sort column highlighting.
@@ -1954,7 +1956,7 @@ to filtering.
.\" ......................................................................
.SS 6a. SYSTEM Configuration File
.\" ----------------------------------------------------------------------
-The presence of this file will influence which version of the 'help' screen
+The presence of this file will influence which version of the help screen
is shown to an ordinary user.
More importantly, it will limit what ordinary users are allowed
to do when \*(We is running.
@@ -1973,8 +1975,8 @@ It must have only two lines.
Here is an example of the contents of\fI /etc/toprc\fR:
.nf
- s # line 1: 'secure' mode switch
- 5.0 # line 2: 'delay'\ \ interval in seconds
+ s # line 1: secure mode switch
+ 5.0 # line 2: delay interval in seconds
.fi
.\" ......................................................................
@@ -1992,7 +1994,7 @@ Here is the general layout:
" # line c: summclr,msgsclr,headclr,taskclr
global # line 15: width, memory scaling & zeroes overrides
" # any remaining lines are devoted to the
- " # generalized 'inspect' provisions
+ " # generalized inspect provisions
" # discussed below
.fi
@@ -2087,7 +2089,7 @@ If you want a truer representation, any embedded tabs should be expanded.
# next would have contained '\\t' ...
# file ^I <your_name> ^I /proc/%d/status
# but this will eliminate embedded '\\t' ...
- pipe ^I <your_name> ^I cat /proc/%d/status | expand -
+ pipe ^I <your_name> ^I cat /proc/%d/status | expand \-
.fi
The above example takes what could have been a 'file' entry but employs
@@ -2121,7 +2123,7 @@ In that way, many more choices can be made visible.
.\" ----------------------------------------------------------------------
.SH 7. STUPID TRICKS Sampler
.\" ----------------------------------------------------------------------
-Many of these 'tricks' work best when you give \*(We a scheduling boost.
+Many of these tricks work best when you give \*(We a scheduling boost.
So plan on starting him with a nice value of \-10, assuming you've got
the authority.
--
1.7.9.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
From ada443268e7f8c4526e6b048c98457679665b727 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 23 Apr 2014 00:00:04 -0500
Subject: [PATCH] misc: fix man doc spelling and grammar for translation
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
ps/ps.1 | 2 +-
sysctl.8 | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git ps/ps.1 ps/ps.1
index cdb7536..90f12ac 100644
--- ps/ps.1
+++ ps/ps.1
@@ -1683,7 +1683,7 @@ number of kernel threads owned by the process.
T}
tid TID T{
-the unique number representing a dispatacable entity (alias
+the unique number representing a dispatchable entity (alias
.BR lwp , \ spid ).
This value may also appear as: a process ID (pid); a process group ID (pgrp);
a session ID for the session leader (sid); a thread group ID for the thread
diff --git sysctl.8 sysctl.8
index faf2255..a74b2d7 100644
--- sysctl.8
+++ sysctl.8
@@ -63,8 +63,8 @@ Load in sysctl settings from the file specified or /etc/sysctl.conf if none
given. Specifying \- as filename means reading data from standard input.
Using this option will mean arguments to
.B sysctl
-are files, which are read in order they are specified. The file argument can
-may be specified as reqular expression.
+are files, which are read in the order they are specified.
+The file argument may be specified as reqular expression.
.TP
\fB\-a\fR, \fB\-\-all\fR
Display all values currently available.
@@ -112,10 +112,10 @@ Alias of \fB\-p\fR
Alias of \fB\-a\fR
.TP
\fB\-o\fR
-Does nothing in favour of BSD compatibility.
+Does nothing, exists for BSD compatibility.
.TP
\fB\-x\fR
-Does nothing in favour of BSD compatibility.
+Does nothing, exists for BSD compatibility.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help text and exit.
--
1.7.9.2

View File

@ -0,0 +1,62 @@
Based on 2f96eef7f86a12b81badef1c91ec2d503ae4029d Mon Sep 17 00:00:00 2001
From: Jaromir Capik <jcapik@redhat.com>
Date: Wed, 30 Apr 2014 13:59:34 +0200
Subject: [PATCH] library: reverting tmpfs subtraction from cached
(18-FEB-2014)
The subtraction was marked as reinforcing the misconception,
that memory in the page cache can be considered free.
The Cached value is not a sum of page cache and tmpfs,
as the tmpfs memory lives in the page cache and therefore
it's an inseparable part of it.
---
free.1 | 4 +---
proc/sysinfo.c | 2 --
vmstat.8 | 3 +--
3 files changed, 2 insertions(+), 7 deletions(-)
diff --git free.1 free.1
index 21cce28..85efef8 100644
--- free.1
+++ free.1
@@ -32,9 +32,7 @@ kernels 2.6.32, displayed as zero if not available)
Memory used by kernel buffers (Buffers in /proc/meminfo)
.TP
\fBcached\fR
-Memory used by the page cache (calculated as Cached - Shmem in
-/proc/meminfo - the Cached value is actually the sum of page cache and
-tmpfs memory)
+Memory used by the page cache (Cached in /proc/meminfo)
.SH OPTIONS
.TP
\fB\-b\fR, \fB\-\-bytes\fR
diff --git proc/sysinfo.c proc/sysinfo.c
index e07ca86..85fb0a4 100644
--- proc/sysinfo.c
+++ proc/sysinfo.c
@@ -688,8 +688,6 @@ nextline:
kb_main_used = 0;
}
kb_main_cached += kb_swap_reclaimable + kb_swap_cached + kb_nfs_unstable;
- /* "Cached" includes "Shmem" - we want only the page cache here */
- kb_main_cached -= kb_main_shared;
}
/*****************************************************************/
diff --git vmstat.8 vmstat.8
index 2782a42..420d9f3 100644
--- vmstat.8
+++ vmstat.8
@@ -102,8 +102,7 @@ b: The number of processes in uninterruptible sleep.
swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
-cache: the amount of memory used as cache (excluding tmpfs memory for
-kernels 2.6.32+)
+cache: the amount of memory used as cache.
inact: the amount of inactive memory. (\-a option)
active: the amount of active memory. (\-a option)
.fi
--
1.7.9.2

View File

@ -0,0 +1,53 @@
From 444fa7102b7f130734e35b45ce86fcc15d307a71 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 7 May 2014 00:00:00 -0500
Subject: [PATCH] top: miscellaneous accumulated changes to man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.1 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git top/top.1 top/top.1
index 67b8b35..5ce405e 100644
--- top/top.1
+++ top/top.1
@@ -1062,7 +1062,7 @@ Otherwise, \*(We displays a summation of all threads in each process.
.TP 7
\ \ \ \fBI\fR\ \ :\fIIrix/Solaris-Mode\fR toggle \fR
-When operating in Solaris mode ('I' toggled \*F), a task's \*(Pu usage
+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 told the new state of this toggle.
@@ -1216,7 +1216,7 @@ This command affects from 2 to many \*(SA lines, depending on the state
of the `1', `2' or `3' \*(CTs and whether or not \*(We is running under
true SMP.
-This portion of the \*(SA is also influenced by the 'H' \*(CI toggle,
+This portion of the \*(SA is also influenced by the `H' \*(CI toggle,
as reflected in the total label which shows either Tasks or Threads.
.TP 7
@@ -1856,7 +1856,7 @@ These examples use spaces for clarity but your input generally would not.
Items #1, #3 and #4 should be self\-explanatory.
Item \fB#2\fR represents both a required \fIdelimiter\fR and the \fIoperator\fR
-which must be one of either equality ('=') or relation ('<' or `>').
+which must be one of either equality (`=') or relation (`<' or `>').
The `=' equality operator requires only a partial match and that
can reduce your `if\-value' input requirements.
@@ -2229,7 +2229,7 @@ If necessary, use the `c' \*(CT to display command lines and ensure
that forest view mode is active with the `V' \*(CT.
Then use the up/down arrow keys to position the display so that some
-truncated command lines are shown ('+' in last position).
+truncated command lines are shown (`+' in last position).
You may have to resize your xterm to produce truncation.
Lastly, use the `j' \*(CT to make the COMMAND column right justified.
--
1.7.9.2

View File

@ -1,232 +1,62 @@
--- proc/ksym.c
+++ proc/ksym.c 2012-06-04 10:06:03.792202072 +0000
@@ -41,7 +41,7 @@
#define KSYMS_FILENAME "/would/be/nice/to/have/this/file"
#define SYSMAP_FILENAME "/home/albert/ps/45621/System.map-hacked"
#define linux_version_code 131598 /* ? */
-#define smp_num_cpus 2
+#define smp_num_cpus() 2
#endif
#if 0
@@ -49,7 +49,7 @@
#define KSYMS_FILENAME "/home/albert/ps/45621/ksyms-2.3.12"
#define SYSMAP_FILENAME "/home/albert/ps/45621/System.map-2.3.12"
#define linux_version_code 131852 /* 2.3.12 */
-#define smp_num_cpus 2
+#define smp_num_cpus() 2
#endif
#if 0
@@ -57,7 +57,7 @@
#define KSYMS_FILENAME "/home/albert/ps/45621/ksyms-2.3.18ac8-MODVERS"
#define SYSMAP_FILENAME "/home/albert/ps/45621/System.map-2.3.18ac8-MODVERS"
#define linux_version_code 131858 /* 2.3.18ac8 */
-#define smp_num_cpus 2
+#define smp_num_cpus() 2
#endif
#if 0
@@ -65,7 +65,7 @@
#define KSYMS_FILENAME "/home/albert/ps/45621/ksyms-2.3.18ac8-NOMODVERS"
#define SYSMAP_FILENAME "/home/albert/ps/45621/System.map-2.3.18ac8-NOMODVERS"
#define linux_version_code 131858 /* 2.3.18ac8 */
-#define smp_num_cpus 2
+#define smp_num_cpus() 2
#endif
/* These are the symbol types, with relative popularity:
--- proc/libprocps.sym
+++ proc/libprocps.sym 2014-05-16 10:01:38.446310070 +0000
@@ -57,6 +57,7 @@ global:
signal_name_to_number;
signal_number_to_name;
smp_num_cpus;
+ __smp_num_cpus;
sprint_uptime;
strtosig;
tty_to_dev;
--- proc/sysinfo.c
+++ proc/sysinfo.c 2013-05-29 11:26:47.797640941 +0000
@@ -37,8 +37,6 @@
@@ -37,7 +37,8 @@
#include <netinet/in.h> /* htons */
#endif
-long smp_num_cpus; /* number of CPUs */
-
+#undef smp_num_cpus
+long smp_num_cpus = -1; /* number of CPUs */
#define BAD_OPEN_MESSAGE \
"Error: /proc must be mounted\n" \
" To mount /proc at boot you need an /etc/fstab line like:\n" \
@@ -200,7 +198,7 @@ static void old_Hertz_hack(void){
free(savelocale);
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 );
+ h = (unsigned)( (double)jiffies/seconds/smp_num_cpus() );
/* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */
switch(h){
case 9 ... 11 : Hertz = 10; break; /* S/390 (sometimes) */
@@ -271,8 +269,6 @@ static void init_libproc(void){
have_privs = check_for_privs();
init_Linux_version(); /* Must be called before we check code */
- cpuinfo();
-
#ifdef __linux__
if(linux_version_code > LINUX_VERSION(2, 4, 0)){
Hertz = find_elf_note(AT_CLKTCK);
@@ -1012,7 +1008,12 @@ out:
@@ -1012,7 +1012,11 @@ out:
///////////////////////////////////////////////////////////////////////////
-void cpuinfo (void) {
+long smp_num_cpus (void) {
+ static long _smp_num_cpus=-1;
+long __smp_num_cpus (void) {
+
+ if (_smp_num_cpus != -1)
+ return(_smp_num_cpus);
+ if (smp_num_cpus != -1)
+ return(smp_num_cpus);
+
// ought to count CPUs in /proc/stat instead of relying
// on glibc, which foolishly tries to parse /proc/cpuinfo
// note: that may have been the case but now /proc/stat
@@ -1024,7 +1025,9 @@ void cpuinfo (void) {
@@ -1024,7 +1029,11 @@ void cpuinfo (void) {
// _SC_NPROCESSORS_CONF returns 2, resulting in HZ=512
// _SC_NPROCESSORS_ONLN returns 1, which should work OK
- smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (smp_num_cpus<1) /* SPARC glibc is buggy */
- smp_num_cpus=1;
+ _smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ if (_smp_num_cpus<1) /* SPARC glibc is buggy */
+ _smp_num_cpus=1;
+ smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ if (smp_num_cpus<1) /* SPARC glibc is buggy */
+ smp_num_cpus=1;
+
+ return _smp_num_cpus;
+ return smp_num_cpus;
}
+
+void cpuinfo (void) { (void)__smp_num_cpus(); }
--- proc/sysinfo.h
+++ proc/sysinfo.h 2012-06-04 10:04:15.812509959 +0000
@@ -7,7 +7,7 @@
@@ -7,7 +7,8 @@
EXTERN_C_BEGIN
extern unsigned long long Hertz; /* clock tick frequency */
-extern long smp_num_cpus; /* number of CPUs */
+extern long smp_num_cpus(void); /* number of CPUs */
+extern long __smp_num_cpus(void); /* number of CPUs */
+#define smp_num_cpus __smp_num_cpus()
extern int have_privs; /* boolean, true if setuid or similar */
#if 0
@@ -137,7 +137,5 @@ extern unsigned int getslabinfo (struct
extern unsigned get_pid_digits(void) FUNCTION;
-extern void cpuinfo (void);
-
EXTERN_C_END
#endif /* SYSINFO_H */
--- top/top.c
+++ top/top.c 2013-05-29 11:28:34.945439635 +0000
@@ -411,7 +411,7 @@ static void bye_bye (const char *str) {
, LINUX_VERSION_PATCH(linux_version_code)
, procps_version
, (unsigned)Hertz, (unsigned)sizeof(Hertz), (unsigned)sizeof(Hertz) * 8
- , Page_size, Cpu_faux_tot, (int)smp_num_cpus, (unsigned)sizeof(CPU_t)
+ , Page_size, Cpu_faux_tot, (int)smp_num_cpus(), (unsigned)sizeof(CPU_t)
, (unsigned)sizeof(HST_t), Page_size / (unsigned)sizeof(HST_t), HHist_siz
, (unsigned)sizeof(proc_t), (unsigned)sizeof(p->cmd), (unsigned)sizeof(proc_t*)
, (long)Frames_libflags
@@ -2230,7 +2230,7 @@ static void zap_fieldstab (void) {
/*** hotplug_acclimated ***/
Fieldstab[P_CPN].width = 1;
- if (1 < (digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)smp_num_cpus))) {
+ if (1 < (digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)smp_num_cpus()))) {
if (5 < digits) error_exit(N_txt(FAIL_widecpu_txt));
Fieldstab[P_CPN].width = digits;
}
@@ -2238,9 +2238,9 @@ static void zap_fieldstab (void) {
#ifdef BOOST_PERCNT
Cpu_pmax = 99.9;
Fieldstab[P_CPU].width = 5;
- if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
- Cpu_pmax = 100.0 * smp_num_cpus;
- if (smp_num_cpus > 10) {
+ if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) {
+ Cpu_pmax = 100.0 * smp_num_cpus();
+ if (smp_num_cpus() > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
@@ -2249,9 +2249,9 @@ static void zap_fieldstab (void) {
#else
Cpu_pmax = 99.9;
Fieldstab[P_CPU].width = 4;
- if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
- Cpu_pmax = 100.0 * smp_num_cpus;
- if (smp_num_cpus > 10) {
+ if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) {
+ Cpu_pmax = 100.0 * smp_num_cpus();
+ if (smp_num_cpus() > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
@@ -2294,8 +2294,8 @@ static void zap_fieldstab (void) {
* cpus[sumSLOT] == tics from the 1st /proc/stat line
* [ and beyond sumSLOT == tics for each cpu NUMA node ] */
static CPU_t *cpus_refresh (CPU_t *cpus) {
- #define sumSLOT ( smp_num_cpus )
- #define totSLOT ( 1 + smp_num_cpus + Numa_node_tot)
+ #define sumSLOT ( smp_num_cpus() )
+ #define totSLOT ( 1 + smp_num_cpus() + Numa_node_tot)
static FILE *fp = NULL;
static int siz, sav_slot = -1;
static char *buf;
@@ -2358,7 +2358,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
we'll force it to be treated as 'idle' so as not to present misleading
percentages. */
cpus[sumSLOT].edge =
- ((cpus[sumSLOT].cur.tot - cpus[sumSLOT].sav.tot) / smp_num_cpus) / (100 / TICS_EDGE);
+ ((cpus[sumSLOT].cur.tot - cpus[sumSLOT].sav.tot) / smp_num_cpus()) / (100 / TICS_EDGE);
#endif
#ifndef NUMA_DISABLE
@@ -2496,7 +2496,7 @@ static void procs_hlp (proc_t *this) {
oldtimev.tv_usec = timev.tv_usec;
// if in Solaris mode, adjust our scaling for all cpus
- Frame_etscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : smp_num_cpus));
+ Frame_etscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : smp_num_cpus()));
#ifdef OFF_HST_HASH
maxt_sav = Frame_maxtask;
#endif
@@ -2649,8 +2649,7 @@ static void sysinfo_refresh (int forced)
#ifndef PRETEND8CPUS
/*** hotplug_acclimated ***/
if (300 <= cur_secs - cpu_secs) {
- cpuinfo();
- Cpu_faux_tot = smp_num_cpus;
+ Cpu_faux_tot = smp_num_cpus();
cpu_secs = cur_secs;
#ifndef NUMA_DISABLE
if (Libnuma_handle)
@@ -3219,9 +3219,8 @@ static void before (char *me) {
// establish cpu particulars
#ifdef PRETEND8CPUS
- smp_num_cpus = 8;
+ Cpu_faux_tot = 8;
#endif
- Cpu_faux_tot = smp_num_cpus;
Cpu_States_fmts = N_unq(STATE_lin2x4_fmt);
if (linux_version_code > LINUX_VERSION(2, 5, 41))
Cpu_States_fmts = N_unq(STATE_lin2x5_fmt);
@@ -5020,19 +5019,19 @@ static void summary_show (void) {
if (CHKw(w, View_CPUNOD)) {
if (Numa_node_sel < 0) {
// display the 1st /proc/stat line, then the nodes (if room)
- summary_hlp(&smpcpu[smp_num_cpus], N_txt(WORD_allcpus_txt));
+ summary_hlp(&smpcpu[smp_num_cpus()], N_txt(WORD_allcpus_txt));
Msg_row += 1;
// display each cpu node's states
for (i = 0; i < Numa_node_tot; i++) {
if (!isROOM(anyFLG, 1)) break;
snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), i);
- summary_hlp(&smpcpu[1 + smp_num_cpus + i], tmp);
+ summary_hlp(&smpcpu[1 + smp_num_cpus() + i], tmp);
Msg_row += 1;
}
} else {
// display the node summary, then the associated cpus (if room)
snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), Numa_node_sel);
- summary_hlp(&smpcpu[1 + smp_num_cpus + Numa_node_sel], tmp);
+ summary_hlp(&smpcpu[1 + smp_num_cpus() + Numa_node_sel], tmp);
Msg_row += 1;
for (i = 0; i < Cpu_faux_tot; i++) {
if (Numa_node_sel == smpcpu[i].node) {

View File

@ -1,52 +0,0 @@
| From: Jaromir Capik <jcapik@redhat.com>
| To: procps-ng <procps@freelists.org>
| Subject: [procps] Re: --enable-libselinux switch
|
diff -Naur procps-ng-3.3.8.orig/configure.ac procps-ng-3.3.8/configure.ac
--- procps-ng-3.3.8.orig/configure.ac 2013-05-25 23:39:39.000000000 +0200
+++ procps-ng-3.3.8/configure.ac 2013-08-06 19:53:49.595654086 +0200
@@ -111,6 +111,14 @@
AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
fi
+AC_ARG_ENABLE([libselinux],
+ AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
+ [enable_libselinux=$enableval],
+ [enable_libselinux="no"])
+if test "$enable_libselinux" = "yes"; then
+ AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
+fi
+
# Optional packages - AC_ARG_WITH
AC_ARG_WITH([ncurses],
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
diff -Naur procps-ng-3.3.8.orig/ps/output.c procps-ng-3.3.8/ps/output.c
--- procps-ng-3.3.8.orig/ps/output.c 2013-05-25 23:39:40.000000000 +0200
+++ procps-ng-3.3.8/ps/output.c 2013-08-06 19:55:32.477650664 +0200
@@ -1282,6 +1282,8 @@
/****************** FLASK & seLinux security stuff **********************/
// move the bulk of this to libproc sometime
+#if !ENABLE_LIBSELINUX
+
static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
char filename[48];
size_t len;
@@ -1310,7 +1312,8 @@
return 1;
}
-#if 0
+#else
+
// This needs more study, considering:
// 1. the static linking option (maybe disable this in that case)
// 2. the -z and -Z option issue
@@ -1345,6 +1348,7 @@
}
return len;
}
+
#endif

View File

@ -1,24 +0,0 @@
| From: Jaromir Capik <jcapik@redhat.com>
| To: procps-ng <procps@freelists.org>
| Subject: [procps] shared memory in 'free'
|
diff --git a/proc/sysinfo.c b/proc/sysinfo.c
index 15cdb83..8e4aca2 100644
--- a/proc/sysinfo.c
+++ b/proc/sysinfo.c
@@ -629,13 +629,14 @@ void meminfo(void){
{"LowTotal", &kb_low_total},
{"Mapped", &kb_mapped}, // kB version of vmstat nr_mapped
{"MemFree", &kb_main_free}, // important
- {"MemShared", &kb_main_shared}, // important, but now gone!
+ {"MemShared", &kb_main_shared}, // obsolete since kernel 2.6! (sharing the variable with Shmem replacement)
{"MemTotal", &kb_main_total}, // important
{"NFS_Unstable", &kb_nfs_unstable},
{"PageTables", &kb_pagetables}, // kB version of vmstat nr_page_table_pages
{"ReverseMaps", &nr_reversemaps}, // same as vmstat nr_page_table_pages
{"SReclaimable", &kb_swap_reclaimable}, // "swap reclaimable" (dentry and inode structures)
{"SUnreclaim", &kb_swap_unreclaimable},
+ {"Shmem", &kb_main_shared}, // sharing the output variable with obsolete MemShared (kernel 2.6 and later)
{"Slab", &kb_slab}, // kB version of vmstat nr_slab
{"SwapCached", &kb_swap_cached},
{"SwapFree", &kb_swap_free}, // important

View File

@ -9,37 +9,3 @@
.
.ll +(\n[half_xtra] + \n[half_xtra])
.
@@ -32,11 +32,11 @@
.ds F \fIOff\fR
.ds O \fIOn\fR
.
-.ds AK asterisk (\'*\')
+.ds AK asterisk ('*')
.ds AM alternate\-display mode
.ds AS auxiliary storage
.ds CF configuration file
-.ds CG \'current\' window/field group
+.ds CG 'current' window/field group
.ds CI interactive command
\# - Note: our 'Command Line' used in 2 places
\# ( and managed to fit in an 80x24 terminal )
@@ -44,7 +44,7 @@
\-\fBu\fR|\fBU\fR user \-\fBp\fR pid \-\fBo\fR fld \-\fBw\fR [cols] \fR
.ds CO command\-line option
.ds CT command toggle
-.ds CW \'current\' window
+.ds CW 'current' window
.ds FG field group
.ds FM full\-screen mode
.ds KA arrow key
@@ -1578,8 +1578,8 @@ It does not require that the window name
.IP "*" 3
The \*(CIs shown with an \*(AK have use beyond \*(AM.
.Bd -literal -compact
- \'=', 'A', 'g' are always available
- \'a', 'w' act the same with color mapping
+ '=', 'A', 'g' are always available
+ 'a', 'w' act the same with color mapping
\ and fields management
.Ed

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4109cfb6fe3bcfb5a0efb37efe04d0c8ce858bff3820d48cc258bad41bed46b
size 553056

View File

@ -0,0 +1,18 @@
--- w.c
+++ w.c 2014-05-15 13:26:57.162238550 +0000
@@ -451,6 +451,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -h, --no-header do not print header\n"),out);
fputs(_(" -u, --no-current ignore current process username\n"),out);
fputs(_(" -s, --short short format\n"),out);
+ fputs(_(" -n, --no-truncat non truncated listing (large)\n"),out);
fputs(_(" -f, --from show remote hostname field\n"),out);
fputs(_(" -o, --old-style old style output\n"),out);
fputs(_(" -i, --ip-addr display IP address instead of hostname (if possible)\n"), out);
@@ -487,6 +488,7 @@ int main(int argc, char **argv)
{"no-header", no_argument, NULL, 'h'},
{"no-current", no_argument, NULL, 'u'},
{"short", no_argument, NULL, 's'},
+ {"no-truncat", no_argument, NULL, 'n'},
{"from", no_argument, NULL, 'f'},
{"old-style", no_argument, NULL, 'o'},
{"ip-addr", no_argument, NULL, 'i'},

View File

@ -1,6 +1,6 @@
--- configure.ac
+++ configure.ac 2013-05-29 10:45:47.473939111 +0000
@@ -69,7 +69,7 @@ AC_FUNC_MMAP
+++ configure.ac 2013-05-29 10:45:47.000000000 +0000
@@ -70,7 +70,7 @@ AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRTOD
@ -10,10 +10,10 @@
AM_GNU_GETTEXT_VERSION([0.14.1])
--- proc/libprocps.sym
+++ proc/libprocps.sym 2013-05-29 10:46:13.165439719 +0000
@@ -12,6 +12,7 @@ global:
free_slabinfo;
freeproc;
+++ proc/libprocps.sym 2014-05-15 13:16:40.950235845 +0000
@@ -14,6 +14,7 @@ global:
get_ns_id;
get_ns_name;
get_pid_digits;
+ get_proc_stats;
get_slabinfo;

3
procps-ng-3.3.9.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00f0cb0fadf968ddf605b0ef119846af07386629244d4f3da711a2cecf4e8663
size 560812

View File

@ -2,16 +2,16 @@
+++ top/top.c 2012-10-30 11:34:42.634844811 +0000
@@ -1910,8 +1910,15 @@ static void zap_fieldstab (void) {
Fieldstab[P_CPU].width = 5;
if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus();
- if (smp_num_cpus() > 10) {
+ if (smp_num_cpus() > 1000) {
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
- if (smp_num_cpus > 10) {
+ if (smp_num_cpus > 1000) {
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
+ Fieldstab[P_CPU].width = 8;
+ } else if (smp_num_cpus() > 100) {
+ } else if (smp_num_cpus > 100) {
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
+ Fieldstab[P_CPU].width = 7;
+ } else if (smp_num_cpus() > 10) {
+ } else if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
+ Fieldstab[P_CPU].width = 6;
} else {
@ -19,16 +19,16 @@
}
@@ -1921,12 +1928,18 @@ static void zap_fieldstab (void) {
Fieldstab[P_CPU].width = 4;
if (Rc.mode_irixps && smp_num_cpus() > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus();
- if (smp_num_cpus() > 10) {
+ if (smp_num_cpus() > 1000) {
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
- if (smp_num_cpus > 10) {
+ if (smp_num_cpus > 1000) {
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
+ Fieldstab[P_CPU].width = 7;
+ } else if (smp_num_cpus() > 100) {
+ } else if (smp_num_cpus > 100) {
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
+ Fieldstab[P_CPU].width = 6;
+ } else if (smp_num_cpus() > 10) {
+ } else if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
+ Fieldstab[P_CPU].width = 5;
} else {

View File

@ -1,58 +0,0 @@
--- vmstat.c
+++ vmstat.c 2012-06-01 13:41:09.844010232 +0000
@@ -179,9 +179,9 @@ static void new_header(void)
/* Translation Hint: Translating folloging header & fields
* that follow (marked with max x chars) might not work,
* unless manual page is translated as well. */
- printf(_("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n"));
+ printf(_("procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------\n"));
printf
- ("%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s\n",
+ ("%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
/* Translation Hint: max 2 chars */
_("r"),
/* Translation Hint: max 2 chars */
@@ -217,7 +217,9 @@ static void new_header(void)
/* Translation Hint: max 2 chars */
_("id"),
/* Translation Hint: max 2 chars */
- _("wa"));
+ _("wa"),
+ /* Translation Hint: max 2 chars */
+ _("st"));
}
static unsigned long unitConvert(unsigned long size)
@@ -230,7 +232,7 @@ static unsigned long unitConvert(unsigne
static void new_format(void)
{
const char format[] =
- "%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u\n";
+ "%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
unsigned int tog = 0; /* toggle switch for cleaner code */
unsigned int i;
unsigned int hz = Hertz;
@@ -273,8 +275,8 @@ static void new_format(void)
(unsigned)( (100*duse + divo2) / Div ),
(unsigned)( (100*dsys + divo2) / Div ),
(unsigned)( (100*didl + divo2) / Div ),
- (unsigned)( (100*diow + divo2) / Div )/*,
- (unsigned)( (100*dstl + divo2) / Div ) */
+ (unsigned)( (100*diow + divo2) / Div ),
+ (unsigned)( (100*dstl + divo2) / Div )
);
/* main loop */
@@ -338,9 +342,9 @@ static void new_format(void)
/* id */
(unsigned)( (100*didl+divo2)/Div ),
/* wa */
- (unsigned)( (100*diow+divo2)/Div )/*,
- / * st * /
- (unsigned)( (100*dstl+divo2)/Div ) */
+ (unsigned)( (100*diow+divo2)/Div ),
+ /* st */
+ (unsigned)( (100*dstl+divo2)/Div )
);
}
}

View File

@ -1,62 +0,0 @@
--- w.c
+++ w.c 2012-10-30 10:58:51.547461515 +0000
@@ -360,7 +360,7 @@ static const proc_t *getproc(const utmp_
}
static void showinfo(utmp_t * u, int formtype, int maxcmd, int from,
- const int userlen, const int fromlen, const int ip_addresses)
+ int userlen, int fromlen, const int ip_addresses)
{
unsigned long long jcpu;
int ut_pid_found;
@@ -390,7 +390,13 @@ static void showinfo(utmp_t * u, int for
strncpy(uname, u->ut_user, UT_NAMESIZE);
if (formtype) {
- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, u->ut_line);
+ int utlnlen = 8;
+ if (formtype > 1) {
+ userlen = strnlen(uname, UT_NAMESIZE);
+ fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
+ utlnlen = strnlen(u->ut_line, UT_LINESIZE);
+ }
+ printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, u->ut_line);
if (from)
print_from(u, ip_addresses, fromlen);
print_logintime(u->ut_time, stdout);
@@ -440,6 +446,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -h, --no-header do not print header\n"
" -u, --no-current ignore current process username\n"
" -s, --short short format\n"
+ " -n, --no-truncat non truncated listing (large)\n"
" -f, --from show remote hostname field\n"
" -o, --old-style old style output\n"
" -i, --ip-addr display IP address instead of hostname (if possible)\n"), out);
@@ -476,6 +483,7 @@ int main(int argc, char **argv)
{"no-header", no_argument, NULL, 'h'},
{"no-current", no_argument, NULL, 'u'},
{"sort", no_argument, NULL, 's'},
+ {"no-truncat", no_argument, NULL, 'n'},
{"from", no_argument, NULL, 'f'},
{"old-style", no_argument, NULL, 'o'},
{"help", no_argument, NULL, HELP_OPTION},
@@ -494,7 +502,7 @@ int main(int argc, char **argv)
#endif
while ((ch =
- getopt_long(argc, argv, "husfoVi", longopts, NULL)) != -1)
+ getopt_long(argc, argv, "husnfoVi", longopts, NULL)) != -1)
switch (ch) {
case 'h':
header = 0;
@@ -505,6 +513,10 @@ int main(int argc, char **argv)
case 's':
longform = 0;
break;
+ case 'n':
+ longform = 2;
+ header = 0;
+ break;
case 'f':
from = !from;
break;

View File

@ -1,3 +1,88 @@
-------------------------------------------------------------------
Fri May 16 09:44:19 UTC 2014 - werner@suse.de
- Update to procps-ng-3.3.9
* kernel namespaces support added to skill, pgrep, ps and top
* pidof was reimplemented from scratch (replacing sysvinit pidof)
* ps has configurable libselinux support (--enable-libselinux)
* ps provides for display of systemd slice unit (--with-systemd)
* free can once again report non-zero 'shared' memory
* sysctl provides '--system' to ignore missing /etc/sysctl.conf
* watch interval capacity was increased - debian #720445
* pwdx no longer fails in a nonexistent locale - debian #718766
* top clarified summary area Mem/Swap stats - debian #718670
* top batch mode -w (width) abend fixed - debian #721204
* top man page removed 'Bd/Ed' mdoc macros - debian #725713
* top no longer clears screen at exit - redhat #977561
* top adapted to potential libnuma stderr message - redhat #998678
* top added missing batch mode newline - redhat #1008674
- Modify patches
procps-ng-3.3.8-watch.patch becomes procps-ng-3.3.9-watch.patch
procps-v3.3.4-w-notruncate.diff becomes procps-ng-3.3.9-w-notruncate.diff
procps-ng-3.3.8-top.1.diff
procps-ng-3.3.8-top.1.diff
procps-v3.3.4-large_pcpu.patch
procps-ng-3.3.8-bnc634071_procstat2.diff
- Remove patches now upstream
procps-v3.3.4-stealtime.patch is upstream
procps-ng-3.3.8-libselinux.patch
procps-ng-3.3.8-shmem.patch
0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch
0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch
0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch
0004-top-enable-screen-contents-preservation-at-end-of-jo.patch
0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch
0006-top-cursor-repositioning-includes-line-oriented-inpu.patch
0007-top-correct-improve-or-otherwise-tweak-some-comments.patch
0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch
0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch
0010-ps-address-a-potential-newline-quirk-the-libselinux.patch
0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch
0013-top-modest-efficiency-change-to-message-line-handlin.patch
0014-top-correct-improve-and-otherwise-tweak-configs_read.patch
0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch
0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch
0019-top-swat-bug-impacting-idle-mode-user-filtering.patch
0021-top-address-some-potential-libnuma-display-corruptio.patch
0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch
0023-top-expand-on-column-highlight-quirks-in-man-documen.patch
0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch
0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch
0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch
0032-top-do-not-lie-about-purported-alphabetical-ordering.patch
0033-top-follow-usual-name-conventions-for-global-variabl.patch
- Add patches from upstream
0023-top-do-not-forget-the-fscanf-s-terminating-null-byte.patch
0024-sysctl-system-loads-default-config-file.patch
0025-Split-help-lines-to-help-translators.patch
0026-library-fixing-uninitialized-variable-pos-in-whattim.patch
0027-pgrep-Fixing-memory-leak-in-do_regcomp.patch
0028-sysctl-Fixing-memory-leaks-in-PreloadSystem.patch
0029-ps-ignore-SIGCONT.patch
0031-vmstat-wide-output-still-not-wide-enough.patch
0032-library-skip-replacement-of-trailing-0-in-read_unvec.patch
0033-kill-for-PID-1-restored.patch
0034-Check-for-presence-of-disks-in-vmstat.patch
0035-PID-2-to-9-for-kill-too.patch
0036-pgrep-fails-to-show-full-command-line-with-au.patch
0037-fail-on-null-string-for-arguments.patch
0038-Update-help-files.patch
0039-vmstat-Support-for-timestamps-with-t-fix-for-wd.patch
0040-watch-Don-t-leak-extra-fds-to-the-child.patch
0041-vmstat-Fixing-format-security-flaws.patch
0043-Added-get-trans-target-to-Makefile.patch
0045-library-properly-handle-memory-used-by-tmpfs.patch
0046-Minor-i18n-fixes.patch
0047-sysctl-increase-max-supported-line-length-of-the-con.patch
0049-fix-url-for-rsync.patch
0051-top-update-copyright-dates-plus-1-preprocessor-chang.patch
0052-top-refactor-man-document-so-as-to-allow-translation.patch
0053-top-minimize-the-usage-of-apostrophes-in-man-documen.patch
0054-top-swap-opening-quotes-for-back-tics-in-man-documen.patch
0055-misc-fix-man-doc-spelling-and-grammar-for-translatio.patch
0058-library-reverting-tmpfs-subtraction-from-cached-18-F.patch
0060-top-miscellaneous-accumulated-changes-to-man-documen.patch
-------------------------------------------------------------------
Thu May 15 11:50:39 UTC 2014 - werner@suse.de

View File

@ -17,7 +17,8 @@
%bcond_with bin2usr
%define somajor 1
%bcond_with pidof
%define somajor 3
%define libname libprocps%{somajor}
Name: procps
@ -35,7 +36,7 @@ BuildRequires: pkg-config
BuildRequires: pkgconfig(systemd)
%endif
BuildRequires: xz
Version: 3.3.8
Version: 3.3.9
Release: 0
Provides: ps = %version-%release
Obsoletes: ps < %version-%release
@ -45,14 +46,13 @@ Requires(postun): %insserv_prereq
Summary: The ps utilities for /proc
License: GPL-2.0+ and LGPL-2.1+
Group: System/Monitoring
Source: http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.8.tar.xz
Source: http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.9.tar.xz
Source1: procps-pmap-legacy.tar.bz2
Source2: boot.sysctl
Source3: systat.xinetd
Patch0: procps-ng-3.3.8-watch.patch
Patch0: procps-ng-3.3.9-watch.patch
Patch1: procps-v3.3.3-ia64.diff
Patch2: procps-v3.3.4-stealtime.patch
Patch3: procps-v3.3.4-w-notruncate.diff
Patch3: procps-ng-3.3.9-w-notruncate.diff
Patch4: procps-v3.3.4-w-simply-work.diff
Patch5: procps-ng-3.3.8-top.1.diff
Patch6: procps-v3.3.3-buffersize.diff
@ -71,64 +71,39 @@ Patch18: procps-ng-3.3.8-petabytes.patch
Patch19: procps-v3.3.4-large_pcpu.patch
Patch20: procps-ng-3.3.8-tinfo.dif
Patch21: procps-v3.3.3-pwdx.patch
# PATCH-FIX-UPSTREAM -- Let libproc support EPIPE in close_stream
Patch22: 0003-library-for-atexit-support-fix-fileutils-for-EPIPE.patch
# PATCH-FIX-UPSTREAM -- Add enable-libselinux switch
Patch23: procps-ng-3.3.8-libselinux.patch
# PATCH-FIX-OPENSUSE -- trifle rest of the old terabyte patch
Patch28: procps-ng-3.3.8-vmstat-terabyte.dif
# PATCH-FIX-UPSTREAM -- Show shared memory in 'free' again
Patch29: procps-ng-3.3.8-shmem.patch
# PATCH-FIX-UPSTREAM -- Add enable-libselinux switch
Patch30: 0010-ps-address-a-potential-newline-quirk-the-libselinux.patch
# PATCH-FIX-SUSE -- Ignore scan_unevictable_pages in sysctl
Patch31: procps-ng-3.3.8-ignore-scan_unevictable_pages.patch
Patch60: 0024-sysctl-system-loads-default-config-file.patch
Patch61: 0025-Split-help-lines-to-help-translators.patch
Patch62: 0026-library-fixing-uninitialized-variable-pos-in-whattim.patch
Patch63: 0027-pgrep-Fixing-memory-leak-in-do_regcomp.patch
Patch64: 0028-sysctl-Fixing-memory-leaks-in-PreloadSystem.patch
Patch65: 0029-ps-ignore-SIGCONT.patch
Patch66: 0031-vmstat-wide-output-still-not-wide-enough.patch
Patch67: 0032-library-skip-replacement-of-trailing-0-in-read_unvec.patch
Patch68: 0033-kill-for-PID-1-restored.patch
Patch69: 0034-Check-for-presence-of-disks-in-vmstat.patch
Patch70: 0035-PID-2-to-9-for-kill-too.patch
Patch71: 0036-pgrep-fails-to-show-full-command-line-with-au.patch
Patch72: 0037-fail-on-null-string-for-arguments.patch
Patch73: 0038-Update-help-files.patch
Patch74: 0039-vmstat-Support-for-timestamps-with-t-fix-for-wd.patch
Patch75: 0040-watch-Don-t-leak-extra-fds-to-the-child.patch
Patch76: 0041-vmstat-Fixing-format-security-flaws.patch
Patch77: 0043-Added-get-trans-target-to-Makefile.patch
Patch78: 0045-library-properly-handle-memory-used-by-tmpfs.patch
Patch79: 0046-Minor-i18n-fixes.patch
Patch80: 0047-sysctl-increase-max-supported-line-length-of-the-con.patch
Patch81: 0049-fix-url-for-rsync.patch
Patch82: 0055-misc-fix-man-doc-spelling-and-grammar-for-translatio.patch
Patch83: 0058-library-reverting-tmpfs-subtraction-from-cached-18-F.patch
# Top patches
# PATCH-FIX-UPSTREAM -- Add the major version to dlopen of libnuma
Patch100: 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch
# PATCH-FIX-UPSTREAM -- Use common mdoc nroff macros
Patch101: 0002-top-trade-two-groff_mdoc-macros-for-groff-equivalent.patch
# PATCH-FIX-UPSTREAM -- Do not clear screen after end-of-job
Patch102: 0004-top-enable-screen-contents-preservation-at-end-of-jo.patch
# PATCH-FIX-UPSTREAM -- Suppress end-of-job report if top if not ended with 'q' key
Patch103: 0005-top-refine-some-miscellaneous-signals-interrupt-stuf.patch
# PATCH-FIX-UPSTREAM -- Cursor repositioning includes line oriented input
Patch104: 0006-top-cursor-repositioning-includes-line-oriented-inpu.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch105: 0007-top-correct-improve-or-otherwise-tweak-some-comments.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch106: 0008-top-tweak-cursor-state-code-to-swat-an-obscure-bugle.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch107: 0009-top-correct-cursor-positioning-for-all-Z-or-C-cases.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch108: 0012-top-hint-that-Summary-Area-cached-is-Mem-not-Swap.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch109: 0013-top-modest-efficiency-change-to-message-line-handlin.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch110: 0014-top-correct-improve-and-otherwise-tweak-configs_read.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch111: 0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch112: 0018-top-restore-the-lost-final-newline-when-in-Batch-mod.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch113: 0019-top-swat-bug-impacting-idle-mode-user-filtering.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch114: 0021-top-address-some-potential-libnuma-display-corruptio.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch115: 0022-top-fix-miscellaneous-spelling-errors-in-man-documen.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch116: 0023-top-expand-on-column-highlight-quirks-in-man-documen.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch117: 0024-top-add-some-flexibility-to-dlopen-for-numa-support.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch118: 0025-top-minimize-the-statistics-overhead-for-numa-suppor.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch119: 0026-top-eliminate-yet-more-gcc-subscript-resolution-bloa.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch120: 0032-top-do-not-lie-about-purported-alphabetical-ordering.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch121: 0033-top-follow-usual-name-conventions-for-global-variabl.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch121: 0023-top-do-not-forget-the-fscanf-s-terminating-null-byte.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch122: 0035-top-provide-for-discontinuous-not-active-NUMA-nodes.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
@ -143,6 +118,17 @@ Patch126: 0044-top-avoid-a-nan-when-the-delay-interval-is-very-low.patch
Patch127: 0045-top-standardize-Esc-key-support-with-prompted-input.patch
# PATCH-FIX-UPSTREAM added at 2014/05/15
Patch128: 0046-top-miscellaneous-accumulated-changes-to-program-cod.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch129: 0051-top-update-copyright-dates-plus-1-preprocessor-chang.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch130: 0052-top-refactor-man-document-so-as-to-allow-translation.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch131: 0053-top-minimize-the-usage-of-apostrophes-in-man-documen.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch132: 0054-top-swap-opening-quotes-for-back-tics-in-man-documen.patch
# PATCH-FIX-UPSTREAM added at 2014/05/16
Patch133: 0060-top-miscellaneous-accumulated-changes-to-man-documen.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -188,7 +174,6 @@ the process information pseudo-file system,
%setup -q -n %{name}-ng-%{version}
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
@ -208,34 +193,33 @@ the process information pseudo-file system,
%patch19
%patch20
%patch21
%patch22
%patch23 -p1
%patch28
%patch29 -p1
%patch30
%patch31 -p1
%patch60
%patch61
%patch62
%patch63
%patch64
%patch65
%patch66
%patch67
%patch68
%patch69
%patch70
%patch71
%patch72
%patch73
%patch74
%patch75
%patch76
%patch77
%patch78
%patch79
%patch80
%patch81
%patch82
%patch83 -b .xyz
# Patches for top
%patch100
%patch101
%patch102
%patch103
%patch104
%patch105
%patch106
%patch107
%patch108
%patch109
%patch110
%patch111
%patch112
%patch113
%patch114
%patch115
%patch116
%patch117
%patch118
%patch119
%patch120
%patch121
%patch122
%patch123
@ -244,6 +228,11 @@ the process information pseudo-file system,
%patch126
%patch127
%patch128
%patch129
%patch130
%patch131
%patch132
%patch133
%build
tar --strip-components=1 -xf %{S:1}
@ -259,6 +248,9 @@ export LFS_CFLAGS="$(getconf LFS_CFLAGS)"
--disable-nls \
--disable-rpath \
--disable-kill \
%if !%{with pidof}
--disable-pidof \
%endif
--enable-watch8bit \
--enable-shared \
--enable-skill \
@ -364,6 +356,9 @@ make check
%verify(link) %{_sbindir}/sysctl
%endif
%{_bindir}/free
%if %{with pidof}
%{_bindir}/pidof
%endif
%{_bindir}/pmap
%{_bindir}/pwdx
%{_bindir}/skill
@ -376,6 +371,9 @@ make check
%{_bindir}/watch
%_mandir/man1/free.1.gz
%_mandir/man1/pgrep.1.gz
%if %{with pidof}
%_mandir/man1/pidof.1.gz
%endif
%_mandir/man1/pkill.1.gz
%_mandir/man1/pmap.1.gz
%_mandir/man1/ps.1.gz