almost works. the attached patch finishes the job...

On Thu, Dec 8, 2016 at 7:34 PM, Rob Landley <r...@landley.net> wrote:
> 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
> _______________________________________________
> Toybox mailing list
> Toybox@lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
From 47083eed49c00b9294725d97f0a5aca4cc89275e Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Fri, 9 Dec 2016 14:44:08 -0800
Subject: [PATCH] Pass DIRTREE_PROC through the ps callbacks.

---
 toys/posix/ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 3a3b8c1..8404e79 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -616,7 +616,7 @@ static int get_ps(struct dirtree *new)
 
   // Recurse one level into /proc children, skip non-numeric entries
   if (!new->parent)
-    return DIRTREE_RECURSE|DIRTREE_SHUTUP
+    return DIRTREE_RECURSE|DIRTREE_SHUTUP|DIRTREE_PROC
       |(DIRTREE_SAVE*(TT.threadparent||!TT.show_process));
 
   memset(slot, 0, sizeof(tb->slot));
-- 
2.8.0.rc3.226.g39d4020

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to