[Toybox] ps on Android

enh enh at google.com
Fri Jun 10 09:45:34 PDT 2016


On Thu, Jun 9, 2016 at 12:57 PM, Rob Landley <rob at landley.net> wrote:
> The reason I hadn't already applied it is my local copy has extensive
> changes (working on the "right fix") and this patch conflicts with it.
>
> If I can't get it finished today I'll delete what I've done, apply this,
> and consider the matter closed until my head's back above water.

i've done my friday sync (actually on a friday this week! and in the
morning!) so there's no urgency on my end. thanks!

> Rob
>
> On 06/09/2016 11:24 AM, enh wrote:
>> i'll submit this (same patch as yesterday, minus the width workaround
>> since that was fixed properly last night) to reduce the urgency, and
>> revert when we have a real fix:
>>
>>>From be7bbced789dbb80daa8fe2707ebe9736a2c0732 Mon Sep 17 00:00:00 2001
>> From: Elliott Hughes <enh at google.com>
>> Date: Wed, 8 Jun 2016 17:03:26 -0700
>> Subject: [PATCH] HACK: restore Android ps behavior.
>>
>> "NAME" is no longer doing what we want; "TNAME" is what "NAME" used to be,
>> except that "TNAME" implies -T. This patch switches us over to "TNAME",
>> disables the implicit -T.
>>
>> Change-Id: I5553703d3939b24eaf39976162d2f75a591e1ce8
>> ---
>>  toys/posix/ps.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/toys/posix/ps.c b/toys/posix/ps.c
>> index 4c66bcd..9402b77 100644
>> --- a/toys/posix/ps.c
>> +++ b/toys/posix/ps.c
>> @@ -1194,7 +1194,7 @@ void ps_main(void)
>>    else if (toys.optflags&FLAG_l)
>>      not_o = "F,S,UID,%sPPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD";
>>    else if (CFG_TOYBOX_ON_ANDROID)
>> -    not_o = "USER,%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10=PC,S,NAME";
>> +    not_o = "USER,%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10=PC,S,TNAME";
>>    sprintf(toybuf, not_o, (toys.optflags & FLAG_T) ? "PID,TID," : "PID,");
>>
>>    // Init TT.fields. This only uses toybuf if TT.ps.o is NULL
>> @@ -1227,7 +1227,7 @@ void ps_main(void)
>>    if (!(toys.optflags&(FLAG_k|FLAG_M))) TT.show_process = (void *)show_ps;
>>    TT.match_process = ps_match_process;
>>    dt = dirtree_read("/proc",
>> -    ((toys.optflags&FLAG_T) || (TT.bits&(_PS_TID|_PS_TCNT|_PS_TNAME)))
>> +    ((toys.optflags&FLAG_T) || (TT.bits&(_PS_TID|_PS_TCNT/*|_PS_TNAME*/)))
>>        ? get_threads : get_ps);
>>
>>    if (toys.optflags&(FLAG_k|FLAG_M)) {
>>



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.



More information about the Toybox mailing list