Add -p|--pretty option to uptime(1) for pretty output.

This patch adds the -p option to the uptime(1) command, which changes
the uptime displayed from something like:

 10:35:52 up  2:33,  1 user,  load average: 1.69, 1.65, 1.63

to:

 up 2 hours, 33 minutes

I originally implemented this as the up(1) program about 14 years ago.
In 2008 or 2009, I created a patch for procps to add this functionality
to uptime and submitted it to the project.  Never heard from the
project and no new releases of procps had been made.  Then I found out
about this project and decided to port my patch to it.  So here it is.

This is really just for fun.  There is no real technical reason to
have this functionality.  But even now, 14 years later, I still get
emails asking where the source code for up is.  So I thought it would
be nice for the uptime command on Linux to sport the up functionality
by default.
procps: add support for linux namespaces

Each process in Linux has a /proc/<pid>/ns directory which contains
symbolic links to pipes that identify which namespaces that process
belongs to. This patch adds support for ps to display that information
optionally.

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
pgrep: introduce support for namespaces

A PID should be specified with --ns:
	$ pgrep --ns 12345
which will only match the processes which belong to to the same 6
namespaces. It is also possible to specify which namespaces to test:
	$ pgrep --ns 12345 --nslist mnt,net,ipc
which will match processes that belong to the same mount, network and
IPC namespaces as PID 12345.

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
skill: support namespaces

In the same fashion of pgrep, introduce two new options:
	--ns <pid>
	- nslist <ns,...>
which allows processes to be filtered by namespace.

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
Fix off-by-one in pmap

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.
Fix overflow of "running" value in  getstat()

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
build-sys: cleanup AC_ARG_ENABLE() usage

 * 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>
build-sys: correct one AC_ARG_ENABLE() cleanup default

Signed-off-by: Jim Warner <james.warner@comcast.net>
build-sys: add support for silent buils

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>
Merge branch 'master' of git://gitorious.org/procps/procps
Increase watch interval.

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>
top: hint that Summary Area 'cached' is Mem (not Swap)

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>
top: modest efficiency change to message line handling

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 46a1356219cfab67240704af9cd73b58a20d4232
. 'screen' window manager refactor
commit 0fe393ff270922cd4f6edbcaabba006314e73a37

Signed-off-by: Jim Warner <james.warner@comcast.net>
top: correct, improve and otherwise tweak configs_read

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>
top: swat bug affecting batch mode and width provision

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>
free: clarification of credits for the Shmem support

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.
free: reusing 'shared' for Shmem

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.
Merge commit 'refs/merge-requests/2' of git://gitorious.org/procps/procps into merge-requests/2

Conflicts:
	uptime.c
Merge commit 'refs/merge-requests/13' of git://gitorious.org/procps/procps into merge-requests/13

Conflicts:
	pgrep.c
	ps/output.c
	ps/ps.1
Fix off-by-one by pmap

Merge request 15