Re: issue #245 plus one

Jim Warner <[email protected]> Thu, 28 Jul 2022 00:32:29 -0500
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
On 7/27/22 6:30 AM, Craig Small wrote:

> newlib and master branches are pushed. I was working on a small test 
> to see what was going on with fatal_proc_unmounted() when you use it to 
> get values for the calling process. Added a caveat to the man page so it 
> doesn't ruin someone's several days trying to work out why it returns 
> PPID but not PID.

Hi Craig,

That was a great catch with fatal_proc_unmounted() and a terrible oops 
on my part.  However, rather than burden future users with an obscure 
potential toe stubber, I'd like to recommend an alternate approach.

There was no reason why all the functions returning a stack or stacks 
should not have behaved exactly the same.  The only exception was this 
single function which doesn't require a prerequisite call.  It was my 
blind-spot regarding 'stat' that produced the disparity, not the 
fatal_proc_unmounted) function.

With the attached patches, the fatal guy can now return any item a 
caller desires, providing an info struct has been obtained and desired 
items identified.  In other words, exactly what was always mandatory 
when 'return_self' was non-zero, but without 'stat' directory limitations.

In the process, the actual function has been greatly simplified.  I've 
traded 20 lines of old code for only 6 lines of new code.

But as luck would have it, while testing to make sure every item could 
be retrieved I found an unrelated 7 year old problem.  A pids item 
identifier was completely misleading.  So I changed that too which then 
impacted the ps program.

Anyway, I think the drip, drip, drip has stopped for now.

Looking forward to your feedback.

Thanks in advance.

Regards,

Jim
newlib-4-more.tgz (application/x-compressed-tar, 5.5 KB) - not displayed