Craig Small [Thu, 22 Dec 2011 22:18:43 +0000 (09:18 +1100)]
Renaming libprocfs to libprocps
The library used to be called libprocps but it was renamed to make sure
there was only one. However the formatting of the library SONAME has
changed so there cannot be any confusion.
libprocps makes it clear that its a library from this project and not a
set of functions directly on the filesystem.
Craig Small [Thu, 22 Dec 2011 13:44:23 +0000 (00:44 +1100)]
Fixed pmap -x Kbytes column
The Kbytes column when using the pmap -x flag would always be zero. This
was because the diff variable was reset before it could be printed.
pmap with no -x was not impacted by this bug or fix.
Jim Warner [Tue, 20 Dec 2011 21:17:26 +0000 (15:17 -0600)]
top: final cleanup following nls conflict resolutions
This patch represents the final resting place for miscellaneous
changes not otherwise encountered or for which the resolution
was incomplete or incorrect.
Jim Warner [Wed, 7 Dec 2011 10:41:14 +0000 (04:41 -0600)]
top: streamlined creation of nls string tables
The gettext documentation leads one to believe that
a printf type call is necessary for gettext string
extraction. That turns out to be misleading and
all one really needs is the runtime gettext string
address resolution.
Thus, we can avoid our original snprintf/strdup
overhead and establish an address for the original
or translated string just by issuing the _() macro.
We create these nls string tables so that:
1) top avoids the overhead of repeated
runtime function calls
2) we can control the order of top's
strings in the .pot file
3) translator comments don't obscure
and clutter the main program
Until this patch, top had used some strings with
special escape sequences to produce colors, normal
text, bold text, etc. They took the following form,
explained by an excerpt from program comments:
...
Our special formatting consists of:
"some text <_delimiter_> some more text <_delimiter_>...\n"
Where <_delimiter_> is a single byte in the range of:
\001 through \010 (in decimalizee, 1 - 8)
and is used to select an 'attribute' from a capabilities table
which is then applied to the *preceding* substring.
...
Unfortunately, these nonprinting values revealed
insurmountable inconsistencies in both the front-end
and back-end translation tools.
The xgettext (extraction) program would take those
special escapes, convert them and then output raw
binary values. Thus the .pot file would contain
lots of unprintable stuff making it unreadable.
If the following was added to po/Makevars, most of
those special escapes would be preserved in their
escape notation:
XGETTEXT_OPTIONS = ... --escape
But two escapes were converted from octal notation
and there was no way to prevent it:
\007 --> \a
\010 --> \b
After a pass through the msginit program, most of
the escapes were reconverted to raw binary values
making translation impossible. There was no
"--escape" option for the back-end programs like
there was for xgettext.
But the real killer was the escape \004, also used
in some of top's special strings. This value would
be silently accepted by xgettext, only to produce
the following fatal error in back-end programs like
msginit, msgfmt and msgen:
.pot:2647: context separator <EOT> within string
To quote from one of the references below:
"Would you create a suite of tools that silently
allow what is destined to become a fatal error
to pass unnoticed?"
So the bottom line was: top's special strings, in
use for the past nine years, had to be redesigned.
Jim Warner [Fri, 14 Oct 2011 16:45:44 +0000 (11:45 -0500)]
top: finalized top nls support (or so he thought)
summary of changes:
. adopted relative paths to 'include' and 'proc'
dirs so that stand alone compiles are made
easier and no one need guess their locations
. corrected several names for enums and macro
usage reflecting fmt vs. txt
. expanded all octal escape sequences to a full
3 digits since one already required 3 digits
. finalized translator hints (for now)
programming note:
as an aside, by not including an argument for
the gettext --add-comments, any preceeding c
style comment will be propagated to the .pot
file, if the gettext macro isn't empty.
/* Need Not Say 'TRANSLATORS' ...
snprintf(buf, sizeof(buf), "%s", _( // unseen
/* Translator Hint: ...
snprintf(buf, sizeof(buf), "%s", _("" // seen
Jim Warner [Tue, 20 Dec 2011 14:23:37 +0000 (08:23 -0600)]
top: with lib xalloc changes, restored prior memory logic
With the privatization of the library xalloc functions,
this patch restores top's previous internal memory logic.
This puts us back on a 3.3.1 (and earlier) footing wherein
memory allocation errors carry these implications:
. if top detected, the terminal will be restored
prior to an abnormal exit and message
. if library detected, the terminal will become
corrupted following the message
To my knowledge, neither type of memory error has ever occurred
during the nine years since top was rewritten. So the issue of
restoring the termios structure is probably moot.
Sami Kerola [Sun, 18 Dec 2011 13:55:30 +0000 (14:55 +0100)]
vmstat: validate numeric user input and allow infinte updates
The vmstat used ULONG_MAX as definition of infinite updates. On a
computer with mighty uptime one will find that after 136 years
(assuming 1 second update interval) the vmstat exits, which is in
conflict with a promise of infinite.
Sami Kerola [Sat, 17 Dec 2011 17:32:47 +0000 (18:32 +0100)]
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>
Sami Kerola [Wed, 7 Dec 2011 12:43:34 +0000 (13:43 +0100)]
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>
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>
Sami Kerola [Sat, 22 Oct 2011 16:05:42 +0000 (18:05 +0200)]
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.
Sami Kerola [Sat, 22 Oct 2011 10:20:35 +0000 (12:20 +0200)]
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.
Sami Kerola [Tue, 18 Oct 2011 18:54:30 +0000 (20:54 +0200)]
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.
Jim Warner [Sun, 6 Nov 2011 23:08:02 +0000 (17:08 -0600)]
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 ""
Jim Warner [Fri, 28 Oct 2011 13:37:30 +0000 (08:37 -0500)]
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.
Sami Kerola [Sun, 9 Oct 2011 20:45:59 +0000 (22:45 +0200)]
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'