www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/09/10/04:53:17

Date: Wed, 10 Sep 1997 11:53:01 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Diego Zuccato <dz AT bo DOT dada DOT it>
cc: djgpp-workers AT delorie DOT com
Subject: Re: fread slowstart
In-Reply-To: <34158A0F.1C24@bo.dada.it>
Message-ID: <Pine.SUN.3.91.970910115211.9494D-100000@is>
MIME-Version: 1.0

On Tue, 9 Sep 1997, Diego Zuccato wrote:

> Can't you set a descriptor in the global area ?

I suspect that some DPMI servers won't let you mingle with the GDT.  
Charles?

> But, hey ! when spawning (if no multitasking is supported) we are always
> the SAME process, for the DPMI server, so they should be valid in the
> child too.

This is incorrect.  The child program is a different process, it has
its own DPMI-related structures; in particular, the selectors are
different.  It even has its own PSP, so even DOS knows they are two
different programs.

Don't confuse multi-tasking with multiple processes.  No multi-tasking
means that you cannot easily pass control from one program to another
while both are in memory.  But you still have two different programs
loaded, it's just that the parent is suspended until the child exits.

> > A single tb is not good enough, even if there's no multitasking, because
> > the child program would overwrite the contents of the buffer, and when
> Uh, I thought a tb is something temporary. It's used just to pass data
> to/from dos, but data isn't stored there for a 'long' time (eg 2 calls
> to read() ) : it's copied to memory over the first MB. Isn't it ?

Yes, but remember that while the child runs, the parent is parked
inside a single DOS call--the call to Exec function that runs the
child.  So, from the parent's point of view, only a single function
call was done, and the data in the tb is supposed to be the same.

It is the same as a single call to `_write': when `_write' returns,
you'd expect to find the same data in the tb as what you put there.

> Why should it expect that the child doesen't change the tb?

Because nobody said it does.  Suppose you put something in a buffer.
Would you expect the contents of the buffer to change under your feet,
unless the docs says so?  tb is just another buffer.  It is documented
to be overwritten by every system call, but not *inside* system calls.

Of course, you could save and restore the contents of tb, but that's
not how it works now.

- Raw text -


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