]> granicus.if.org Git - procps-ng/log
procps-ng
9 years agotop: exploit the new library API for memory statistics
Jim Warner [Sun, 28 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: exploit the new library API for memory statistics

This commit represents the pioneering attempt at using
the concept of 'chained' library requests in an effort
to reduce function call overhead. It required exposing
no more implementation details than were already shown
through the individual calls, yet is satisfied in one.

It is just such an approach that will prove invaluable
when it comes time to access individual /proc/##/data.
Programs could 'chain' only those 'results' structures
representing their current view independent of all the
fields any such programs might be prepared to display.

Thus the standard 'read', which wouldn't apply to task
level data very well (or efficiently), can now become
a 'read_chain' whereby the former PROC_FILL flags need
can be satisfied & yield the minimum open/close calls.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: add chaining provisions to meminfo and vmstat
Jim Warner [Sun, 28 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: add chaining provisions to meminfo and vmstat

If a caller chooses to reduce the overhead of repeated
function calls, this commit provides for acquiring all
the desired information in just a single library call.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: add missing meminfo logic, improve efficiency
Jim Warner [Sun, 28 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: add missing meminfo logic, improve efficiency

This patch fills in some missing fields which have top
dependencies. Additionally, I've tried to mirror those
calculations Jaromir added for release 3.3.10. The one
calculation that remains missing is 'available' memory
for some kernels. For this API, we'll use a fall-back.

Lastly the lxc safeguards which were recently added to
the old procps library were incorporated here as well.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: tweak formatting style for meminfo and vmstat
Jim Warner [Sun, 28 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: tweak formatting style for meminfo and vmstat

This patch mostly just eliminates darn tab characters.

Plus the library function declarations and definitions
have been standardized. Most visibly, the input params
now have all been indented on their own separate line.

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: export pwcache functions correctly
Craig Small [Wed, 24 Jun 2015 12:46:06 +0000 (22:46 +1000)]
library: export pwcache functions correctly

9 years agolibrary: more mem and stat fixes
Craig Small [Wed, 24 Jun 2015 12:16:16 +0000 (22:16 +1000)]
library: more mem and stat fixes

Make distcheck now succeeds.
Changed some of the binaries to use the new API.

9 years agolibrary: Fix up stat API
Craig Small [Tue, 23 Jun 2015 12:22:50 +0000 (22:22 +1000)]
library: Fix up stat API

Adjusted vmstat to use the new API for memory and CPU statistics

9 years agolibrary: memory and vmstat API changes
Craig Small [Sun, 21 Jun 2015 08:22:28 +0000 (18:22 +1000)]
library: memory and vmstat API changes

Created new set of functions for meminfo related calls. Liked the
format of that better so changed vmstat around so the look similar.
Missed the makefile change for uptime so added it in now.

9 years agolibrary: uptime API changes
Craig Small [Sun, 21 Jun 2015 08:20:04 +0000 (18:20 +1000)]
library: uptime API changes

Removed the printf_uptime, binaries can do printf easily enough.
sprint_uptime split into two as there wasn't a lot of common
code
 sprint_uptime(): old style uptime line
 sprint_uptime_short(): short new style "uptime -p"

Hertz_hack needed this, no sane system uses the code (I think)
so just assume 100 like we do in FreeBSD.

9 years agolibrary: Add procps_meminfo_* functions
Craig Small [Sat, 20 Jun 2015 13:08:47 +0000 (23:08 +1000)]
library: Add procps_meminfo_* functions

New set of functions that read the /proc/meminfo file. Still needs
work.

9 years agolibrary: sysstat and vmstat api changes
Craig Small [Fri, 19 Jun 2015 21:43:02 +0000 (07:43 +1000)]
library: sysstat and vmstat api changes

Use the standard libc declarations.
For protecting the headers for C++ procps used to have its
own defines, this change makes them use the standard libc ones.

getstat() -> procps_stat_*
vminfo() -> procps_vmstat_*
These two components of the library now use the newer version of
the API with less exposed global variables. The old methods are
there for now.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopwdx: Do not link to libprocps
Craig Small [Wed, 24 Jun 2015 12:27:24 +0000 (22:27 +1000)]
pwdx: Do not link to libprocps

pwdx doesn't actually use any of the libprocps functions but
it is linked because it is the default.  This specific LDADD
removes that unrequired linking.

9 years agobuild-sys: tweak to prevent dirty tree with every make
Jim Warner [Sat, 20 Jun 2015 05:00:00 +0000 (00:00 -0500)]
build-sys: tweak to prevent dirty tree with every make

Please let's stop the nls translation insanity. With a
one time push we can eliminate the dirty tree syndrome
which surfaces with every local build. Later, before a
release, the translations can be updated in final form
then pushed just 1 more time to the gitlab repository.

I'm tired of having to always re-issue this request in
order to circumvent the problem and thus prevent a too
broad commit (not to mention some nasty side effects).

[ bash$ git update-index --assume-unchanged po/??.po ]

Reference(s):
http://www.freelists.org/post/procps/procpsng-translations

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: sacrifice a redundant procps_linux_version() call
Jim Warner [Sat, 20 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: sacrifice a redundant procps_linux_version() call

With the commit referenced below, the linux version is
no longer available via an external variable. So we'll
eliminate the extra superficial function call employed
at program end as part of a debugging (only) o/p spew.

[ the user will soon be returned to the command line ]
[ & he/she can run their own 'uname -r' if in doubt! ]

Reference(s):
commit 56d9d5e7e701e71646679b2b8cefa9239ee59592

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agofix integer overflow on 2GiB+ maps on 32-bit platforms
Yuriy M. Kaminskiy [Sat, 20 Jun 2015 11:39:41 +0000 (21:39 +1000)]
fix integer overflow on 2GiB+ maps on 32-bit platforms

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agomiscellaneous: remove some trailing whitespace buildup
Jim Warner [Fri, 19 Jun 2015 13:41:51 +0000 (08:41 -0500)]
miscellaneous: remove some trailing whitespace buildup

wish folks (craig) would use these in their .gitconfig

[core]
  whitespace = trailing-space, space-before-tab, blank-at-eof
[apply]
  whitespace = warn

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agobuild-sys: fix oversight for a newly added header file
Jim Warner [Fri, 19 Jun 2015 13:34:12 +0000 (08:34 -0500)]
build-sys: fix oversight for a newly added header file

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: Change linux version
Craig Small [Fri, 19 Jun 2015 11:00:46 +0000 (21:00 +1000)]
library: Change linux version

Added function procps_linux_version() which used to be an
exported integer instead.  Also changed the method of obtaining
the linux version (more correctly the os release) to use a specific
procfs entry. This works for both Linux and FreeBSD.

9 years agoUpdate the po files
Craig Small [Fri, 19 Jun 2015 10:36:43 +0000 (20:36 +1000)]
Update the po files

9 years agodocumentation: fix man pages due to refactor for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
documentation: fix man pages due to refactor for wchan

This patch will bring three of our man pages into line
with the recent refactor of the libprocps wchan logic.

[ and also eliminates more damn eol whitespace which ]
[ snuck in our repo with the commit referenced below ]

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11
commit cf4788c28dba784a09c8b036a56fffa49da584e7

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: adapt to a simplified library interface for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: adapt to a simplified library interface for wchan

This patch was made necessary by those library changes
in support of recently revised/simplified wchan logic.

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agops: exploit the simplified library interface for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
ps: exploit the simplified library interface for wchan

This patch was made necessary by those library changes
in support of recently revised/simplified wchan logic.

In addition, this commit eliminates a broken alternate
'namelist' provision which was intended to allow users
to specify a System.map file to be used in translating
addresses into function names. But, the real effect of
the now defunct 'N' and '-n' options was to indirectly
force addresses (not names) to be displayed since such
user named map files could not be successfully parsed.

Besides when the required FRAME_POINTER kconfig option
is absent there is no address to translate and when it
is present /proc/PID/wchan is already translated. Thus
an alternate mapping is unnecessary and inappropriate.

[ we'll forgive POSIX for documenting '-n  namelist' ]

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: refactor and rely on modern kernels for wchan
Jim Warner [Thu, 18 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: refactor and rely on modern kernels for wchan

Several Debian based distributions were recently found
to have omitted a kernel configuration option that had
the effect of rendering /proc/#/stat and /proc/#/wchan
useless for providing any 'sleeping in function' info.

That problem also prompted a reevaluation of the whole
approach to wchan matters which had grown increasingly
complex as our library evolved over the last 13 years.

The net result was a decision to rely on /proc/#/wchan
which arrived along with the 2.5 kernel. This then let
us vastly simplify the internal code plus the external
interface which will benefit both the top and ps pgms.

Reference(s):
http://www.freelists.org/post/procps/WCHAN,11
https://lkml.org/lkml/2008/11/6/12
https://bugs.debian.org/711592

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: correct an alphabetic field error in man document
Jim Warner [Mon, 15 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: correct an alphabetic field error in man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agobuild-sys: do not distribute the aging README.top file
Jim Warner [Tue, 12 May 2015 08:00:00 +0000 (03:00 -0500)]
build-sys: do not distribute the aging README.top file

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: remove procps_version functions
Craig Small [Thu, 18 Jun 2015 12:37:24 +0000 (22:37 +1000)]
library: remove procps_version functions

It doesn't make any sense to have the binary version strings
embedded into the library. The version strings are defined
already either in the Makefile or in include/c.h

9 years agops: update man document to support LXC container names
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
ps: update man document to support LXC container names

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agops: add code to exploit the new library LXC containers
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
ps: add code to exploit the new library LXC containers

Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: update man document to support the LXC containers
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: update man document to support the LXC containers

[ in addition to the primary 'lxc' business, i found ]
[ numerous apostrophes used instead of that back-tic ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: add support exploiting new library LXC containers
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
top: add support exploiting new library LXC containers

Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: add support for displaying LXC container name
Jim Warner [Sat, 13 Jun 2015 05:00:00 +0000 (00:00 -0500)]
library: add support for displaying LXC container name

This commit adds a lxc container name to every proc_t.
If a process is not running in a container, then a '-'
will be provided, making such a field always sortable.

Unlike other proc_t character pointers, lxc containers
will find many duplicate shared values. So rather than
strdup 'em (with a later free required upon reuse), we
try to keep track of those already seen and share that
address among all tasks running within each container.

We rely on the lines in the task's cgroup subdirectory
which may initially seem somewhat unsophisticated. But
the lxc library itself uses a similar approach when it
is called to list active containers. In that case, the
/proc/net/unix directory is parsed for the '/lxc' eye-
catcher, with potential complications from hashed path
and names that are too long (something we don't face).

[ too bad docker abandoned lxc - our commit won't do ]
[ anything for the users of those kind of containers ]

Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agolibrary: address memory aberration with LXC containers
Jim Warner [Sat, 13 Jun 2015 00:00:00 +0000 (00:00 +0000)]
library: address memory aberration with LXC containers

Under a lxc container, the /proc/meminfo 'MemFree' and
'MemAvailable' amounts will be equal, unless memory is
being limited via cgroups in which case 'MemAvailable'
could exceed that for 'MemTotal'. And when a container
has been nested, there exist additional memory quirks.

A program might then display used or available amounts
greater than total memory (assuming unsigned honored),
or negative values (should a signed cast be employed).

This anomaly primarily impacted the top and free pgms.
Thus, two simple sanity checks have been introduced to
avoid any illogical kb_main_available or kb_main_used.

( Busybox top & free also display anomalous although )
( different results when running in a lxc container. )

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

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotestsuite: fix ps signals test
Craig Small [Sun, 14 Jun 2015 05:20:48 +0000 (15:20 +1000)]
testsuite: fix ps signals test

On some setups the signals count can change and be truncated. You
will notice this because the number will have "<" prepended. The
testsuite didn't handle this.
You could either get:
         BLOCKED          BLOCKED          BLOCKED           CAUGHT
CAUGHT          CATCHED
0000000000000000 0000000000000000 0000000000000000 00000001f3d1fef9 00000001f3d1fef9 00000001f3d1fef9

or
  BLOCKED   BLOCKED   BLOCKED    CAUGHT    CAUGHT   CATCHED
 00000000  00000000  00000000 <f3d1fef9 <f3d1fef9 <f3d1fef9

9 years agorevert pl.po file
Craig Small [Sat, 13 Jun 2015 23:08:01 +0000 (09:08 +1000)]
revert pl.po file

9 years agoupdate polish po file
Craig Small [Sat, 13 Jun 2015 22:59:53 +0000 (08:59 +1000)]
update polish po file

9 years agoDo not link test process to libprocps
Craig Small [Sat, 13 Jun 2015 22:54:59 +0000 (08:54 +1000)]
Do not link test process to libprocps

The test process introduced at 420cd9c7 incorrectly linked to
libprocps which made the CI runner fail.

9 years agops.1: usernames are truncated
Peggy Russell [Sat, 13 Jun 2015 06:54:23 +0000 (16:54 +1000)]
ps.1: usernames are truncated

ps now truncates usernames and doesn't change them to uids.
Man page is now updated with the correct information

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agoSkip tests where /proc/vmstat unreadable
Craig Small [Sat, 13 Jun 2015 05:13:39 +0000 (15:13 +1000)]
Skip tests where /proc/vmstat unreadable

testsuite would fail if /proc/vmstat was unreadable.
Issue #3 brought up by Mike Frysinger.
test script explicitly checks to see if it is readable and
sets these tests to unsupported if not.

9 years agoCreate test process
Craig Small [Sat, 13 Jun 2015 05:04:31 +0000 (15:04 +1000)]
Create test process

For the test suite, procps used to use sleep which would just
create a process or two to test the tools against.  Some setups
coreutils creates all programs including sleep into one blob which
means a lot of the tests fail, see issue #2

procps has its own sleep program now.

9 years agoprocps: Add a zero-width break point in slabtop.1
David Prévot [Sat, 23 May 2015 20:01:14 +0000 (16:01 -0400)]
procps: Add a zero-width break point in slabtop.1

It allows to distinguish the initial NAME (to be translated) with the
latter one (that must not be translated) and thus permits to handle its
translation differently.

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

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopgrep: prevent buffer overflow in opts
Filipe Brandenburger [Mon, 11 May 2015 18:40:50 +0000 (11:40 -0700)]
pgrep: prevent buffer overflow in opts

Recent commit 9742c74e7c522 ("pgrep: Enable case-insensitive process matching")
caused the "opts" string to overflow the show 32-character space allocated for
it.

Bump it up to 64 bytes, which should be enough even if more options are added.

Tested: Running ./pgrep stopped crashing and `make check` passed.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agoMerge branch 'fix_parallel_build' into 'master'
Craig Small [Wed, 13 May 2015 11:57:10 +0000 (11:57 +0000)]
Merge branch 'fix_parallel_build' into 'master'

build-sys: use proper dependencies on libproc.la

Use `LDADD` or `*_LDADD` instead of `AM_LDFLAGS` to refer to `libproc.la`.

This is recommended in the automake manual:
http://www.gnu.org/software/automake/manual/html_node/Linking.html

Before this commit, parallel builds may break, as there is no explicit dependency to ensure the library is built before the binaries that try to link to it.

Tested by running `make -jNN` repeatedly for different levels of parallelism to ensure the build works. Also checked that `make check` and `make distcheck` still work as expected. Also made sure that a parallel make invocation works with `make -j distcheck`.

Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
See merge request !2

9 years agobuild-sys: use proper dependencies on libproc.la
Filipe Brandenburger [Mon, 11 May 2015 19:31:59 +0000 (12:31 -0700)]
build-sys: use proper dependencies on libproc.la

Use LDADD or *_LDADD instead of AM_LDFLAGS to refer to libproc.la.
Otherwise, parallel builds will break as there is no explicit dependency
to ensure the library is built before the binaries that try to link to
it.

v2: Added empty rules lib_test_*_LDADD to remove the dependency on
libproc which is not used by the lib/test_* binaries.

Tested by running `make -jNN` repeatedly for different levels of
parallelism to ensure the build works. Also checked that `make check`
and `make distcheck` still work as expected. Also made sure that a
parallel make invocation works with `make -j distcheck`.

Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agotranslations: update translations from TP
Craig Small [Sun, 10 May 2015 07:50:19 +0000 (17:50 +1000)]
translations: update translations from TP

9 years agodocs: Update filenames in Makefile too
Craig Small [Sun, 10 May 2015 07:49:11 +0000 (17:49 +1000)]
docs: Update filenames in Makefile too

9 years agopgrep: Enable case-insensitive process matching
William Orr [Sun, 10 May 2015 07:42:09 +0000 (17:42 +1000)]
pgrep: Enable case-insensitive process matching

FreeBSD has case-insensitive matching of processes in pgrep and
pkill, which can be super-useful. This patch uncomments and
documents the code needed to make this work.

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agodocs: Fixed title and linked to bugs
Craig Small [Sun, 10 May 2015 07:36:21 +0000 (17:36 +1000)]
docs: Fixed title and linked to bugs

9 years agodocs: Updated documentation
Craig Small [Sun, 10 May 2015 07:23:54 +0000 (17:23 +1000)]
docs: Updated documentation

Updated the documents with the following general changes:
* Replaced Gitorious with GitLab
* Moved translate stuff out of README
* Changed plain text to markdown (looks better on website)

9 years agoadded a README in markup
Craig Small [Sun, 10 May 2015 06:43:41 +0000 (06:43 +0000)]
added a README in markup

9 years agoMerge branch 'filbranden/procps-build_sys_cleanup_usrbin'
Craig Small [Sun, 10 May 2015 05:28:56 +0000 (15:28 +1000)]
Merge branch 'filbranden/procps-build_sys_cleanup_usrbin'

configure.ac conflict was due to the git url being
changed after the merge request.

Conflicts:
configure.ac

9 years agotests: slabinfo should not be too strict about slab names
dmarc-noreply@freelists.org [Wed, 6 May 2015 22:17:24 +0000 (15:17 -0700)]
tests: slabinfo should not be too strict about slab names

Before this commit, the test checking `vmstat -m` (slabinfo) output uses
a fairly strict regular expression that only allows alphanumeric
characters and a few exceptions such as "_", "-", "(" and ")".

However, recent kernels use a wider range of characters, such as ">".
For instance, see this Linux commit which creates a "page->ptl" slab:
  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/mm/memory.c?id=b35f1819acd9243a3ff7ad25b1fa8bd6bfe80fb2#n4283

Other patches for reporting slab usage per memcg include the names of
the cgroup in the slabinfo output, which can include additional
characters and use dots for abbreviation.

The check should not be so string, instead it could simply look for a
chain of non-whitespace characters and that should be enough.

Tested that `make check` is still working, including in some of the
environments where features that enable the additional slabinfo names.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotests: fix regexp in ps_sched_batch.exp to match in first line
dmarc-noreply@freelists.org [Wed, 6 May 2015 22:17:23 +0000 (15:17 -0700)]
tests: fix regexp in ps_sched_batch.exp to match in first line

The current regexp checks for a \s+ in the beginning, however that will
only match if there is a \n in the `ps` output before test-schedbatch,
but that will not happen if test-schedbatch is the first process in the
list, which happens if the PID of test-schedbatch is low enough to bring
it up in the sorted list.

Fix it by enabling newline-sensitive matching with (?n) which then
allows using ^ and $ anchors in the regexp (including an optional \r
introduced by expect.) Matching the end of line also improves checking
that the last field matches 18 exactly and not something like 181, etc.

Tested that `make check` does not break and also fixed the flakiness
seen in an environment with few processes running under the test user
which made the issue more frequent.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agotests: do not mark ps_sched_batch.exp as untested
dmarc-noreply@freelists.org [Wed, 6 May 2015 22:17:22 +0000 (15:17 -0700)]
tests: do not mark ps_sched_batch.exp as untested

Right now the test case is both testing it (expect_pass "$test") and
marking it as untested (untested "$test"), it should do either one or
the other, so stop marking it as untested.

Before this change, these lines appear in testsuite/ps.log or the output
of `make check RUNTESTFLAGS="--all"`:

  PASS: ps SCHED_BATCH scheduler
  UNTESTED: ps SCHED_BATCH scheduler

Note that the second line is confusing, it's implying that the test is
untested, right after having tested it and indicated it passes.

After this change, only the first line will appear.

Tested that both `make check` and `make distcheck` continue working with
this commit.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agorevert ps_sched checks for following commits
Craig Small [Sun, 10 May 2015 05:04:19 +0000 (15:04 +1000)]
revert ps_sched checks for following commits

9 years agoChanged git site to gitlab
Craig Small [Sun, 10 May 2015 04:57:50 +0000 (14:57 +1000)]
Changed git site to gitlab

9 years agopgrep SID=1 is valid
Craig Small [Sat, 9 May 2015 07:53:08 +0000 (17:53 +1000)]
pgrep SID=1 is valid

On most systems the only process with a SID=1 is init
and certainly not a test sleep.  On docker systems this
test program IS on SID=1 and so our "impossible SID" becomes
possible.

9 years agoFix some sched and tty tests
Craig Small [Sat, 9 May 2015 07:48:12 +0000 (17:48 +1000)]
Fix some sched and tty tests

The ps sched test has been disabled. There are too many
odd build farms this fails in strange ways.

Other odd build farms have no tty and so some tests check
for no tty and skip if not found.

9 years agobuild-sys: install binaries in bindir (get rid of usrbin_execdir)
Filipe Brandenburger [Sat, 2 May 2015 06:27:13 +0000 (23:27 -0700)]
build-sys: install binaries in bindir (get rid of usrbin_execdir)

The "usrbin_execdir" hack meant to install some binaries in /bin and
others in /usr/bin. However:

- It is very inflexible: not much control on the final directory name
  and it is not possible to get rid of the usr/bin suffix without
  patching the build system.

- It is hard to use: it requires configure to receive --exec_prefix=/
  and other settings do not make much sense. It is not very obvious that
  that setting needs to be passed and it takes a while to figure it out.

- It produces garbage with the default setup: the default prefix of
  /usr/local ends up installing the binaries under /usr/local/usr/bin
  which does not make any sense.

Furthermore, the requirement to split binaries in /bin and /usr/bin is
not that strong since some distributions adopted the /usr merge and so
would agree to just deploy all binaries to /usr/bin directly.

Distributions that would still like to split /bin from /usr/bin should
actually move binaries such as `ps` and `kill` to /bin after the install
of procps-ng is complete. After all, they are the ones responsible for
determining what are the binaries that need to be in the root partition
and that list depends on their early boot init scripts, so it is
possible that the list must be augmented with other binaries from this
package.

Therefore, I propose here to get rid of that hack and simply install all
the binaries to bindir instead, which solves the problems described
above and simplifies the build and install of procps-ng.

Tested that it builds and both `make check` and `make distcheck` work.

Tested that `make install` works and produces the expected tree, the
only difference being the absence of the bogus /usr/local/usr/bin
directory and now all binaries are merged into /usr/local/bin as
expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: enable "subdir-objects" automake option
Filipe Brandenburger [Fri, 1 May 2015 23:48:21 +0000 (16:48 -0700)]
build-sys: enable "subdir-objects" automake option

Otherwise, automake 1.14 will warn that this option will become the
default in an upcoming release, which will cause problems for the
procps-ng build.

Now that the automake rules were merged in the top level Makefile.am,
it is possible to enable "subdir-objects" without breaking the build or
the dist.

Tested that it builds and both `make check` and `make distcheck` work.

Tested that `make install` works and produces the same tree before and
after this change. Confirmed that binaries are also placed in the same
locations in the build tree.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: merge automake subdirs into toplevel
Filipe Brandenburger [Sat, 2 May 2015 04:28:53 +0000 (21:28 -0700)]
build-sys: merge automake subdirs into toplevel

This will be required for subdir-objects, otherwise automake will have
problems with more than one Makefile.am having rules to build the same
files.

Tested that it builds and both `make check` and `make distcheck` work.

Tested `make install` and compared the tree with the one installed
before this commit, both installed the binaries to the same locations.
The binaries are also in the same location in the build tree (for
instance, ps/pscommand is still there.)

Checked the binaries for the correct libraries linked into them. Binary
sizes matched before and after this change.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: drop unneeded $(top_srcdir) from source paths
Filipe Brandenburger [Sat, 2 May 2015 04:36:40 +0000 (21:36 -0700)]
build-sys: drop unneeded $(top_srcdir) from source paths

This is cleaner and we need to match paths exactly when we enable the
subdir-objects automake option.

Out-of-tree builds still work since automake is smart to know these are
source files and that it needs to look for them in $(top_srcdir), so
there is no need to make this explicit.

Tested that it builds and both `make check` and `make distcheck` work.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: split test cases in lib/ into their own files
Filipe Brandenburger [Sat, 2 May 2015 00:43:51 +0000 (17:43 -0700)]
build-sys: split test cases in lib/ into their own files

In order to avoid compiling the same source files twice, with and
without the TEST_PROGRAM define.

Tested that the build still works and that `make distcheck` works as
expected.

Tested that the test_* programs in lib/ keep working. (Though they are
not really invoked by `make check` and in particular test_nsutils is
quite useless, test_fileutils also quite poor.)

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: remove AC_PROG_RANLIB from configure.ac
Filipe Brandenburger [Fri, 1 May 2015 23:42:33 +0000 (16:42 -0700)]
build-sys: remove AC_PROG_RANLIB from configure.ac

This suppresses the following warning from libtoolize 2.4.2:

  libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'

Tested that this does not break the build and that both `make check` and
`make distcheck` continue working as expected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agobuild-sys: add $(top_srcdir) to include search dir
Filipe Brandenburger [Sat, 2 May 2015 00:09:39 +0000 (17:09 -0700)]
build-sys: add $(top_srcdir) to include search dir

This is required for out-of-tree build to work, since many source files
include e.g. proc/*.h which is not under the include/ directory.

Tested that `make distcheck` starts working after this patch.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agotop: correct a small typo in manual page
Tobias Stoeckmann [Fri, 13 Feb 2015 18:00:00 +0000 (12:00 -0600)]
top: correct a small typo in manual page

Reference(s)
http://www.freelists.org/post/procps/PATCH-typo-in-top1

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: miscellaneous accumulated changes to program code
Jim Warner [Sun, 1 Feb 2015 06:00:00 +0000 (00:00 -0600)]
top: miscellaneous accumulated changes to program code

This commit just tweaks top in the following respects:

. for alphabetic integrity, change 'INSP_hdr...' names

. eliminate the -Wsometimes-uninitialized warning that
was found under OSX Yosemite (llvm 6.0/clang-600.0.56)

. update program 'comments' reflecting copyright dates

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agotop: miscellaneous accumulated changes to man document
Jim Warner [Sun, 1 Feb 2015 06:00:00 +0000 (00:00 -0600)]
top: miscellaneous accumulated changes to man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
9 years agofree: Use IEC units
Craig Small [Fri, 3 Apr 2015 08:18:58 +0000 (19:18 +1100)]
free: Use IEC units

Free always used 1024 based units but used the confusing old style
kilo,mega etc.

This change changes the names to kibi,mebi for 1024 based divisors
and kilo,mega for 1000 based divisors or IEC units.

It also checks if you try to set two units, e.g free -k -m
Petabyte and Pebibyte have been added.

If you used to use the long options such as --mega these will now
actually print megabytes (they previously printed mebibytes).
The short options are being used on the IEC units

References: https://www.gitorious.org/procps/procps/merge_requests/38

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopgrep: Off by one in realloc in option handling
Vadim Kaushan [Fri, 3 Apr 2015 07:17:08 +0000 (18:17 +1100)]
pgrep: Off by one in realloc in option handling

The loop that parses options has a of by one bug where the realloc
adds one byte, instead of one list element.  This is exposed when
you try things like:
  pgrep -t,,,,

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopgrep.1 removed STANDARDS section
Craig Small [Tue, 17 Mar 2015 11:43:22 +0000 (22:43 +1100)]
pgrep.1 removed STANDARDS section

pgrep got updated due to the confusion of the f,l and a flags.
While the newer behaviour is far better but it is no longer following
the ancient Solaris standards, so that got removed.

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

9 years agow: fixing missing '-' in the FROM field when empty
Jaromir Capik [Mon, 2 Mar 2015 17:41:07 +0000 (18:41 +0100)]
w: fixing missing '-' in the FROM field when empty

With 99bebff06a058f1ebf794fca1b358d0df73fdd35 a configurable
width of the FROM column was introduced. Unfortunately this
caused a regression in the dash printing. Hopefully fixed
with this commit.

9 years agowatch: treat <ESC>[m as <ESC>[0m
Jaromir Capik [Wed, 25 Feb 2015 17:40:53 +0000 (18:40 +0100)]
watch: treat <ESC>[m as <ESC>[0m

Known terminals call reset in case of empty ANSI sequence.
We should do the same, even when this is not defined by the
ANSI standard.

9 years agoUpdated translations
Craig Small [Sat, 24 Jan 2015 08:09:33 +0000 (19:09 +1100)]
Updated translations

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agopmap: print process even if smaps unreadable
Craig Small [Sat, 24 Jan 2015 07:53:29 +0000 (18:53 +1100)]
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>
9 years ago'slabtop -o' with stdin not a tty would complain
Derek Fawcus [Thu, 15 Jan 2015 13:14:53 +0000 (13:14 +0000)]
'slabtop -o' with stdin not a tty would complain

When the command is executed in one shot mode (-o) with stdin
being something other than a terminal,  the tcgetattr() call
would fail,  and generate an error message. e.g.:

slabtop: terminal setting retrieval: Inappropriate ioctl for device
 Active / Total Objects (% used)    : 905319 / 915886 (98.8%)

Signed-off-by: Craig Small <csmall@enc.com.au>
9 years agoskill: fix command line with signal
Craig Small [Sat, 24 Jan 2015 06:11:11 +0000 (17:11 +1100)]
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>
10 years agoUpdate NEWS with merge 33
Craig Small [Wed, 3 Dec 2014 11:41:17 +0000 (22:41 +1100)]
Update NEWS with merge 33

Signed-off-by: Craig Small <csmall@enc.com.au>
10 years agoMerge commit 'refs/merge-requests/33' of git://gitorious.org/procps/procps into merge...
Craig Small [Sat, 8 Nov 2014 06:03:51 +0000 (17:03 +1100)]
Merge commit 'refs/merge-requests/33' of git://gitorious.org/procps/procps into merge-requests/33

10 years agodocs: adding latest french man translations
Jaromir Capik [Thu, 30 Oct 2014 15:49:10 +0000 (16:49 +0100)]
docs: adding latest french man translations

10 years agotop: tweak forest view protections for forking anomaly
Jim Warner [Tue, 28 Oct 2014 05:00:00 +0000 (00:00 -0500)]
top: tweak forest view protections for forking anomaly

A recent commit eliminated the potential for a storage
violation with forest view mode. It occurred when some
program (erroneously?) created a lengthy forking loop.
However, the associated commit message was misleading.

The message implied that an unexpected order following
a sort on start_time was the cause of storage overruns
and a 'char' used to track nesting level only distorts
the display when it goes negative. Actually, the truth
is really just the opposite. Any start_time sort quirk
causes no harm while that 'char' can yield corruption.

Should some child end up sorted ahead of its parent by
way of an extremely unlikely shared start_time the end
result is such a child will be displayed unnested just
like init or kthreadd along with all its own children.

However, if nesting levels exceeded 255 (and became 0)
a massive array overrun could be triggered when such a
task and *all* its children were added to an array for
the second time. Exactly how much storage was violated
depended on the number of children that zeroed process
had spawned (hinted at via either SIGSEGV or SIGABRT).

The earlier commit limited nested levels to 100 so the
root cause of the storage violation was already fixed.
The potential for distorted nesting levels due to sort
on start_time would seem to remain. But it's extremely
unlikely that 2 tasks would share the same start_time.

Even so, a new #define has been introduced which makes
top impervious to the order of tasks such that a qsort
is no longer necessary (providing an init/systemd task
exists & was harvested as the first task by readproc).
It can be utilized if distorted nesting ever becomes a
real issue. But since there is a 5-10% performance hit
with that, we'll continue using start_time as default.

References(s):
commit ce70017eb1927be51f73cbe0a0b4babcc502607e

Signed-off-by: Jim Warner <james.warner@comcast.net>
10 years agotop: provide some protection against forking anomalies
Jim Warner [Thu, 23 Oct 2014 05:00:00 +0000 (00:00 -0500)]
top: provide some protection against forking anomalies

This commit will eliminate a very nasty bug associated
with top's forest view mode.  It addresses a potential
SIGSEGV/SIGABRT that was only encountered when another
program (erroneously?) creates a lengthy forking loop.

If the growing list of nested children is sufficiently
fast such that proc_t start_time is duplicated between
children then the sort upon which top relies might not
produce the expected order. That, in turn, could cause
the forest_adds function to initially miss some child.

But that missed child would be caught by forest_create
and eventually would cause our array boundary overrun.
Such overrun occurs when some child of that originally
*missed* child is found and a duplicate add attempted.

In correcting this bug we'll also use this opportunity
to prohibit a borrowed proc_t padding byte (char) from
going negative. If the nesting level exceeded 127, the
effect was an "unnesting" with the snprintf width then
viewed as flag+width also yielding left justification.

Henceforth, we'll limit nesting to 100 with subsequent
children shown as " +  ", not the usual " `- " prefix.

References(s):
https://bugzilla.redhat.com/show_bug.cgi?id=1153642
http://www.freelists.org/post/procps/Bug-in-the-forrest-view,6

Signed-off-by: Jim Warner <james.warner@comcast.net>
10 years agotop: ensure previously saved rcfile honored completely
Jim Warner [Sun, 28 Sep 2014 05:00:00 +0000 (00:00 -0500)]
top: ensure previously saved rcfile honored completely

When startup defaults were changed users with existing
rcfiles would likely find their previous configuration
was not being honored in all respects. The disparities
involved Graphs modes and Summary/Task memory scaling.

This patch simply restores what was always intended as
the proper behavior for previously saved config files.

References(s):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762928
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762947
. new startup defaults
commit 8ef6cd91fc5df6372a93bc4a37cbad34ead9654e

Signed-off-by: Jim Warner <james.warner@comcast.net>
10 years agodocs: adding latest man translations v3.3.10
Jaromir Capik [Tue, 23 Sep 2014 11:40:36 +0000 (13:40 +0200)]
docs: adding latest man translations

10 years agodocs: Fix typos in slabtop.1, sysctl.8 and uptime.1
Yuri Chornoivan [Tue, 16 Sep 2014 05:51:13 +0000 (08:51 +0300)]
docs: Fix typos in slabtop.1, sysctl.8 and uptime.1

10 years agobuild-sys: removing translated mans from Makefile.am
Jaromir Capik [Mon, 15 Sep 2014 17:55:13 +0000 (19:55 +0200)]
build-sys: removing translated mans from Makefile.am

The previous commit didn't work like expected.
It's better to call 'make translate-mans'
manually prior calling 'make dist'.

10 years agodocs: Committing new translations
Jaromir Capik [Mon, 15 Sep 2014 17:04:47 +0000 (19:04 +0200)]
docs: Committing new translations

10 years agobuild-sys: adding translated mans to dist
Jaromir Capik [Mon, 15 Sep 2014 16:57:40 +0000 (18:57 +0200)]
build-sys: adding translated mans to dist

10 years agodocs: Fix typos in sysctl.8 and sysctl.conf.5
Yuri Chornoivan [Sat, 13 Sep 2014 18:02:45 +0000 (21:02 +0300)]
docs: Fix typos in sysctl.8 and sysctl.conf.5

10 years agoconfigure.ac: re-enabling the ALL_LINGUAS related checks
Jaromir Capik [Mon, 15 Sep 2014 13:30:08 +0000 (15:30 +0200)]
configure.ac: re-enabling the ALL_LINGUAS related checks

10 years agoAdd translated mans to tarball
Craig Small [Fri, 12 Sep 2014 13:04:33 +0000 (23:04 +1000)]
Add translated mans to tarball

The source tarball now includes translated man pages and the
man-po po files.

Signed-off-by: Craig Small <csmall@enc.com.au>
10 years agowatch: typo in man (closign->closing)
Jaromir Capik [Fri, 12 Sep 2014 12:22:48 +0000 (14:22 +0200)]
watch: typo in man (closign->closing)

10 years agoMerge remote-tracking branch 'refs/remotes/origin/master'
Craig Small [Wed, 10 Sep 2014 11:21:26 +0000 (21:21 +1000)]
Merge remote-tracking branch 'refs/remotes/origin/master'

10 years agoman pot files added to dist
Craig Small [Wed, 10 Sep 2014 11:19:24 +0000 (21:19 +1000)]
man pot files added to dist

The dist tarball was missing the man-po/*.pot files. This change adds
them to the extra_dist target so they are in the distribution tarball.

10 years ago3.3.10 API
Jaromir Capik [Tue, 9 Sep 2014 16:35:44 +0000 (18:35 +0200)]
3.3.10 API

10 years agoNEWS: adding enhanced ANSI support in watch
Jaromir Capik [Tue, 9 Sep 2014 16:13:23 +0000 (18:13 +0200)]
NEWS: adding enhanced ANSI support in watch

10 years agowatch: avoid ansi manipulations in non-ansi mode
Jaromir Capik [Mon, 8 Sep 2014 16:28:08 +0000 (18:28 +0200)]
watch: avoid ansi manipulations in non-ansi mode

10 years agowatch: fixing uninitialized variable
Jaromir Capik [Mon, 8 Sep 2014 16:24:28 +0000 (18:24 +0200)]
watch: fixing uninitialized variable

10 years agowatch: fixing default color handling
Jaromir Capik [Mon, 8 Sep 2014 13:50:24 +0000 (15:50 +0200)]
watch: fixing default color handling

Previously the default background color was expected
to be always black and the default foreground color
was expected to be always white. This commit extends
the group of color pairs with pairs containing default
colors.

10 years agowatch: fixing future italic support
Jaromir Capik [Sat, 6 Sep 2014 08:54:34 +0000 (10:54 +0200)]
watch: fixing future italic support

10 years agowatch: enhancing ANSI color & style support
Jaromir Capik [Sat, 6 Sep 2014 08:46:27 +0000 (10:46 +0200)]
watch: enhancing ANSI color & style support

This commit adds support for background colors
and additional ANSI styles (faint, italic,
underlined, blinking, inversed).