Date: Wed, 10 Sep 1997 11:53:01 +0300 (IDT) From: Eli Zaretskii To: Diego Zuccato cc: djgpp-workers AT delorie DOT com Subject: Re: fread slowstart In-Reply-To: <34158A0F.1C24@bo.dada.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.