This flaw was revealed under 'man2htm' and dates back
to the first Gitorious revised top submission.
Reference:
commit fd62123562
Date: Thu Mar 31 22:15:12 2011 +1100
Signed-off-by: Jim Warner <james.warner@comcast.net>
When the maj_delta and min_delta fields were added to
the proc_t, they necessitated some compiler generated
padding bytes.
With this slight reordering, those padding bytes are
no longer generated. And since the original commit
already broke the library ABI, now is an opportune
time to correct that misalignment.
Reference:
commit 7753bd1004
Signed-off-by: Jim Warner <james.warner@comcast.net>
The UNIX and POSIX standards require that user and
group names be printed as decimal integers when there
is insufficient room. This has led to a constant
stream of bug reports.
With this commit, long names will be truncated and
displayed with a trailing visual clue.
To avoid truncation. the UNIX and POSIX way to change
column width is to rename the column:
ps -o pid,user=CumbersomeUserNames -o comm
The easy way is to directly specify the desired width:
ps -o pid,user:19,comm
Reference:
http://www.freelists.org/post/procps/rhbz737215-ps-does-not-resolve-some-user-names
Signed-off-by: Jim Warner <james.warner@comcast.net>
Both options provide more information about a process using -X and -XX
flags. The data comes from /proc/PID/smaps so it may vary.
Signed-off-by: Craig Small <csmall@enc.com.au>
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>
The TREE_RESCANS #define (formerly TREE_ONEPASS) has
been eliminated and the approach to forest view mode
redesigned. The chance of dangling children has been
eliminated and overhead reduced.
We now order processes on start_time (non-display)
and are therefore immune to any pid, ppid or tgid
anomalies when pid values wrap.
The new algorithm also accommodates any distortions
caused by the 3.3 kernel 'hidepid' provisions --
something guaranteed to produce dangling children
under the former approach.
Related References:
commit a2086dfdf6
commit cd608f462e
commit 41ed28aa5d
Signed-off-by: Jim Warner <james.warner@comcast.net>
The recent introduction of scrollable variable width
columns makes a process 'environment' a potentially
useful addition to top's displayable fields.
This commit exploits the following new library flag:
PROC_EDITENVRCVT
Signed-off-by: Jim Warner <james.warner@comcast.net>
In preparation for top scrollable environment display,
the new flag PROC_EDITENVRCVT was added to mirror the
existing single vector string handling for cgroup and
cmdline.
Signed-off-by: Jim Warner <james.warner@comcast.net>
In an effort to avoid dangling children when in forest
view mode, top defaulted to a complete rescan of every
proc_t for each child encountered.
That expense was never really cost justified and now
with the 3.3 kernel 'hidepid' provisions it no longer
can offer such protection.
With this commit, the TREE_ONEPASS define is changed
to TREE_RESCANS so as to reverse the default scan
behavior.
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit represents mostly spelling corrections
in comments. It also includes a few very minor logic
changes/relocations.
Signed-off-by: Jim Warner <james.warner@comcast.net>
This section purported to list fields in alphabetical
order, but this was not always true.
With this commit, strict ascii collating sequence is
now observed.
Signed-off-by: Jim Warner <james.warner@comcast.net>
With the introduction of intra-column scrolling, the
scroll coordinates message was enhanced to give some
hint of positioning within a scrolled column.
Rather than rebuild this somewhat costly string from
scratch with each frame, we'll now do the bulk of the
work only when column headers are constructed.
The only remaining per frame costs will then be the
addition of a few terminfo escapes and the current
Frame_maxtask count.
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit introduces horizontal scrolling within any
variable width column. Thus, an entire command line,
complete list of control groups, etc. can now be
viewed -- not just a screen width's portion.
It is activated when any variable width column:
. is (via field selection) or
. has become (via the right arrow key)
the only displayed field.
Then, the right and left arrow keys can be used in the
normal way to continue scrolling within that column.
The amount scrolled with each key press is currently
set as the normal tab stop increment of 8 characters.
Signed-off-by: Jim Warner <james.warner@comcast.net>
The control group hierarchies for any particular task
could conceivably grow quite large. However, the
library might impose an arbitrary limit of 1024 bytes
via fill_cgroup_cvt.
Two utility buffers of 128 KiB each were already
available for command line use. This commit simply
trades the smaller 1024 byte stack based buffers for
those much larger existing ones. Thus, truncation
can be avoided with no additional run-time costs.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Some inconsistencies have emerged during development
of support for these relatively new proc_t fields.
For example, a PROC_FILLCGROUP flag (via file2strvec)
could return NULL in cgroup whereas PROC_EDITCGRPCVT
(via fill_cgroup_cvt) *almost* guaranteed a return
address (as is true for PROC_EDITCMDLCVT and cmdline).
But even PROC_EDITCGRPCVT could return NULL if the
kernel version was less than 2.6.24. Then with NULL
ps would display a "-" while top would show "n/a".
And while unlikely, with the PROC_FILLSTATUS flag (via
status2proc) a NULL supgid address was theoretically
possible and both ps and top would then show "n/a".
This commit standardizes the following usage:
. PROC_FILLSTATUS (via status2proc)
guarantees a valid supgid address
representing either a true comma
delimited list or "-"
. PROC_FILLCGROUP plus
PROC_EDITCGRPCVT (via fill_cgroup_cvt)
guarantees a cgroup single vector
representing either a true control
group hierarchy or "-"
And as was true before, the following remains true:
PROC_FILLCOM or
PROC_FILLARG (via file2strvec)
may return a NULL cmdline pointer
. PROC_FILLCGROUP (via file2strvec)
may return a NULL cgroup pointer
. PROC_FILLCOM or
PROC_FILLARG plus
PROC_EDITCMDLCVT (via fill_cmdline_cvt)
guarantees a cmdline single vector
representing either a true command
line or a bracketed program name
. PROC_FILLSTATUS plus
PROC_FILLSUPGRP (via supgrps_from_supgids)
guarantees a valid supgrp address
representing either a true comma
delimited list or "-"
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit restores the missing space between command
lines and the environment when the later is being
displayed. Below is a brief history of that elusive
character.
commit bb4f08ba29
Date: Thu Aug 11 07:42:14 2011 +1000
The ps program was altered for improved args/comm
compliance. At this time, the needed space was
present due to a buglet in the new library
read_unvectored function used by fill_cmdline_cvt.
commit a5881b5a4e
Date: Thu Dec 8 10:19:38 2011 -0600
The trailing space was eliminated so that the
file2strvec and fill_cmdline_cvt returned
command lines contained no trailing space.
However, this created a buglet when control group
hierarchies were displayed and the final cgroup
was empty.
This is also where the undetected ps buglet was
created.
commit c3a1239efe
Date: Sun Dec 11 12:00:50 2011 -0600
The control group anomaly was fixed but the impact
on ps args/environ was still not detected.
Signed-off-by: Jim Warner <james.warner@comcast.net>
'si' and 'so' values depend on the result of the unitConvert
function where the output is a fixed-point size of kb_per_page
after the conversion. It gives 4 for kB units and 0 for MB units.
This also causes problems when switching between 'K' and 'k'
since the output value is 4 in both cases and the result for
'k' and 'K' then doesn't differ ... I swapped the conversion with
multiplication in order to make the number higher so it doesn't
lose precision. Since the unitConvert now accepts long instead
of int, I had to change the input type from int to long.
Signed-off-by: Craig Small <csmall@enc.com.au>
Some checks will fail due to different locales. For example 1.2 will
become 1,2 so the match fails. Problem reported by Alfredo Esteban
with fix suggested by Mike Frysinger
When ps is not available (like it may happen in a chroot), pgrep.exp and pkill.exp tests fail.
Use just build ps instead.
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
There soon will be slab types per cgroup meaning the name of the slab
will have the cgroup name in parathensis after the slab name. This
minor change increases the slab name size to cater for this.
Signed-off-by: Craig Small <csmall@enc.com.au>
Commig a5d9c40262 caused signal spec,
again, to be required as first option; for example
pkill -3 <program> # worked
pkill <program> -3 # did not
This commit fixes the regression, without breaking option -u <numeric>
argument, assuming no-one is using negative numeric UID specifications
with space after -u && the argument. IMHO such use case is rare enough
to be broken.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This version detects IPv6 address in the host field
and also IPv6 link interface separated by % sign.
It also handles unprintable characters and spaces better
than the previous one.
Signed-off-by: Craig Small <csmall@enc.com.au>
Commit a5d9c40262 had one small problem.
In that function its *argc not argc. This stops pgrep with no commands
from segfaulting, thankyou dejagnu!!
Signed-Off-By: Craig Small <csmall@enc.com.au>
On some architectures/gcc's, the pwdx tool doesn't compile right
because of bad type of a variable. Afterwards pwdx can't be
persuaded to work. Use int as the type, like the other tools
(like pgrep) do.
Signed-off-by: Craig Small <csmall@enc.com.au>
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>
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
The commit 8967f0fca3 has an typo like
error, which I must have done. The Bug-Debian 240989 did not have 12
but 128. Rest of the fixes are from Bug-Debian 675069 e.g. missing
include added, and usage of iswprint().
Bug-Debian: http://bugs.debian.org/240989
Bug-Debian: http://bugs.debian.org/675069
Reported-by: "Dr. David Alan Gilbert" <dave@treblig.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
I checked the second patch, saved it, it looked ok.
And then applied the first (wrong) patch. Jaromik gave this correction.
Signed-off-by: Craig Small <csmall@enc.com.au>
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
Building w on an x86_64 system triggers:
w.c:404:4: warning: format '%zu' expects argument of type 'size_t',
but argument 4 has type 'int' [-Wformat]
Since we're comparing UT_NAMESIZE to an int, cast it to that type
(since it can't exceed it) and update the printf.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>