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 01:04:46 -0700 Organization: http://groups.google.com Lines: 33 Message-ID: <4d201f78.0405270004.9eec890@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.227.203.36 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1085645086 20227 127.0.0.1 (27 May 2004 08:04:46 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Thu, 27 May 2004 08:04:46 +0000 (UTC) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote in message news:... > > From: Brian Inglis > > Newsgroups: comp.os.msdos.djgpp > > Date: Mon, 24 May 2004 00:11:44 GMT > > > > Alternatively, the fork routine, after copying the VM, has to look at > > the child process' file handle table, and reestablish the open file > > handles. > > I don't see how this could be done, at least not easily. We don't > need just to have the same file open, we need their file handles to > refer to the same entry in the DOS System File Table (SFT), so that if > the child moves the file position (by, e.g., reading or seeking into > the file), the file position of the parent is moved as well to the > same place. I.e., we need the equivalent of the `dup' system call > (except that we cannot call `dup' because it doesn't work with handles > from another process). I do not think that in Unix, file position is shared between processes. I think that if one process reads from a file at one position, another one can still read it at another position. Otherwise, it would probably result in a terrible mess. ;-) This is also what we have in DR-DOS; copying the VM also copies the SFT, so each VM has its own virtual SFT. > Therefore, if the DR-DOS's fork doesn't handle these problems, there's > no way we could, unless we know enough about DR-DOS internals to > manipulate the SFT entries directly. By definition of a VM, it does. And so there is no need to mess with the entries in the SFT directly. Of course we could have the new root process using dup on all of its inherited file handles, but it probably would not change much.