Commit Graph

993 Commits

Author SHA1 Message Date
Sami Kerola
c7cf98b0e0 lib: add fileutils file with stream error checking facility
The close_stream() is copied from GNU lib. Inspiration to do this
is talk by Jim Meyering - Goodbye World! The perils of relying on
output streams in C.

Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-23 15:57:41 +01:00
Sami Kerola
1462c4e581 skill, snice: do not encourage building these utilities
Both skill and snice are are mentioned in manual page to be 'obsolete
and unportable'.  This commit discourages distributors to keep these
commands part of default system.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-16 14:34:21 +01:00
Sami Kerola
be34477bbd skill: remove dead code
Commit 991b8a94f0 took use
getopt_long(), which means the code that is related to earlier
selfmade argument parsing is unnecessary.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-16 14:34:21 +01:00
Sami Kerola
85e0a23347 watch: refactor code, add output_header() and run_command()
The main() was starting to be quite long with deep indents.  Both
signs of clean up being welcome change.

FIXME: The comment also changes -g option to exit immediately,
when screen contents change.  This should be separated commit,
e.g. the stuff is not ready to be merged.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-16 14:32:49 +01:00
Sami Kerola
dbedc905fe watch: remove arbitrary terminal size restriction
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-16 13:18:57 +01:00
Sami Kerola
94fa402d4b slabtop, vmstat, watch: remove file descriptor constants
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-16 13:18:43 +01:00
Craig Small
7267c3a22b Merge commit 'refs/merge-requests/3' of git://gitorious.org/procps/procps into merge-requests/3 2012-03-16 07:26:12 +11:00
Craig Small
98ebb386c4 Merge remote-tracking branch 'sami/2012wk9' 2012-03-16 07:21:37 +11:00
Jim Warner
fa21a6ca81 top: correct loss of keystrokes paste capability
When top introduced true line input editing, the
ability to paste keystrokes was lost.  This remains
a necessary evil so that top has an opportunity to
translate cursor motion keystrokes into terminfo
escapes during line input.  Motion keys themselves,
of course, can never be pasted.

If pasting ever became more important than input
editing, then native termios support should have been
available via a define called TERMIOS_ONLY.  But a
recent commit, eliminating what was thought to be
obsolete logic, rendered the alternate linein()
function virtually useless.

Similar to top-3.2.8, when native termios input is
functional, these abberations can be experienced:
. cursor motion keys will appear as escapes
. excessive input can cause line wraps
. ^Z during i/p is not be honored until <Enter>
. SIGWINCH during i/p corrupts screen temporarily

In hindsight, it now seems that the ability to paste
keystrokes may indeed outweigh any shortcomings of
native termios support.  This is especially true if
one is preparing to search ('L') for some lengthy
process command line contined in the clipboard.

Thus, this patch fixes the alternate linein() function
and changes TERMIOS_ONLY to TERMIO_PROXY so that top
now defaults to using native termios input.  In turn,
that will restore the paste keystrokes capability.

Reference(s):
commit: 045538e01b

Reported by: sergio <mailbox@sergio.spb.ru>
Bug-Debian:  http://bugs.debian.org/663334

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-16 07:10:53 +11:00
Jim Warner
42380330d7 misc: update remaining memory references to IEC standard
This commit brings the few remaining occurances
of kB, etc. into line with the IEC binary naming
standard.

Comments containing any such references have been
left unchanged.

Reference(s):
commit 2fc3f15770

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-16 07:06:58 +11:00
Jim Warner
397810a67f top: some isolated typos and minor code changes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-16 07:06:53 +11:00
Kent R. Spillner
ddfc402886 Don't check if output changed on first screen.
When invoked with the --chgexit/-g options wait until we have at
least one screen of output before checking if the output changed.
Otherwise, we're comparing the initial screen of output to all
spaces, which usually isn't what we want.
2012-03-11 10:14:27 -05:00
Kent R. Spillner
f5a3afdcae watch: exit cleanly when falling through main loop.
Revert commit ffe5e0b08e.  Restores
clean exit when falling through main loop.

Previously, watch only exited when there was an error or when
interrupted by the user.  Commit 81f64657ba
added another exit condition when the watched command's output
changes, causing execution to fall out of the main loop.

With this change, watch correctly restores the terminal and returns
an exit code indicating success when invoked with the --chgexit/-g
options.
2012-03-10 18:35:08 -06:00
Craig Small
29b62a1482 mentioned kB kiB change in news 2012-03-09 06:57:10 +11:00
Jim Warner
2fc3f15770 top: refer to memory using strict IEC standard names
Admittedly, top referred to memory quantities in
a variety of non-standard ways.  This commit brings
the program and supporting documentation into strict
compliance with IEC standard binary names.

According to wikipedia, as of 2012 this IEC standard
was still not in widespread use.  However, I'm making
this change now for the anal-retentive among us.

Reference:
http://en.wikipedia.org/wiki/Megabyte

Reported by: Roman Mamedov <rm@romanrm.ru>
Bug-Debian:  http://bugs.debian.org/662786

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-09 06:56:06 +11:00
Jim Warner
18c08390da sysctl: fix argument parsing regression
Any key=value pair following the first one are dropped after
commit 81df8e2630, due to changing
from the while loop to using getopt.

Broken behavior:
  sysctl net.ipv6.conf.tun0.optimistic_dad net.ipv6.conf.tun0.mc_forwarding
  net.ipv6.conf.tun0.optimistic_dad = 0

Good behavior:
  sysctl net.ipv6.conf.tun0.optimistic_dad net.ipv6.conf.tun0.mc_forwarding
  net.ipv6.conf.tun0.optimistic_dad = 0
  net.ipv6.conf.tun0.mc_forwarding = 0

Reference: http://www.freelists.org/post/procps/BUG-Commit-81df8e2-allows-only-one-keyvalue-arg
Reported-By: Sven Ulland <sveniu@opera.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-08 08:40:02 +11:00
Jim Warner
87bb21b557 top: fix selected miscellaneous compiler warnings
These per instance warnings have been eliminated:
warning: range expressions in switch statements are non-standard
warning: padding struct to align 'winflags'
warning: dereferencing type-punned pointer will break strict-aliasing rules

   These per instance warnings have not been addressed
   since they simply trade one warning for another:
      From:
warning: ISO C does not permit named variadic macros
warning: ISO C does not support the '%Lu' gnu_scanf format
      To:
warning: anonymous variadic macros were introduced in C99
warning: ISO C90 does not support the 'll' gnu_scanf length modifier

   Lastly, since all C compilers have supported use of
   C++ style comments for the past 20 years, the top
   program will never trade them for the often more
   cumbersome C style comments simply to avoid this
   once per source file warning:
warning: C++ style comments are not allowed in ISO C90

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-06 11:05:42 +11:00
Sami Kerola
d5c760ee07 pmap: use only address start to range determination
Fix to an edge case.  When user defined begining of address range to
be at between two allocations the previous allocation which ended to
that address was included to printout.  After this commit one will
see only allocations that are within range definition.

$ pmap -A00007f4e0df08000,00007f4e0df08000 895
895:   bash
00007f4e0dd08000   2048K -----  /lib/libreadline.so.6.2
00007f4e0df08000      8K r----  /lib/libreadline.so.6.2
 total             2056K

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 12:13:18 +01:00
Sami Kerola
ed57504c38 pmap: add range arguments parsing function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 12:13:18 +01:00
Sami Kerola
031afacb48 w: align header when from lenght is defined
Before this commit header and output was not in sync if
PROCPS_FROMLEN environment variable where defined.  Example of wrong
behavior is below where the last four fields which are skewed.

$ PROCPS_FROMLEN=18 w -f | cat
 12:31:34 up  1:25,  1 user,  load average: 0.03, 0.06, 0.06
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
sake     tty1     -                  11:06    1:25m  3.76s  0.00s xinit /ho[...]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 12:12:42 +01:00
Sami Kerola
c459346303 w: make date string abbreviations nls aware
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 11:56:25 +01:00
Sami Kerola
abd9e0f6e2 w: use utmp headers to determine host size as well
Completes change in commit ddd15211e0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 11:53:29 +01:00
Sami Kerola
ddd15211e0 w: use utmp definitions to determine array sizes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	w.c
2012-03-04 08:20:39 +11:00
Jaromir Capik
0f6b289212 license: update FSF addresses
The license files are synchronized with the versions from GNU web
site.

http://www.gnu.org/licenses/gpl-2.0.html
http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html

Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-04 08:04:24 +11:00
Craig Small
7e1657db48 Increase library revision number
There have been some internal changes to the library, so the revision
will be incremented for this release. There is no ABI or API changes
so its no real impact.
2012-03-03 18:47:40 +11:00
Sami Kerola
ce61089059 docs: clarification to license headers in files
Add license header to all files.  The summary of licensing is below,
taken from Craig Small's email which is referred in commit message
tail.

sysctl and pgrep are GPL 2+
The rest is LGPL 2.1+

Reference: http://www.freelists.org/post/procps/Incorrect-FSF-address-in-the-license-files,8
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=797962
CC: Craig Small <csmall@enc.com.au>
CC: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:41:11 +11:00
Sami Kerola
f5e2277a2e sysctl: print new line explicitely
In some cases sysctl does not print new line after the last line.
This commit fixes that behavior.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:40:58 +11:00
Sami Kerola
6dd921ca1c slabtop: return failure if /proc/slabinfo cannot be accessed
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
00744108c6 docs: add testsuite readme file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
56ed9826a5 test: add lib/strutils check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
abd113313d slabtop: fix clang complier warnings
slabtop.c:273:29: warning: named variadic macros are a GNU extension [-pedantic,-Wvariadic-macros]

slabtop.c:299:9: warning: unused variable 'end' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
a3544b00f8 free: remove redundant boundary check
The strtol_or_err() already check argument is not larger than
LONG_MAX. This commit also removes clang warning.

free.c:262:55: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                        if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
                                                       ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Gilles Espinasse
90c0590b4c build-sys: fix typo
Fix a typo s/unnessary/unnecessary/ in configure --help

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
2012-03-03 18:36:29 +11:00
Sami Kerola
60ea600599 ps: fix compiler warnings
common.h:23:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
global.c:499:3: warning: ISO C does not support the '%Ld' gnu_printf format [-Wformat]
output.c:134:1: warning: 'sr_cstime' defined but not used [-Wunused-function]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
bd9abebd9f pmap: fix compiler format warnings
pmap.c: In function 'discover_shm_minor':
pmap.c:87:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:87:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c: In function 'mapping_name':
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c: In function 'one_proc':
pmap.c:265:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:265:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c:315:11: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
2347521bb5 w: fix compiler warnings
w.c:409:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
w.c:325:42: warning: unused variable 'args' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:36:29 +11:00
Sami Kerola
909285ce44 watch: remove unused variables
watch.c:281:43: warning: unused variable 'option_version' [-Wunused-variable]
watch.c:281:26: warning: unused variable 'option_help' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	watch.c
2012-03-03 18:36:21 +11:00
Sami Kerola
1e489c7bc9 pwdx: fix compiler warning
pwdx.c:96:3: warning: ISO C90 forbids variable length array 'buf' [-Wvla]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:35:35 +11:00
Sami Kerola
5d04a5a75c c.h: fix macro definition warning
../include/c.h:106:18: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:107:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:108:25: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:109:26: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:32:40 +11:00
Sami Kerola
bc3710664c build-sys: require compiler running in C99 mode
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:32:29 +11:00
Sami Kerola
703e1e0486 watch: remove unused variables
watch.c:281:43: warning: unused variable 'option_version' [-Wunused-variable]
watch.c:281:26: warning: unused variable 'option_help' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	watch.c
2012-03-03 18:31:13 +11:00
Sami Kerola
2f6b9bbfb8 pgrep: fix compiler warnings
pgrep.c:539:10: warning: unused variable 'buff' [-Wunused-variable]
pgrep.c:648:1: warning: "/*" within comment [-Wcomment]
pgrep.c:803:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	pgrep.c
2012-03-03 18:29:40 +11:00
Sami Kerola
afa45f0da0 vmstat: fix compiler warnings
vmstat.c:408:10: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
vmstat.c:644:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:645:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:646:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:647:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:648:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:649:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:650:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:651:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:28:52 +11:00
Sami Kerola
b3a7665780 docs: add how to contribute to README
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:28:52 +11:00
Sami Kerola
bfbd5d9bda docs: ask gitorious merge request announces
Gitorious merge requests are too easy to miss for long time, and it
is difficult to think contributors would discuss by using web
interface.  Therefore ask contributors to announce request to pull
(merge) in mail list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:28:52 +11:00
Sami Kerola
9639a1c901 docs: change README to describe procps-ng project
Reference: http://www.freelists.org/post/procps/PATCH-Clean-README
CC: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:28:52 +11:00
Jaromir Capik
99c99baebc docs: typo in ps.1 manual [rpmlint]
Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:18:27 +11:00
Craig Small
dbc47f4496 Updated NEWS for next version 2012-03-03 15:10:48 +11:00
Craig Small
35d6960b5a Merge commit 'refs/merge-requests/1' of git://gitorious.org/procps/procps 2012-03-03 14:39:43 +11:00
Jim Warner
0053eefbb9 top: extend rcfile conversions for '--enable-oomem'
Under openSUSE, old top uses additional fields for
out-of-memory reporting.  As a result, under the
original approach to rcfile conversion, new top would
issue a fatal corrupt window entry message asking that
the rcfile be deleted.

This patch extends the conversion range to include
the extra openSUSE field characters.  It's effective
when ./configure specifies the --enable-oomem option
which in turn defines OOMEM_ENABLE.

This commit also makes the conversion logic slightly
more forgiving.  While enforcing an upper limit on the
expected number of old style field characters, amounts
less than that will be handled seemlessly.

Reference:
commit 4b98733132

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-03 14:01:35 +11:00