Commit Graph

778 Commits

Author SHA1 Message Date
Sami Kerola
9047933b2d tload: validate numeric user input
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
7f99096ded sysctl: exit with error message instead of usage()
Printing usage() output at error is too noisy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
127c82763a docs: add exit values to pmap manual page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
46d5d44734 pgrep: exit with error message instead of usage()
Printing usage() output at error is too noisy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
003d388922 docs: clean up ps.1 manual page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
0022b6ec5d nls: improve translations and provide translator help comments
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
7b6084451d other: tell what was taken from util-linux package
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
c862a4caa5 nls: add functions which take translations to be used
Add the following three functions to most of the commands.

setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);

Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
b40353c91e skill: use rpmatch() to yes/no question
The patch also removes fixed size of input, which can be problematic.
I do not know how long the string `yes' might be in all of the worlds
languages.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
72e37c7d11 vmstats: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
7af3d4efce dosc: add long options to skill.1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
526bae02bb docs: add long options to kill.1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
1ac2921f6f skill: fix compiler warnings
Pretty much all of the warnings where caused by some of the previous
patches, and they became visible with gcc when compiling with;

CFLAGS="-O -g -ggdb -Wall -Wextra -pedantic -Wstrict-overflow
	-Wformat -Wswitch-default -Wswitch-enum -Wsync-nand
	-Wredundant-decls -Wuninitialized"

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
d8d94a87ef skill: add long options to usage output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
4ea27a7716 skill: support usage output to stdout & stderr
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
89e1a83c07 skill: use symbolic exit values
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
8b8149ba60 skill: use strtosig() for -l option argument
Re-enable signal number to name string, and other way around,
conversion after it broke at the time when long options where
introduced.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
94bbf63140 libproc-ng: add strtosig() function
The function will convert a signal number string to a signal name, or
vice a verse.  Return value is string, which is an function user is
expected to free after use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
a45a1c6c88 skill: add long options
This commit broke `-l <sig>' conversion, which needs to be fixed
before kill can be claimed to work similar enough way as it did
earlier.  The fix require libprocps change, because the current
print_given_signals() simply does not work in this case.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
b4b73df69c skill: warning printout for non-existing processes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
991b8a94f0 skill: add long options & new debugging option
Done for skillsnice_parse(), meaning the kill needs functionality
will be done later.

This commit also introduces new debugging option.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
61094186fe skill: parse kill signals separately
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
723ce0dc74 skill: use strtol_or_err to nice argument parsing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
b260b11a3b lib: add strtol into utility library
The utility library is for functions which are shared in commands,
but that does not belong to libproc-ng.  The first function is a
wrapper for strtol that performs error checking, and exists if such
happen.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
130895b02e skill: remove run time configuration global variables
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
9e3203203f skill: move usage functions near each other
Done only for convenience.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
4c8446dc55 skill: clean up which functionality is being called
The skill.c is three different commands depending on how the
executable is named. This patch makes evaluation of the command name
cleaner.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
57f290dcb4 skill: reindent the file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Jim Warner
3e90357803 build-sys: use Makevars --add-comments= to limit .pot comments
By not limiting --add-comments= via an argument, xgettext is far
too aggressive (one might say stupid) when extracting comments.
It doesn't even limit extraction to a single preceeding comment.

Here is an example showing a program source excerpt and the
resulting .pot excerpt:

 --- program source ----------------------------------------
 close (0); dup (in_fd[0]);  /* set the stdin to the in pipe */
 close (1); dup (out_fd[1]); /* set the stdout to the out pipe */
 close (2); dup (out_fd[1]); /* set the stderr to the out pipe */
 execvp (args[0], args);     /* exec gdb */
 perror (_("exec failed"));

 --- resulting .pot ----------------------------------------
 #. set the stdin to the in pipe
 #. set the stdout to the out pipe
 #. set the stderr to the out pipe
 #. exec gdb
 #: ps/stacktrace.c:28 ps/stacktrace.c:63
 msgid "exec failed"
 msgstr ""
2011-12-20 17:30:52 +01:00
Jim Warner
364325362d build-sys: we don't need wide-ncurses, what were we thinking?
. 1 program uses curses (top)
. 2 programs use ncurses (slabtop, watch)
. all 3 include non-wide <curses.h> or <ncurses.h>
. those 3 do not currently need wide support
. but anticipating nls, we link against libncursesw

This patch ensures an environment consistent with current
and future ncurses needs.
2011-12-20 17:30:52 +01:00
Jim Warner
692dcb531c build-sys: added config.h include to nls.h (for PACKAGE str) 2011-12-20 17:30:52 +01:00
Jim Warner
50fca987cc build-sys: added tabs to AC_CONFIG_FILES for consistency 2011-12-20 17:30:51 +01:00
Jim Warner
326c510e70 build-sys: alphabeticized strverscmp in AC_CHECK_FUNCS 2011-12-20 17:30:51 +01:00
Jim Warner
cb10eb8e18 build-sys: added some missing files to AC_CHECK_HEADERS 2011-12-20 17:30:51 +01:00
Jim Warner
0d27054a7b slabtop: added remaining missing nls support 2011-12-20 17:30:51 +01:00
Jim Warner
7b9b0c8d18 free: added remaining missing nls support 2011-12-20 17:30:51 +01:00
Jim Warner
faed131f10 misc: trailing space/tab cleanup following rebase 2011-12-20 17:30:51 +01:00
Jim Warner
0d48df69a4 build-sys: corrected/simplified ncurses support detection 2011-12-20 17:30:51 +01:00
Jim Warner
86e938a333 pmap: correct 'rh analysis #2' patch and contrib document 2011-12-20 17:30:51 +01:00
Sami Kerola
565e4c61a8 build-sys: verify gettext is present in autogen.sh
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Sami Kerola
ab3ff3cdab build-sys: add missing files to distribution
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Sami Kerola
305b36e5b1 build-sys: remove non-existing files from Makefile.am
The f23390043bece9f2d4870e5b3a187896e2c7d23f removed few files,
which still exist in Makefile.am making `make dist' to fail. This
patch fixes the isue.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Sami Kerola
4d12ff393f docs: add rh analysis #2 information to contrib
Reference information.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Jim Warner
1a993ca8eb build-sys: enable xgettext TRANSLATORS comments
This commit will enable pass comments to translators near gettext
directive to .pot file. For example;

/* TRANSLATORS: this is visible in .pot file */
printf(_("to be translated"));

Signed-off-by: Jim Warner <james.warner@comcast.net>
2011-12-20 17:30:51 +01:00
Sami Kerola
8795154eac sysctl: warn when separators are repeated
For some reason sysctl earlier allowed quite strange separators.

% sysctl kernel./.pty.nr
kernel./.pty.nr = 6
% sysctl kernel///pty//////////nr
kernel...pty..........nr = 6

This commit does not disallow that sort of constructs, but will warn
about them. In future disallowing these might be reasonable thing to
do.

% sysctl kernel./.pty.nr
sysctl: separators should not be repeated: ./.pty.nr
kernel./.pty.nr = 6

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Sami Kerola
9f89e336c3 sysctl: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
f70cdd0666 vmstat: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
4bfc4a00fb pgrep: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
9057b18a32 libproc-ng & ps: fix warning reported by smatch
proc/ksym.c +279 read_file(54) info: redundant null check on buf calling free()
proc/ksym.c +330 parse_ksyms(41) info: redundant null check on ksyms_data calling free()
proc/ksym.c +332 parse_ksyms(43) info: redundant null check on ksyms_index calling free()
proc/ksym.c +451 sysmap_mmap(110) info: redundant null check on sysmap_index calling free()
proc/procps.h:74:5: warning: undefined preprocessor identifier 'SHARED'
proc/slab.c +145 parse_slabinfo20(24) error: potential null derefence 'prev'.
proc/slab.c +222 parse_slabinfo11(21) error: potential null derefence 'prev'.
ps/stacktrace.c +131 debug(6) error: snprintf() is printing too much 99 vs 16

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
c1fa3bfce8 misc: compiler warning fixes
Fix few compiler warnings. Some of these warnings appeared multiple
times, and the listing bellow is more about which sort of errors
where fixed.

devname.c:87:12: warning: comparison of integers of different signs: 'int' and 'unsigned long'
output.c:389:36: warning: passing 'char **const' to parameter of type 'const char *const restrict *' discards qualifiers in nested pointer types
output.c:611:31: warning: comparison of integers of different signs: 'const unsigned long' and 'int'
stacktrace.c:33:37: warning: unused parameter 'signum'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00