ps and username size

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sat Jan 5 13:00:52 PST 2008


Noticed that several usernames on my debian sid box are longer than 8
bytes:

,----
| Debian-exim:x:102:102::/var/spool/exim4:/bin/false
| messagebus:x:103:104::/var/run/dbus:/bin/false
| fetchmail:x:107:65534::/var/lib/fetchmail:/bin/sh
| debarchiver:x:109:109:Deb archiving tool,,,:/var/lib/debarchiver:/bin/false
| smokeping:x:127:127:SmokePing daemon,,,:/var/lib/smokeping:/bin/false
| haldaemon:x:132:124:Hardware abstraction layer,,,:/home/haldaemon:/bin/false
| email-reminder:x:1002:1003:Email-reminder mailer,,,:/var/spool/email-reminder:/bin/bash
`----

ps from procps-3.2.7-5 shows such users using the uid instead of username:

,----
| 103       4469  0.0  0.0   2764   888 ?        Ss   15:52   0:00 /usr/bin/dbus-d
| 127       4969  0.0  0.3  15468 12364 ?        Ss   15:52   0:00 /usr/sbin/smoke
| 132       5241  0.0  0.1   5284  3352 ?        Ss   15:52   0:00 /usr/sbin/hald
| 132       5273  0.0  0.0   2224   908 ?        S    15:52   0:00 hald-addon-acpi
| 127      27372  0.0  0.0   2692   920 ?        S    21:28   0:00 /usr/bin/fping
`----

bb-ps shifts 'VSZ STAT COMMAND' a few columns, adjusting to the username
string size:

,----
|  4469 messagebus   2764 S   /usr/bin/dbus-daemon --system
|  4969 smokeping  15468 S   /usr/sbin/smokeping [FPing]
|  5241 haldaemon   5284 S   /usr/sbin/hald
|  5265 root       3248 S   hald-addon-input: Listening on /dev/input/event4 /dev
|  5273 haldaemon   2224 S   hald-addon-acpi: listening on acpid socket /var/run/
`----

The attached patch attempts to immitate procps-3.2.7-5 behaviour, so that:

  # ./busybox_unstripped ps

shows:

,----
|   PID  USER       VSZ STAT COMMAND
|  4469 103        2764 S    /usr/bin/dbus-daemon --system
|  4969 127       15468 S    /usr/sbin/smokeping [FPing]
|  5241 132        5284 S    /usr/sbin/hald
|  5273 132        2224 S    hald-addon-acpi: listening on acpid socket /var/run/
`----

similar to:

  # ps -A -o pid,user,vsz,stat,commandps -A -o pid,user,vsz,stat,command

,----
|   PID USER        VSZ STAT COMMAND
|  4469 103        2764 Ss   /usr/bin/dbus-daemon --system
|  4969 127       15468 Ss   /usr/sbin/smokeping [FPing]
|  5241 132        5284 Ss   /usr/sbin/hald
|  5273 132        2224 S    hald-addon-acpi: listening on acpid socket /var/run/
`----

There are still some differences the way STAT is shown.


Cheers,

--
Cristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ps.c.patch
Type: text/x-diff
Size: 967 bytes
Desc: 
Url : http://busybox.net/lists/busybox/attachments/20080105/b8792f70/attachment.bin 


More information about the busybox mailing list