Commit Graph

1483 Commits

Author SHA1 Message Date
Jaromir Capik
5d818a7a6d library: fixing stdio.h include position in nsutils.c
The previous commit removes the stdio_ext.h header,
but the ns_read function calls snprintf that needs
stdio.h and therefore moving the stdio.h include
from the bottom test program to the top line.
2014-08-26 15:24:55 +02:00
Fredrik Fornwall
41f7ff3ea8 library: remove unused includes in nsutils.c
The <stdio_ext.h> include breaks building on platforms without that header and is unused in nsutils.c.

Also remove unused but harmless <error.h> include.
2014-08-26 15:24:34 +02:00
Jaromir Capik
29b27fb282 watch: fixing uninitialized endptr in the previous commit
And increasing the ANSI buffer size from 10 to 100.
2014-08-20 19:14:13 +02:00
Sean Silva
469cac00ff watch: Fix handling of ANSI color escapes for -c
The previous code assumed that there would be 1 or 2 attributes to
apply. In fact, there can in general be any number (but typically
between 1 and 3). This commit generalizes the existing code to read
arbitrarily many attributes from the escape sequence.
2014-08-20 19:13:20 +02:00
Jaromir Capik
c9908b5971 free: fixing the layout broken with the -w introduction
For some reason I thought the columns are left justified
and consequently modified the header incorrectly when
implementing the -w/--wide feature.
With this commit the column width was increased by 1
so that the default layout is 79 characters wide
and allows to display 11 digits per column.
2014-08-20 13:21:22 +02:00
Beni Cherniavsky-Paskin
b4951bfea3 Add -a/--list-full to --help output. 2014-08-19 21:05:30 +02:00
Adam Sampson
1d212457f2 pmap: avoid depending on an uninitialised value.
It's possible for the first entry that this reads from /proc/*/smaps to
start with a map_desc-less line like this:

7fa71b77d000-7fa71c288000 rw-p 00000000 00:00 0

in which case sscanf will only read up to inode, and it won't set c; the
code below would then incorrectly discard the next ("Size:") line.

(With GCC 4.9.0, this bug causes the "pmap extra extended output" test
to fail for me.)
2014-08-19 18:59:28 +02:00
Craig Small
12f13f9fc2 Update free testsuite
free got a makeover to suit the newer kernel memory management.
This commit updates the tests to follow the new output for free

Signed-off-by: Craig Small <csmall@enc.com.au>
2014-08-19 22:43:33 +10:00
Jim Warner
8adf4acc03 top: final tweak to recent changes for new graph modes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-08-11 16:39:51 +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
e92b692932 top: swat a potential buglet affecting new graph modes
This patch will cure a potential aberration associated
with a terminal's size (SIGWINCH) and top's new graphs
modes. The symptoms were a dangling tilde (~) plus the
potential loss of a graph's right-most visual content.

The condition was only apparent when a %Cpu approached
100% usage. Also the apparent loss of content affected
the 'block' graph only. With 'bar' graphs, that affect
became the loss of proper right-most bar graph colors.

The cause was determined to be a combination of: 1) an
unnecessary snprintf precision specification; and 2) a
rounding quirk for any graphs which displayed distinct
types of information (as for user/syst, used/unavail).
These could then combine to produce an extra bar/block
which, in turn, resulted in the truncation of a pseudo
termcap attribute used by the show_special() function.

What was originally interpreted as an intractable race
condition turns out to be just a self inflicted wound.

Reference(s):
http://www.freelists.org/post/procps/top-Possible-bug-in-the-graphs,1

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
Fredrik Fornwall
dfe1f7d104 top: replace <values.h> with <limits.h> plus <float.h>
This fixes a compilation problem on Android which lacks values.h.

Reference(s):
https://gitorious.org/procps/procps/merge_requests/26

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-08-08 22:14:21 +02:00
Jaromir Capik
2538b5ac03 library: increasing meminfo()/namebuf size from 16 to 32 2014-08-05 19:15:03 +02:00
Jaromir Capik
51cd57259a docs: free.1 now follows the latest used/cache changes 2014-07-31 16:46:54 +02:00
Jaromir Capik
f47001c9e9 free: remove -/+ buffers/cache
With introduction of the 'available' column
and with the latest changes in the 'used' evaluation
the -/+ buffers/cache line became redundant.
The first value duplicates the 'used'
column and the second value has a more accurate
brother called 'available'.
2014-07-31 15:10:42 +02:00
Jaromir Capik
5a0b972ca0 free: replace -a/--available with -w/--wide
This renames the --available switch
to the --wide switch and changes the default
layout so that it includes the 'available'
column and joins buffers and cache into
a common column called 'buff/cache'.
2014-07-31 15:10:42 +02:00
Jim Warner
5380ef9022 top: adapt global memory support to new library format
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-31 15:10:42 +02:00
Jaromir Capik
6cb75efef8 library: cached += slabs, used -= cached + buffers
From now we include slabs in cached
and exclude buffers and cached from used.
2014-07-31 15:10:42 +02:00
Jaromir Capik
3f3b1a59ad library: MemAvailable fallback now uses /proc/meminfo
Taking the values from /proc/vmstat was unnecessary
and prone to race conditions.
2014-07-31 15:10:42 +02:00
Jaromir Capik
784c6eda1c library: use LINUX_VERSION macro in the MemAvailable fallback 2014-07-22 18:18:51 +02:00
Jaromir Capik
cbba7ad7a7 top: exclude reclaimable slabs from used 2014-07-22 14:07:45 +02:00
Jaromir Capik
cdc95efe74 library: fix kb_slab_*reclaimable names and export both 2014-07-22 13:52:11 +02:00
Jim Warner
c437faf8d3 library: evolve MenAvailable algorithm on older kernel
Let's not report zero for kb_main_available when older
kernels don't have MemAvailable. Instead, if we simply
duplicate the 'free' amount we can avoid all ancillary
problems, such as those involving top's graphing mode.

Reference(s):
http://www.freelists.org/post/procps/kb-main-available-etc,3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-21 16:17:52 +02:00
Jim Warner
7391699b07 top: correct one grammatical error in the man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-18 20:49:58 +02:00
Jim Warner
d310a18fc2 top: exploit new kb_main_available, make Jaromir happy
This patch will trade a former pessimistic calculation
of free physical memory for a more optimistic one that
uses the newly added kb_main_available library export.

But in case one might wish to return to the old former
method, there's a new #define that was made available.

[ the new calculation will affect graphing mode only ]

Reference(s):
http://www.freelists.org/post/procps/systemd-support-to-library,9

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-18 20:49:57 +02:00
Jim Warner
9500dc198c top: trade Page_size for that newly exposed page_bytes
Might as well use the newly exposed sysinfo.h variable
'page_bytes' rather than our own. Plus, in the process
we can avoid incurring yet one more function call hit.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-18 20:49:57 +02:00
Jim Warner
e4f0b4ebf3 library: tweak newly added MemAvailable fall-back code
This commit just ensures recalculation of some amounts
for iterative processes, like top. It also trades some
repeated runtime calls to sysconf for a one time cost.

Reference(s):
http://www.freelists.org/post/procps/systemd-support-to-library,7
. fall-back calculations
commit b779855cf1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-18 20:49:57 +02:00
Jim Warner
6c148b4f8b docs: with systemd now in library, remember openproc.3
[ plus remove just a little darn trailing whitespace ]

Reference(s):
. systemd migrated to library
commit 9d8ad6419f
. added library documentation
commit a74fb8fade

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-18 20:49:57 +02:00
Jaromir Capik
2577da66b1 docs: Add the 'MemAvailable' availability in free.1 2014-07-17 17:02:27 +02:00
Jim Warner
1da2c98937 library: disable a potential 'ELF note' is missing msg
The stderr message regarding ELF notes appears on some
systems (openSUSE-13.1 for example) but I have not yet
isolated why. Since at startup we go on to determine a
Hertz value the old fashion way, this patch just turns
off the useless message until the cause is understood.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-17 13:31:06 +02:00
Jim Warner
93d37cf57a ps: exploit library systemd support vs. internal logic
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-17 13:31:06 +02:00
Jim Warner
9d8ad6419f library: generalize then add former 'ps' systemd logic
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-17 13:31:06 +02:00
Jim Warner
d187304854 ps: clarify which options depend on systemd in man doc
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-17 13:31:06 +02:00
Jaromir Capik
6dbe8fd18e docs: top.1 minor fix
RES - memory task has used -> is using
2014-07-17 13:08:29 +02:00
Jaromir Capik
f8128568d6 sysctl: support expansion of csh style braces with -p
This commit adds the GLOB_BRACE flag in the glob flags.
That allows to expand the csh style braces {a,b} and
define multiple independent patterns for config file
locations.
2014-07-16 14:29:42 +02:00
Jaromir Capik
b779855cf1 library: fallback MemAvailable evaluation if missing
This commit adds support for fallback calculation
of the MemAvailable field if not exported by the
kernel. The MemAvailable field appeared in kernel
3.14, but it's possible to calculate it from other
fields since 2.6.27 (splitLRU changes).
2014-07-15 19:17:02 +02:00
Jaromir Capik
d75d8addc6 library: additional comments to the buffer size increase 2014-07-14 19:44:14 +02:00
Jaromir Capik
b2ad21990a library: fixing buffer sizes in sysinfo.c 2014-07-14 19:07:25 +02:00
Jaromir Capik
d4ddc96bc1 library: changing P_G_SZ from 20 to 33
Nowadays the usernames can be 32 characters long
(typically OpenShift usernames use the whole length)
and the old limit was preventing us from processing
them correctly.
The macro change affects the proc_t structure size.
2014-07-14 16:21:52 +02:00
Jaromir Capik
0393047a4f library: removing note about PROC_{PID,UID} being obsolete 2014-07-14 16:12:53 +02:00
Jaromir Capik
a74fb8fade docs: adding openproc(), readproc() and readproctab() man 2014-07-14 16:07:23 +02:00
Jaromir Capik
ba6396f886 free: support for MemAvailable
This commit adds a new switch -a/--available that
appends a new column called 'available' to the
output. The column displays an estimation
of how much memory is available for starting
new applications, without swapping. Unlike the data
provided by the 'cached' or 'free' fields, this
field takes into account page cache and also that
not all reclaimable memory slabs will be reclaimed
due to items being in use.
2014-07-11 22:34:06 +02:00
Jaromir Capik
e751606fcc ps: add -q/q/--quick-pid option
This commit introduces a new option q/-q/--quick-pid
to the 'ps' command. The option does a similar job
to the p/-p/--pid option (i.e. selection of PIDs
listed in the comma separated list that follows
the option), but the new option is optimized
for speed.
In cases where users only need to specify a list
of PIDs to be shown and don't need other selection
options, forest type output and sorting options,
the new option is recommended as it decreases
the initial processing delay by avoiding reading
the necessary information from all the processes
running on the system and by simplifying
the internal filtering logic.
2014-07-10 21:24:19 +02:00
Jim Warner
6cd8691720 top: fix potential 'nan', should a system have no Swap
Gosh, just because most of us might run with some swap
file allocated, not every system might. I only wish my
testing methodology was as sophisticated as Jaromir's.

Reference(s):
http://www.freelists.org/post/procps/latest-top-enhancements,7

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jim Warner
1dd0c4d07f top: as with ps, distinguish between 'T' and 't' state
Wow, even the linux/Documentation/filesystems/proc.txt
document doesn't provide us with that level of detail.

Thank you, Jaromir, for your additional clarification!

Reference(s):
commit 411d218793

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jim Warner
a7741055f1 top: add another translation hint for graphs alignment
This should be the last of this kind of crap. I'll get
to work on some means to no longer burden a translator
with lengths requirements. Ideally each word should be
allowed to stand alone and the minimum/maximum lengths
handled programmatically when our ol' top is executed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jim Warner
206570e8c4 top: with new startup defaults, tweak the man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jim Warner
c75586f523 top: eliminated unreferenced macros & an error message
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jaromir Capik
4ba9ff5c0d pgrep: Fixing regression in exitcodes
The pgrep usage() rework commit from 26-Sep-2011 introduced
a regression in exitcodes and the pgrep tool now returns
EXIT_FAILURE (1) or even EXIT_SUCCESS (0) instead
of the documented EXIT_USAGE (2). This commit fixes
the usage() so that the exitcodes match the manual.
2014-07-02 17:42:08 +02:00