]> granicus.if.org Git - procps-ng/log
procps-ng
8 years agops: removed stripping of prefixes off wchan data
Jan Rybar [Tue, 22 Nov 2016 15:58:14 +0000 (16:58 +0100)]
ps: removed stripping of prefixes off wchan data
resolves Red Hat Bugzilla #1322111

8 years agoMerge branch 'master' into 'master'
Craig Small [Mon, 21 Nov 2016 10:56:00 +0000 (10:56 +0000)]
Merge branch 'master' into 'master'

ps: recognize SCHED_DEADLINE

See merge request !31

8 years agops: recognize SCHED_DEADLINE
Martin Polednik [Mon, 7 Nov 2016 09:23:01 +0000 (10:23 +0100)]
ps: recognize SCHED_DEADLINE

8 years agotop: make that 'forest view' just a tad more efficient
Jim Warner [Sat, 8 Oct 2016 15:10:10 +0000 (10:10 -0500)]
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>
8 years agotop: just some minor tweaks to the man document (only)
Jim Warner [Thu, 29 Sep 2016 06:11:11 +0000 (01:11 -0500)]
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>
8 years agomisc: remove some newly introduced trailing whitespace
Jim Warner [Wed, 21 Sep 2016 12:07:07 +0000 (07:07 -0500)]
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>
8 years agoMerge branch 'sysctl_manpage_extnd' into 'master'
Craig Small [Wed, 21 Sep 2016 10:44:03 +0000 (10:44 +0000)]
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

8 years agoNOTES now contain mention of sysctl(8)
Jan Rybar [Mon, 19 Sep 2016 17:02:47 +0000 (19:02 +0200)]
NOTES now contain mention of sysctl(8)

8 years agosysctl.conf - Adds new NOTES section to manpage with info about all modifiable variables
Jan Rybar [Mon, 19 Sep 2016 14:09:42 +0000 (16:09 +0200)]
sysctl.conf - Adds new NOTES section to manpage with info about all modifiable variables

8 years agotop: finally circumvent that minor libnuma memory leak
Jim Warner [Mon, 12 Sep 2016 21:16:16 +0000 (16:16 -0500)]
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>
8 years agopgrep: Fix off by one error in line check
Craig Small [Sun, 11 Sep 2016 00:11:25 +0000 (10:11 +1000)]
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 8e8835b2ee4af7947d5131895ef1719129d3e70d

8 years agoMerge branch 'fifteen_chars_warning' into 'master'
Craig Small [Sun, 11 Sep 2016 00:04:46 +0000 (00:04 +0000)]
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

8 years agoMerge branch 'fix-kill-l-bad-free-sig-prefix' into 'master'
Craig Small [Sat, 10 Sep 2016 23:54:44 +0000 (23:54 +0000)]
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

8 years agopmap: fix printing bug associated with the '-x' option
Jim Warner [Thu, 8 Sep 2016 16:11:11 +0000 (11:11 -0500)]
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 380cc1e9082d662d09dd80fcbb73de9dc98b3ea1

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agokill: Fix free() with bad pointer on SIG-prefixed signal-name
Olof Sivertsson [Thu, 8 Sep 2016 06:32:43 +0000 (08:32 +0200)]
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.

8 years agopgrep - adds warning that pattern exceeds 15 chars without '-f' option
Jan Rybar [Tue, 6 Sep 2016 16:41:56 +0000 (18:41 +0200)]
pgrep - adds warning that pattern exceeds 15 chars without '-f' option

8 years agolibrary: Don't use SIGPWR on FreeBSD
Jon Boden [Sun, 28 Aug 2016 09:14:32 +0000 (19:14 +1000)]
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>
8 years agotop: avoid yet more overhead of accessing /proc/status
Jim Warner [Sat, 20 Aug 2016 05:00:00 +0000 (00:00 -0500)]
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>
8 years agotop: when setting library flags favor stat over status
Jim Warner [Sat, 20 Aug 2016 05:00:00 +0000 (00:00 -0500)]
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>
8 years agolibrary: revert one ancient 'escape_str_utf8' deletion
Jim Warner [Sat, 20 Aug 2016 05:00:00 +0000 (00:00 -0500)]
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 7b0fc19e9d28380dc9790615b93bc3653d6d686e

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agoMerge branch 'free_french_alignment' into 'master'
Craig Small [Tue, 23 Aug 2016 10:44:53 +0000 (10:44 +0000)]
Merge branch 'free_french_alignment' into 'master'

free: french translation alignment

address issue #24

See merge request !13

8 years agoMerge branch 'pkg-config-ncursesw' into 'master'
Craig Small [Mon, 15 Aug 2016 11:16:21 +0000 (11:16 +0000)]
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

8 years agoMerge branch 'use-strchr' into 'master'
Craig Small [Mon, 15 Aug 2016 11:13:16 +0000 (11:13 +0000)]
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

8 years agoMerge branch 'selinux-dlfcn-fix' into 'master'
Craig Small [Mon, 15 Aug 2016 11:09:13 +0000 (11:09 +0000)]
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

8 years agoMerge branch 'find_elf_note_fix' into 'master'
Craig Small [Mon, 15 Aug 2016 11:08:15 +0000 (11:08 +0000)]
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

8 years agoMerge branch 'vmstat_isdev_fix' into 'master'
Craig Small [Mon, 15 Aug 2016 11:06:06 +0000 (11:06 +0000)]
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

8 years agoconfigure.ac: use pkg-config to get ncursesw header location
Gustavo Zacarias [Sun, 7 Aug 2016 09:35:20 +0000 (11:35 +0200)]
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>
8 years agosysctl.c: use strchr() instead of index()
Yann E. MORIN [Sun, 7 Aug 2016 09:31:25 +0000 (11:31 +0200)]
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>
8 years agops/output.c: include <dlfcn.h> only when necessary
Thomas Petazzoni [Sun, 7 Aug 2016 09:08:26 +0000 (11:08 +0200)]
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>
8 years agoFixing invalid reads in find_elf_note due to setenv invocation
Jan Rybar [Fri, 5 Aug 2016 13:21:49 +0000 (15:21 +0200)]
Fixing invalid reads in find_elf_note due to setenv invocation
Resolves issue on mailing list and Red Hat Bugzilla 1163404.

8 years agoFixing is_disk() which mistakes devices with name longer than 20 chars for partitions.
Jan Rybar [Thu, 4 Aug 2016 09:25:19 +0000 (11:25 +0200)]
Fixing is_disk() which mistakes devices with name longer than 20 chars for partitions.
Associated with previous vmstat -d enhancement commit.

8 years agotop: provide for expanded potential displayable fields
Jim Warner [Sat, 30 Jul 2016 05:00:00 +0000 (00:00 -0500)]
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>
8 years agolibrary: dont use vm_min_free on non-Linux systems
Craig Small [Sat, 16 Jul 2016 23:06:24 +0000 (09:06 +1000)]
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 3f3b1a59ada85d21f34530cfb1dc1c0afd70e6dc
 https://bugs.debian.org/831396

8 years agotop: make compilation possible under netbsd-curses too
Jim Warner [Sat, 16 Jul 2016 05:00:00 +0000 (00:00 -0500)]
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>
8 years agoUpdated Chinese po file
Craig Small [Sat, 16 Jul 2016 22:45:48 +0000 (08:45 +1000)]
Updated Chinese po file

8 years agomisc: fix strtod_nol_err tests
Dr. Werner Fink [Wed, 13 Jul 2016 10:08:51 +0000 (20:08 +1000)]
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>
8 years agomisc: Remove strtod tests
Craig Small [Sun, 10 Jul 2016 23:25:43 +0000 (09:25 +1000)]
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.

8 years agowatch: define HOST_NAME_MAX
Craig Small [Sun, 10 Jul 2016 22:41:21 +0000 (08:41 +1000)]
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.

8 years agomisc: Update translations v3.3.12
Craig Small [Sat, 9 Jul 2016 23:09:32 +0000 (09:09 +1000)]
misc: Update translations

Update the translations to the latest versions.
We also now have simplified Chinese language too!

8 years agomisc: testsuite to source aux scripts correctly
Craig Small [Sat, 9 Jul 2016 23:04:44 +0000 (09:04 +1000)]
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.

8 years ago6:0:0 lbirary API bump
Craig Small [Sat, 9 Jul 2016 22:55:45 +0000 (08:55 +1000)]
6:0:0 lbirary API bump

8 years agomisc: Add note for Debian bug about ANSI
Craig Small [Sat, 9 Jul 2016 21:59:20 +0000 (07:59 +1000)]
misc: Add note for Debian bug about ANSI

8 years agowatch: fix process_ansi typo
Craig Small [Sat, 9 Jul 2016 05:57:11 +0000 (15:57 +1000)]
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 261c571acafed88d03ebdb5c5fa3d7e084daf25b

8 years agowatch: Remove second [m check
Craig Small [Sat, 9 Jul 2016 05:16:57 +0000 (15:16 +1000)]
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.

8 years agowatch: Don't attempt to ungetc parts of unknown ANSI escape sequences
Josh Triplett [Fri, 8 Jul 2016 07:32:59 +0000 (00:32 -0700)]
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>
8 years agowatch: Fix ANSI escape sequence termination
Josh Triplett [Fri, 8 Jul 2016 07:29:59 +0000 (00:29 -0700)]
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>
8 years agowatch: Don't process additional numbers in unknown ANSI color escapes
Josh Triplett [Sat, 9 Jul 2016 04:52:54 +0000 (14:52 +1000)]
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.

8 years agobuild-sys: Re vert noinst and check programs
Craig Small [Sat, 9 Jul 2016 04:35:06 +0000 (14:35 +1000)]
build-sys: Re vert noinst and check programs

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

8 years agobuild-sys: Make check programs before check
Craig Small [Sat, 9 Jul 2016 04:11:06 +0000 (14:11 +1000)]
build-sys: Make check programs before check

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.

8 years agowatch: fix 8bit regression
Craig Small [Sat, 9 Jul 2016 03:27:23 +0000 (13:27 +1000)]
watch: fix 8bit regression

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 5a40c7970d8185fcf322575de9fed69d4cdedd93

8 years agoNEWS: update (and reorganize) with accumulated changes
Jim Warner [Thu, 7 Jul 2016 05:00:00 +0000 (00:00 -0500)]
NEWS: update (and reorganize) with accumulated changes

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>
8 years agobuild sys: update configure.ac for the latest autoscan
Jim Warner [Wed, 6 Jul 2016 05:00:00 +0000 (00:00 -0500)]
build sys: update configure.ac for the latest autoscan

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agomisc: repair a single instance of 'whitespace' boo-boo
Jim Warner [Wed, 6 Jul 2016 05:00:00 +0000 (00:00 -0500)]
misc: repair a single instance of 'whitespace' boo-boo

[ this is just the case of the final newline missing ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agolibrary: avoid QUICK_THREADS, swat Redhat bug #1284091
Jim Warner [Wed, 6 Jul 2016 05:00:00 +0000 (00:00 -0500)]
library: avoid QUICK_THREADS, swat Redhat bug #1284091

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>
8 years agolibrary: rename clashing pwcache functions
Craig Small [Fri, 17 Jun 2016 22:17:45 +0000 (08:17 +1000)]
library: rename clashing pwcache functions

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>
8 years agomisc: adapted others to that new proc_t 'cgname' field
Jim Warner [Sun, 3 Jul 2016 05:00:00 +0000 (00:00 -0500)]
misc: adapted others to that new proc_t 'cgname' field

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>
8 years agolibrary: play catchup with a new proc_t 'cgname' field
Jim Warner [Sun, 3 Jul 2016 05:00:00 +0000 (00:00 -0500)]
library: play catchup with a new proc_t 'cgname' field

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>
8 years agotop: eliminate 2 author sections from the man document
Jim Warner [Sun, 3 Jul 2016 05:00:00 +0000 (00:00 -0500)]
top: eliminate 2 author sections from the man document

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>
8 years agotop: improved that #define PRETENDNOCAP implementation
Jim Warner [Sun, 3 Jul 2016 05:00:00 +0000 (00:00 -0500)]
top: improved that #define PRETENDNOCAP implementation

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>
8 years agodocumentation: Update watch man page
Craig Small [Sun, 3 Jul 2016 06:16:28 +0000 (16:16 +1000)]
documentation: Update watch man page

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>
8 years agowatch,free: interpet intervals in non-locale way
Craig Small [Sun, 3 Jul 2016 06:14:36 +0000 (16:14 +1000)]
watch,free: interpet intervals in non-locale way

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>
8 years agodocumentation: rewrite for shared in free
Craig Small [Sun, 3 Jul 2016 00:36:58 +0000 (10:36 +1000)]
documentation: rewrite for shared in free

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>
8 years agolibrary: find tty device name of process quicker
Simon Tatham [Sun, 3 Jul 2016 00:08:18 +0000 (10:08 +1000)]
library: find tty device name of process quicker

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>
8 years agowatch: truncate command in non-8 bit mode
Craig Small [Sat, 2 Jul 2016 06:07:56 +0000 (16:07 +1000)]
watch: truncate command in non-8 bit mode

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 367b8bb616c6d52513b594ccb936d322a3f8b6c1

Signed-off-by: Craig Small <csmall@enc.com.au>
8 years agowatch: Add hostname to the header
Jesse Hathaway [Sat, 2 Jul 2016 05:45:36 +0000 (15:45 +1000)]
watch: Add hostname to the header

watch has the hostname added to the header so you know what device
if you have many it is running on.

Signed-off-by: Craig Small <csmall@enc.com.au>
8 years agokill: Correct pid type
Craig Small [Sat, 2 Jul 2016 05:18:29 +0000 (15:18 +1000)]
kill: Correct pid type

Previous commit used a pid type of int in the printf, this should
be a long.

8 years agoMerge branch 'master' into 'master'
Craig Small [Sat, 2 Jul 2016 04:52:43 +0000 (04:52 +0000)]
Merge branch 'master' into 'master'

- 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

8 years agokill: report error if cannot kill process
Craig Small [Sat, 2 Jul 2016 02:25:14 +0000 (12:25 +1000)]
kill: report error if cannot kill process

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

8 years ago- Fixing sysinfo - devices with length exceeding 15 chars are not displayed in vmstat -d
Jan Rybar [Thu, 30 Jun 2016 16:29:50 +0000 (18:29 +0200)]
- Fixing sysinfo - devices with length exceeding 15 chars are not displayed in vmstat -d

8 years agoMerge branch 'master' into 'master'
Craig Small [Fri, 17 Jun 2016 11:56:40 +0000 (11:56 +0000)]
Merge branch 'master' into 'master'

- 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

8 years ago- Fixing incorrect memory usage assessment due to skipping vmflags parsing
Jan Rybar [Wed, 15 Jun 2016 12:12:59 +0000 (14:12 +0200)]
- Fixing incorrect memory usage assessment due to skipping vmflags parsing
- Resolves Red Hat Bugzilla #1262864, affecting upstream

8 years agops: adapt to revised approach for --with-systemd build
Jim Warner [Thu, 2 Jun 2016 05:00:00 +0000 (00:00 -0500)]
ps: adapt to revised approach for --with-systemd build

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>
8 years agotop: accommodate the loss of that OOMEM_ENABLE #define
Jim Warner [Thu, 2 Jun 2016 05:00:00 +0000 (00:00 -0500)]
top: accommodate the loss of that OOMEM_ENABLE #define

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>
8 years agolibrary: make sure that the proc_t is now fixed length
Jim Warner [Thu, 2 Jun 2016 05:00:00 +0000 (00:00 -0500)]
library: make sure that the proc_t is now fixed length

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>
8 years agotop: make more responsive when toggling cpu off/online
Jim Warner [Wed, 1 Jun 2016 05:00:00 +0000 (00:00 -0500)]
top: make more responsive when toggling cpu off/online

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>
8 years agotop: miscellaneous accumulated tweaks of code/comments
Jim Warner [Tue, 26 Apr 2016 05:00:00 +0000 (00:00 -0500)]
top: miscellaneous accumulated tweaks of code/comments

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>
8 years agotop: extend 'zero suppression' scope to several fields
Jim Warner [Fri, 15 Apr 2016 05:00:00 +0000 (00:00 -0500)]
top: extend 'zero suppression' scope to several fields

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>
8 years agotop: man page now includes resident memory enhancement
Jim Warner [Wed, 13 Apr 2016 05:00:00 +0000 (00:00 -0500)]
top: man page now includes resident memory enhancement

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>
8 years agotop: exploit new linux-4.5 resident memory enhancement
Jim Warner [Wed, 13 Apr 2016 05:00:00 +0000 (00:00 -0500)]
top: exploit new linux-4.5 resident memory enhancement

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>
8 years agolibrary: exploit linux-4.5 resident memory enhancement
Jim Warner [Wed, 13 Apr 2016 05:00:00 +0000 (00:00 -0500)]
library: exploit linux-4.5 resident memory enhancement

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>
8 years agopmap: Do not display error if shmctl(..IPC_RMID) returns EINVAL
Cristian Rodríguez [Thu, 28 Apr 2016 05:22:53 +0000 (02:22 -0300)]
pmap: Do not display error if shmctl(..IPC_RMID) returns EINVAL

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
[..]

8 years agobprocps: fix order of operations for %use of slabinfo
Takayuki Nagata [Mon, 25 Apr 2016 09:30:36 +0000 (05:30 -0400)]
bprocps: fix order of operations for %use of slabinfo

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>
8 years agoadded gettext to dependency
Craig Small [Wed, 20 Apr 2016 12:15:27 +0000 (22:15 +1000)]
added gettext to dependency

8 years agofixed incorrect libtool dependency
Craig Small [Wed, 20 Apr 2016 12:07:45 +0000 (22:07 +1000)]
fixed incorrect libtool dependency

8 years agoneeded extra dependencies
Craig Small [Wed, 20 Apr 2016 12:03:50 +0000 (22:03 +1000)]
needed extra dependencies

8 years agoUpdate gitlab test yaml
Craig Small [Wed, 20 Apr 2016 12:00:24 +0000 (22:00 +1000)]
Update gitlab test yaml

8 years agopidof: check cmd if space in argv0
Craig Small [Sun, 17 Apr 2016 06:43:26 +0000 (16:43 +1000)]
pidof: check cmd if space in argv0

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 #4
 https://gitlab.com/procps-ng/procps/issues/4
 https://github.com/limingth/sysvinit/blob/master/sysvinit-2.88dsf/src/killall5.c#L800

8 years agofix parsing of negative PIDs
Benedikt Böhm [Tue, 12 Apr 2016 19:02:28 +0000 (21:02 +0200)]
fix parsing of negative PIDs

Signed-off-by: Craig Small <csmall@enc.com.au>
8 years agotests: Conditionally add prctl to test process
Craig Small [Sat, 16 Apr 2016 23:09:41 +0000 (09:09 +1000)]
tests: Conditionally add prctl to test process

prctl was already bypassed on Cygwin systems. This extends to
non-Linux systems such as kFreeBSD and Hurd.

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

8 years agotop: minimal necessary corrections to the man document
Jim Warner [Tue, 12 Apr 2016 05:00:00 +0000 (00:00 -0500)]
top: minimal necessary corrections to the man document

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 e4bbd3ca1abe57bc52e7eff72aa3973ecf67765c
. subsequent patch with invalid commit ref
commit 5dcbcd00fe0978b5e2e8e0a19a34389d896e84d9

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agofree: french translation alignment
Christophe Drevet-Droguet [Wed, 6 Apr 2016 14:27:50 +0000 (16:27 +0200)]
free: french translation alignment

8 years agotop: add additional memory information to the man page
Jim Warner [Thu, 17 Mar 2016 05:00:00 +0000 (00:00 -0500)]
top: add additional memory information to the man page

In response to Issue #21, the commit referred to below
provided some much needed improvements and corrections
to topic `3a. DESCRIPTIONS of Fields' in the man page.
However, it assumed a reader possessed much background
knowledge that may not, in truth, actually be present.

So without, hopefully, insulting anyone's intelligence
this patch offers an expanded discussion of some terms
and concepts within a separate section under OVERVIEW.

[ plus it affords an opportunity to incorporate that ]
[ extremely useful table from Florent Bruneau's post ]

Reference(s):
commit f2a08cf16794ec6085bdecbaf8f7c2887cd4e87f
https://techtalk.intersec.com/2013/07/memory-part-1-memory-types/

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agotop: improve/correct several memory fields in man page
Jim Warner [Mon, 14 Mar 2016 06:00:00 +0000 (00:00 -0600)]
top: improve/correct several memory fields in man page

Due to quirks in kernel memory management plus limited
information available from /proc/<pid>/status & statm,
some of the top resident memory fields were capable of
exceeding available physical memory. So this commit is
a bit of a band-aid until the kernel has been changed.

Such a change appears to be on the horizon in the form
of three new fields to be added to /proc/<pid>/status.
While not preventing 'resident' memory from apparently
exceeding physical memory, the new fields will help to
clarify any such contingency, if/when we exploit them.

Reference(s):
. original post by Samuel Thibault
https://gitlab.com/procps-ng/procps/issues/21
. informative memory analysis
https://techtalk.intersec.com/2013/07/memory-part-1-memory-types/
https://techtalk.intersec.com/2013/07/memory-part-2-understanding-process-memory/
. kernel changes to /proc/<pid>/status
commit 8cee852ec53fb530f10ccabf1596734209ae336b
commit eca56ff906bdd0239485e8b47154a6e73dd9a2f3

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agoMerge branch 'master' into 'master'
Craig Small [Sat, 12 Mar 2016 04:00:28 +0000 (04:00 +0000)]
Merge branch 'master' into 'master'

Cygwin build support

I have added some changes to make building in Cygwin possible. Please review the changes and let me know if there are any ways I may have done anything incorrectly.

strverscmp is included to satisfy a dependency in Cygwin.
Excluded utmp and prctl functions that are not supported currently.

See merge request !12

8 years agotop: tweaks to vertical scroll management & 'i' toggle
Jim Warner [Mon, 1 Feb 2016 06:00:00 +0000 (00:00 -0600)]
top: tweaks to vertical scroll management & 'i' toggle

The commit referenced below claims to disable vertical
scrolling when idle tasks weren't being shown. However
it really addresses only a point in time when that 'i'
toggle is keyed. Left untouched were the up/down keys.

So this commit will simply finish the job of disabling
vertical scrolling whenever tasks which have used some
CPU are the only ones which are currently being shown.

Reference(s):
commit c07f6c5e6d6170ef3f2373b4d86988184c3235bf

Signed-off-by: Jim Warner <james.warner@comcast.net>
8 years agoFixed tests so make check no longer fails
Wayne Porter [Thu, 10 Mar 2016 23:35:30 +0000 (15:35 -0800)]
Fixed tests so make check no longer fails

8 years agoAdded Cygwin build support
Wayne Porter [Thu, 10 Mar 2016 23:04:27 +0000 (15:04 -0800)]
Added Cygwin build support

strverscmp is included to satisfy a dependency in Cygwin.
Excluded utmp and prctl functions that are not supported currently.

8 years agoenable transparent large file support
Mike Frysinger [Mon, 7 Mar 2016 20:36:59 +0000 (15:36 -0500)]
enable transparent large file support

Historically LFS mattered only to open/read large files.  A few programs
here use open/seek, but not generally on files that are large.  However,
LFS also applies to stat which procps does in a bunch of places -- some
filesystems have 64bit inodes and attempts to do a 32bit stat will throw
an error.

Enable transparent LFS everywhere to avoid this.

8 years agoset test programs to check_PROGRAMS
Mike Frysinger [Mon, 7 Mar 2016 20:19:47 +0000 (15:19 -0500)]
set test programs to check_PROGRAMS

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoReplace %Lu with standard %llu
Craig Small [Thu, 3 Mar 2016 10:43:52 +0000 (21:43 +1100)]
Replace %Lu with standard %llu

Multiple scanf()s use the GNU-permitted %Lu. This is not supported in
other libraries and isn't to the POSIX specification. The L modifier
is only used for floats in POSIX.

Replacing %Lu with %llu is the same for GNU libc (scanf(3) says as much)
but means other libraries will work fine.

Closes: #19
References:
 http://pubs.opengroup.org/onlinepubs/009695399/functions/fscanf.html