file i/o troubles

Gerke Kok gerke.kok at tpa-nl.com
Wed Apr 25 06:45:00 UTC 2001


Graet to see a fix.
Does this mean we have to patch version 4.5.0 too? Does it have the problem
too?
wkr,
Gerke

> -----Oorspronkelijk bericht-----
> Van: Joel Sherrill [mailto:joel.sherrill at OARcorp.com]
> Verzonden: dinsdag 24 april 2001 23:36
> Aan: Andrew Bythell
> CC: jennifer averett; RTEMS
> Onderwerp: Re: file i/o troubles
> 
> 
> Andrew Bythell wrote:
> > 
> > Hi -
> > 
> > Attached is a sample application that demonstrates the problem.
> 
> Ahhh.... test cases. :)
> 
> This was an interesting artifact of the file descriptors
> not being completely reinitialized.  The fix was 1 line 
> to memfile_open to set the file size field in the 
> libio structure.  I also took the liberty to modify
> rtems_libio_allocate() to clear out offset and size 
> to remove the now redundant iop->offset=0 from open().
> 
> The tftp and any other filesystems need to be updated to
> set the file size in their open handler.  I do not know
> how to do this for tftp.
> 
> Thanks for the bug report.  It took a nice example to test it.
> 
> --joel
>  
> > Andrew.
> > 
> > jennifer averett wrote:
> > >
> > > Do you have a complete test that shows this problem that you
> > > could submit?  It is much easer to reproduce and
> > > fix problems that way.
> > >
> > > Thanks
> > > Jennifer
> > >
> > > Andrew Bythell wrote:
> > >
> > > > Hello -
> > > >
> > > > I am seeing strange behaviour when writing to files 
> using the IMFS and
> > > > rtems-ss-20010326.  I had this same problem with 
> earlier snapshots too.
> > > > Consider:
> > > >
> > > > FILE *fp = fopen("somefile", "w");
> > > > fprintf(fp, "line1\n");
> > > > fclose();
> > > > fp = fopen("somefile", "a");
> > > > fprintf("fp, "line2\n");
> > > > fclose();
> > > >
> > > > The first time I call this routine, 'somefile' is 
> created and contains:
> > > >
> > > > line1
> > > > line2
> > > >
> > > > which is fine.  Subsequent calls, using the same or 
> different filename,
> > > > insert junk (NULL characters) between line1 and line2:
> > > >
> > > > line1
> > > > 
^@^@^@^@^@^@...
> > > > line2
> > > >
> > > > Can anyone offer an explanation and/or solution?
> > > >
> > > > --
> > > > Andrew Bythell
> > > > Nortel Networks    System Verification
> > > > Ottawa, Ontario Canada    esn.39.56930
> > > > tel.613.765-6930      fax.613.763-7795
> > 
> >   
> --------------------------------------------------------------
> ----------
> >                    Name: ftest.tar.gz
> >    ftest.tar.gz    Type: GNU Zip (application/x-gzip)
> >                Encoding: base64
> 
> -- 
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>    Support Available             (256) 722-9985
> 



More information about the users mailing list