Commit Graph

314 Commits

Author SHA1 Message Date
Jim Warner
d3203d99dd top: fix potential SEGV when no tasks were displayable
This patch fixes a nearly decade old bug discovered by
Frederik Deweerdt. His merge request shown below would
be an adequate solution except for iterative overhead.

This alternate patch will represent substantially less
overhead for an admittedly extremely rare possibility.

Reference(s):
https://gitlab.com/procps-ng/procps/-/merge_requests/114

And-thanks-to: Frederik Deweerdt <fdeweerdt@fastly.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:00:49 +10:00
Jim Warner
c02fc0b977 NEWS: updated for those recent utf-8 translation fixes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-29 21:13:40 +10:00
Jim Warner
23224bb4af NEWS: acknowledge those two new top command provisions
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:49:40 +10:00
Craig Small
9f751a7538 pgrep: Allow older than selection
Re-work merge request !79 of @edneville to permit older than
selection using the new library API.

References:
 procps-ng/procps!79
2020-05-17 23:00:27 +10:00
Craig Small
eeb8cf00a4 watch: add additional notes about environment
References:
 procps-ng/procps!62
 commit d3e0ff5a0a
2020-05-12 19:30:28 +10:00
Craig Small
48a201c46f vmstat: Add NEWS and revert comment from prev
Reverted the translation hint as the fields are used for both
normal and wide modes, so need to fit the smaller of the two.

Added NEWS item

References:
 commit 01c1b2345e
2020-05-12 19:06:34 +10:00
Arun Chandrasekaran
89392e67a9 pgrep: use sigqueue to pass value with the signal.
Based on the command line option, use 'sigqueue'
instead of 'kill' to pass the integer value with
the signal.

References:
 procps-ng/procps!32

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2020-05-11 16:59:14 +10:00
Craig Small
7f44382938 kill: Adjust documentation for sigqueue
Added NEWS item
Changed the section for sigqueue as its 3 for me.
2020-05-11 16:51:28 +10:00
Craig Small
ebaa5f2823 NEWS: Add item for previous entry
Added NEWS item for pidof show worker threads patch

References:
 commit 9c3296bae9
2020-04-10 15:00:31 +10:00
Jim Warner
f5a6f4af6d NEWS: fix top alpha order, add 'e' command line switch
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-04-10 14:37:15 +10:00
Craig Small
7f83a8faab NEWS: synchronise the entries 2020-04-07 19:40:35 +10:00
Craig Small
b3f7bfede6 docs: Mention stime in ps.1
References:
 procps-ng/procps#164
2020-04-07 19:38:17 +10:00
Craig Small
5da3024e4e sysctl: config directory order
Matches the systemd directory order (/run is after /etc) and
document what directories are used better.
2020-02-27 21:56:13 +11:00
Jim Warner
e7995652be NEWS: update/catch up with the 'master' branch version
With the two preceding 'catch up' patches, this newlib
NEWS can now be made identical to that master version.

[ it's assumed any releases prior to 3.3.15 have all ]
[ been represented under newlib (where appropriate). ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2019-09-22 07:32:03 +10:00
Craig Small
ef03c89447 misc: Move NEWS item to correct version 2018-05-06 09:55:56 +10:00
Craig Small
61a9a54229 library: check not undef SIGLOST
sig.c had this odd logic where on non-Hurd systems it would undefine
SIGLOST. Fine for Hurd or amd64 Linux systems. Bad for a sparc which
has SIGLOST defined *and* is not Hurd.

Just check its defined, its much simpler.
2018-05-06 07:20:12 +10:00
Jim Warner
1f95cfe8a6 NEWS: note build on non-glibc systems _____ (catch up)
--------------- Original Master Branch Commit Message:
Some non-glibc systems didn't have libio.h or __BEGIN_DECLS
Changes to make it more standard.

References:
 issue #88

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-05-06 07:19:38 +10:00
Jim Warner
f28d605a0d free: fix scaling on 32-bit systems _______ (catch up)
--------------- Original Master Branch Commit Message:
Systems that have a 32-bit long would give incorrect results in free.

References:
 Issue #89
 https://www.freelists.org/post/procps/frees-scale-size-broken-with-32bit-long

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-05-06 07:19:38 +10:00
Jim Warner
5fee15fcb6 misc: Update news about #91 _______________ (catch up)
--------------- Original Master Branch Commit Message:
[ none ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-05-06 07:19:38 +10:00
Jim Warner
ac73415e32 pgrep: Don't segfault with no match _______ (catch up)
--------------- Original Master Branch Commit Message:
If pgrep is run with a non-program name match and there are
no matches, it segfaults.

The testsuite thinks zero bytes sent, and zero bytes sent
because the program crashed is the same :/

References:
 commit 1aacf4af7f
 https://bugs.debian.org/894917

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-05-06 07:19:38 +10:00
Jim Warner
c7b7ab8547 3.3.13 release candidate 1 ________________ (catch up)
--------------- Original Master Branch Commit Message:
Update NEWS with the version
Add library API change into NEWS
Update c:r:a for library to 7:0:1

This means the current and age are incremented, so old programs can
use new library but not vice-versa as they won't have the numa*
functions.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-05-06 07:19:38 +10:00
Jim Warner
1f27f3fb61 misc: update NEWS with some missed items __ (catch up)
--------------- Original Master Branch Commit Message:
[ none ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-05-06 07:19:38 +10:00
Craig Small
90a4aee474 ps: Add NEWS and checks for times and cputimes
The previous commit had one minor bug in it because the fields need
to be alphabetical and times comes after timeout.

Added NEWS item for this feature
Added another testsuite check for new flags in case they
disappear or go strange one day.

References:
 commit 8a94ed6111
2018-03-02 22:22:25 +11:00
Craig Small
39cd65c798 misc: Add news entry for previous pidof 2018-03-02 21:49:28 +11:00
Craig Small
233b5228be free: Update tests and fix for previous patch
The previous two patches updated free, but needed a tweak and the tests
also needed to be updated. I've hand-calculated the results using bc and
both the testsuite and bc results equal what free prints out.

References:
 commit 9365be7633
 procps-ng/procps#45
2018-01-13 16:12:19 +11:00
Craig Small
91df65b9e7 docs: Document I idle state in ps and top
Linux 4.2 provided a new process state of I which is used for an idle
kernel thread. This new state means that kernel threads do not
contribute to the loadavg as they are no longer state D or S but I.

While both ps and top displayed this state, it wasn't documented in
either manual page until now.

References:
 https://bugs.debian.org/886967
 https://www.quora.com/What-does-mean-Linux-process-state-I-in-the-top-output
 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=80ed87c8a9ca0cad7ca66cf3bbdfb17559a66dcf
2018-01-13 11:25:59 +11:00
Craig Small
8882afa047 sysctl: Don't crash file fopen fails
The commit referenced below put a setvbuf() before checking what
fopen() returned. If the file could not be opened then the file
handle was NULL at setvbuf() crashed.

setvbuf() is now called after checking what fopen() returns and only
when it was successful.

References:
 procps-ng/procps#76
 commit 58ae084c27
2018-01-07 12:31:37 +11:00
Craig Small
10a715faba Add news for previous commit
References:
 procps-ng/procps!55
 387e2cf
2017-12-29 15:40:00 +11:00
Jim Warner
55a42ae040 top: allow more flexible approach for startup defaults
Those references below offer more detail regarding the
default startup changes beginning with version 3.3.10.

It is important to remember that all such changes were
supposed to impact only new users or users who had not
saved the personal config file (via that 'W' command).
However, I introduced a bug wherein the rcfile was not
fully honored. This gave the changes a bad reputation.

That bug was corrected in release 3.3.11 but the issue
of default startup options keeps resurfacing. And it's
clear there's no consensus on what should be included.

Our --disable-modern-top configure option is of little
help since it remains an all-or-nothing approach. What
we need is an answer offering unlimited customization.
So, this commit will provide distribution packagers or
system administrators with a much more flexible way to
set their own preferred startup default configuration.

A new rcfile is being introduced: '/etc/topdefaultrc',
whose format/content is the same as a personal rcfile.
Thus once a 'proper' enterprise configuration has been
established and saved via 'W', it can be copied to the
/etc/ directory. Thereafter, startup in the absence of
a saved rcfile will use that configuration as default.

Now if a distribution packager or system administrator
wishes to expose their users to some of top's advanced
capabilities they can do so gradually. Perhaps setting
up graph mode for summary area task and memory display
while retaining the %CPU sort could be tried. Or maybe
showing colors, but better customized for a particular
terminal emulator. Such possibilities are now endless.

[ in exploiting this new capability, i hope that the ]
[ other windows (alt display mode) aren't overlooked ]

Reference(s):
. Sep, 2014 - Not fully honoring rcfile bug discussed
https://www.freelists.org/post/procps/top-saved-rcfile-bug
. Oct, 2014 - Attempt to defend new startup defaults
https://bugzilla.redhat.com/show_bug.cgi?id=1153049
. Jul, 2015 - Forest vs. %CPU views discussion
https://gitlab.com/procps-ng/procps/issues/6
. Oct, 2017 - Question the use of --disable-modern-top
https://bugzilla.redhat.com/show_bug.cgi?id=1499410
. Oct, 2017 - Forest vs. %CPU views discussion again
https://www.freelists.org/post/procps/Forest-mode-by-default-in-top-seems-a-bit-strange
. Dec, 2017 - Rehash of 3.3.10 startup defaults change
https://gitlab.com/procps-ng/procps/issues/78

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-12-23 17:44:34 +11:00
Craig Small
c0256bb2d2 watch: Support ANSI 39,49 reset sequences
ANSI colour sequences 39 and 49 reset the foreground and background
colours respectively. This feature was missing from watch using the
colour "-c" option.

References:
 Fixes #73
 https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
2017-12-20 22:13:31 +11:00
Jim Warner
9246b950c8 NEWS: acknowledged top's multi-byte support extensions
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-10-01 22:26:35 +11:00
Craig Small
ccbd818cb4 vmstat: Fix alignment for disk partition format
The disk partition format translation hint, the actual text and the
printf statements were all diagreeing with each other. This meant
the disk partition output from vmstat was a mess.

Now all the titles and values line up and everything is right-aligned
which looks better than some half-hearted attempt at center-aligned
for titles and right-aligned for values.

Thanks to @goeran for the heads-up in #69
2017-09-25 09:24:42 +10:00
Jim Warner
aab30a0aad top: protect against the anomalous 'Mem' graph display
Until this patch, top falsely assumed that there would
always be some (small) amount of physical memory after
subtracting 'used' and 'available' from the total. But
as the issue referenced below attests, a sum of 'used'
and 'available' might exceed that total memory amount.

I'm not sure if this is a problem with our calculation
of the 'used' amount, a flaw in the kernel 'available'
algorithms or some other reason I cannot even imagine.

Anyway, this patch protects against such a contingency
through the following single line addition of new code
. if (pct_used + pct_misc > 100.0 || pct_misc < 0) ...

The check for less than zero is not actually necessary
as long as the source numbers remain unsigned. However
should they ever become signed, we'll have protection.

[ Most of the changes in this commit simply separate ]
[ a variable's definition from its associated logic. ]

Reference(s):
https://gitlab.com/procps-ng/procps/issues/64

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-08-19 20:52:41 +10:00
Jim Warner
86a7d65c8d top: address a Debian wishlist NLS man page suggestion
Reference(s):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865689

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-08-19 20:52:41 +10:00
Jim Warner
4da0030544 NEWS: add issue and bugzilla references where possible
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-08-19 20:52:41 +10:00
Jan Rybar
62da5ee3ce top: refresh interval accepts non-locale decimal value
For the past 3 years top has fully honored that locale
LC_NUMERIC setting which impacts his refresh interval.
For the past nearly 5 years top has saved that refresh
value in a locale independent form in his config file.

With this commit we'll intentionally break top so that
a comma or period will be accepted for the radix point
regardless of what that LC_NUMERIC may have suggested.

The current locale LC_NUMERIC will, however, determine
how the delay interval is displayed in the 'd' prompt.

[ This position is better than the approach employed ]
[ by those coreutils 'sleep' and 'timeout' programs. ]
[ Both claim to permit floating point arguments. But ]
[ neither one will accept the comma separator should ]
[ the locale be a country that in fact uses a comma. ]

Reference(s):
https://gitlab.com/procps-ng/procps/merge_requests/50

Prototyped by: Jan Rybar <jrybar@redhat.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-08-19 20:46:39 +10:00
Craig Small
aa41c309dd kill: -l space between name parses correctly
This was supposed to be just a cherry-pick of the referenced
commit. However there were two problems:
 1. kill code was moved out to its own file
 2. strtosig() had a latent bug where signal numbers were not
 converted to names.

Original note:
kill -lHUP would work correctly, but kill -l HUP would not.

The list option in kill was hit by a quirk of getopt_long where an
option with an optional argument would not attempt to get the argument
beyond the space, even though a mandatory argument would do that.

The fix is a kludge to scan to the next argument and if it looks
like something we can use, use it. Lucky for us, the list option is
one where parsing can stop immediately.

Thanks to Brian Vandenberg for the way forward.

References:
 http://stackoverflow.com/questions/1052746/getopt-does-not-parse-optional-arguments-to-parameters
 https://bugs.debian.org/854407
 commit 537cea324b121f54744369425332c256aa84a181
2017-05-22 22:15:59 +10:00
Jim Warner
3ad417c0c0 top: address the argument parsing quirk involving '-h'
There exists the possibility that a 'putp' call can be
issued before the 'setupterm' invocation has occurred,
as is reflected in a bugzilla report referenced below.

Strangely, such a SEGV isn't always triggered as logic
would suggest it ought to be. I experienced a fault in
these environments with the associated curses version:
. archlinux, procps-ng 3.3.12, ncurses 6.0.20170429
. fedora-25, procps-ng 3.3.10, ncurses 6.0.20160709
. opensuse-42.2, procps-ng 3.3.9, ncurses 5.9.20140201
. gentoo, procps-ng 3.3.12, ncurses 6.0.20150808
. slackw-14.2, procps-ng 3.3.12, ncurses 6.0.20160910

Whereas under these environments there was no problem:
. ubuntu-17.04, procps-ng 3.3.12, ncurses 6.0.20160625
. debian-test, procps-ng 3.3.12, ncurses 6.0.20161126
. mageia-5.1, procps-ng 3.3.9, ncurses 5.9.20140323

[ as an aside, the expected result in the bug report ]
[ is incorrect and should mention the '1' parameter. ]

[ however, until release 3.3.13 when the '1' becomes ]
[ a valid switch, numbers are not detected when used ]
[ with any switch which doesn't require an argument. ]

[ you're welcome to treat that as a separate bugglet ]

Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=1450429

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-05-22 21:38:16 +10:00
Jim Warner
c0ce5793e8 NEWS: update/alphabetize enhancements for next release
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-05-22 21:38:10 +10:00
Jim Warner
5e708c5db7 top: provide -1 command line switch as 'Cpu(s)' toggle
If built without ./configure --disable-modern-top, the
program displays each cpu individually providing there
is sufficient vertical screen real estate. For massive
SMP environments this will necessitate use of a config
file where the cpu summary toggle ('1') could be saved
via the 'W' command. But, an rcfile may not be viable.

So this commit introduces a '1' command line switch to
emulate exactly the effects of the interactive toggle.

And since it is our first numeric switch some existing
parsing logic had to be changed slightly. Such changes
are, in truth, an improvement. For example, instead of
seeing "inappropriate '2'" with ./top -2 we'll now see
the vastly more appropriate error "unknown option '2'.

References(s):
https://gitlab.com/procps-ng/procps/issues/55

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Jim Warner
b2bd65407a top: provide -E command line switch for memory scaling
In their 3.2.7 version of top, Redhat introduced an -M
switch to automatically scale Summary Area memory data
to avoid truncation (and the resulting '+' indicator).

The procps-ng top does not employ suffixes with memory
data nor does it allow for different scaling with each
separate value. Rather, scaling appears at line start.

If built without ./configure --disable-modern-top, the
Summary Area memory will be scaled at GiB which should
lessen chance of truncation. Otherwise KiB was used to
reflect such memory, increasing the truncation chance.

And while 'W' can be used to preserve some appropriate
scaling value, there are arguments against such rcfile
approaches as cited in the issue and bug report below.

So this commit will bump the Summary Area memory scale
factor from KiB to MiB when using --disable-modern-top
as a concession to that Redhat bug report noted below.

And it also introduces a new command line switch which
can force any desired scaling regardless of the rcfile
or which ./configure option might have been specified.

[ for top's help text we'll show 'E' as if it were a ]
[ switch without arguments in order to keep the help ]
[ text displayable without wrap in an 80x24 terminal ]

[ the man page, however, will show all k-e arguments ]

Reference(s):
https://gitlab.com/procps-ng/procps/issues/53
https://bugzilla.redhat.com/show_bug.cgi?id=1034466

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Jim Warner
f318be467b top: show fewer decimal places for memory (by default)
After much reflection I've come to the conclusion that
displaying 3 decimal places (usually) when memory data
had been scaled is no longer optimal with today's ever
increasing amounts. And given that not all task memory
fields are the same widths, inconsistencies can easily
arise as illustrated and discussed in the issue below.

Instead of unilaterally reducing the number of decimal
places, this commit will sneak in such a change via an
existing configure option that was very likely unused.

The former 'disable-wide-memory' option has now become
'enable-wide-memory', which can be used if the current
behavior (3 decimal places) is preferred. Without that
option, whenever memory is scaled beyond KiB, just one
decimal place will be shown in Summary and Task areas.

And Task area field width will no longer be changed by
this revised configure option. Instead, all such field
widths will now be fixed at the former maximum values.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/50

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Craig Small
ff05573f0d pkill: Return 0 if successfully killed process
Original report:
When trying kill a process with insufficient privileges (see blow),
pkill displays the error message “... failed: Operation not permitted”,
but returns 0. Surely it should return 3?

$ pkill syslogd ; echo $?
pkill: killing pid 373 failed: Operation not permitted
0

Return value 0 means one of more things matched. For a pgrep (which
shares code with pkill) this makes sense, there was a match. It seems
wrong for pkill to return 0 when it in fact could not do what you told
it to.  However return value 3 means a fatal error and it's not fatal.

Looking at other programs when trying to kill things it cannot kill.
shell kill returns 1, procps kill returns 1, killall returns 1, skill
returns 0 (and says it was successful!, ah well poor old skill)

The consensus seems to be that you return 1 if you cannot kill it, even
if you found it. In other words the return value for both not found and
not able to kill it is the same.

pkill only returns 0 if something was killed. This means we found a
match AND the kill() system call worked too.

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

Signed-off-by: Craig Small <csmall@enc.com.au>
2017-02-04 12:00:24 +11:00
Craig Small
1f094f51f1 NEWS: Very minor typo fixed
Signed-off-by: Craig Small <csmall@enc.com.au>
2017-02-04 11:07:21 +11:00
Jim Warner
a2d2b89ce0 NEWS: updated with the two most recent program changes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-02-04 11:07:06 +11:00
Jan Rybar
5602dd04e1 library: don't strip off prefixes from the wchan names
This commit will resolve the RedHat Bugzilla #1322111.

[ import from identical commit against master branch ]
[ but without trailing whitespace, thank you so much ]

Imported by: Jim Warner <james.warner@comcast.net>
2016-12-07 22:07:00 +11:00
Jim Warner
1c0d54e963 ps: now made responsive to 32 or 64-bit address widths
While a Debian bug report referenced below was limited
to the 'eip' and 'esp' fields, this patch also extends
address width adaptations to some other addresses too.

[ and, we do so in a far less invasive manner than a ]
[ redhat approach shown below adding two new fields! ]

Reference(s):
. new debian bug report
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=846361
. old redhat solution
https://bugzilla.redhat.com/show_bug.cgi?id=244152

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-12-07 22:07:00 +11:00
Jim Warner
fe3c8d74bc NEWS: updated with most recent copy from master branch
This just brings the newlib branch NEWS into line with
the current version from our master branch since those
changes have already been incorporated in this branch.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-09-18 20:37:24 +10:00
Craig Small
2c5bc47b8e 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>
2016-07-03 16:20:48 +10:00
Simon Tatham
f888a30d23 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>
2016-07-03 10:47:25 +10:00
Jesse Hathaway
80594403cc 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>
2016-07-02 15:47:39 +10:00
Craig Small
5e9c522eea 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:
 commit 07642b8ea6
 https://bugs.debian.org/733172
2016-07-02 14:49:51 +10:00
Craig Small
7fdab1fcc8 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:
 Commit 3f5b75035e
 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
2016-04-17 16:55:44 +10:00
Craig Small
0c78f4f954 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
2016-04-17 09:11:24 +10:00
Laurent Bigonville
828540578c ps: use attr/current as fallback for context
If SELINUX is enabled but the machine is using another MAC system
(like apparmor), ps will fallback to just parsing
"/proc/%d/attr/current", otherwise the label/context would not
be properly displayed in that case.

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

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-04-16 07:44:31 +10:00
Craig Small
0ee090ae16 ps: display control group name
The cgroup field while shown as a vector is a concatenated
string, so alot of the complexity of sorting and displaying
has gone.

This change simplifies the cgroup sorting and adds display
and sorting for the name attribute of the cgroup, if found.

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-08-15 17:10:38 +10:00
Craig Small
4bd0e539af ps: sort by cgroup
A rather small fix to sort by cgroup. This sorting function
could be used for other string vector entries, but I can't
see why you want to for, say, environment.

Reference:
 https://bugs.debian.org/692279

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-08-15 16:23:37 +10:00
Craig Small
e3d9ee04d9 Update NEWS for next version 2015-08-15 15:42:40 +10:00
Craig Small
de985eced5 RELEASE 3.3.11
Update NEWS file to number this release.

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-08-09 17:54:49 +10:00
Craig Small
57396ae39d build-sys: Update Library Version
procps v3.3.11 will bring Library API 5:0:0
The reason for the change is the removal of some calls and
the addition of others. The newlib branch should hopefully
reset some of these changes to a much slower pace.

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-08-09 17:45:19 +10:00
Craig Small
fd007d6d1d free: Parse -s option correctly.
If the -s option was the first option on the command line, free
would report seconds argument failed. This only appeared on the
Debian free, not the one in git.

Closer examination revealed that if a valid float string is
given to strtof() it doesn't set errno to 0, but just leaves it
alone. As we are explicitly testing errno for overflows, this
means the previous errno change is picked up here.

The simple answer is to set errno to 0 before calling strtof().

References:
 https://bugs.debian/org/733758
 https://enc.com.au/2015/08/08/be-careful-with-errno/
2015-08-08 21:04:01 +10:00
Craig Small
1f67b7dc71 Add notice in news about vmstat 2015-08-08 17:14:36 +10:00
Jim Warner
b4923fa745 miscellaneous: a final cleanup prior to release 3.3.11
This patch just eliminates some eol whitespace, adds a
missing eof newline and contributes yet one additional
entry to the NEWS summary regarding saved top rcfiles.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-08-08 16:56:50 +10:00
Craig Small
e54b372498 Update NEWS entry 2015-08-06 22:35:02 +10:00
Craig Small
313f936739 ps: enable sort by etimes
ps has two columns showing the same data which is elapsed time, just
the format is changed:
 etimes - elapsed time in seconds
 etime  - elapsed time in DD-hh:mm:ss

ps used to only sort by etime but not etimes, by making etimes
and alias of etime for sorting both flags work.

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

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-08-06 22:08:13 +10:00
Craig Small
96dc43d72b Changed git site to gitlab 2015-05-10 14:57:50 +10:00
Craig Small
92071e963e pmap: print process even if smaps unreadable
pmap would previously print the process name if
/proc/PID/smaps could be opened, even if subsequent
reads failed.  This actually occurs with other users
PIDs.

Kernel 3.18rc1 introduced a change where the file could
not been opened, meaning pmap -X 1 previously showed
the process name and nothing else but NOW shows nothing
make check failed because of this.

This change prints the process name even before trying to open
the file, returning it to previous behaviour.
Thanks to Vincent Bernat for some analysis.

References:
  https://bugs.debian.org/775624
  https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=29a40ace841cba9b661711f042d1821cdc4ad47c

Signed-off-by: Craig Small <csmall@enc.com.au>
2015-01-24 18:53:29 +11:00
Craig Small
7610b3128e skill: fix command line with signal
If skill was used with a signal number then it would intepret
the command line with last option interpreted twice. This often
confused the program so it just would end up killing nothing.
So this would work:
skill -t pts/0
This would not:
skill -9 -t pts/0

The kill path (in the same file) uses the same logic that has
been introduced here.

References: https://www.freelists.org/post/procps/skill-command-does-not-work-in-debian-7-releases

    Signed-off-by: Craig Small <csmall@enc.com.au>
2015-01-24 17:11:11 +11:00
Craig Small
fc7cb8dd4c Update NEWS with merge 33
Signed-off-by: Craig Small <csmall@enc.com.au>
2014-12-03 22:41:17 +11:00
Jaromir Capik
60660219b8 NEWS: adding enhanced ANSI support in watch 2014-09-09 18:13:23 +02:00
Jim Warner
fd71717b9b NEWS: add a few more for the release 3.3.10 change log
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-08-08 22:14:21 +02:00
Jim Warner
bcbc3c5a02 misc: result after checking all files for misspellings
Reference(s):
https://github.com/lyda/misspell-check.git

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-08-08 22:14:21 +02:00
Jim Warner
8ef6cd91fc top: retire old stale startup defaults in favor of new
For over a decade top has used a startup configuration
mimicking the original redhat top. This decision dates
back to when the forked Sourceforge version was trying
to win over users in battles with that ancient kludge.

Will anybody deny that those defaults are coyote ugly?

Well, it is time that top presented a more modern look
at startup, providing that no saved rcfile exists. But
just in case some distro prefers that old, comfortable
look, there's the '--disable-modern-top' build option.

[ Pssst. With the widened memory fields it turns out ]
[ the 'Mem' default window had become almost useless ]
[ on an 80x24 terminal since %CPU & COMMAND were out ]
[ of view. So some other defaults were tweaked a bit ]
[ whether or not --disable-modern-top was specified. ]

Reference(s)
http://www.freelists.org/post/procps/tops-graph-mode-saga-continues,3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-01 21:30:46 +10:00
Jim Warner
2199af404a top: maximize recent locale aware numeric enhancements
When startup argument parsing was recently enhanced to
account for LC_NUMERIC settings, some user input logic
dealing with numbers fails to exploit that capability.

This patch extends such enhancements to a running top.

Reference(s):
commit f7b84f45c7
http://www.freelists.org/post/procps/topwatch-floating-point-input,2

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-01 21:30:45 +10:00
Jim Warner
ff7af8d982 NEWS: update with accumulated changes for next release
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-06-22 21:39:55 +10:00
Craig Small
d06aaaaf2b ps: ignore SIGCONT
SIGCONT is a continue signal.  It seems that some zsh setups can send
this signal, causing ps to abort.  This is not what "continue" means.
This change just uses the default handler which will continue a stopped
process.

References:
  http://bugs.debian.org/732410
  http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=32251

Signed-off-by: Craig Small <csmall@enc.com.au>
2014-01-14 22:23:58 +11:00
Craig Small
7f6efed9bb sysctl --system loads default config file
Commit cdca71e945 fixed
the loading the sysctl.conf file, but had the logic
for checking the file exists reversed incorrectly.
2013-12-27 23:08:14 +11:00
Jim Warner
23dd0cec41 NEWS: updated with the next procps-ng release of 3.3.9
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-11-25 20:57:32 +11:00
Craig Small
ce0539ecac 3.3.8 NEWS and API
NEWS mentions systemd unit support for ps

Library REVISION (internal change only) incremented

Signed-off-by: Craig Small <csmall@enc.com.au>
2013-05-26 08:03:01 +10:00
Jim Warner
0fe393ff27 top: inoculated against a window manager like 'screen'
If top were invoked under the 'screen' window manager,
writing the terminfo string 'exit_ca_mode' at top exit
would not restore the display to the state existing at
the time top was started. That's what occurs normally.
The net result of that failure was a corrupted screen.

However, there is a 'screen' configuration option that
will produce proper 'rmcup' behavior, but it is off by
default. That screencr option is known as 'altscreen'.
I stumbled across this provision by cloning the screen
git repository then searching for references to 'cup'.

If 'altscreen on' had been in either the /etc/screenrc
or the $HOME/.screenrc configuration file, my poor old
top would never have been accused of such corruptions.
Of course, the Programming Gods decree that any simple
solution for our problem must always be revealed last.

So before discovering that rc option, another approach
was taken involving top only. With just a little extra
refactoring of top display logic he was made immune to
any such quirk in the implementation of 'smcup/rmcup'.

I always feel good about any enhancement that actually
reduces the total number of lines of code. Even though
this change involved mostly rearranging some logic, it
yielded one less line (can't judge by diffstat because
of braces & notes). Anyway, rather than requiring some
change to a screenrc file, now we are self-sufficient.

Reference(s):
  procps ---------------------------------------------
https://bugzilla.redhat.com/show_bug.cgi?id=962022
http://www.freelists.org/post/procps/top-procpsng337-no-screen-cleaning-at-exit,3
. top : disable tty scrollback buffer to improve SIGWINCH
commit dedaf6e1a8
  screen ---------------------------------------------
git://git.sv.gnu.org/screen.git
. Improve cursor store/restore on smcup/rmcup.
commit f95352946080be803b794c9f2733d8c809c1a39a
. Fix using alternate screen buffers in some cases.
commit ad56f746c6243d45124485d198d577bdbb78071c
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558724

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-22 14:55:40 +02:00
Jim Warner
b11a328a97 NEWS: update of some changes destined for next release
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-19 09:40:42 +10:00
Jim Warner
c2afde130e top: documentation update, enable NUMA/Node extensions
This commit provides the NEWS and man document changes
supporting the new NUMA/Node top program enhancements.

For providing the initial impetus for this enhancement
I wish to thank Lance Shelton <LShelton@fusionio.com>.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Lance Shelton <LShelton@fusionio.com>
2013-04-14 22:21:41 +10:00
Jim Warner
f9a208b273 top: enable other filtering, add documentation support
This commit provides the hard copy support for our new
'Other Filter' feature. The man document contains some
potentially useful examples and it will be interesting
to see what use this new tool is put to in the future.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-04 18:46:37 +01:00
Jim Warner
041730bfa4 NEWS: top's changes to be included in the next release
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:45 +11:00
Craig Small
f7c418155a Expose freeproc for libproc
freeproc was missing from the libproc API which meant while you could
allocate proc structures, you couldn't free them!

Bug-Debian: http://bugs.debian.org/681653
2013-01-01 13:13:44 +11:00
Craig Small
c4427d9823 Updated NEWS for procps 3.3.6
Signed-off-by: Craig Small <csmall@enc.com.au>
2013-01-01 12:52:09 +11:00
Jim Warner
5f640b3768 NEWS: updated with additional changes for next release
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-23 06:48:36 +11:00
Jim Warner
705d1b28cd NEWS: updated with changes for the new release (3.3.6)
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:02 +11:00
Craig Small
c5ee091e4c Updated news for 3.3.5 2012-11-06 23:01:08 +11:00
Jim Warner
66c87f8ef1 top: update NEWS with additional capabilities
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jaromir Capik
8e867659e6 SELinux spelling (rhbz#859900)
We got a bug report, that our project doesn't spell "SELinux"
consistently/correctly. I've fixed that and the patch is attached.

Signed-off-by: Craig Small <csmall@enc.com.au>
2012-09-27 21:46:46 +10:00
Alfredo Esteban
a5d9c40262 pkill -u uid fix
pkill would not parse -u <uid> options correctly and needed no space
between the flag and uid.

Bug-Debian: http://bugs.debian.org/676239
Signed-Of-By: Craig Small <csmall@enc.com.au>
2012-06-11 22:30:01 +10:00
Steven Chamberlain
a5ba6b98c1 Description: fix to build on non-Linux arches
Fix the build where it seems a code fix for Linux was likely untested
on other systems.
Define SCHED_BATCH in test-schedbatch, for systems that don't have it;
the corresponding RH BZ#741090 patch used the magic value 3 in output.c
anyway.

Bug-Debian: http://bugs.debian.org/677055
2012-06-11 22:11:23 +10:00
Jaromir Capik
2b58862421 Add -i option to w
w can now show IP address for the from field with the -i option
2012-05-29 22:20:36 +10:00
Craig Small
dc1531b211 Removed bogus bogus -aux message
This message has been here for ages and either people ignore it because
they are so used to using -aux or never see it.  It was here before 2005
and really 7 years is enought time to people to change their ways.

The notice is now removed, people who make usenames like "x" deserve all
the punishment they can get.

Bug-Debian: http://bugs.debian.org/670592
2012-05-22 20:50:34 +10:00
Craig Small
d9239ee3e6 Last minute updates to NEWS for v3.3.3 2012-05-20 14:39:52 +10:00
Jim Warner
4b833b1bce NEWS: just playing catch-up with resolved issues
This commit simply:
. adds some missing top acknowledgements
. reorganizes 3.3.3 text by program and bug number
. eliminates one instance of trailing whitespace

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-04-15 10:25:10 +10:00
Jim Warner
2323f864f3 top: correct miscellaneous omission, typo and buglet
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-18 08:18:11 +11:00
Craig Small
29b62a1482 mentioned kB kiB change in news 2012-03-09 06:57:10 +11:00
Craig Small
dbc47f4496 Updated NEWS for next version 2012-03-03 15:10:48 +11:00