This commit provides for raising the total displayable
fields from its current 70 to 86. It also bumps the id
in an rcfile representing the version from 'i' to 'j'.
The increase in number of fields will make sharing the
rcfile with an older top, once it's saved, impossible.
These changes are being done via a #define rather than
hard coded so any such sharing will still be possible.
Signed-off-by: Jim Warner <james.warner@comcast.net>
For a specific slice of kernel versions we can get a better
estimate of the available memory before the "real" available
figure appears around kernel 3.2
However, that middle method requires a /proc/sys/vm directory.
FreeBSD 9.x used to emulate a < 2.6.27 kernel procfs meaning
it never tried the middle method. FreeBSD 10.x emulates something
more modern, but without the available figure and without a
/proc/sys/vm, so the library falls into a hole.
Hurd may to one day have this bug so we'll exclude him as well
as its triggered by whatever number appears in
/proc/sys/kernel/osrelease
References:
commit 3f3b1a59adhttps://bugs.debian.org/831396
Whoa, I had never considered an alternative to ncurses
until the issue referenced below was raised. Thus, I'm
surprised to find that 'tparm' was the only impediment
to ultimately utilizing this alternate curses library.
And, while we could have substituted that non-standard
'tiparm' with only 2 arguments, we'll utilize the full
parms compliment in the spirit of that original patch.
Frankly, the task of developing an alternative library
to that ncurses implementation really boggles my mind.
Congratulations to rofl0r, whoever that masked man is.
Reference(s):
. issue raised
https://gitlab.com/procps-ng/procps/issues/38
. netbsd-curses home
https://github.com/sabotage-linux/netbsd-curses
Signed-off-by: Jim Warner <james.warner@comcast.net>
Those infernal arches of kfreebsd-i386 (not -amd64) don't define
HOST_NAME_MAX. This patch is a work-around for those systems with
lacking include files.
Because I don't know how to redirect properly in tcl, there are
some small scripts that do this for me. With your standard
make check, all is good because the scripts and the binary are
in the usual spots.
make distcheck however puts them all over the place. The binary is
in a different tree to the test and aux scripts. The change now
tells where aux script where its binary is.
If process_ansi encountered an unknown character when processing an ANSI
escape sequence, it would ungetc all the characters read so far, except
for the character just read, and the opening '\033['. ungetting the
middle of the escape sequence does not produce useful results, and also
relies on the unportable assumption that ungetc works on multiple
characters (which glibc does not support). Discard the characters
instead.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
process_ansi stopped processing an ANSI escape sequence if
(c < '0' && c > '9' && c != ';'), which will never happen. Fix the
range check to use || instead.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
process_ansi assumed all numbers in a color control sequence correspond
to colors or attributes, which breaks badly if it encounters a
ISO-8613-3 escape sequence (such as for truecolor RGB). For instance,
the sequence "\x1b[38;2;10;20;30m" sets the foreground color to
rgb(10,20,30), but watch will interpret all five numbers in the sequence
as colors or attributes themselves.
Stop processing the entire escape sequence if watch encounters any
number it doesn't understand, as that number may change the meaning of
the rest of the sequence.
Previously there was a commit to change all noinst_PROGRAMS into
check_PROGRAMS. This was not a good idea.
check_PROGRAMS are built before TESTS are run. However they are
NOT build before the dejagnu tests are run, causing those tests
to fail.
So:
If the program is required for dejagnu, it needs to go into
noinst_PROGRAMS
If the program is required for TESTS or is one of those TESTS,
it needs to go into check_PROGRAMS
For some unknown reason, check_PROGRAMS are not built before check.
They are built before recheck and after check, which isn't very
useful.
This means any tests by dejagnu that need those programs will fail.
On my console I get a build error, the CI merrily reports the error
but considers the build OK; go figure.
The kludge adds check_PROGRAMS to be a dependency to check.
Note, TESTS don't need to be included in this, because they are
properly compliled after the dejagnu tests but before they are
run.
As part of the fix to truncate the command in non-8bit, watch had
the function for output_header changed (much for scope cleanliness
and cohesiveness than anything; so I'm going to blame Meyer)...
Anyhow the 8bit enabled version did not have that update which
meant watch failed to compile. Thanks to @asavah for issue #37
and the patch.
References:
commit 5a40c7970d
For what could be our last oldlib release, why not try
to make the NEWS a little more readable. So, it's been
reorganized by category and bug fixes were out-dented.
Signed-off-by: Jim Warner <james.warner@comcast.net>
For this release, what's likely to be our last oldlib,
we really no longer care when top or ps threads access
is made a little less efficient. This is especially so
when efficiency was gained at the expense of accuracy.
The newlib branch already has turned off QUICK_THREADS
so this patch just brings the master branch into line.
Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=1284091
Signed-off-by: Jim Warner <james.warner@comcast.net>
On MacOS the system already has user_from_uid and group_from_gid.
These are renamed pwcache_get_user and pwcache_get_group.
For the old library, pwcache_get_user needs to be exported
for skill.
References:
https://gitlab.com/procps-ng/procps/issues/34
Signed-off-by: Craig Small <csmall@enc.com.au>
This patch adapts the ps program to a newly add proc_t
field and provides for new support in that top program
along with his man document (ps was already ok there).
Signed-off-by: Jim Warner <james.warner@comcast.net>
Since we're about to break the ABI/API anyway, why not
go ahead and add yet another field to our proc_t which
the newlib branch has had for awhile. This then allows
the top program to offer 'control group name' and will
also permit a few reductions in that ps program logic.
And let's also clean up some unrelated warnings below.
Clang warnings:
proc/readproc.c:1178:50: warning: address of array 'ent->d_name' will always evaluate to 'true' [-Wpointer-bool-conversion]
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
~~~~~~^~~~~~
proc/readproc.c:1205:50: warning: address of array 'ent->d_name' will always evaluate to 'true' [-Wpointer-bool-conversion]
if(unlikely(unlikely(!ent) || unlikely(!ent->d_name))) return 0;
~~~~~~^~~~~~
Signed-off-by: Jim Warner <james.warner@comcast.net>
We'll follow Craig's lead and whack some author stuff.
[ and we'll honor the SEE ALSO guideline for periods ]
[ but essentially ignore all the other busybody crap ]
[ which, to be honest, we pretty much follow already ]
[ actually, if you're told to follow a certain style ]
[ in program examples, you've gone way past busybody ]
[ crap and have entered the realm of anal retentive! ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
This development (only) define can be used to turn top
into a simple text program, disabling termcap effects.
But input (at screen bottom) suffers from a line wrap.
So, this commit just makes the input prompt processing
a little more effective by adding one leading newline.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Added locale details and fixed this manual page to follow standards
including ordering it the right way, keeping the names of things
consistent and removing authors section.
Signed-off-by: Craig Small <csmall@enc.com.au>
Both watch and free used the locale to determine the required delay
interval for subsequent updates. It's preferable to not care about
locale and accept both 12.34 and 12,34 as meaning 12 seconds and
340 microseconds.
References:
https://bugs.debian.org/692113
Signed-off-by: Craig Small <csmall@enc.com.au>
Minor tweaks in the free manual page
* Removed author section. It's wrong and strongly discouraged
by the man page standards.
* Moved note about shared not in old kernels into bugs sections
as this is not relevant for most people and declutters the top
sections.
References:
https://bugs.debian.org/755233
Signed-off-by: Craig Small <csmall@enc.com.au>
The procps library attempts to work out the tty of a process
through several methods. For things like /dev/tty123 or
/dev/foo it works fine.
For tty devices that put the minor number in a directory
of the major name this fails. So then we have to fallback
to stating things like the processes STDERR and try again.
Considering a lot of processes sit on ttys such as
/dev/pts/3 this is a lot of wasted time. At the point of
entering driver_name we know "/dev/pts" and we know "3"
we just didn't join them up the right way as this is old
code.
This change now looks for /dev/pts/3 as well. It does it
after looking for /dev/pts3 so the behaviour is the same.
References:
https://bugs.debian.org/770215
Signed-off-by: Craig Small <csmall@enc.com.au>
When the screen width is not long enough to display the entire
command, watch puts three dots ... like elipses at the end of
the truncated line.
It's been like that for years, perhaps noone uses non 8-bit
watch?
References:
commit 367b8bb616
Signed-off-by: Craig Small <csmall@enc.com.au>
- Fixing sysinfo - devices with length exceeding 15 chars are not displayed in vmstat -d
Resolves Bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=586078. See for more info.<br/>
Enhances procps-ng to get aligned with kernel features (support for devices of name 32 chars long).
See merge request !16
Shell kill would report a problem if you tried to kill a process
while procps kill was silent. This meant it looked like kill worked
when it actually failed.
References:
https://bugs.debian.org/733172
- Fixing incorrect memory usage assessment due to skipping vmflags parsing
- Sometimes occurs when calculating memory usage of program using virtual memory. Vmflags line not recognized and affects calculations, resulting in nonsense values. Raised in Red Hat Bugzilla #1262864, affecting upstream.
See merge request !15
We'll now display a '?' for any systemd field when our
library was built without that above configure option.
Since the man page documents such fields this approach
is far superior to that old (confusing) error message:
. error: unknown user-defined format specifier "slice"
Signed-off-by: Jim Warner <james.warner@comcast.net>
Now that the conditional OOMEM_ENABLE has been removed
and all users exposed to those 'out of memory' fields,
it's about time we added them to the top man document.
Signed-off-by: Jim Warner <james.warner@comcast.net>
The former variable length structure created potential
problems for library users like that referenced below.
We will now parallel the same approach newlib uses for
the configure options --enable-oomem & --with-systemd.
Thus, the --enable-oomem and OOMEM_ENABLE #define have
been eliminated and the --with-systemd option (#define
WITH_SYSTEMD) will hereafter impact one function only.
The proc_t struct itself will now *never* be impacted.
Reference(s):
https://gitlab.com/procps-ng/procps/issues/31
Signed-off-by: Jim Warner <james.warner@comcast.net>
Using the <STAT> api under the newlib branch, that top
program is very responsive to changes in the number of
on-line cpus. However under the master branch this top
program is very responsive only to losses of some cpu.
When a cpu is brought back on-line potential delays of
60 seconds could be encountered. That delay was simply
an attempt to reduce costs and reflected the erroneous
assumption that adding a cpu required physical effort.
So without redesigning the cpu refresh code to emulate
that of newlib, this commit just reduces the potential
delay to 3 seconds (the same that is used for memory).
[ As an aside, if one wants to have their confidence ]
[ in that htop program badly shaken, try taking some ]
[ cpus off-line & on-line again while it is running. ]
[ Poor ol' htop just continues to report results for ]
[ whatever were the cpus when started. Nice feature, ]
[ but I wonder where those phantom results are from. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit just tries to parallel that newlib branch.
It contains the following changes, which were prompted
by the newlib coverity analysis which Craig initiated:
. comment typo predicting 'String not null terminated'
. eliminate 'Logically dead code' from insp_make_row()
Some tweaks, unrelated to coverity, are also included:
. use more modern (recommended) approach for time call
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit just tries to parallel the implementations
in the newlib branch. The config file Rc.zero_suppress
will be extended to include both out-of-memory fields.
And while we're at it, we'll also extend zero suppress
to that NI (nice value) field, which already should've
had it. Plus we trade those namespaces custom suppress
logic for our now slightly enhanced make_num function.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Since support already exists in the newlib branch this
represents an equivalent master branch implementation,
and this commit message is shared with 2 more patches.
Beginning with linux-4.5, the following new fields are
being added under that /proc/<pid>/status pseudo file:
. RssAnon - size of resident anonymous memory
. RssFile - size of resident file mappings
. RssShmem - size of resident shared memory
p.s. Locked resident memory support was also added but
isn't directly related to the kernel 4.5 enhancements.
p.p.s. Archlinux, Debian-stretch and Fedora-23 already
are currently using a 4.5 linux kernel (as of 6/2/16).
Signed-off-by: Jim Warner <james.warner@comcast.net>
Since support already exists in the newlib branch this
represents an equivalent master branch implementation,
and this commit message is shared with 2 more patches.
Beginning with linux-4.5, the following new fields are
being added under that /proc/<pid>/status pseudo file:
. RssAnon - size of resident anonymous memory
. RssFile - size of resident file mappings
. RssShmem - size of resident shared memory
p.s. Locked resident memory support was also added but
isn't directly related to the kernel 4.5 enhancements.
p.p.s. Archlinux, Debian-stretch and Fedora-23 already
are currently using a 4.5 linux kernel (as of 6/2/16).
Signed-off-by: Jim Warner <james.warner@comcast.net>
Since support already exists in the newlib branch this
represents an equivalent master branch implementation,
and this commit message is shared with 2 more patches.
Beginning with linux-4.5, the following new fields are
being added under that /proc/<pid>/status pseudo file:
. RssAnon - size of resident anonymous memory
. RssFile - size of resident file mappings
. RssShmem - size of resident shared memory
p.s. Locked resident memory support was also added but
isn't directly related to the kernel 4.5 enhancements.
p.p.s. Archlinux, Debian-stretch and Fedora-23 already
are currently using a 4.5 linux kernel (as of 6/2/16).
Signed-off-by: Jim Warner <james.warner@comcast.net>
The segment may have been destroyed by the kernel automagically
after shmdt(addr)
How to reproduce:
sysctl -w kernel.shm_rmid_forced=1
./pmap 1
shared memory remove: Invalid argument
[..]