Re: three for newlib

Jim Warner <[email protected]> Sat, 18 Dec 2021 04:41:55 -0600
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
On 12/17/21 3:50 PM, Craig Small wrote:
> That patch is pushed, makes top a little bare now but that's all the 
> information it is given that's all it can show.

Hi Craig,

Although some Summary Area lines had to be suppressed, I was pleased 
that at least the task states line could be included.  And when it comes 
to the Task Area, of the 72 fields only %CPU and %MEM could not be 
printed (receiving a "?" instead).  The remaining 70 can all be displayed.

> The configure flag was --enable-harden-flags it shows some 
> format-truncation errors.

I get a bunch of truncation warnings with or without the 
'--enable-harden-flags' configure option, though they differ somewhat. 
That's why I always add '-Wno-format-truncation' to CFLAGS.

> So one of the interesting failure modes with the library is for certain 
> fields that need system fields.
> An example is pgrep with --older. It needs the PIDS field TIME_ELAPSED. 
> That is calculated with the processes start_time (which it can get) and 
> the system seconds since boot (which it cannot). The library checks to 
> see if the boot happens before the process started and if so subtracts 
> them otherwise return zero.
> For a subset=pid system, it returns zero. Is this the correct answer or 
> should it return an error?
> 
> There's probably a bunch of other fields like this.

I think the zero return value should be thought of as an error.  And 
PIDS_TIME_ELAPSED is the only derived item that depends on a global proc 
file not available under subset=pid.

Regards,

Jim