]> granicus.if.org Git - procps-ng/log
procps-ng
2 years agotop: provide for visual hint when overtype mode active
Jim Warner [Mon, 13 Jun 2022 05:00:00 +0000 (00:00 -0500)]
top: provide for visual hint when overtype mode active

Given that we won't always be able to alter the cursor
shapes (from underscore to block) if in input overtype
mode, this commit will at least provide a visual clue.

[ while this libvte quirk will impact gnome-terminal ]
[ and likely others, we're able to change the cursor ]
[ shape from underscore to block at a linux console. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: avoid premature forced loss of that bottom window
Jim Warner [Mon, 13 Jun 2022 05:00:00 +0000 (00:00 -0500)]
top: avoid premature forced loss of that bottom window

In the commit shown below the bottom window was forced
off if a full screen replacement function was invoked.
It did so by setting Frames_signal after calling those
routines from the keys_global function. However, there
was sometimes a possibility such action was premature.

At least two of those full screen replacement routines
may issue an error message & return without corrupting
the screen. As such, forcing off that bottom window is
totally unnecessary. It therefore should be preserved.

So this commit just moves the setting of Frames_signal
to the full screen replacement routines when possible.

Reference(s):
. May, 2022 - bottom window forced off for some
commit d66c1f39b52d53ec279fc638aa4a6352d7672201

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agodoc: acknowledge the top 'message log' display ability
Jim Warner [Thu, 2 Jun 2022 05:00:00 +0000 (00:00 -0500)]
doc: acknowledge the top 'message log' display ability

[ along the way, we'll fix-up the section 4 commands ]
[ summary which has gotten a little outdated lately. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: provides a new user 'message log' display ability
Jim Warner [Thu, 2 Jun 2022 05:00:00 +0000 (00:00 -0500)]
top: provides a new user 'message log' display ability

Messages issued by top will be displayed for only 1.25
seconds. And while this length of time would appear to
be acceptable (given the absence of complaints), there
will be times when a specific message might be missed.

So, this commit offers users the opportunity to recall
up to 10 of the most recent messages that were issued.

[ we'll just exploit top's new bottom window feature ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agolibrary: at unref, close these cached file descriptors
Jim Warner [Thu, 2 Jun 2022 05:00:00 +0000 (00:00 -0500)]
library: at unref, close these cached file descriptors

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agolibrary: Close filehandle for procps_loadavg
Craig Small [Thu, 2 Jun 2022 06:36:40 +0000 (16:36 +1000)]
library: Close filehandle for procps_loadavg

Previous commit didn't close the filehandle after making the
open non-persistent.

References:
 commit 8fcd14de18b998647ba47f5b35feb1d85e2d2f08

2 years agolibrary: clear rc in procps_loadavg again
Craig Small [Tue, 31 May 2022 12:03:22 +0000 (22:03 +1000)]
library: clear rc in procps_loadavg again

During the changes to procps_loadavg I didn't set the initial
value for retval, meaning it was a random number.
It is now correctly intialised to zero.

References:
  commit 8fcd14de18b998647ba47f5b35feb1d85e2d2f08

2 years agotload: Report on lack of /proc/loadavg
Craig Small [Tue, 31 May 2022 11:35:40 +0000 (21:35 +1000)]
tload: Report on lack of /proc/loadavg

Now that the library correctly returns an error if loadavg
is not available, tload can tell the user the bad news.

References:
 procps-ng/procps#227
 commit 8fcd14de18b998647ba47f5b35feb1d85e2d2f08

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agolibrary: Return -errno not print messages
Craig Small [Tue, 31 May 2022 11:32:03 +0000 (21:32 +1000)]
library: Return -errno not print messages

A library should generally return an error value, rather than
printing to stderr a message. procps_loadavg() had a few things
to change:

It had a global buffer, but we don't call this function over and
over except in tload. It also did had two macros where a plain
fopen() would do the job nicely.

This removed the macro FILE_TO_BUF which was used everywhere in oldlib
but only for loadavg in newlib.

This library change will set us up to fix tload.

2 years agofree: better error message if meminfo not available
Craig Small [Tue, 31 May 2022 11:10:18 +0000 (21:10 +1000)]
free: better error message if meminfo not available

When /proc is mounted with subset=pid free just gives the
standard cannot create meminfo structure without any hint why.
free now checks the return value and if it is -ENOENT then it
gives more information about the problem.

References:
 procps-ng/procps#227

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agolibrary: Cygwin doesnt have /proc/vmstat
Craig Small [Tue, 31 May 2022 10:41:30 +0000 (20:41 +1000)]
library: Cygwin doesnt have /proc/vmstat

Make the vmstat_read_failed() return non-error for Cygwin as
it always will error because /proc/vmstat doesn't exist.

Patch from Achim of the Cygwin project.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agotop: the bottom 'window' headings are now translatable
Jim Warner [Fri, 27 May 2022 05:00:00 +0000 (00:00 -0500)]
top: the bottom 'window' headings are now translatable

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: remove the 'BOT_MENU_YES' prototype demonstration
Jim Warner [Fri, 27 May 2022 05:00:00 +0000 (00:00 -0500)]
top: remove the 'BOT_MENU_YES' prototype demonstration

Now that a potential use of that bottom 'window' for a
menu has been demonstrated, we'll remove such clutter.

[ after all, the prior commit cautioned against text ]
[ made conditional which might also be translatable. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: don't make translatable text subject to a #define
Jim Warner [Fri, 27 May 2022 05:00:00 +0000 (00:00 -0500)]
top: don't make translatable text subject to a #define

While it is acceptable to make text usage conditional,
one must never make the text itself conditional. After
all, the translators must be presented with all of the
text so the opportunity to translate it is never lost.

[ one wonders who the idiot was that did this anyway ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: cleanup of miscellaneous stuff from prior commits
Jim Warner [Fri, 27 May 2022 05:00:00 +0000 (00:00 -0500)]
top: cleanup of miscellaneous stuff from prior commits

Fix some errors introduced in the commits shown below.

Reference(s):
. Apr, 2022 - 'keys_global' missed redundancy
commit 27f5904edd3772a2f3f66ac62148dee636295933
. Apr, 2022 - added extraneous comma in help text
commit fb32021eeb6f78f01bf455231423a162c9766408

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agolibrary: Cygwin only has 4 cpu numbers
Craig Small [Thu, 26 May 2022 07:53:43 +0000 (17:53 +1000)]
library: Cygwin only has 4 cpu numbers

Old library never checked how many matches there were meaning that
both 8-number and 4-number cpu lines would work.

2 years agotop: enable bottom 'window' multi-byte char capability
Jim Warner [Wed, 25 May 2022 05:00:00 +0000 (00:00 -0500)]
top: enable bottom 'window' multi-byte char capability

If the special bottom 'window' routines remain unaware
of potential multi-byte characters, that heading could
be truncated prematurely and unnecessary blank line(s)
added to the reserved rows at the bottom of a display.

So, in both cases, this patch will now account for any
difference between string lengths and display columns.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: rework bottom 'window' logic to reduce redundancy
Jim Warner [Wed, 25 May 2022 05:00:00 +0000 (00:00 -0500)]
top: rework bottom 'window' logic to reduce redundancy

This patch attempts to reduce the proliferation of the
bottom window support routines by combining the 'misc'
with 'item' functions. Along the way we can now rename
those two 'pick' functions 'menu' while keeping proper
alphabetic order among all the bottom window routines.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agobuild-sys: Give sensible errors if missing pkg-config
Craig Small [Wed, 25 May 2022 11:08:50 +0000 (21:08 +1000)]
build-sys: Give sensible errors if missing pkg-config

pkg-config is used to find various libraries used by procps.
Unfortunately it, or rather automake, give terrible misleading
error messages if pkg-config is not installed.

At ./configure time you get this:
configure: error: ncurses support missing/incomplete (for partial
build use --without-ncurses)

At automake time you get this:
configure.ac:33: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:48: error: possibly undefined macro: AS_IF
configure.ac:113: error: possibly undefined macro: AC_DEFINE

The internet is filled with such wonderful other examples.

This commit does two things:
 At autoconf time, check PKG_PREREQ macro is defined which is found in
pkg.m4 and tells us pkg-config has its macros available.
 At configure time, check the result of the pkg-config test and error
 if it didn't find it.

Now it actually says its missing pkg-config. To be fair, the autoconf
check is "documented" and recommended in pkg.m4 file.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agobuild-sys: Use ncursesw by default
Craig Small [Sat, 21 May 2022 01:06:57 +0000 (11:06 +1000)]
build-sys: Use ncursesw by default

The existing build system would only require wide ncurses for
a wide watch and even if the library was there would not link
anything else to it.

The first issue which #123 made me think of, is if ncursesw
was there and ncurses is not, why not use ncursesw?

A more major issue is if programs such as slabtop are linked
to ncurses, then certain languages will display their text
wrong, as found in #237.

The days of assuming ASCII only is ok are over the build system
now does the following:
 1. If ncursesw is available use this for all relevant programs
 2. If ncursesw is not but ncurses is, use this instead
 3. If you enable 8bit watch and either disable ncurses or
    we cannot find ncursesw error at configure time.

In related news, I hate M4sh.

References:
 procps-ng/procps#123
 procps-ng/procps#237

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agolibrary: silence the clang warning for 'uptime' module
Jim Warner [Wed, 18 May 2022 05:00:00 +0000 (00:00 -0500)]
library: silence the clang warning for 'uptime' module

Reference(s):
proc/uptime.c:191:9: warning: variable 'uphours' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: extend shift+tab (back_tab) navigation to console
Jim Warner [Wed, 18 May 2022 05:00:00 +0000 (00:00 -0500)]
top: extend shift+tab (back_tab) navigation to console

Really, extend shift+tab navigation to only some linux
consoles (or maybe most consoles). However, there were
some consoles where shift+tab always yields just '\t'.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: apply a special emphasis with some focus elements
Jim Warner [Wed, 18 May 2022 05:00:00 +0000 (00:00 -0500)]
top: apply a special emphasis with some focus elements

Since top now uses string vectors for two items in the
new focus window (cmdline & environ), there is no real
use for that 'separator' specified at toggle time. So,
this commit will find a new use for what is the space.

Henceforth, when a user is navigating using the tab or
backtab keys, should a strv element with focus contain
embedded space(s), it will be emphasized & highlighted
using the current window's message color (capclr_msg).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: some imbedded literals are now manifest constants
Jim Warner [Wed, 18 May 2022 05:00:00 +0000 (00:00 -0500)]
top: some imbedded literals are now manifest constants

A commit that changes no code but, hopefully, helps to
better document where and how such literals were used.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agodocs: Update news for watch equexit
Craig Small [Wed, 18 May 2022 11:50:14 +0000 (21:50 +1000)]
docs: Update news for watch equexit

References:
 commit 3ac20bf5366b5784d8ee4b1f927e96f4dd164f28

2 years agowatch: Add --equexit option
Orhun Parmaksız [Thu, 31 Mar 2022 19:36:57 +0000 (22:36 +0300)]
watch: Add --equexit option

This commit adds a new option called `--equexit` which is the opposite
of `--chgexit`. This option makes it possible to exit when the output
of the given command does not change for the given number of cycles.
A download operation could be given as a use-case since `watch` will
exit when the output does not change anymore, in other words, when
the download is completed.

References:
 procps-ng/procps#232

Signed-off-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2 years agodocs: Minor fix for kill.1 manpage
Craig Small [Wed, 18 May 2022 11:37:26 +0000 (21:37 +1000)]
docs: Minor fix for kill.1 manpage

Merge request 154 brought up the issue of the space before the commar
after sigaction, however the MR included the translated generated
pages.

References:
  procps-ng/procps!154

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agotop: modify 'focus' strv function to display 'n/a' too
Jim Warner [Tue, 17 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: extend 'focus' navigation to shift+tab (back_tab)
Jim Warner [Tue, 17 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: be more careful with memcpy length specifications
Jim Warner [Tue, 17 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: modify 'Ctrl' bottom window 'str' use with 'strv'
Jim Warner [Sun, 15 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: needed 'Ctrl' bottom window fixes were discovered
Jim Warner [Sun, 15 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agodoc: man page adjusted for response to keyboard inputs
Jim Warner [Fri, 13 May 2022 05:00:00 +0000 (00:00 -0500)]
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 6e78355d4d1ab011c1d65ebbec9a4408b743a6b3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: program is now more responsive to keyboard inputs
Jim Warner [Fri, 13 May 2022 05:00:00 +0000 (00:00 -0500)]
top: program is now more responsive to keyboard inputs

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agodoc: detail 'Ctrl' bottom window namespaces plus focus
Jim Warner [Thu, 12 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: extend 'Ctrl' bottom window for 'memu' selections
Jim Warner [Thu, 12 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: extend 'Ctrl' bottom window for focus via tab key
Jim Warner [Thu, 12 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: expand 'Ctrl' bottom window to display other data
Jim Warner [Thu, 12 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: rename 'Ctrl' bottom window routines and relocate
Jim Warner [Thu, 12 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agops: Document -P option
Craig Small [Wed, 11 May 2022 07:34:12 +0000 (17:34 +1000)]
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

2 years agodoc: bring the namespaces up to date with linux kernel
Jim Warner [Thu, 5 May 2022 05:00:00 +0000 (00:00 -0500)]
doc: bring the namespaces up to date with linux kernel

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agops: make those namespaces up to date with linux kernel
Jim Warner [Thu, 5 May 2022 05:00:00 +0000 (00:00 -0500)]
ps: make those namespaces up to date with linux kernel

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: bring the namespaces up to date with linux kernel
Jim Warner [Thu, 5 May 2022 05:00:00 +0000 (00:00 -0500)]
top: bring the namespaces up to date with linux kernel

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agolibrary: bring namespaces up to date with linux kernel
Jim Warner [Thu, 5 May 2022 05:00:00 +0000 (00:00 -0500)]
library: bring namespaces up to date with linux kernel

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: turn off the 'Ctrl' bottom window with 1 more key
Jim Warner [Thu, 5 May 2022 05:00:00 +0000 (00:00 -0500)]
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 d66c1f39b52d53ec279fc638aa4a6352d7672201

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: fix a bug from when 'Ctrl' window was made sticky
Jim Warner [Thu, 5 May 2022 05:00:00 +0000 (00:00 -0500)]
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 0f2a755b0b2754fca79545984e25ec52f4ae4444

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agobuild-sys: Add missing configure flag
Craig Small [Wed, 4 May 2022 07:02:39 +0000 (17:02 +1000)]
build-sys: Add missing configure flag

Missed adding configure.acfor the use ctty commit

References:
 commit b47693c078c256e897baf6b50f3aaf6accb5d35e

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agotop: avoid library shame with refactored 'Ctrl' window
Jim Warner [Wed, 4 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agolibrary: cygwin fixes for devname
Craig Small [Tue, 3 May 2022 10:33:44 +0000 (20:33 +1000)]
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>
2 years agolibrary: Use standard major minor macros
Craig Small [Tue, 3 May 2022 10:13:49 +0000 (20:13 +1000)]
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>
2 years agotestsuite: shmget returns an int
Craig Small [Tue, 3 May 2022 09:41:00 +0000 (19:41 +1000)]
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>
2 years agotestsuite shmid can be hex too
Craig Small [Tue, 3 May 2022 09:37:39 +0000 (19:37 +1000)]
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>
2 years agotop: turn off the 'Ctrl' bottom window after some keys
Jim Warner [Tue, 3 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: allow sticky 'Ctrl' bottom window code by #define
Jim Warner [Mon, 2 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agodoc: adapt to the 'Ctrl' bottom window one changed key
Jim Warner [Mon, 2 May 2022 05:00:00 +0000 (00:00 -0500)]
doc: adapt to the 'Ctrl' bottom window one changed key

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: trade just 1 'Ctrl' bottom window key association
Jim Warner [Mon, 2 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agodoc: adapt to the 'Ctrl' bottom window sticky behavior
Jim Warner [Mon, 2 May 2022 05:00:00 +0000 (00:00 -0500)]
doc: adapt to the 'Ctrl' bottom window sticky behavior

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: make the new 'Ctrl' bottom window behavior sticky
Jim Warner [Mon, 2 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agolibrary: eliminate insidious 'LIBPROC_HIDE_KERNEL' bug
Jim Warner [Sun, 1 May 2022 05:00:00 +0000 (00:00 -0500)]
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 2a7ec67ac806d91520f59c384684e2332774368b
. original hide_kernel proposal
https://gitlab.com/procps-ng/procps/-/merge_requests/147

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: add a program name to 'Ctrl' bottom window header
Jim Warner [Sun, 1 May 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agodoc: add variable width data display without scrolling
Jim Warner [Sat, 30 Apr 2022 05:00:00 +0000 (00:00 -0500)]
doc: add variable width data display without scrolling

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: add variable width data display without scrolling
Jim Warner [Sat, 30 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: eliminate the 'keys_global' redundant definitions
Jim Warner [Fri, 29 Apr 2022 05:00:00 +0000 (00:00 -0500)]
top: eliminate the 'keys_global' redundant definitions

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotestsuite: Add check for shared memory
Craig Small [Tue, 26 Apr 2022 12:04:05 +0000 (22:04 +1000)]
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>
2 years agopmap: Don't reopen stdin for reading file
Craig Small [Tue, 26 Apr 2022 11:18:03 +0000 (21:18 +1000)]
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>
2 years agoMerge branch 'time-river/procps-newlib' into newlib
Craig Small [Tue, 26 Apr 2022 10:25:00 +0000 (20:25 +1000)]
Merge branch 'time-river/procps-newlib' into newlib

References:
 procps-ng/procps!155
 procps-ng/procps#236

2 years agosignal: fix suspending ps when receving SIGTERM or SIGHUP
liutie [Tue, 26 Apr 2022 04:11:07 +0000 (12:11 +0800)]
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>
2 years agodoc: added provision for autogroup nice (AGNI) changes
Jim Warner [Sun, 24 Apr 2022 05:00:00 +0000 (00:00 -0500)]
doc: added provision for autogroup nice (AGNI) changes

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: added provision for autogroup nice (AGNI) changes
Jim Warner [Sun, 24 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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 631e5d91f3c34374a095b8351235627545617de7
. Aug 2021, autogroups added to top
commit b789b46f84da590a39afd8d74c76c2f5e5436d40

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: the '%CUC' column must be just a little bit wider
Jim Warner [Wed, 20 Apr 2022 05:00:00 +0000 (00:00 -0500)]
top: the '%CUC' column must be just a little bit wider

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agops: that '%CUC' column must be just a little bit wider
Jim Warner [Wed, 20 Apr 2022 05:00:00 +0000 (00:00 -0500)]
ps: that '%CUC' column must be just a little bit wider

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agolibrary: fix some 'origin' header comments, <pids> api
Jim Warner [Wed, 20 Apr 2022 05:00:00 +0000 (00:00 -0500)]
library: fix some 'origin' header comments, <pids> api

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agolibrary: annotate header with tics/jiffies, <pids> api
Jim Warner [Fri, 15 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agops: improved three elapsed 'jiffies/tics' calculations
Jim Warner [Fri, 15 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agolibrary: tighten up some TIME calculations, <pids> api
Jim Warner [Fri, 15 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agolibrary: eliminate redundant assignment, <meminfo> api
Jim Warner [Thu, 14 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agops: that restored aix behavior gets its ultimate tweak
Jim Warner [Wed, 13 Apr 2022 05:00:00 +0000 (00:00 -0500)]
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>
2 years agotop: remove those winflags which restricted 'x' toggle
Jim Warner [Tue, 12 Apr 2022 05:00:00 +0000 (00:00 -0500)]
top: remove those winflags which restricted 'x' toggle

On occasion, even as the top author, I wonder why that
'x' toggle has stopped working. Of course, it actually
was working but a locate request ('L') or other filter
('O') operation was active and thus temporarily turned
if off. Such behavior is documented in top's man page.

Well, with this patch that 'x' suppression is no more.

[ the original justification, however, remains true. ]

[ but there's really only one character which causes ]
[ any potential trouble & i'm gonna' keep it secret. ]

[ besides, if a display is corrupted, there's always ]
[ that '=' key which restores things back to normal. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agop/version.c: osrelease for Cygwin
Craig Small [Mon, 11 Apr 2022 07:30:25 +0000 (17:30 +1000)]
p/version.c: osrelease for Cygwin

On Cygwin systems use a different file and format to get the
OS version.

Thanks to procps Cygwin maintainer Achim!

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agobuild-sys:
Craig Small [Mon, 11 Apr 2022 07:09:53 +0000 (17:09 +1000)]
build-sys:

While the previous commit checked for a GNU environment so Hurd
compilied ok, this tripped up Cygwin. configure now explicitly tests
for the structure field rather than trying to guess through compilier
flags about what the environment tells us about signals.h

References:
 commit d39d9db07974f4f09cd2f31137742a7ea3be65c5

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agolibrary: fix 'smaps' bug preventing a build with clang
Jim Warner [Sun, 10 Apr 2022 05:00:00 +0000 (00:00 -0500)]
library: fix 'smaps' bug preventing a build with clang

As a result of the issue referenced below, we'll trade
our homegrown offset generator for an 'offsetof' macro
found in the stddef.h header file. This pleases clang.

[ and thanks to Daniel Kolesa for the report and fix ]

Reference(s):
. bug report & recommended solution
https://gitlab.com/procps-ng/procps/-/issues/235

. clang error message
proc/readproc.c:673:9: error: initializer element is not a compile-time constant
        mkENT(Rss),
        ^~~~~~~~~~
proc/readproc.c:661:34: note: expanded from macro 'mkENT'
  #define mkENT(F) { #F ":", -1, (int)((void*)&q->smap_ ## F - (void*)&q->fZERO) }
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: raise %CPU maximum if large numbers of processors
Jim Warner [Sat, 9 Apr 2022 05:00:00 +0000 (00:00 -0500)]
top: raise %CPU maximum if large numbers of processors

It would appear that openSUSE was the first to release
procps-ng version 4.0.0 (in the tumbleweed distro). As
a result I checked their source rpm and found a couple
of patches I'm porting to newlib for the next release.

This particulate patch, with some changes, is openSUSE
patch 'procps-ng-3.3.10-large_pcpu.patch'. The changes
were strictly cosmetic. They involved whitespace only.

[ it should be noted that the net effect for raising ]
[ the maximum is to produce a '?' in the %CPU field. ]
[ that's because its width is fixed at five columns. ]
[ but at least the '?' won't distort actual results. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: ignore the SIGHUP signal if running in batch mode
Jim Warner [Sat, 9 Apr 2022 05:00:00 +0000 (00:00 -0500)]
top: ignore the SIGHUP signal if running in batch mode

It would appear that openSUSE was the first to release
procps-ng version 4.0.0 (in the tumbleweed distro). As
a result I checked their source rpm and found a couple
of patches I'm porting to newlib for the next release.

This particulate commit was a refactor of the openSUSE
patch 'procps-ng-3.3.8-bnc634840.patch'. Unfortunately
their original patch did not have the intended effect.

That was because the amended signal handling logic was
performed well before the command line parameters were
parsed. So the global 'Batch' flag was in its 0 state.

. what follows is the original openSUSE commit message
------------------------------------------------------
Do not setup SIGHUP signal handler if we are in the batch mode

Top enables a signal handler for the SIGHUP signal (loss of terminal).  While
this makes sense for top's default interactive mode, it doesn't make any sense
for batch mode. If you run top in nohup just to collect data over time and
disconnect top finishes which is not what one would expect.
------------------------------------------------------

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotestsuite: Add AIX field checks for ps
Craig Small [Sat, 9 Apr 2022 04:50:53 +0000 (14:50 +1000)]
testsuite: Add AIX field checks for ps

AIX fields (generally %char) have had some love now but
are parsed slightly differently to other fields, so they
have some tests.

References:
 commit 4fbf8d22a99445bc7b37c6d36ed9e045821439e3
 https://www.freelists.org/post/procps/some-procpsn4400-fixes,7
Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agosysctl: print dotted keys again
Craig Small [Sat, 9 Apr 2022 04:18:28 +0000 (14:18 +1000)]
sysctl: print dotted keys again

When the globbing update was put into sysctl, you could no longer
simply use the keys because one key could potentially be
multiple paths once the glob expansion occured.  Using the path
instead gave a unique output.

Except certain programs, such as salt, expected the output to use
the dotted path "kernel.hostname" and not "kernel/hostname".

We can no longer use the original key, so now for each path:
  Copy the path
  strip off /proc/
  convert all / to .

The sysctl testsuite was also updated to check for a few different
types of conversion failures.

References:
 commit 6389deca5bf667f5fab5912acde78ba8e0febbc7
 https://www.freelists.org/post/procps/some-procpsn4400-fixes,4
 https://repo.saltproject.io/

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2 years agops: that restored aix behavior is now even more robust
Jim Warner [Mon, 4 Apr 2022 05:00:00 +0000 (00:00 -0500)]
ps: that restored aix behavior is now even more robust

With the commit referenced below a nasty bug affecting
aix parsing was swatted. Beyond the bug, the logic was
enhanced to disallow commas in the format string since
they would otherwise be shown with their field's data.

However, there remained many characters other than ','
that could survive the edits to then be shown adjacent
to the data. Well, with this patch they won't anymore!

[ along the way we will no longer try to forgive the ]
[ use of a double '%%' prefix since that resulted in ]
[ display of one '%' and field code instead of data. ]

Reference(s):
. March, 2022 - restored aix bahavior
commit 8cb646bdfc6e37b221f9616df96c6c116e6def28

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agoNEWS: update with 2 ps related release 4.0.0 bug fixes
Jim Warner [Fri, 1 Apr 2022 05:00:00 +0000 (00:00 -0500)]
NEWS: update with 2 ps related release 4.0.0 bug fixes

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agoNEWS: Mention elogind merge
Craig Small [Fri, 1 Apr 2022 06:28:53 +0000 (17:28 +1100)]
NEWS: Mention elogind merge

Reference:
 procps-ng/procps!151

2 years agoAdd support for elogind
Sven Eden [Tue, 30 May 2017 14:33:28 +0000 (16:33 +0200)]
Add support for elogind

A session manager similar to logind from systemd.
See https://github.com/elogind/elogind

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2 years agops: restore thread display when using a pidlist option
Jim Warner [Wed, 30 Mar 2022 17:00:00 +0000 (12:00 -0500)]
ps: restore thread display when using a pidlist option

This commit will once again display threads when using
the -L option along with any of those pidlist options.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/234

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agops: restore aix behavior while keeping an original fix
Jim Warner [Wed, 30 Mar 2022 17:00:00 +0000 (12:00 -0500)]
ps: restore aix behavior while keeping an original fix

The commit shown below broke the aix behavior that Dr.
Fink recently reported. However, in the proposed patch
the old behavior, showing garbage when '%cpu' was used
with an invalid formatting option, would appear again.

So this patch, based on Werner's patch, goes the extra
distance to prevent that. Along the way we'll disallow
commas in the aix format str to prevent their display.

Reference(s):
https://www.freelists.org/post/procps/Procpsng-400-released-with-newlib,2
. Mar, 2022 - where aix bug was introduced
commit 81df85a1b528d4edb9ab98b37fb6c6244430b6c4

Prototyped-by: Dr. Werner Fink <werner@suse.de>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: update one function prologue after rcfile changes
Jim Warner [Tue, 29 Mar 2022 05:00:00 +0000 (00:00 -0500)]
top: update one function prologue after rcfile changes

When top's rcfile was reorganized, trading that 'char'
based field representation for the 'int' scheme, there
was a function prologue that should have been changed.

Thus, this patch will correct that original oversight.

Reference(s):
. Mar, 2022 - rcfile reorganized
commit 46aa96e438435628810b33d20cb1c14dc33dd84f

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agonls: man-po fixes
Craig Small [Wed, 23 Mar 2022 06:56:20 +0000 (17:56 +1100)]
nls: man-po fixes

Add update-po target, to update the manpage po files run
make -C man-po update-po

Updated the po files.

References:
 procps-ng/procps#230

2 years agomisc: Add v4.0.0 to NEWS
Craig Small [Wed, 23 Mar 2022 06:56:11 +0000 (17:56 +1100)]
misc: Add v4.0.0 to NEWS

2 years agonls: Update translations v4.0.0
Craig Small [Tue, 22 Mar 2022 10:40:10 +0000 (21:40 +1100)]
nls: Update translations

2 years agotestsuite: ps out tests more lenient
Craig Small [Tue, 22 Mar 2022 09:20:53 +0000 (20:20 +1100)]
testsuite: ps out tests more lenient

Sometimes due to race conditions or the way dejagnu gates the
output, or even there is another interesting process, the ps tests
sometimes fail. These changes make it a little more lenient without
losing the purpose of the test.

Replaces Debian patch ps_tests

References:
 https://salsa.debian.org/debian/procps/-/blob/debian/2%253.3.17-7/debian/patches/ps_checks

2 years agotestsuite: Return error if tty is TTY
Craig Small [Tue, 22 Mar 2022 08:53:28 +0000 (19:53 +1100)]
testsuite: Return error if tty is TTY

In some build systems, such as the Debian pbuilders, the
environment is strange. The tty is called "TTY" which causes
some of the ps tests to fail.

This commit checks for that specific result and returns ""
so the tests can be bypassed.

Replaces Debian patch fix_checks.

References:
 https://salsa.debian.org/debian/procps/-/blob/debian/2%253.3.17-7/debian/patches/fix_checks

2 years agolibrary: fixed some header inconsistencies, <pids> api
Jim Warner [Tue, 22 Mar 2022 05:00:00 +0000 (00:00 -0500)]
library: fixed some header inconsistencies, <pids> api

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agotop: why not maximize usage of some manifest constants
Jim Warner [Mon, 21 Mar 2022 05:00:00 +0000 (00:00 -0500)]
top: why not maximize usage of some manifest constants

Signed-off-by: Jim Warner <james.warner@comcast.net>
2 years agonls: Remove incorrect Romanian file
Craig Small [Mon, 21 Mar 2022 11:01:53 +0000 (22:01 +1100)]
nls: Remove incorrect Romanian file

This is for psmisc