delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/27/07:30:16

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: file system change notification
Date: 27 Aug 2001 10:55:35 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 37
Message-ID: <9md8v7$n7c$1@nets3.rz.RWTH-Aachen.DE>
References: <Xns9109B74F0D8A6ASINANUNUR AT 132 DOT 236 DOT 56 DOT 8>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 998909735 23788 137.226.32.75 (27 Aug 2001 10:55:35 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 27 Aug 2001 10:55:35 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

A. Sinan Unur <asu1 AT cornell DOT edu> wrote:

> I can do this in Windows using  the code snippet included at the bottom of 
> this post. However, I would like to use djgpp. I am assuming there is no 
> similar API in the libraries, and hence I should chain some DOS interrupts. 
> (I could sit in a tight loop reading directory contents but I could miss 
> some creations/deletions if they happen rapidly).

I have serious doubts that DJGPP would be the right tool for this
particular task.  It may even be completely impossible, depending upon
the type of environment you're targetting.

The basic problem is that DOS is a single-task OS, at its heart.
I.e. once your watcher program is running, there cannot be anything
else running at the same time, doing any file I/O.  I.e., as far as
DOS is concerned, the need for this kind of hook function in the OS
simply doesn't exist, so you shouldn't expect any pre-fabricated, let
alone documented mechanism for doing this.

The only exception from this would be if your monitoring program were
a TSR --- but that's a lot harder to do using DJGPP than with a 16bit
compiler (the freely available TurboC 2.0, e.g.).  You'ld have to hook
your own interrupt service routine into Int21h itself, I suspect.
Checking function numbers to see if there's any _open()/_create()
happening in your monitored directory, then chaining to the original
Int21h handler.

Now, you may reply: "but there *is* multitasking, as I'm actually
running Win9x!". But in that case, you're actually running several
independant instances of DOS itself, not several programs controlled
by one DOS.  These instances don't know anything of each other (or at
least, they're not supposed to), so you can't watch what the other one
may be doing.  So if you're running Windows, only a Windows app using
your shown code snippet could possibly to this kind of monitoring.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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