ps and username size
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Mon Jan 7 15:20:42 PST 2008
On Mon, 7 Jan 2008, Denys Vlasenko wrote:
> On Sunday 06 January 2008 14:16, Cristian Ionescu-Idbohrn wrote:
>
> - len = printf("%5u %-8.8s %s %s ",
> + len = printf("%5u %-8.8s %6s %-4s ",
> p->pid, user, buf6, p->state);
>
> Re "%6s":
> buf6 is always 5 chars long. With this patch, you have at least
> two spaces between USER and VSZ. Not useful.
>
> Re "%-4s":
> Correct, p->state is always 3 chars. I will do it by adding
> a space: "%s ".
That's fine, but here are some STAT differencies I observed between bb
v1.10.0.svn ps and ps from procps-3.2.7 on my debian sid box (see attached
files and compare linewise).
STAT is up to 4 chars on one process:
ps-stat.lis:143: 14147 SLs+
pid 14147 is shown like this right now:
PID USER VSZ STAT COMMAND
14147 root 145760 RLs+ /usr/bin/X11/X -dpi 100 -nolisten tcp
^^^^
I see something similar on another box (debian etch):
PID USER VSZ STAT COMMAND
13171 root 2528 S<Ls /usr/bin/atop -a -w /var/log/atop.log 600
^^^^
'man ps' says:
W paging (not valid since the 2.6.xx kernel)
bb uses that flag in the state output.
Well, here's that paragraph:
,----
| PROCESS STATE CODES
| Here are the different values that the s, stat and state output
| specifiers (header "STAT" or "S") will display to describe the state of
| a process.
| D Uninterruptible sleep (usually IO)
| R Running or runnable (on run queue)
| S Interruptible sleep (waiting for an event to complete)
| T Stopped, either by a job control signal or because it is being
| traced.
| W paging (not valid since the 2.6.xx kernel)
| X dead (should never be seen)
| Z Defunct ("zombie") process, terminated but not reaped by its
| parent.
|
| For BSD formats and when the stat keyword is used, additional
| characters may be displayed:
| < high-priority (not nice to other users)
| N low-priority (nice to other users)
| L has pages locked into memory (for real-time and custom IO)
| s is a session leader
| l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
| + is in the foreground process group
`----
> > The current svn chops of long usernames to 8 chars. That may create
> > confusion if the output from ps is in any way used to identify process
> > owners. Users:
> >
> > 'longnameA' and 'longnameB' will both be displayed as 'longname'.
> >
> > Please consider replacing usernames longer than 8 chars with the
> > corresponding uids. That will make them unique in the ps list.
>
> Good idea.
Super. I made an attempt in a previous sent patch to do just that.
It probably just passed unnoticed :(
Cheers,
--
Cristian
-------------- next part --------------
PID STAT
1 S
2 SW<
3 SW<
4 SWN
5 SW<
6 SW<
7 SWN
8 SW<
9 SW<
10 SW<
11 SW<
30 SW<
31 SW<
32 SW<
33 SW<
132 SW<
158 SW<
159 SW<
160 SW<
648 SW<
649 SW<
771 SW<
772 SW<
773 SW<
844 SW<
845 SW<
1242 SW<
1810 SW<
1811 SW<
1998 S <
2436 SW<
2809 SW<
2815 SW<
2820 SW<
2828 SW<
2833 SW<
2838 SW<
2844 SW<
2849 SW<
2854 SW<
2888 SW<
2889 SW<
3540 S
3549 S
3775 S
3782 S
3795 S
3889 S
3905 S
3915 S
4001 S
4033 S
4042 S
4050 S
4056 S
4058 S
4063 S N
4064 S N
4079 S
4083 S
4123 S
4129 S N
4140 S
4142 S
4153 S
4167 S N
4169 S N
4183 S
4222 S
4223 S
4282 S
4326 SW
4327 SW<
4328 SW<
4329 SW<
4330 SW
4331 SW
4332 SW
4333 SW
4334 SW
4335 SW
4336 SW
4337 SW
4341 S
4367 S
4381 S
4388 S
4395 S
4402 S
4404 S
4477 S
4486 S
4504 S
4507 S
4510 S
4514 S
4518 S
4522 S
4531 S
4542 S
4551 S
4558 S
4578 S
4591 S
4599 S
4639 S
4643 S
4726 S
4740 S
4794 S
4815 S
4816 S
4839 S
4847 S
4849 S
4901 S
4911 S
4938 S
4945 S
4976 S
5128 S
5129 S
5130 S
5131 S
5132 S
5134 S
5234 S
5654 S
6525 S
6526 S
6527 S
6528 S
6529 S
6530 S
6849 S
6858 S
10324 S <
13689 S
13732 S
14129 S
14146 S
14147 S
14152 S
14191 S
14204 S
14205 S
14207 S
14213 S
14219 S
14220 S
14229 S
14230 S
14231 S
14232 S
14233 S
14234 S
14235 S
14236 S
14237 S
14238 S
14239 S
14240 S
14241 S
14242 S
14243 S
14244 S
14245 S
14246 S
14247 S
14248 S
14249 S
14250 S
14251 S
14252 S
14253 S
14255 S
14256 S
14257 S
14258 S
14259 S
14269 S
14270 S
14271 S
14272 S
14273 S
14274 S
14275 S
14278 S
14285 S
14286 S
14287 S
14288 S
14289 S
14290 S
14291 S
14340 S
14388 S
14443 S
14459 S
14460 S
14461 S
14463 S
14464 S
14479 S
14518 S
14519 S
14520 S
15953 S
15986 S
16358 SW
16925 SW
17112 S
17113 S
17464 S
17469 S
18594 S N
18596 S N
22048 S N
26211 S
-------------- next part --------------
PID STAT
1 Ss
2 S<
3 S<
4 SN
5 S<
6 S<
7 SN
8 S<
9 S<
10 S<
11 S<
30 S<
31 S<
32 S<
33 S<
132 S<
158 S<
159 S<
160 S<
648 S<
649 S<
771 S<
772 S<
773 S<
844 S<
845 S<
1242 S<
1810 S<
1811 S<
1998 S<s
2436 S<
2809 S<
2815 S<
2820 S<
2828 S<
2833 S<
2838 S<
2844 S<
2849 S<
2854 S<
2888 S<
2889 S<
3540 Ss
3549 Ss
3775 Ss
3782 Ss
3795 Ss
3889 Ss
3905 S
3915 S
4001 Ss
4033 Ss
4042 Ss
4050 Ss
4056 S
4058 S
4063 SNs
4064 SN
4079 S
4083 Ss
4123 S
4129 SN
4140 Ss
4142 Ss
4153 S
4167 SN
4169 SN
4183 S
4222 Sl
4223 S
4282 Ss
4326 S
4327 S<
4328 S<
4329 S<
4330 S
4331 S
4332 S
4333 S
4334 S
4335 S
4336 S
4337 S
4341 Ss
4367 Ss
4381 Ss
4388 Ss
4395 Ss
4402 Ss
4404 S
4477 Ss
4486 Ss
4504 Ss
4507 Ss
4510 Ss
4514 Ss
4518 Ss
4522 S
4531 S
4542 Ss
4551 Ss
4558 Ss
4578 S
4591 Ss
4599 S
4639 Ss
4643 S
4726 S
4740 Ss
4794 Ss
4815 Ss
4816 S
4839 S
4847 S
4849 S
4901 Ss
4911 S
4938 Ss
4945 Ss
4976 Ss
5128 Ss
5129 S
5130 S
5131 S
5132 S
5134 S
5234 Ss
5654 Sl
6525 Ss
6526 Ss
6527 Ss+
6528 Ss+
6529 Ss+
6530 Ss+
6849 S+
6858 S
10324 S<L
13689 S
13732 Ss
14129 S+
14146 S+
14147 SLs+
14152 S
14191 SL
14204 S
14205 Ss
14207 S
14213 Ss
14219 S
14220 S
14229 S
14230 S
14231 S
14232 S
14233 S
14234 Ss
14235 S
14236 S
14237 S
14238 S
14239 S
14240 S
14241 S
14242 Ss
14243 Ss
14244 Ss
14245 Ss
14246 Ss
14247 Ss
14248 Ss
14249 Ss
14250 Ss
14251 Ss
14252 Ss
14253 Ss+
14255 Ss
14256 Ss
14257 Ss
14258 Ss
14259 Ss
14269 Ss
14270 Ss
14271 Ss
14272 Ss
14273 Ss
14274 Ss
14275 Ss
14278 Ss+
14285 Ss+
14286 Ss
14287 Ss+
14288 Ss+
14289 Ss
14290 Ss
14291 Ss
14340 Ss+
14388 Ss+
14443 Ss
14459 Ss
14460 Ss
14461 Ss
14463 Ss
14464 S
14479 S+
14518 S+
14519 S+
14520 S+
15953 S+
15986 S+
16358 S
16925 S
17112 Ss
17113 Ss
17464 Ss
17469 S
18594 SN
18596 SNs
22048 SNl
26211 S
More information about the busybox
mailing list