From: P D H (pdh@netcom.com)
Date: 05/14/93


From: pdh@netcom.com (P D H)
Subject: Re: floppy overbuffering
Date: Fri, 14 May 1993 08:46:50 GMT

sct@dcs.ed.ac.uk (Stephen Tweedie) writes:

>You could always try doing a raw sync() followed by a sleep for a few
>seconds, but this is less than ideal.

Unfortunately it slows things down to sleep.

What I want to show is the current progress of floppy I/O in much the same
way as fdformat does.

>The fsync() call is in the latest system library, but currently it just
>does a sync(). Once fsync() becomes standard the library can be
>upgraded transparently to provide the necessary functionality.
>
>In the mean time, you can always use the kernel stub for fsync() to
>detect whether or not it is there already. For example:
>
>#include <linux/unistd.h>
>
>_syscall1(int, fsync, int, fd);
>
>int try_to_fsync(int fd)
>{
> int rcode;
> rcode = fsync(fd);
> if (rcode && errno==ENOSYS)
> rcode = sync();
> return rcode;
>}

Why not also have the fsync() function do the same thing with the kernel?
If the kernel interface for fsync fails, then fall back to regular sync().

But it has to work in such a way that at the very minimum, a binary
compiled with this library will work on the current kernels as well as
the future kernels.

-- 
/***********************************************************************\
| Phil Howard  ---  KA9WGN  ---  pdh@netcom.com   |   "The problem with |
| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/