[procps] newlib pids implementation

  • From: Jim Warner <james.warner@xxxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Wed, 19 Aug 2015 04:40:41 -0500

Hi Craig,

Attached is the implementation of <proc/pids.h>, along with an additional patch
to top for really old kernel support. I began with the objective of maximizing
use of the existing proven library code, but a few changes were still
necessary. They are explained in the commit message.

In this implementation, 'new' is where the maximum stack depth is established.
Later, the items can be reordered and the depth changed (shortened) via
'reset'. The 'reap' function is the equivalent of other api’s 'read'. I
wanted a name different from but similar to what’s already implemented. There
exists 'fill' support, but here it’s used to filter/select specific pids or
users.

I implemented history (delta) support for elapsed tics plus major and minor
page faults. It uses the simple, yet efficient hashing scheme top has employed
for years. And, the library can provide converted KiB values for those 'number
of pages' values in /proc/#/statm.

With the enumerators, I tried to retain some semblance to the original proc_t
identifiers. But I also grouped some via prefixes (ADDR, ID, TICS, etc) and
renamed some of the more obscure ones (trs to CODE, etc).

I’ll be interested in your feedback.

Regards,
Jim

Attachment: newlib-pids-stuff.tgz
Description: Binary data



Other related posts: