www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/07/27/06:20:42

Date: Mon, 27 Jul 1998 13:18:16 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
cc: DJGPP-WORKERS <djgpp-workers AT delorie DOT com>
Subject: Re: A call to `sync' inside `spawn'
In-Reply-To: <199807261715.TAA10692@father.ludd.luth.se>
Message-ID: <Pine.SUN.3.91.980727131758.29918E-100000@is>
MIME-Version: 1.0

On Sun, 26 Jul 1998, Martin Str|mberg wrote:

> I suppose that there is no way to flush the _write_ cache and not the
> read cache?

It's actually much worse: there's no standard way to flush DOS/Windows
cache at all.  Windows 9X is the only system that introduces a service
like this (and `_flush_disk_cache' uses it under LFN), but for other
cases, the disk is reset using a BIOS function, which experience shows
works for every disk cache I could lay my hands on.  (Each one of them
has its own service to do this, but it wasn't worth the hassle to go
to the lengths required to detect every known cache.)

In any case, the call to `sync' before running a child program doesn't
even need to flush the write cache.  It just needs to make sure output
to the same file/device doesn't appear out-of-order, for which the DOS
CommitFile function is enough.  IMHO, this is simply a DOS bug (it
should have done that in our stead, inside its Exec function) which we
are working around.  I can hardly believe any Unix box calls `sync',
since the `sync' system call is typically prohibitively expensive on
Unix (it takes several seconds even on fast machines).

Anyway, I'm not sure you can distinguish between ``read'' and
``write'' cache, since the cacje itself usually doesn't.  But if you
know how to flush the cache without invalidating it, please tell.  In
particular, the Windows 9X function 710Dh has several varieties, the
difference between which aren't clearly documented (see below).

--------D-21710D-----------------------------
INT 21 - Windows95 - RESET DRIVE
	AX = 710Dh
	CX = action (see #1642)
	DX = drive number
Return: CF clear
Note:	for compatibility with DOS versions prior to v7.00, the carry flag
	  should be set on call to ensure that it is set on exit
SeeAlso: AH=0Dh

(Table 1642)
Values for drive reset action:
 0000h	flush filesystem buffers for drive, and reset drive
 0001h	flush filesystem buffers and cache for drive, and reset drive
 0002h	remount DriveSpace volume

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019