procps/proc
Jim Warner 649e45482f library: refactor 'escape' logic for newlib (2nd time)
Much of what was represented in the commit message for
the reference shown below was revisited in this patch.
It also means that the assertion in the last paragraph
of that message will only now be true with LANG unset.

[ and forget all the bullshit about not altering any ]
[ kernel supplied data. sometimes we must to avoid a ]
[ corrupt display due to a string we can not decode. ]

And while this commit still avoids the overhead of the
'mbrtowc', 'wcwidth' 'isprint, & 'iswprint' functions,
we achieve all the benefits with simple table lookups.
Plus such benefits are extended to additional strings.

For example, both PIDS_EXE and PIDS_CMD fields are now
also subject to being 'escaped'. If a program name did
contain multibyte characters, potential truncation may
corrupt it when it's squeezed into a 15/63 byte array.

Now, all future users of this new library only need to
deal with the disparities between string and printable
lengths. Such strings themselves are always printable.

[ the ps program now contains some unnecessary costs ]
[ with the duplicated former 'escape' functions. But ]
[ we retain that copied escape.c code for posterity. ]
[ besides, in a one-shot guy it's of little concern. ]

Note: Proper display of some multibyte strings was not
possible at the linux console. It would seem a concept
of zero length chars (like a 'combining acute accent')
is not recognized. Thus the display becomes corrupted.
But if utf8 decoding is disabled (via LANG=), then all
callers will now see '?', restoring correct alignment.

Reference(s):
. Dec 2020, newlib 'escape' logic refactored
commit a221b9084a

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-01-02 15:42:10 +11:00
..
.gitignore build-sys: added a 'test_Itemtables' to testing scheme 2020-08-17 21:49:14 +10:00
COPYING miscellaneous: clean up trailing whitespace once again 2013-04-07 18:05:01 +10:00
devname.c 0040-proc/devname.c: Never write more than "chop" (part 2). 2018-06-09 21:35:19 +10:00
devname.h library: eliminate inappropriate '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
diskstats.c library: eliminate one potential source of human error 2020-08-26 21:50:20 +10:00
diskstats.h library: ensure 'XTRA_PROCPS_DEBUG' works in real life 2020-07-29 19:01:50 +10:00
escape.c library: refactor 'escape' logic for newlib (2nd time) 2021-01-02 15:42:10 +11:00
escape.h library: refactor 'escape' logic for newlib essentials 2020-12-29 08:48:23 +11:00
libprocps.pc.in Renaming libprocfs to libprocps 2011-12-23 09:18:43 +11:00
libprocps.sym library: make that 'escape_str' private to our library 2020-07-05 21:13:01 +10:00
meminfo.c library: eliminate one potential source of human error 2020-08-26 21:50:20 +10:00
meminfo.h library: <meminfo> api, update for current linux state 2020-08-09 22:19:46 +10:00
namespace.c library: ensure 'namespace' types treated consistently 2017-01-04 08:29:44 +11:00
namespace.h library: replace the troublesome '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
numa.c library: set stage for NUMA node field display support 2017-05-22 21:38:10 +10:00
numa.h library: eliminate inappropriate '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
pids.c library: extend ITEMTABLE_DEBUG just a tad, <PIDS> api 2020-12-29 08:48:23 +11:00
pids.h library: ensure 'XTRA_PROCPS_DEBUG' works in real life 2020-07-29 19:01:50 +10:00
procps-private.h library: eliminate unused 'FUNCTION' in private header 2020-09-13 10:00:49 +10:00
pwcache.c library: eliminate all dependencies on alloc.h/alloc.c 2017-12-20 21:18:53 +11:00
pwcache.h library: eliminate inappropriate '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
readproc.c library: refactor 'escape' logic for newlib (2nd time) 2021-01-02 15:42:10 +11:00
readproc.h library: refactor 'escape' logic for newlib essentials 2020-12-29 08:48:23 +11:00
slabinfo.c library: eliminate one potential source of human error 2020-08-26 21:50:20 +10:00
slabinfo.h library: ensure 'XTRA_PROCPS_DEBUG' works in real life 2020-07-29 19:01:50 +10:00
stat.c library: tweak those system cpu statistics, <stat> api 2020-09-13 10:00:49 +10:00
stat.h library: tweak those system cpu statistics, <stat> api 2020-09-13 10:00:49 +10:00
sysinfo.c library: eliminate all dependencies on alloc.h/alloc.c 2017-12-20 21:18:53 +11:00
sysinfo.h library: replace the troublesome '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
test_Itemtables.c build-sys: proper fix for the 'test_Itemtables' module 2020-08-18 10:19:53 +10:00
test_namespace.c library: eliminated the questionable 'procps.h' header 2020-07-05 21:13:01 +10:00
test_pids.c testsuite: Correct include 2020-07-05 21:18:36 +10:00
test_sysinfo.c tests: update template and add pids 2016-04-19 21:33:02 +10:00
test_uptime.c library: eliminated the questionable 'procps.h' header 2020-07-05 21:13:01 +10:00
test_version.c library: Fix LINUX_VERSION macro 2016-05-01 17:46:25 +10:00
uptime.c 0047-proc/whattime.c: Always initialize buf. 2018-06-09 21:35:19 +10:00
uptime.h library: replace the troublesome '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
version.c miscellaneous: remove some trailing whitespace buildup 2015-06-20 07:46:23 +10:00
version.h library: replace the troublesome '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
vmstat.c library: eliminate one potential source of human error 2020-08-26 21:50:20 +10:00
vmstat.h library: <vmstat> api, updated for current linux state 2020-08-09 22:19:46 +10:00
wchan.c library: don't strip off prefixes from the wchan names 2016-12-07 22:07:00 +11:00
wchan.h library: eliminate inappropriate '__BEGIN_DECLS' macro 2018-05-06 07:19:38 +10:00
xtra-procps-debug.h library: ensure 'XTRA_PROCPS_DEBUG' works in real life 2020-07-29 19:01:50 +10:00