SUSv3 touch+who

Denys Vlasenko vda.linux at googlemail.com
Mon Mar 23 07:38:32 UTC 2009


On Sunday 22 March 2009 19:08, walter harms wrote:
> Hi Denis,
> my SUSv3 conform versions of touch+who had some rounds on the bb mailing list.
> I think you can now move them into the svn.

The latest who.c I found in my mail is in this mail:

Message-ID: <49952AA5.6050001 at bfs.de>
Date: Fri, 13 Feb 2009 09:09:09 +0100
From: walter harms <wharms at bfs.de>

Ok, I'm working on it...

...an hour later...

First thing I did is I removed lots of whitespace damage.
See attached 2.patch (13 kilobytes).

Then I build it, fixed one warning (you have to use CONFIG_WERROR
before submitting code), and I see this:

function                                             old     new   delta
who_main                                             292     771    +479
print_ut                                               -     441    +441
time2str                                               -      44     +44
_stat                                                  -      40     +40
ttyname                                                -      33     +33
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 1/0 up/down: 1037/0)           Total: 1037 bytes
   text    data     bss     dec     hex filename
 821187     476    7616  829279   ca75f busybox_old
 822432     476    7648  830556   cac5c busybox_unstripped

Not very encouraging.

Okay, let's see how it performs.

Coreutils 6.9:

# /usr/bin/who -a
LOGIN      /dev/tty6    2009-03-23 06:11              1048 id=v/t
root     + tty2         2009-03-23 06:12 02:21         902

Busybox before patch:

# ./busybox who -a
USER       TTY      IDLE      TIME            HOST
LOGIN      /dev/tty6 ?         Mar 23 06:11:32
root       tty2     02:21     Mar 23 06:12:25

After patch:

# ./busybox who -a
(nothing)

This is not good.

Strace:

open("/var/run/utmp", O_RDWR)           = 3
fcntl(3, F_GETFD)                       = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
lseek(3, 0, SEEK_SET)                   = 0
read(3, "\6\0\0\0\30\4\0\0/dev/tty6\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\7\0\0\0\206\3\0\0tty2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "", 384)                        = 0
_exit(0)   

Please find my /var/run/utmp attached.

Are you willing to debug this problem?
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 13515 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090323/027f84ce/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utmp
Type: application/octet-stream
Size: 768 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090323/027f84ce/attachment.obj>


More information about the busybox mailing list