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
[..]
In some environments, 100 * nr_active_objs is calculated at first,
and lower 32bit of the result is divided by nr_objs.
If 100 * nr_active_objs > 42949672, %use will be incorrect.
Signed-off-by: Takayuki Nagata <tnagata@redhat.com>
A difference in behaviour between the sysvinit and procps pidof
was that the procps one would sometimes not find process that
the sysvinit one did.
The difference is that if a space is found in argv[0] then sysvinit
would look at cmd for a match. This isn't perfect and more of a
best guess but does often work.
procps pidof now follows the same "standard". The most obvious
difference is with kde based processes and incoming ssh connections
with sshd.
References:
GitLab issue #4https://gitlab.com/procps-ng/procps/issues/4https://github.com/limingth/sysvinit/blob/master/sysvinit-2.88dsf/src/killall5.c#L800
After experimenting with those 4.5 kernel enhancements
to /proc/<pid>/status, that newly added overview topic
'Memory Types' was found to be in need of some tweaks.
In addition, the 'DATA' description wasn't quite broad
enough since explicit private file mappings impact it.
( lastly, for the record, the 2nd commit referred to )
( below contained an incorrect reference that should )
( have been the original issue 21 commit. instead it )
( showed an invalid SHA-1 hash. i believe i have now )
( identified a flaw in my workflow that produced it. )
Reference(s):
. original patch responding to issue #21
commit e4bbd3ca1a
. subsequent patch with invalid commit ref
commit 5dcbcd00fe
Signed-off-by: Jim Warner <james.warner@comcast.net>