Commit Graph

2039 Commits

Author SHA1 Message Date
Jan Rybar
cc1f49aeba Merge branch 'ps_remove_wchan_strip' into 'master'
ps: removed stripping of prefixes off wchan data

Implementation of what was settled on ML discussion: http://www.freelists.org/post/procps/ps-wchanf-option  
'ps' does not remove "do_" and "sys_" prefixes from wchan data.  
  
Resolves Red Hat Bugzilla #1322111

See merge request !33
2016-11-23 12:05:28 +00:00
Jan Rybar
fc7f60a6bc ps: removed stripping of prefixes off wchan data
resolves Red Hat Bugzilla #1322111
2016-11-22 16:58:14 +01:00
Craig Small
3afaccc376 Merge branch 'master' into 'master'
ps: recognize SCHED_DEADLINE

See merge request !31
2016-11-21 10:56:00 +00:00
Martin Polednik
f8ccf3126e ps: recognize SCHED_DEADLINE 2016-11-07 10:23:01 +01:00
Jim Warner
c6407ef125 top: make that 'forest view' just a tad more efficient
It makes no sense to begin our tracked nested level at
'1' then later require a '1' to be subtracted from the
level as artwork and indentation is added for display.

By beginning such tracked levels at zero, we can avoid
the need to adjust it & use it directly in a snprintf.

[ this commit parallels a patch in our newlib branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-10-16 08:18:31 +11:00
Takayuki Nagata
23ba442c88 libprocps: use float to calculate %use of slabtop
In some environments, 100 * nr_active_objs is calculated at first,
and the result of lower 32bits is divided by nr_objs. This occurs
even in a 64-bit architecture. So nr_active_objes > 42949672, %use
will be incorrect.

This fix casts type of nr_active_objs to float to calculate
correctly the %use in 32-bit/64-bit architectures.

Signed-off-by: Takayuki Nagata <tnagata@redhat.com>
2016-10-12 16:59:01 +09:00
Takayuki Nagata
636b48efd8 Revert "bprocps: fix order of operations for %use of slabinfo"
This reverts commit 99d71ad581.

When nr_active_objs / nr_objs is calculated, the result will be 1
or 0 since the variables are integer. So the commit is wrong.
2016-10-12 16:58:56 +09:00
Jim Warner
98ed114c26 top: just some minor tweaks to the man document (only)
This patch just parallels some adjustments/corrections
which were also implemented under the 'newlib' branch.

[ remaining differences between man documents relate ]
[ to old kernels with topic '2b. TASK and CPU State' ]
[ and a note in '4c. SORTING' for TTY + WCHAN fields ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-10-09 21:34:05 +11:00
Jim Warner
79260cb5f7 misc: remove some newly introduced trailing whitespace
Maybe some folks still need a few .gitconfig tweaks to
catch the trailing whitespace errors a little earlier.

Or, at the least, after a local commit they should do:
$ git diff HEAD~1

[ and then check if git marks any with his red blobs ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-09-26 07:41:04 +10:00
Craig Small
e715d0f42a Merge branch 'sysctl_manpage_extnd' into 'master'
sysctl.conf manpage - new NOTES section helps variable listing

sysctl.conf manpage now explains what tools to use to list all modifiable variables.

See merge request !28
2016-09-21 10:44:03 +00:00
Jan Rybar
c355ba3147 NOTES now contain mention of sysctl(8) 2016-09-19 19:02:47 +02:00
Jan Rybar
2636cd54e1 sysctl.conf - Adds new NOTES section to manpage with info about all modifiable variables 2016-09-19 16:09:42 +02:00
Jim Warner
18b1a887b7 top: finally circumvent that minor libnuma memory leak
Still unhappy with a minor memory leak associated with
libnuma, I experimented with omitting the dlclose that
was issued at module's end. For some reason which will
remain a mystery, the valgrind leak then went bye-bye.

So this patch just omits one use of dlclose and relies
on whatever kernel magic is at work to free the memory
when each process ends. We kept, however, the original
code (now commented-out) to serve as a future caution.

There remains one potential (but unlikely) dlclose use
near the original dlopen. But there will be no leak as
that 'numa_node_of_cpu' will not yet have been called.
This seems to be the culprit that triggers such leaks.

None of this libnuma shit would likely have come close
to hitting our fan had the numa developers provided us
with 'new' and 'unref' functions like our newlib does.

[ this commit parallels a patch in our newlib branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-09-18 20:39:12 +10:00
Craig Small
24fd2605c5 pgrep: Fix off by one error in line check
There is now a warning if your command is longer than 15 characters
and therefore can never match. Except it was checking for more than
16 characters.

Adjusted this and added a test case.

References:
 !25
 commit 8e8835b2ee
2016-09-11 10:11:25 +10:00
Craig Small
8e8835b2ee Merge branch 'fifteen_chars_warning' into 'master'
pgrep - adds warning that pattern exceeds 15 chars without '-f' option

Resolves many questions seen on forums around the web. Adds a decent warning about the behaviour.<br>
Ideas about better text?

See merge request !25
2016-09-11 00:04:46 +00:00
Craig Small
18e7ebd261 Merge branch 'fix-kill-l-bad-free-sig-prefix' into 'master'
kill: Fix free() with bad pointer on SIG-prefixed signal-name

kill -l SIGHUP (or any other signal-name prefixed with "SIG")
would cause free() to be called with a bad pointer instead of
a pointer to what was allocated. Fix this and add test-case.

See merge request !26
2016-09-10 23:54:44 +00:00
Jim Warner
b899c55dca pmap: fix printing bug associated with the '-x' option
Ever since its introduction, the 'x' (extended format)
option has employed strncmp to parse those smaps keys.

Such an approach worked well as long as those prefixes
were guaranteed to be unique. But, with the 4.3 kernel
a new 'SwapPss' field was added to those within smaps.

That triggered a 2nd match for the 'Swap' logic which,
in turn, resulted in a duplicate output line of zeros.

So this patch just trades strncmp for strcmp, avoiding
potential future problems when /proc/$$/smaps evolves.

Reference(s):
. recent bug report
https://bugzilla.redhat.com/show_bug.cgi?id=1374061
. linux 4.3 kernel introduces SwapPss
commit 8334b96221ff0dcbde4873d31eb4d84774ed8ed4
. original pmap -x option introduction
commit 380cc1e908

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-09-11 09:21:44 +10:00
Olof Sivertsson
586bfb7655 kill: Fix free() with bad pointer on SIG-prefixed signal-name
kill -l SIGHUP (or any other signal-name prefixed with "SIG")
would cause free() to be called with a bad pointer instead of
a pointer to what was allocated. Fix this and add test-case.
2016-09-08 22:32:18 +02:00
Jan Rybar
4a7f9fca14 pgrep - adds warning that pattern exceeds 15 chars without '-f' option 2016-09-06 18:41:56 +02:00
Jon Boden
8abd0c92ab library: Don't use SIGPWR on FreeBSD
FreeBSD doesn't have SIGPWR so makes no sense in warning and assuming
its 29.

References:
 https://bugs.debian/org/832148

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-08-28 19:14:32 +10:00
Jim Warner
5313852596 top: avoid yet more overhead of accessing /proc/status
After discovering those terrible costs associated with
/proc/status vs. /proc/stat, the build_header function
changed to favor the latter for a field found in both.

Well, low-and-behold, this top program still used some
flags that needlessly caused 'status' to still be read
when 'statm' could have served. And, while top's needs
require conversion from pages to KiB, that's still far
less costly than reading that gosh darn 'status' file.

[ this patch parallels similar changes to newlib top ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-08-23 21:12:32 +10:00
Jim Warner
7df87ea7cf top: when setting library flags favor stat over status
Long ago, in a galaxy far away, top was convinced that
/proc/stat was to be favored over /proc/status if some
field could be satisfied with either. This was done to
avoid extra costs of 64-bit math for 32-bit platforms.

Well, its time to acknowledge the prevalence of 64-bit
platforms. And in such an environment there is a large
hidden cost currently if using status instead of stat.
In fact, that cost difference can be as high as 1400%.

So, this commit will coax top into favoring that least
costly route while also fixing an EU_TGD library flag.

[ this patch parallels similar changes to newlib top ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-08-23 21:12:32 +10:00
Jim Warner
67a634dc4c library: revert one ancient 'escape_str_utf8' deletion
Profiling revealed a large amount of time spent in the
'escape_str_utf8' function (escape.c) with both of our
NLS branches (newlib and master). That same result was
not seen under an ancient top-3.2.8 program & library.

Well, the 3.2.8 result was ultimately explained by the
absence of a 'setlocale', necessary under NLS support.
Thus, when that ancient library tested for locale, all
it got was 'ANSI_...' & assumed 'UTF-8' wasn't active.

But after a hack to that ancient code to place it on a
par with newlib/master, I still found cost differences
that led me to revisit an old change referenced below.

It turns out that 'iswprint' costs far more than would
a call of 'isprint', even with the extra support code.
So this commit just reverts that five year old change.

[ this patch parallels a similar change under newlib ]

Reference(s):
commit 7b0fc19e9d

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-08-23 21:12:32 +10:00
Craig Small
57619dcd81 Merge branch 'free_french_alignment' into 'master'
free: french translation alignment

address issue #24

See merge request !13
2016-08-23 10:44:53 +00:00
Craig Small
3db39cd9ed Merge branch 'pkg-config-ncursesw' into 'master'
configure.ac: use pkg-config to get ncursesw header location

Don't assume ncursesw headers are in ../usr/include/ncursesw/..
On a pure build/system without legacy ncurses that may not be true.
Since we're using pkg-config let it provide the correct include path.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

See merge request !23
2016-08-15 11:16:21 +00:00
Craig Small
45b14318cf Merge branch 'use-strchr' into 'master'
sysctl.c: use strchr() instead of index()

index() is a legacy function, which is no longer implemented by all C
libraries (example: uClibc). Instead, use the POSIX defined strchr()
function.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

See merge request !22
2016-08-15 11:13:16 +00:00
Craig Small
41fee5ea66 Merge branch 'selinux-dlfcn-fix' into 'master'
ps/output.c: include <dlfcn.h> only when necessary

dlopen() functionality is only used when SELinux support is enabled, so
<dlfcn.h> only needs to be included when ENABLE_LIBSELINUX is
defined. This fixes the build in configurations where <dlfcn.h> is not
available.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

See merge request !21
2016-08-15 11:09:13 +00:00
Craig Small
1955657461 Merge branch 'find_elf_note_fix' into 'master'
Fixing invalid reads in find_elf_note due to setenv invocation

Resolves issue on mailing list from 12 Nov 2014 and Red Hat Bugzilla 1163404.

See merge request !20
2016-08-15 11:08:15 +00:00
Craig Small
0a247fdb28 Merge branch 'vmstat_isdev_fix' into 'master'
Fixing is_disk() which mistakes devices with name longer than 20 chars for partitions.

Associated with previous vmstat -d enhancement commit.

See merge request !19
2016-08-15 11:06:06 +00:00
Gustavo Zacarias
58559a5b64 configure.ac: use pkg-config to get ncursesw header location
Don't assume ncursesw headers are in ../usr/include/ncursesw/..
On a pure build/system without legacy ncurses that may not be true.
Since we're using pkg-config let it provide the correct include path.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-07 11:36:10 +02:00
Yann E. MORIN
60b4208dd6 sysctl.c: use strchr() instead of index()
index() is a legacy function, which is no longer implemented by all C
libraries (example: uClibc). Instead, use the POSIX defined strchr()
function.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-07 11:32:52 +02:00
Thomas Petazzoni
4fc9a34802 ps/output.c: include <dlfcn.h> only when necessary
dlopen() functionality is only used when SELinux support is enabled, so
<dlfcn.h> only needs to be included when ENABLE_LIBSELINUX is
defined. This fixes the build in configurations where <dlfcn.h> is not
available.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-07 11:08:26 +02:00
Jan Rybar
ecabdaca41 Fixing invalid reads in find_elf_note due to setenv invocation
Resolves issue on mailing list and Red Hat Bugzilla 1163404.
2016-08-05 15:21:49 +02:00
Jan Rybar
c63a5a4af0 Fixing is_disk() which mistakes devices with name longer than 20 chars for partitions.
Associated with previous vmstat -d enhancement commit.
2016-08-04 13:55:01 +02:00
Jim Warner
b4fdb27a05 top: provide for expanded potential displayable fields
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>
2016-08-01 20:11:11 +10:00
Craig Small
2e4959bab8 library: dont use vm_min_free on non-Linux systems
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 3f3b1a59ad
 https://bugs.debian.org/831396
2016-07-17 09:06:24 +10:00
Jim Warner
63f8c16fa4 top: make compilation possible under netbsd-curses too
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>
2016-07-17 08:52:50 +10:00
Craig Small
bf7e728098 Updated Chinese po file 2016-07-17 08:45:48 +10:00
Dr. Werner Fink
4ed44ab58e misc: fix strtod_nol_err tests
A better way of implementing the string to double
conversion and a better way of testing it.

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-07-13 20:08:51 +10:00
Craig Small
100afbc149 misc: Remove strtod tests
Due to the interesting properties of floating points, the strtod
tests have been removed. One day I may bother enabling them again.
2016-07-11 09:25:43 +10:00
Craig Small
e564ddcb01 watch: define HOST_NAME_MAX
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.
2016-07-11 08:41:21 +10:00
Craig Small
e0784ddaed misc: Update translations
Update the translations to the latest versions.
We also now have simplified Chinese language too!
2016-07-10 09:09:32 +10:00
Craig Small
6118be808c misc: testsuite to source aux scripts correctly
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.
2016-07-10 09:04:44 +10:00
Craig Small
96f151a4f8 6:0:0 lbirary API bump 2016-07-10 08:55:45 +10:00
Craig Small
9069db6c5d misc: Add note for Debian bug about ANSI 2016-07-10 07:59:20 +10:00
Craig Small
9115ad7655 watch: fix process_ansi typo
When I had to apply Josh's ansi fix a few commits below I put the
return before the setattr

References:
 commit 261c571aca
2016-07-09 15:57:11 +10:00
Craig Small
2f5e0da5bb watch: Remove second [m check
With the previous watch fixes, there is no need for the second
[m check as these are covered in previous checks.
2016-07-09 15:16:57 +10:00
Josh Triplett
0236d278f2 watch: Don't attempt to ungetc parts of unknown ANSI escape sequences
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>
2016-07-09 14:56:29 +10:00
Josh Triplett
f9a4fef6a9 watch: Fix ANSI escape sequence termination
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>
2016-07-09 14:55:11 +10:00
Josh Triplett
261c571aca watch: Don't process additional numbers in unknown ANSI color escapes
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.
2016-07-09 14:52:54 +10:00