X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: 048321887-0001 AT t-online DOT de (Udo Kuhnt) Newsgroups: comp.os.msdos.djgpp Subject: Re: Using DR-DOS fork in DJGPP Date: 27 May 2004 00:43:26 -0700 Organization: http://groups.google.com Lines: 38 Message-ID: <4d201f78.0405262343.1d5baa0e@posting.google.com> References: <7704-Wed19May2004233123+0300-eliz AT gnu DOT org> <4d201f78 DOT 0405191847 DOT 6697f90d AT posting DOT google DOT com> <4d201f78 DOT 0405200540 DOT 307bb15a AT posting DOT google DOT com> <9743-Thu20May2004201223+0300-eliz AT gnu DOT org> <4d201f78 DOT 0405210913 DOT 26a5ffcb AT posting DOT google DOT com> <4d201f78 DOT 0405230527 DOT 3f17fb4b AT posting DOT google DOT com> <2719-Sun23May2004185224+0300-eliz AT gnu DOT org> NNTP-Posting-Host: 217.93.40.24 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1085643806 18839 127.0.0.1 (27 May 2004 07:43:26 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Thu, 27 May 2004 07:43:26 +0000 (UTC) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Brian Inglis wrote in message news:... > On Sun, 23 May 2004 18:52:25 +0200 in comp.os.msdos.djgpp, "Eli > Zaretskii" wrote: > > >> From: 048321887-0001 AT t-online DOT de (Udo Kuhnt) > >> Newsgroups: comp.os.msdos.djgpp > >> Date: 23 May 2004 06:27:29 -0700 > >> > >> If a file had been opened by the parent process, it should also be open for > >> the child process which can access it using the same handle. If the child > >> closes the file in its VM using the handle, it will still be open in the > >> parent's VM. > > > >And the latter means that just copying is not good: it is a frequent > >case that the child closes one or more of inherited handles that it > >doesn't need. You don't want that to invalidate the handle in the > >parent, since existing programs don't expect such a calamity. > > > >Se perhaps writing a (16-bit real-mode) program to test this aspect > >would be a useful first step. > > Copying the VM is not sufficient: the OS also has to know which file > handles the parent process has open, and set up the child process so > that it has the same open file handles. This is exactly what "copying the VM" means - all data structures of the old VM are being copied into the the new one, including the file data structures. So the handles of the child are an exact copy of the parent's ones. > Alternatively, the fork routine, after copying the VM, has to look at > the child process' file handle table, and reestablish the open file > handles. This is not necessary. See above. > Similarly with any other OS resources the child is to "inherit". What other resources are you referring to?