pgrep got updated due to the confusion of the f,l and a flags.
While the newer behaviour is far better but it is no longer following
the ancient Solaris standards, so that got removed.
References: https://bugs.debian.org/752501
With 99bebff06a a configurable
width of the FROM column was introduced. Unfortunately this
caused a regression in the dash printing. Hopefully fixed
with this commit.
pmap would previously print the process name if
/proc/PID/smaps could be opened, even if subsequent
reads failed. This actually occurs with other users
PIDs.
Kernel 3.18rc1 introduced a change where the file could
not been opened, meaning pmap -X 1 previously showed
the process name and nothing else but NOW shows nothing
make check failed because of this.
This change prints the process name even before trying to open
the file, returning it to previous behaviour.
Thanks to Vincent Bernat for some analysis.
References:
https://bugs.debian.org/775624https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=29a40ace841cba9b661711f042d1821cdc4ad47c
Signed-off-by: Craig Small <csmall@enc.com.au>
When the command is executed in one shot mode (-o) with stdin
being something other than a terminal, the tcgetattr() call
would fail, and generate an error message. e.g.:
slabtop: terminal setting retrieval: Inappropriate ioctl for device
Active / Total Objects (% used) : 905319 / 915886 (98.8%)
Signed-off-by: Craig Small <csmall@enc.com.au>
If skill was used with a signal number then it would intepret
the command line with last option interpreted twice. This often
confused the program so it just would end up killing nothing.
So this would work:
skill -t pts/0
This would not:
skill -9 -t pts/0
The kill path (in the same file) uses the same logic that has
been introduced here.
References: https://www.freelists.org/post/procps/skill-command-does-not-work-in-debian-7-releases
Signed-off-by: Craig Small <csmall@enc.com.au>
A recent commit eliminated the potential for a storage
violation with forest view mode. It occurred when some
program (erroneously?) created a lengthy forking loop.
However, the associated commit message was misleading.
The message implied that an unexpected order following
a sort on start_time was the cause of storage overruns
and a 'char' used to track nesting level only distorts
the display when it goes negative. Actually, the truth
is really just the opposite. Any start_time sort quirk
causes no harm while that 'char' can yield corruption.
Should some child end up sorted ahead of its parent by
way of an extremely unlikely shared start_time the end
result is such a child will be displayed unnested just
like init or kthreadd along with all its own children.
However, if nesting levels exceeded 255 (and became 0)
a massive array overrun could be triggered when such a
task and *all* its children were added to an array for
the second time. Exactly how much storage was violated
depended on the number of children that zeroed process
had spawned (hinted at via either SIGSEGV or SIGABRT).
The earlier commit limited nested levels to 100 so the
root cause of the storage violation was already fixed.
The potential for distorted nesting levels due to sort
on start_time would seem to remain. But it's extremely
unlikely that 2 tasks would share the same start_time.
Even so, a new #define has been introduced which makes
top impervious to the order of tasks such that a qsort
is no longer necessary (providing an init/systemd task
exists & was harvested as the first task by readproc).
It can be utilized if distorted nesting ever becomes a
real issue. But since there is a 5-10% performance hit
with that, we'll continue using start_time as default.
References(s):
commit ce70017eb1
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit will eliminate a very nasty bug associated
with top's forest view mode. It addresses a potential
SIGSEGV/SIGABRT that was only encountered when another
program (erroneously?) creates a lengthy forking loop.
If the growing list of nested children is sufficiently
fast such that proc_t start_time is duplicated between
children then the sort upon which top relies might not
produce the expected order. That, in turn, could cause
the forest_adds function to initially miss some child.
But that missed child would be caught by forest_create
and eventually would cause our array boundary overrun.
Such overrun occurs when some child of that originally
*missed* child is found and a duplicate add attempted.
In correcting this bug we'll also use this opportunity
to prohibit a borrowed proc_t padding byte (char) from
going negative. If the nesting level exceeded 127, the
effect was an "unnesting" with the snprintf width then
viewed as flag+width also yielding left justification.
Henceforth, we'll limit nesting to 100 with subsequent
children shown as " + ", not the usual " `- " prefix.
References(s):
https://bugzilla.redhat.com/show_bug.cgi?id=1153642http://www.freelists.org/post/procps/Bug-in-the-forrest-view,6
Signed-off-by: Jim Warner <james.warner@comcast.net>
When startup defaults were changed users with existing
rcfiles would likely find their previous configuration
was not being honored in all respects. The disparities
involved Graphs modes and Summary/Task memory scaling.
This patch simply restores what was always intended as
the proper behavior for previously saved config files.
References(s):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762928https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762947
. new startup defaults
commit 8ef6cd91fc
Signed-off-by: Jim Warner <james.warner@comcast.net>
Previously the default background color was expected
to be always black and the default foreground color
was expected to be always white. This commit extends
the group of color pairs with pairs containing default
colors.
GLOB_TILDE is a GNU extension and may not be present on all systems.
Note (jcapik): The original patch from Michael Forney didn't
apply cleanly due to my recent addition of the GLOB_BRACE flag
in the list of flags. I had to edit the patch to make it apply,
but that produces an inconsistent state. It's gonna be fixed
in the next commit.
It looks like an off by one error was added to tload a couple years
ago while removing goto statements. This causes tload to go into
an endless loop when the load is just under a scale change integer.
eg: .99, 1.99, 3.99, 7.99
to reproduce you can add, just under the loadavg at line 170 in tload.c:
av[0] = 1.99;
or get the load to that level separately.
The patch below makes the code more like the original, but without the
goto statements. This can also be fixed by just changing line 183 in
tload.c from "if (0 < row)" -> "if (0 <= row)".
The previous commit removes the stdio_ext.h header,
but the ns_read function calls snprintf that needs
stdio.h and therefore moving the stdio.h include
from the bottom test program to the top line.
The <stdio_ext.h> include breaks building on platforms without that header and is unused in nsutils.c.
Also remove unused but harmless <error.h> include.
The previous code assumed that there would be 1 or 2 attributes to
apply. In fact, there can in general be any number (but typically
between 1 and 3). This commit generalizes the existing code to read
arbitrarily many attributes from the escape sequence.
For some reason I thought the columns are left justified
and consequently modified the header incorrectly when
implementing the -w/--wide feature.
With this commit the column width was increased by 1
so that the default layout is 79 characters wide
and allows to display 11 digits per column.
It's possible for the first entry that this reads from /proc/*/smaps to
start with a map_desc-less line like this:
7fa71b77d000-7fa71c288000 rw-p 00000000 00:00 0
in which case sscanf will only read up to inode, and it won't set c; the
code below would then incorrectly discard the next ("Size:") line.
(With GCC 4.9.0, this bug causes the "pmap extra extended output" test
to fail for me.)
free got a makeover to suit the newer kernel memory management.
This commit updates the tests to follow the new output for free
Signed-off-by: Craig Small <csmall@enc.com.au>