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>
This patch will cure a potential aberration associated
with a terminal's size (SIGWINCH) and top's new graphs
modes. The symptoms were a dangling tilde (~) plus the
potential loss of a graph's right-most visual content.
The condition was only apparent when a %Cpu approached
100% usage. Also the apparent loss of content affected
the 'block' graph only. With 'bar' graphs, that affect
became the loss of proper right-most bar graph colors.
The cause was determined to be a combination of: 1) an
unnecessary snprintf precision specification; and 2) a
rounding quirk for any graphs which displayed distinct
types of information (as for user/syst, used/unavail).
These could then combine to produce an extra bar/block
which, in turn, resulted in the truncation of a pseudo
termcap attribute used by the show_special() function.
What was originally interpreted as an intractable race
condition turns out to be just a self inflicted wound.
Reference(s):
http://www.freelists.org/post/procps/top-Possible-bug-in-the-graphs,1
Signed-off-by: Jim Warner <james.warner@comcast.net>
With introduction of the 'available' column
and with the latest changes in the 'used' evaluation
the -/+ buffers/cache line became redundant.
The first value duplicates the 'used'
column and the second value has a more accurate
brother called 'available'.
This renames the --available switch
to the --wide switch and changes the default
layout so that it includes the 'available'
column and joins buffers and cache into
a common column called 'buff/cache'.
Let's not report zero for kb_main_available when older
kernels don't have MemAvailable. Instead, if we simply
duplicate the 'free' amount we can avoid all ancillary
problems, such as those involving top's graphing mode.
Reference(s):
http://www.freelists.org/post/procps/kb-main-available-etc,3
Signed-off-by: Jim Warner <james.warner@comcast.net>
This patch will trade a former pessimistic calculation
of free physical memory for a more optimistic one that
uses the newly added kb_main_available library export.
But in case one might wish to return to the old former
method, there's a new #define that was made available.
[ the new calculation will affect graphing mode only ]
Reference(s):
http://www.freelists.org/post/procps/systemd-support-to-library,9
Signed-off-by: Jim Warner <james.warner@comcast.net>
Might as well use the newly exposed sysinfo.h variable
'page_bytes' rather than our own. Plus, in the process
we can avoid incurring yet one more function call hit.
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit just ensures recalculation of some amounts
for iterative processes, like top. It also trades some
repeated runtime calls to sysconf for a one time cost.
Reference(s):
http://www.freelists.org/post/procps/systemd-support-to-library,7
. fall-back calculations
commit b779855cf1
Signed-off-by: Jim Warner <james.warner@comcast.net>
[ plus remove just a little darn trailing whitespace ]
Reference(s):
. systemd migrated to library
commit 9d8ad6419f
. added library documentation
commit a74fb8fade
Signed-off-by: Jim Warner <james.warner@comcast.net>
The stderr message regarding ELF notes appears on some
systems (openSUSE-13.1 for example) but I have not yet
isolated why. Since at startup we go on to determine a
Hertz value the old fashion way, this patch just turns
off the useless message until the cause is understood.
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit adds the GLOB_BRACE flag in the glob flags.
That allows to expand the csh style braces {a,b} and
define multiple independent patterns for config file
locations.
This commit adds support for fallback calculation
of the MemAvailable field if not exported by the
kernel. The MemAvailable field appeared in kernel
3.14, but it's possible to calculate it from other
fields since 2.6.27 (splitLRU changes).