Mail Archives: djgpp/2004/05/29/06:41:35
> From: 048321887-0001 AT t-online DOT de (Udo Kuhnt)
> Newsgroups: comp.os.msdos.djgpp
> Date: 27 May 2004 00:43:26 -0700
> >
> > 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.
I already explained in another message in this thread that a copy is
not what we want, if we want to emulate the Posix semantics of `fork'.
File handle inheritance is not a simple copy.
Btw, the documentation of Z_DomFork (which is what we are discussing,
I presume) does not say that it simply copies the current VM, it says:
Z_DomFork creates an exact copy of the current domain, then creates
a process in it and starts the process executing. The process is
specified in the PCREATE_PBLK which is identical to that used in the
X_PCreate call [...]
So after the VM is copied, a new process is started in it. Whether
this is the same process as the one that called Z_DomFork, and if so,
whether it begins from the same point where we called Z_DomFork, is
left unspecified.
So the question which started this thread, namely: how we can write
an emulation of the Posix `fork' using this API, still stands.
> > Similarly with any other OS resources the child is to "inherit".
>
> What other resources are you referring to?
Signal handlers, for one.
- Raw text -