Commit Graph

2873 Commits

Author SHA1 Message Date
Jim Warner
fc3ba30af6 top: modify 'focus' strv function to display 'n/a' too
This commit just brings that 'bot_focus_strv' function
up to the same standard as the vanilla 'bot_focus_str'
guy. Namely, if there is no cmdline or environ for any
process, that bottom window will now display an 'n/a'.

[ with the nature of those string vectors, it wasn't ]
[ the same simple process found for regular strings. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-18 21:30:56 +10:00
Jim Warner
434e224230 top: extend 'focus' navigation to shift+tab (back_tab)
Some of those bottom windows grow quite large, as with
the firefox environment. If one is navigating the data
using the tab key, it can be very inconvenient when an
element should be reexamined but that focus has moved.

Therefore, this commit will support the 'back_tab' key
which is a standard combination of the shift+tab keys.

Now a user can easily backup up to any missed element,
assuming a terminal emulator honors that terminfo key.

[ a gui emulator typically will honor the 'back_tab' ]
[ terminfo string, whereas a linux console does not. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-18 21:30:56 +10:00
Jim Warner
c00d09edf1 top: be more careful with memcpy length specifications
Using 'mempcpy' was a mistake where plain old 'memcpy'
was appropriate. More importantly, the careless length
specified resulted in a SEGV under some circumstances.

[ namely, it occurred under a multi-threaded top and ]
[ the top program itself as focus + CtrlN 'environ'. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-18 21:30:56 +10:00
Jim Warner
73b4f1134f top: modify 'Ctrl' bottom window 'str' use with 'strv'
After satisfying increased buffer size in the previous
patch, I decided to improve the highlight accuracy for
both the command lines plus the environment variables.

Since they both may contain elements which themselves
include embedded spaces, to accomplish this goal, one
must trade vanilla strings for string vectors instead.

[ at last such library items have now been justified ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:06:18 +10:00
Jim Warner
da36ff2b8d top: needed 'Ctrl' bottom window fixes were discovered
As it turns out, some of the 'environ' strings are big
enough to overrun the initial buffer sizes. And, while
no real harm was done (other than to silently truncate
the output), this patch will increase the buffer size.

While we're at it. we will normalize a few more buffer
declarations along with correcting a couple typos too.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:06:18 +10:00
Jim Warner
b8f79a7bb8 doc: man page adjusted for response to keyboard inputs
[ and along the way, those 2 newest namespace fields ]
[ are now mentioned under that same 'X' command part ]
[ this commit already changed for improved response. ]

[ they should have been included in the patch below. ]

Reference(s):
commit 6e78355d4d

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Jim Warner
3ea1bc779f top: program is now more responsive to keyboard inputs
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Jim Warner
381af1af81 doc: detail 'Ctrl' bottom window namespaces plus focus
[ along the way we will restore '^R' to keys summary ]
[ plus correct a leftover reference to 'Ctrl-V' too. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Jim Warner
659590b068 top: extend 'Ctrl' bottom window for 'memu' selections
This commit adds a prototype for a potential extension
of that tabbed bottom window capability. It introduces
a 'menu' which then provides for users' selections. It
does not actually do anything meaningful and will only
be enabled with the new #define called 'BOT_PICK_YES'.

[ since it's just a proof of concept, no attempt has ]
[ been made to add the usual NLS translation support ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Jim Warner
de22afc4c2 top: extend 'Ctrl' bottom window for focus via tab key
This commit introduces the 'tab' key which can be used
to highlight individual elements in that bottom 'Ctrl'
window. This can really help when reviewing such data.

[ note, normal ongoing monitoring continues unabated ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Jim Warner
c46a60d9c4 top: expand 'Ctrl' bottom window to display other data
This commit adds support for displaying the namespaces
in top's separate bottom 'Ctrl' window. Along the way,
the plumbing is now in place to extend this capability
to other data (if we don't run out of '^' keystrokes).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Jim Warner
ad17ffe60d top: rename 'Ctrl' bottom window routines and relocate
This patch will just set the stage for the next commit
where we'll be adding the capability to display things
that sometimes may necessitate multiple library items.

In that effort we will be adding several new routines.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-16 20:05:59 +10:00
Craig Small
19c65159a9 ps: Document -P option
The -P option for ps has been in there for decades but neither the
man page nor the help option explained what it did.

Amazing what crops up even now!

References:
 https://unix.stackexchange.com/questions/701422/what-does-p-mean-in-the-context-of-the-ps-command
2022-05-11 17:34:12 +10:00
Jim Warner
6e78355d4d doc: bring the namespaces up to date with linux kernel
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-09 18:44:21 +10:00
Jim Warner
644a6e055c ps: make those namespaces up to date with linux kernel
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-09 18:44:21 +10:00
Jim Warner
371e9138ba top: bring the namespaces up to date with linux kernel
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-09 18:44:21 +10:00
Jim Warner
d1ae5276e9 library: bring namespaces up to date with linux kernel
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-09 18:44:21 +10:00
Jim Warner
3f068a66c8 top: turn off the 'Ctrl' bottom window with 1 more key
In that commit shown below, the concept of a corrupted
display was introduced so that 'Ctrl' windows could be
redrawn now that they were made more persistent. Well,
it turns out there is another case where redrawing was
necessary. That is when transitioning between task and
thread modes. So this patch addresses those occasions.

Reference(s):
. May, 2022 - introduced Frames_signal BREAK_screen
commit d66c1f39b5

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-09 18:44:21 +10:00
Jim Warner
793f3e85ae top: fix a bug from when 'Ctrl' window was made sticky
In the patch referenced below the bottom 'Ctrl' window
was made to remain until it was dismissed by the user.

As such, it required abandoning a 'Cap_nl_clreos' used
when all the terminal rows had not been drawn. Instead
each line had to be cleared individually until the row
reserved for that 'Ctrl' window area had been reached.

Unfortunately, while a 'Cap_nl_clreos' didn't create a
problem for 'batch' mode, a 'Cap_clr_eol' used instead
yielded an unending loop if those rows were limitless.

So, now we will only clear that area when top isn't in
'batch' mode (which should have always been the case).

Reference(s):
. May, 2022 - bottom window made sticky
commit 0f2a755b0b

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-09 18:44:20 +10:00
Craig Small
9dd75a4ac8 build-sys: Add missing configure flag
Missed adding configure.acfor the use ctty commit

References:
 commit b47693c078

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-04 17:02:39 +10:00
Jim Warner
bc4b499ed2 top: avoid library shame with refactored 'Ctrl' window
Well darn it, whoever wrote that new library caught me
with my pants down (again?). Shoot, they were not just
down but somehow missing altogether. Here's the story.

Any item from that library supported by dynamic memory
can only be represented in user's stacks exactly once.

Should any string based enumerator be duplicated among
the items array, for any instance beyond the first the
library will return '[ duplicate ENUM ]' for a result.

That's where I lost my pants. While command lines were
given special handling (and never duplicated) I failed
to turn on CGROUPS, SUPGRPS & ENVIRON when testing the
Ctrl-G, Ctrl-U & Ctrl-N keys. If any of those 3 are on
that's when a Ctrl window sees a 'duplicate' notation.

[ and who runs top with such fields displayed anyway ]

In responding to this oops, the internals were changed
quite dramatically & vastly simplified in the process.

More importantly, the 'duplicate' results are no more.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-04 16:45:57 +10:00
Craig Small
b47693c078 library: cygwin fixes for devname
Change the default name to cons%d

ctty can be used by other systems not just Cygwin so create a define
separate to cygwin for using the ctty function. The autoconf will need
to be updated to check for these specific systems in future.

Thanks to Achim of the Cygwin project for the patches.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-03 20:33:44 +10:00
Craig Small
823b6a3b1a library: Use standard major minor macros
I'm not sure why you would roll your own macros for major and minor
while the standard includes have these defined. Using our versions
causes two problems:
 - Some systems don't use this format for their minor/major
 - If the kernel proc interface becomes a 64-bit number, like
   dev_t is in the library, then our macro will need to be changed.

autoconf already had the check and as a bonus for anyone that
puts these definitions in sys/mkdev.h it handles that too.

So this is now the standard way of getting a minor/major number out of a
device id. Examining bits/sysmacros.h showed that their defines are
close to what devname.c had, except it can handle 64-bit numbers.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-03 20:13:49 +10:00
Craig Small
412f3e8aa4 testsuite: shmget returns an int
Stops the compilier (correctly) complaining:

lib/test_shm.c: In function ‘main’:
lib/test_shm.c:65:23: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘int’ [-Wformat=]
   65 |     printf("SHMID: %llx\n", shm_id);
      |                    ~~~^     ~~~~~~
      |                       |     |
      |                       |     int
      |                       long long unsigned int

shm_id is an int which is what shmget() returns.

Strangely pmap has always scanned this in as a llx even though the maps
"inode" column is the same number that shmget() returns.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-03 19:41:00 +10:00
Craig Small
38693960a1 testsuite shmid can be hex too
Previously the match for shmid was \d+ but the variable is printed
as a hex number, updated the regex to suit.

Added some changes for pmap test so if the test_shm process fails
we just skip past it.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-05-03 19:37:39 +10:00
Jim Warner
d66c1f39b5 top: turn off the 'Ctrl' bottom window after some keys
To complete the implementation of this new feature, we
must address the problem created by any commands which
offer their own full replacement displays. Should that
'Ctrl' bottom window be active, a return from any such
command leaves that lower portion of a terminal blank.

While we could issue a 'TAGGED_TOSS' macro right after
invoking any of those 4 (currently) affected commands,
it is wrong to make them aware of this 'tagged' stuff.

So, I'll opt for a more generalized solution whereby a
notice regarding a corrupted screen is broadcast. Then
the logic already aware of 'tagging' can deal with it.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
16e202d26d top: allow sticky 'Ctrl' bottom window code by #define
After making that new bottom window more persistent, I
decided to offer a build choice for somebody who might
prefer to have the rug pulled out from under him while
reviewing window contents should some target task end.

If 'TAGGED_BRIEF' is defined old behavior is restored.

[ it should be noted, however, that when this define ]
[ is active we'll lose any benefit of onetime update ]
[ for the bottom window. just like with the original ]
[ behavior, it is repainted with every update cycle. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
54b949a113 doc: adapt to the 'Ctrl' bottom window one changed key
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
9ff5a4fff0 top: trade just 1 'Ctrl' bottom window key association
I grew tired of inadvertently causing a premature exit
from top when all I wanted was to review some process'
environment variables. That 'V' key was just too close
to the 'C' key so the '^V' attempt became one of '^C'.

Well, not any more. Should a user wish to see a task's
environment, it will now require the '^N' combination.

[ it also now places G/U & N/K on a similar diagonal ]

Along the way, lower case Ctrl key combinations on the
help screen were all changed into upper case versions.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
ef27aea6b8 doc: adapt to the 'Ctrl' bottom window sticky behavior
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
0f2a755b0b top: make the new 'Ctrl' bottom window behavior sticky
After using this new feature for awhile, I encountered
numerous times when that 'Ctrl' window would disappear
as I was studying the contents. This was caused by the
death of the target task but it made me think that the
window could/should persist until dismissed by a user.

Well, now it will persist until that same Ctrl key has
been struck a 2nd time or a different Ctrl key used to
target another process after positioning it on row #1.

So now, instead of that former 'moving target' type of
approach, this window is more of a 'snapshot' in time.

[ even more significant, perhaps, is the fact that a ]
[ Ctrl window will now be drawn exactly 1 time only, ]
[ instead of being repainted after each delay cycle. ]

[ this will remain true no matter how many intervals ]
[ might elapse while its contents were under review. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
b9723148a2 library: eliminate insidious 'LIBPROC_HIDE_KERNEL' bug
When support for the 'LIBPROC_HIDE_KERNEL' environment
variable was introduced, a deficiency was present that
allowed any rejected proc_t (i.e. a kworker thread) to
preserve the strdup'd 'cmd' value. That residual value
would prevent stat2proc or status2proc from updating a
cmd field with the proper program name for some tasks.

This patch just ensures a proc_t is freshened whenever
it has been rejected due to an active PT->hide_kernel.

[ again thanks to Björn for initiating the extension ]

Reference(s):
. original hide_kernel implementation
commit 2a7ec67ac8
. original hide_kernel proposal
https://gitlab.com/procps-ng/procps/-/merge_requests/147

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
bad7f2a263 top: add a program name to 'Ctrl' bottom window header
This minor addition to that new 'Ctrl' feature is more
important than it seems. It's responsible for alerting
yours truly to the 'LIBPROC_HIDE_KERNEL' bug addressed
in the very next commit. All this while, program names
for some tasks would be mysteriously replaced with the
kernel 'kworker' names. However, customary clutter for
the top process display tended to obscure such a fact.

[ and, of course, to notice the problem in the first ]
[ place required one to have the command line toggle ]
[ 'off' or perhaps to toggle its state 'on' & 'off'. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
6b24d11b07 doc: add variable width data display without scrolling
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
fb32021eeb top: add variable width data display without scrolling
There are times when one might want to see some task's
particular variable width data. However, prior to this
commit, the only way was to first turn on a field then
scroll through it via repeated right arrow keystrokes.

[ this also required that field to be displayed last ]

Needless to say, given the potential length of some of
that variable data this could be extremely cumbersome.

Now with this patch, a Ctrl keystroke combination will
create a separate window at the bottom of the terminal
screen where such variable width data is seen in full.

[ the targeted task is the 1st task displayed, which ]
[ is a convention employed in some existing commands ]

[ the targeted data was determined by these Ctrl key ]
[ combinations: CtrlG = ctrl group; CtrlK = cmdline; ]
[ CtrlU = supplementary groups; plus CtrlV = environ ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Jim Warner
27f5904edd top: eliminate the 'keys_global' redundant definitions
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-05-03 19:21:21 +10:00
Craig Small
9c5397a941 testsuite: Add check for shared memory
Created a test process test_shm that allocates a shared memory
segment and prints the segment ID. pmap testsuite runs pmap to
check that the segment is found.

The value returned by shmget() is the same value that is printed
in the fifth column /proc/<PID>/maps

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-04-26 22:04:05 +10:00
Craig Small
1f085f5a9f pmap: Don't reopen stdin for reading file
pmap uses freopen to read /proc/self/maps. There doesn't
seem to be a good reason to do this and if pmap has its
stdin previously closed then it fails.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-04-26 21:18:03 +10:00
Craig Small
581ed4bcab Merge branch 'time-river/procps-newlib' into newlib
References:
 procps-ng/procps!155
 procps-ng/procps#236
2022-04-26 20:25:00 +10:00
liutie
e9445a07cf signal: fix suspending ps when receving SIGTERM or SIGHUP
Call trace:
  #0 __lll_lock_wait_private () at
     ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
  #1 0x00007f95c059f9d7 in _L_lock_638 () from /lib64/libc.so.6
  #2 0x00007f95c059f8b6 in _nl_expand_alias
  #3 0x00007f95c059dad8 in _nl_find_domain
  #4 0x00007f95c059d22e in __dcigettext
  #5 0x00007f95c059c05f in __GI___dcgettext
  #6  0x00000000004032b3 in signal_handler (signo=15) at display.c:54
  #7  <signal handler called>
  #8  __memcpy_sse2 () at ../sysdeps/x86_64/memcpy.S:104
  #9  0x00007f95c05d9934 in __GI__IO_getline_info
  #10 0x00007f95c05d99b8 in __GI__IO_getline
  #11 0x00007f95c05e2a5d in __GI_fgets_unlocked
  #12 0x00007f95c059f478 in read_alias_file
  #13 0x00007f95c059f97a in _nl_expand_alias
  #14 0x00007f95c059dad8 in _nl_find_domain
  #15 0x00007f95c059d22e in __dcigettext
  #16 0x00007f95c059c05f in __GI___dcgettext
  #17 0x0000000000403a8d in reset_global () at global.c:410
  #18 0x0000000000402605 in main at display.c:650

The above call trace happens when the ps process is suspending, and the
signal SIGTERM is sent to the ps process at the same time.
Just cancel the SIGTERM and SIGHUP handler when suspending to prevent
the problem.

Signed-off-by: liutie <liutie4@huawei.com>
Signed-off-by: fu.lin <fulin10@huawei.com>
2022-04-26 20:24:42 +10:00
Jim Warner
df4d2dc570 doc: added provision for autogroup nice (AGNI) changes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-26 20:18:15 +10:00
Jim Warner
e18981ec0a top: added provision for autogroup nice (AGNI) changes
When autogroups are active programs such as renice and
nice are basically useless because the nice value will
only affect the target task priority relative to other
processes in the same autogroup. So to accomplish what
we thought of as renice, /proc/<pid>/autogroup must be
changed. Altering a single member in an autogroup will
also affect every other member of that same autogroup.

Since top's renice provision ('r') suffers constraints
like those of the stand alone nice/renice programs, we
will now provide a means to manipulate that nice value
found within some process' /proc/<pid>/autogroup file.

[ to alter this file for other user's tasks requires ]
[ root privileges, as does setting a negative value. ]

[ however, unlike that 'r' command, this new command ]
[ allows raising *and* lowering all positive values. ]

Reference(s):
. Aug 2021, autogroups added to librady
commit 631e5d91f3
. Aug 2021, autogroups added to top
commit b789b46f84

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-26 20:18:15 +10:00
Jim Warner
71d7cc512a top: the '%CUC' column must be just a little bit wider
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-22 12:02:30 +10:00
Jim Warner
a2c1abb136 ps: that '%CUC' column must be just a little bit wider
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-22 12:02:30 +10:00
Jim Warner
c130f45ec7 library: fix some 'origin' header comments, <pids> api
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-22 12:02:30 +10:00
Jim Warner
fb093914a5 library: annotate header with tics/jiffies, <pids> api
To avoid potential user confusion, like that reflected
in the previous commit message, a short narrative will
be included in the header file as programmer comments,

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-17 10:43:19 +10:00
Jim Warner
20e44569f5 ps: improved three elapsed 'jiffies/tics' calculations
With openSUSE's tumbleweed release of procps-ng-4.0.0,
their source rpm contained a questionable patch. It is
ostensibly devoted to increasing the accuracy for %cpu
calculations in the ps program. However, in my opinion
it goes too far and is quite flawed for these reasons:

1. Six separate files were impacted instead of just 1.
2. While ps was the object, libproc-2 was changed too.
3. A header file's alphabetic item order was violated.
4. The library API and ABI were altered unnecessarily.

It should be noted that all the <pids> TIME items were
made 'real' when representing seconds so that they can
be converted into jiffies/tics if multiplied by hertz.
Thus, there was absolutely no justification for adding
a new PIDS_TICS_ELAPSED ull_int item to the interface.

As an example, assuming a hertz value of 100, there is
enough capacity in all of those 'TIME' seconds to hold
nearly 3 million years worth of tics without a loss of
precision whenever they are changed back into jiffies.

[ that's nine quadrillion seven trillion one hundred ]
[ ninety-nine billion two hundred fifty-four million ]
[ seven hundred forty thousand nine hundred ninety + ]
[ one! or more concisely, as: 9,007,199,254,740,991. ]

So, any need for increased accuracy in that ps program
can be realized within the single output.c file alone.

That's what will be accomplished with this new commit.

And for any doubters here's a 'double' capacity proof:

beg ------ 9007199254740991.000000000000000000000 tic|
 d /= 100, 90071992547409.90625000000000000000000 sec
 d /=  60, 1501199875790.165039062500000000000000 min
 d /=  60, 25019997929.83608245849609375000000000 hrs
 d /=  24, 1042499913.743170142173767089843750000 day
 d /=   7, 148928559.1061671674251556396484375000 wks
 d /=  52, 2864010.752041676081717014312744140625 yrs
 d *=  52, 148928559.1061671674251556396484375000 wks
 d *=   7, 1042499913.743170142173767089843750000 day
 d *=  24, 25019997929.83608245849609375000000000 hrs
 d *=  60, 1501199875790.165039062500000000000000 min
 d *=  60, 90071992547409.90625000000000000000000 sec
 d *= 100, 9007199254740991.000000000000000000000 tic
end ------ 9007199254740991.000000000000000000000  " |

[ who knows, maybe we'll even convince openSUSE that ]
[ the original sledgehammer 'dif' should be dropped. ]

Reference(s):
. openSUSE equivalent: 'procps-ng-4.0.0-accuracy.dif'

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-17 10:43:19 +10:00
Jim Warner
9fbe9be45e library: tighten up some TIME calculations, <pids> api
This patch trades some recurring per-task calculations
for calculations performed once at get, select or reap
time. It was prompted by the openSUSE dif named below.

[ my next commit will deal more thoroughly with that ]

Reference(s)
. openSUSE patch named: 'procps-ng-4.0.0-accuracy.dif'

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-17 10:43:19 +10:00
Jim Warner
af443770e3 library: eliminate redundant assignment, <meminfo> api
With the memset to zero of a 'new' meminfo_data struct
near the beginning of the meminfo_read_failed function
there's never a need to later set anything in it to 0.

[ who knows, our patch might even coax opensuse into ]
[ reevaluating that 4.0.0 'overflow' guy named below ]

Reference(s):
. overflow: 'procps-ng-4.0.0-integer-overflow.patch'

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-17 10:43:19 +10:00
Jim Warner
5edeabbd4a ps: that restored aix behavior gets its ultimate tweak
Now that this 'c' variable initial assignment has been
moved outside the looping code, there is no longer any
need to specifically check for space/comma when 'c' is
not '%'. So, let us eliminate those two lines of code.

[ i promise not to change this algorithm ever again! ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-17 10:43:19 +10:00