home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news.service.uci.edu!ucivax!news.claremont.edu!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
- From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
- Newsgroups: comp.os.vms
- Subject: Re: flushing in VAXC and DECC
- Date: 29 Dec 1992 23:43:17 GMT
- Organization: HST Wide Field/Planetary Camera
- Lines: 53
- Distribution: world
- Message-ID: <1hqnqlINNg7b@gap.caltech.edu>
- References: <1hjtr9INN34t@gap.caltech.edu> <1992Dec27.200611.24473@nntpd2.cxo.dec.com> <1hn91uINNnna@gap.caltech.edu>,<3088@anprda.atson.asahi-np.co.jp>
- Reply-To: carl@SOL1.GPS.CALTECH.EDU
- NNTP-Posting-Host: sol1.gps.caltech.edu
-
- > Anyway, this does not invalidate my argument. Since fsync is named
- >after the unix function (though actual semantics is quite different; as
- >you know, on unix "written" data are immediatedly shared among processes.
- >Fsync() merely guarantees the data is on disk and can be considered safe
- >from crash), it should reasonably imitate unix behaviour - no wonder you
- >need fflush() before fsync().
-
- Well, as I pointed out to Jerry Leichter in e-mail, I think a better emulation
- of UNIX behavior would involve having (groan) yet another set of I/O buffers in
- the VAXC RTL, so we'd have:
- 1) The buffers associated with emulation of the UNIX standard I/O
- library (e.g. printf(), etc.);
- 2) The buffers associated with emulation of UNIX I/O system calls
- (e.g., write(), etc.);
- 3) The actual RMS buffers.
- Doing it that way, fflush() would simply force the data from the first type of
- buffer into the corresponding buffer of the second type, while fsync() would
- force the contents of the second type of buffer into the RMS buffers and
- execute a SYS$FLUSH. Doing it that way would make porting code somewhat easier,
- since then the emulation of the UNIX I/O system would be considerably more
- accurate.
-
- Of course, that would make the VAXC RTL I/O routines even slower than they
- already are.
-
- It would also have been nice if there were an equivalent of fflush() that works
- with a file descriptor rather than a file pointer. Of course, the workaround
- is to do an fdopen() to get a file pointer to pass to fflush():
-
- #include stdio
- main()
- { int i, fd;
- FILE *fp;
-
- { fd = creat("TEST.DAT");
- write(fd, "This is a test.\n", 16);
- fp = fdopen(fd, "a");
- fflush(fp);
- fsync(fd);
- sleep(30);
- }
- }
-
- It'd also be nice if DEC would clarify the documentation for fsync() that was
- previously mentioned in this thread.
- --------------------------------------------------------------------------------
- Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
-
- Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My
- understanding of astronomy is purely at the amateur level (or below). So
- unless what I'm saying is directly related to VAX/VMS, don't hold me or my
- organization responsible for it. If it IS related to VAX/VMS, you can try to
- hold me responsible for it, but my organization had nothing to do with it.
-