[BusyBox] Re: [BusyBox-cvs] cvs commit to busybox by bug1

Glenn McGrath bug1 at optushome.com.au
Fri Oct 5 07:02:40 UTC 2001


On Fri, 5 Oct 2001 05:36:47 -0600
Erik Andersen <andersen at codepoet.org> wrote:

> On Thu Oct 04, 2001 at 11:24:19PM -0600, bug1 at busybox.net wrote:
> > Repository: busybox
> > who:        bug1
> > time:       Thu Oct  4 23:24:19 MDT 2001
> > 
> > 
> > Log Message:
> > 
> > Use wfopen instead of fopen & error_msg, saves 64 bytes
> 
> Wow Glenn, you've been busy!  Thanks!
> 
>  -Erik
> 
>

I was just looking at the cvs web page and thought i would have a look at
some applets that havent been touched for a while.

I also changed freeramdisk, but ive been having second thoughts, 

I changed this
        if ((f = open(argv[1], O_RDWR)) == -1) {
                perror_msg_and_die("cannot open %s", argv[1]);
        }
        if (ioctl(f, BLKFLSBUF) < 0) {
                perror_msg_and_die("failed ioctl on %s", argv[1]);
        }

to this
        f = xfopen(argv[1], "r+");
        
        if (ioctl(fileno(f), BLKFLSBUF) < 0) {
                perror_msg_and_die("failed ioctl on %s", argv[1]);
        }

Which saved 32 Bytes, but then i tried applying the same technique to this
section of fdflush

        if ((fd = open(*argv, 0)) < 0)
                perror_msg_and_die("%s", *argv);

        if (ioctl(fd, FDFLUSH, 0))
                perror_msg_and_die("%s", *argv);


But it didnt make any difference, so im not really sure whats going on
there.

The only difference between fdflush and freeramdisk is that they use a
difference ioctl and mode, maybe the applets could be merged somehow ?

Glenn










More information about the busybox mailing list