Android has a lot of long usernames. the bluetooth code, for example,
runs as "bluetooth", and the camera code as "cameraserver". ideally
the USER column would grow to fit (especially when the tty is very
wide), but right now it's kind of narrow, doesn't grow, and truncates
from left rather than the right:

USER       PID  PPID     VSZ    RSS WCHAN            ADDR S NAME
...
raserver   609     1  115152  43496 hread_read   f4c10044 S cameraserver
...
luetooth 13631     1   17808   1740 le_timeout 77105ff7e8 S wcnss_filter

similarly for LABEL; we've been lucky so far in that all the labels
i'd seen happen to be <= 30 characters, but for the first time i've
started to see slightly longer ones, so
"u:r:priv_app_nxfile:s0:c512,c768", say, gets left-truncated to
"r:priv_app_nxfile:s0:c512,c768".

my username is very short and my desktop doesn't use selinux, so
forgive the crappy example, but afaict the tradition is to truncate
from the right, and indicate that truncation has taken place by
replacing the last character with '+':

~$ ps -O user:2
  PID USER S TTY        TIME COMMAND
18357 e+ S pts/23   00:00:00 -/bin/bash
18422 e+ R pts/23   00:00:00 ps -O user:2

ah, actually it's weirder than that...

$ adb shell ps -AZ | grep too
u:r:bluetooth:s0               bluetoot 13320 13015 2245220  58420
SyS_epoll_ 6fe4ab06b0 S com.android.bluetooth
u:r:wcnss_filter:s0            bluetoot 13631     1   17808   1740
poll_sched 77105ff7e8 S wcnss_filter
$ adb shell -t ps -AZ | grep too
u:r:bluetooth:s0               luetooth 13320 13015 2245220  58420
epoll_wait 6fe4ab06b0 S com.android.bluetooth
u:r:wcnss_filter:s0            luetooth 13631     1   17808   1740
le_timeout 77105ff7e8 S wcnss_filter
$

if we're writing to a tty ps calls draw_trim but if not, calls printf
directly. so in one case we truncate from the correct side (but don't
mark the truncation with '+') and in the other we truncate from the
wrong side (and also don't mark the truncation).

(/me wishes Unix weren't still so ASCII; the unicode ellipsis '…'
would be a nice improvement over '+'.)

-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to