[Toybox] ps: only stat() /proc/<pid>

Rob Landley rob at landley.net
Thu Dec 8 19:34:27 PST 2016


On 10/26/2016 03:14 PM, Mark Salyzyn wrote:
>>From the AOSP gerrit fixing internal bug 32399196
> ( https://android-review.googlesource.com/#/c/295732 )
> 
> Change subject: dirtree: add DIRTREE_NOSTAT flag
> 
> Callback from top /proc/ node tells dirtree to hold off performing
> a fstatat() call until after we hare satisfied with the name being
> numerical.  Affects ps and pgrep superfluous calls.

Sorry it took so long to get to this one, crazy couple months. Trying to
dig through the backlog.

I just pushed a commit adding DIRTREE_PROC (skips non-numeric entries in
dirtree_recurse) and making ps.c use it. Does this address the issue for
you, or do you still need bits of these two changes?

(I tried doing a dirtree_proc() function you call instead of
dirtree_read() that automatically opens /proc, but wound up reproducing
too much infrastructure. Might try again as a wrapper though.)

Thanks,

Rob


More information about the Toybox mailing list