[procps] newlib, ps fix

  • From: Jim Warner <james.warner@xxxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Mon, 24 Aug 2015 03:10:50 -0500

Hi Craig,

The attached will cure that ps aberration when run without arguments. The
problem was caused by changes I made to the look_up_our_self() function when
the 'cmd' array became a dynamically acquired string.

But this raises the question of how newlib should handle a /proc not mounted
condition. Should I add a procps_pids_lookup_self function, with fatal stderr
exit? Or does that belong in some other place and perhaps be automatic with
library initialization?

Anyway, this new pids interface was designed principally with top’s needs in
mind, as it was the most dynamic and demanding consumer. As currently
implemented the interface provides for selecting on pid/uid or harvesting all
tasks/threads. Before we try to convert the other tools, we should decide if
we also need a single task (stack) retrieval.

Both ps and pgrep currently use such an approach, but they could be altered to
use procps_pids_reap() instead. I think it’s inherently more accurate to
snapshot all of the /proc processes and then apply whatever selection criteria
is desired. But a procps_pids_read() could be added and serve as the newlib
equivalent of the old readproc function.

What are your thoughts?

Regards,
Jim

p.s. Thanks in advance for pushing these two patches.

Attachment: newlib-no-args-fix.tgz
Description: Binary data



Other related posts: