delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/05/21/13:16:03

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: 21 May 2004 10:13:22 -0700
Organization: http://groups.google.com
Lines: 37
Message-ID: <4d201f78.0405210913.26a5ffcb@posting.google.com>
References: <4d201f78 DOT 0405181653 DOT 16a677b6 AT posting DOT google DOT com> <uoeok2abs DOT fsf AT gnu DOT org> <4d201f78 DOT 0405191158 DOT 63550b51 AT posting DOT google DOT com> <7704-Wed19May2004233123+0300-eliz AT gnu DOT org> <4d201f78 DOT 0405191847 DOT 6697f90d AT posting DOT google DOT com> <u3c5vbous DOT fsf AT gnu DOT org> <4d201f78 DOT 0405200540 DOT 307bb15a AT posting DOT google DOT com> <9743-Thu20May2004201223+0300-eliz AT gnu DOT org>
NNTP-Posting-Host: 217.227.194.231
X-Trace: posting.google.com 1085159603 8619 127.0.0.1 (21 May 2004 17:13:23 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Fri, 21 May 2004 17:13:23 +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" <eliz AT gnu DOT org> wrote in message news:<9743-Thu20May2004201223+0300-eliz AT gnu DOT org>...
> > From: 048321887-0001 AT t-online DOT de (Udo Kuhnt)
> > Newsgroups: comp.os.msdos.djgpp
> > Date: 20 May 2004 06:40:00 -0700
> > 
> > The documentation is not very detailed, but as I understand it, X_PCreate
> > creates a new process (or rather a new thread) in the same address room,
> > while Z_Dom_Fork copies the entire address room, which probably includes the
> > file handles of the calling process.
> 
> Z_Dom_Fork is clearly documented to run the same program, but it
> creates a process in a separate VM, which is not very helpful for us,
> since there's no way to inherit file handles between VMs (otherwise we
> could have easily implemented `fork' on Windows by using the Windows
> `start' command).  If our `fork' doesn't inherit file handles, the
> programs that use it will not work, as on Unix the child always
> inherits the parent's handles.

Well, I do not know anything about the start command you mentioned, but I
thought that if Z_Dom_Fork makes an exact copy of the first 4 MB of the
address room, then it would also copy the file handles. Anyway, I agree with
you that creating a new VM is probably not what we would want in this
context.

> It would be interesting to see what happens with this aspect of the
> process created by X_PCreate.

Since the child and parent process share the same VM, the file handles would
probably be the same for both processes. The child could share a data segment
with the parent, making it theoretically possible to pass the handles to it.
Now, how could one verify this? Perhaps by a test program that opens a file,
then creates a new process with X_PCreate. The processes would have to share
the parent's process and file handle. The processes check whether they are
parent or child by comparing their process handle with the parent's, then the
child tries to read some data from the file using the parent's file handle.
If this succeeds, the X_PCreate function could be used to fork a new process
in DJGPP, right?

- Raw text -


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