(Fwd) Re: DOSFS bug fixes, IDE drivers and sample released

Ralf Corsepius corsepiu at faw.uni-ulm.de
Fri May 23 05:05:32 UTC 2003


Am Fre, 2003-05-23 um 03.50 schrieb Chris Johns:
> Angelo Fraietta wrote:
> > Ralf Corsepius wrote:
> > 
> >> Have you tried using sync(2)?
> >>
> >> I.e. something similar to this:
> >>
> >> fwrite( ...);
> >> fclose(..);
> >>  
> >>
> >> sync();
> >>
> > I get a link error -- undefined reference to sync
> > 
> 
> I do not see a 'sync' but I see:
My fault, you both seem to be right. RTEMS seems to lack sync(2).

>    int fsync(int fd);
>    int fdatasync(int fd);
> 
> are present. Maybe you could try these.
> 
> 
> 
> Should these calls also flush the user-space buffered (libc) data ?

Good question, SUSv3 says:

fsync - synchronize changes to a file

int fsync(int fildes);

DESCRIPTION:

        The fsync() function shall request that all data for the open
        file descriptor named by fildes is to be transferred to the
        storage device associated with the file described by fildes in
        an implementation-defined manner. The fsync() function shall not
        return until the system has completed that action or until an
        error is detected.
        

I am not sure on how to interpret this, but I am inclined to read this
as "fsync shall imply fflush".


Anyway, I think, the actual problem in Angelo's case is shutting down
the "system too fast", before the fclose has completed (Assuming that
"restartRtems" issues a shutdown/reboot or similar).

If this presumption is true, waiting for a couple of seconds before
exiting the process rsp. issueing a "reboot/reset" should help. 

If this doesn't help, probably something in RTEMS's fclose or the
fs-code underneath is broken.

Ralf






More information about the users mailing list