Mail Archives: djgpp/2004/05/27/04:30:10
Brian Inglis <Brian DOT Inglis AT SystematicSw DOT Invalid> wrote in message news:<f7f2b0tp6atvgj7rgqg83bo9mo2asdsndf AT 4ax DOT com>...
> On Sun, 23 May 2004 18:52:25 +0200 in comp.os.msdos.djgpp, "Eli
> Zaretskii" <eliz AT gnu DOT org> 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?
- Raw text -