Additional errors resulting from merge request #13 are
being addressed in this commit. They involve two cases
of trailing whitespace and one xwarnx printf type arg.
Reference(s):
http://gitorious.org/procps/procps/merge_requests/13
. earlier build-sys fix
commit e2242cb943
. original merge
commit dd6f24dbed
Signed-off-by: Jim Warner <james.warner@comcast.net>
While a 'make dist' appeared to work fine without this
patch, the nsutils.h file was missing from the include
subdirectory. Thus the tarball could not support make.
Reference(s):
http://gitorious.org/procps/procps/merge_requests/13
commit dd6f24dbed
Signed-off-by: Jim Warner <james.warner@comcast.net>
Previously the shared memory column was always zero
for 2.6 series kernels (and later) due to the fact,
that the value was taken from the MemShared entry
that disappeared with 2.6 series kernels.
Later a new Shmem entry appeared in the /proc/meminfo
file and the 'shared' column now displays either
the MemShared or the Shmem value (depending on their
presence - the presence is mutually exclusive).
If none of the two entries is exported by the kernel,
then the column is zero.
An unpleasant thing happened when I comitted the shmem support
for the 'free' tool. We already had a merge request from
Adrian Brzezinski in the queue, doing exactly the same.
As Adrian deserves credits, I'm reverting the change
and re-applying with the next commit in order to make
him a part of the project history.
Normally, the internally tracked 'Screen_cols' can not
exceed the lessor of 512 or actual screen width. There
was one case, however, where that 512 byte upper limit
was no longer properly imposed as it should have been.
When operating in 'Batch' mode the actual screen width
was allowed to be exceeded when the optional -w switch
was also used. But, it should never have exceeded 512.
This patch ensures the upper limit is always observed.
Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721204
Signed-off-by: Jim Warner <james.warner@comcast.net>
This patch addresses the four '-Wunused-result' errors
generated whenever an optimized compile is invoked. It
also made the configs_read() guy a little more robust.
In the process, some logic was rearranged slightly and
some comments were re-indented simply for consistency.
Reference(s):
warning: ignoring return value of 'fgets', declared with attribute warn_unused_result [-Wunused-result]
warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Jim Warner <james.warner@comcast.net>
When the final solution for cursor positioning for all
^Z or ^C cases was introduced the revised placement of
message line management introduced with the window mgr
'screen' refactor was retained. Those two commits mean
that a former tgoto was no longer needed when clearing
that msg line or displaying the scroll coordinate msg.
This patch eliminates the tgoto employed by frame_make
while assimilating a now defunct show_scroll function.
Reference(s):
. final cursor positioning for ^Z or ^C
commit 46a1356219
. 'screen' window manager refactor
commit 0fe393ff27
Signed-off-by: Jim Warner <james.warner@comcast.net>
This patch just provides a visual clue to separate the
values reported for cached Memory from other values on
the Swapped line (which is being shared due to space).
Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718670
Signed-off-by: Jim Warner <james.warner@comcast.net>
watch would only use an interval of up to 4294 seconds and silently
change to this limit. The 4294 seconds is 2^32/10^6 or how many
microseconds fit into unsigned int.
This change increases the limit to 2^32 seconds which is
approximately 136 years. This should be ok for now. Anything above
the old limit now uses sleep() instead of usleep() which only uses
integers (so 9999.123 seconds will be 9999 seconds)
This bug was first reported in 2006 and included a patch by
Stephen Kratzer. The patch was updated to fit the current source.
Bug-Debian: http://bugs.debian.org/720445
References: http://sourceforge.net/mailarchive/message.php?msg_id=4335929
Signed-off-by: Craig Small <csmall@enc.com.au>
The automake AM_SILENT_RULES macro is supported since automake 1.11
(which is required for procps). The silent functionality is enabled by
default, you can change it by:
./configure --disable-silent-rules
or
make V=1
Note that make still prints compiler errors, etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
* don't duplicate default behavior with [enable_foo=$enableval]
* don't introduce things like disable_* variables
* use everywhere the same coding style
Signed-off-by: Karel Zak <kzak@redhat.com>
Sometimes with libselinux present but SELinux inactive
the context reported is "unconfined" which contains an
embedded newline. This then causes misalignment of any
subsequent data. So, ps will now protect against that.
Reference(s):
http://www.freelists.org/post/procps/enablelibselinux-switch,14
Signed-off-by: Jim Warner <james.warner@comcast.net>
Some more (very obscure) conditions where a suspension
or program end might embed the shell prompt within top
output have been uncovered beyond the 2 already known.
We had already covered some suspend/end contingencies:
1. the users were using the 'fields management' screen
2. the users were prompted for any line oriented input
However, there remained some situations where ^Z or ^C
could still produce a misplaced cursor + shell prompt:
3. the 'g' command while waiting for the window choice
4. the 'W' command if about to overwrite an old rcfile
5. the '=' command when exploiting the Inspect feature
6. the period during which any error message was shown
But, even when all those bases are covered there still
remains a remote possibility that such interrupts will
occur during a top repaint cycle. So rather than throw
yet more code at these self-inflicted problems perhaps
it is better if we just throw in the proverbial towel.
Thus, I'll take the only sane approach and restore the
results expected ever since top's inception and before
scrollback buffers entered the picture. Namely, with a
^Z or ^C the cursor will be placed on the final screen
row. That usually means it will immediately follow the
last output line but it may follow many blank lines if
the user interrupts top when *not* on the main screen.
Reference(s):
. expanded repositioning (for line oriented input)
commit 33104a2bcc
. introduced repositioning (for fields management)
commit 5c974ff44d
. scrollback buffers (the cursor handling changes)
commit dedaf6e1a8
Signed-off-by: Jim Warner <james.warner@comcast.net>
An obscure bug has been discovered where a 'W' with an
old rcfile, warning against overwrite, would display a
cursor that should normally be hidden. This followed a
user's reply. So some logic was rearranged just a bit.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Previously the shared memory column was always zero
for 2.6 series kernels (and later) due to the fact,
that the value was taken from the MemShared entry
that disappeared with 2.6 series kernels.
Later a new Shmem entry appeared in the /proc/meminfo
file and the 'shared' column now displays either
the MemShared or the Shmem value (depending on their
presence - the presence is mutually exclusive).
If none of the two entries is exported by the kernel,
then the column is zero.
Previously the libselinux support was present
in the sources, but disabled with a preprocessor
condition (#if 0).
From now the libselinux support can be enabled with
the --enable-libselinux switch available
in the configuration script. That way is more
flexible than local patches modifying the condition
value from 0 to 1.
pwdx rather mysteriously fails with "invalid process id" when run in a
nonexistent locale (e.g. "LC_ALL=foo pwdx $$"). This is because it
fails to obey the documented calling sequence for strtol - that is, set
errno to 0 before the call - and thus the errno from the setlocale
failure bleeds over into its check for whether strtol failed.
References: http://bugs.debian.org/718766
Signed-off-by: Craig Small <csmall@enc.com.au>
A recent patch introduced the ability to recognize the
need to reposition the cursor at suspension or program
end. There remained unmet 1 additional potential need.
This commit extends that ability to embrace line input
so that if a user issues ^Z or ^C while being prompted
the resulting shell output will no longer be embedded.
Reference(s):
http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,7
commit 5c974ff44d
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit mostly justs renames a few identifiers but
it also will now suppress any end-of-job report if top
wasn't ended via the 'q' key convention (i.e. signal).
Signed-off-by: Jim Warner <james.warner@comcast.net>
The title of this commit is actually quite misleading.
Were it more accurate, it would at least mention a tty
emulator's scrollback buffer, which was the cumulation
of a long pursuit to reduce the SIGWINCH overhead when
a window manager carelessly floods an application with
that signal *while* a user is still resizing a window!
Disabling and enabling that scrollback buffer resulted
in the final top display replaced with original screen
contents, a phenomenon acknowledged at the time but it
also represented a user interface change which has now
produced the first request for return to old behavior.
After the SIGWINCH dust settled, another problem arose
regarding behaviors under the 'screen' window manager.
In response, top was refactored a bit to avoid display
corruption. That was before discovering 'screen' could
duplicate the scrollback buffer behavior top expected.
As it turns out, the 'screen' refactoring had probably
made scrollback buffer manipulation unnecessary. Still
one could argue that a window should not be allowed to
scroll while a constantly updating program was active.
The solution represented in this commit returns former
behavior at program end (retaining top's last screen).
And if we ever wish to disable scrollback buffers, the
associated logic was retained but made conditional. It
is not reflected in configure.ac but might be someday.
Lastly, this commit corrects cursor positioning when a
^C is issued under 'Fields Management' at any terminal
that didn't have a scrollback buffer (i.e. a console).
Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=977561http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,1
. screen program refactor
commit 0fe393ff27
. scrollback buffer disabled
commit dedaf6e1a8
. sigwinch management defines
commit adca737758
commit 4f33b6b8c5
Signed-off-by: Jim Warner <james.warner@comcast.net>
When fileutils with stream error checking was borrowed
from GNU lib, an omission was also propagated where an
errno of EPIPE wouldn't be preserved in close_stream()
making a test for EPIPE in close_stdout() meaningless.
This patch corrects such oversight so that an errno of
EPIPE no longer produces 'write error' at program end.
( gnulib provides for optionally ignoring EPIPE, but )
( if a program chooses to ignore it, then their code )
( appears to suffer from this close_stream oversight )
Reference(s):
. original fileutilis addition
commit c7cf98b0e0
. bugzilla report
https://bugzilla.redhat.com/show_bug.cgi?id=976199
The .Bd and .Ed macros, from the mdoc collection, have
caused a few raised eyebrows (lintian, doclifter, etc)
in the past. With this commit, we will trade their use
for the standard existing groff .nf & .fi equivalents.
Signed-off-by: Jim Warner <james.warner@comcast.net>
It seems in some cases procs_running field of /proc/stat can contain 0 even if vmstat itself is running. At least this can be reproduced on Linux 3.9.3 compiled with BFS scheduler.
Since getstat() decrements value of procs_running by 1, we get overflow:
$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 667732 918996 57376 911260 21 30 36 40 98 45 14 82 4 1
4294967295 0 667728 916716 57376 911264 8 0 8 0 1958 3733 28 7 65 1
0 0 667700 915996 57376 911416 24 0 152 0 1735 3600 23 5 71 1
4294967295 0 667700 915872 57376 911392 0 0 0 0 1528 3165 21 4 76 0
When the plug-in approach to NUMA support was added, I
carelessly employed the compile-time linker convention
for naming the library. Technically this then required
the 'devel' package for NUMA support to be present for
the unqualified soname symlink to be available. Either
that or one must have manually created such a symlink.
This commit adds the missing major version to dlopen()
of libnuma.so.1 so simply having a more likely package
such as 'numactl' will enable both '2' & '3' commands.
References(s):
http://www.freelists.org/post/procps/top-NUMA-node-CPU-utilization-support,25
. initial dlopen support
commit edba932a7e
Signed-off-by: Jim Warner <james.warner@comcast.net>
which is a separate package that may not be available and is not yet build on Linux from scratch build order.
Instead use posix command -v. command -v is a builtin working with bash-4.2, 3.0.25 or even old bash-2.05 or current debian dash
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
I find more readable instead of make check to run
cd testsuite && make site.exp && DEJAGNU=global-conf.exp runtest
But in that case, kill.exp was still trying to run with
ERROR: tcl error sourcing ./kill.test/kill.exp.
ERROR: couldn't execute "/usr/src/procps-ng-3.3.7/kill": no such file or
directory
...
Simply return from test if kill is not build
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
When procps is built with gcc 4.8 address sanitizer
static int one_proc(proc_t * p)..
..
char smap_key[20];
...
(sscanf(mapbuf, "%20[^:]: %llu", smap_key..
rightfully results in an overflow and the program aborts.
ps : This patch removes sd_ prefix from recently added systemd output options
to let them look more tied with the system.
Patch does not change behaviour of these options, only modifies their
representation to user.
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=962022http://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>
When summary & task area memory scaling was introduced
in release 3.3.6, the memory field widths were widened
slightly so unscaled KiB values could be provided more
consistently and scaled values (beyond MiB) could show
3 decimal places of precision. However, some users may
prefer the former widths/precisions for memory fields.
This commit will provide a build time configure option
to return top to those former defaults as a compliment
to a new %CPU & %MEM field precision configure option.
Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707648
commit 21e550bc08
Signed-off-by: Jim Warner <james.warner@comcast.net>
When summary & task area memory scaling was introduced
in release 3.3.6, the percentage columns were expanded
to provide 3 decimal places of precision. In hindsight
that may have been overkill, making those columns more
of a distraction than useful, with just too much info.
This patch will revert those columns to the former one
decimal place. And as was true, that decimal point may
be sacrificed depending on the number of cpus present.
And, in case anyone might prefer additional precision,
a build option can provide it (--enable-wide-percent).
Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707648http://www.freelists.org/post/procps/What-happened-to-my-top,1
commit 21e550bc08
Signed-off-by: Jim Warner <james.warner@comcast.net>
Some versions of man have had trouble with the leading
apostrophe employed with interactive commands/toggles.
Instead, a '?' would be displayed in their place. With
this patch all such conventions have now been removed.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Function getbtime() currently makes the assumption that btime==0 equals
btime not being present in /proc/stat. This is not quite accurate, as
timestamp 0 is, in fact, also a valid time (Epoch), and /proc/stat may
report it as such.
We introduce a flag to indicate whether btime was found in /proc/stat.
In this way, btime==0 becomes a valid case, provided /proc/stat
actually reports this as the boot time.
procps can still detect the case of btime actually not being reported
by the kernel.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
The earlier commit purporting to allow top to be built
in the absence of that dynamic linking library stopped
just a little short of the truth. So this will fix it.
Reference(s):
commit 5686877cd4
Signed-off-by: Jim Warner <james.warner@comcast.net>
Been a while since we ran a re-scan over the autotools files. This
change modernises the configure file. Not a great deal of changes
required to bring us up to date, autoscan doesn't understand our
optional things, which is fine.