[Toybox] A ps cleanup I can't test...

Rob Landley rob at landley.net
Sun Jan 12 12:38:28 PST 2025


Elliott, could you give this a sniff/smoke test on android? Built with 
the NDK it's giving blank space for PCY on all the processes I've got, 
which seems right according to the logic (before and after), but maybe 
not intentional?

   $ cat /proc/self/cgroup
   0::/1

It's "-" if the file couldn't be opened, but "  " if the file exists but 
doesn't start with ":cpuset:/"? And then also "  " for 
"system-background"...

Rob

(It just trying to genericize a function already used in sh.c. The idx+1 
or 0 return instead of idx or -1 is a bit different than other lib 
entries, but every user so far either cares about true/false or is using 
it for a lookup table like this that has a "not found" entry so I'd be 
adding +1 to every caller to get the logic I want. The "anystr" vs 
"strany" name is a bit of cognitive friction to remind about the 
semantic difference, still not sure whether that's a good idea or not. 
Again, "hard because the stakes are so small": as with Bill Door 
sharpening his scythe, the tricky bits were the later passes...)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ps.patch
Type: text/x-patch
Size: 2667 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20250112/132ec454/attachment.bin>


More information about the Toybox mailing list