: The parent process's data segment is not copied, just re-alloced, and
: rather than returning to the parrent process, fork sleeps on the parents
: child_wait wait queue.

        Let me try to remind myself of the vfork semantics....  Basically,
rather than copying the data segment on real computers the OS sets
the data segment page tables to copy-on-write, so that the data segment
copy time and space is saved, since it's all going to be replaced by the
following exec, right?

        What do you mean when you just re-alloc the parent data segment?
You mean you increment the use count?

: All this seems to work just fine, but to make sure the parents stack
: does not get corrupted by the child before it execs, I make a copy
: of the bottom 100 bytes on the stack, below the stack, for the child to
: use.
: 
        Some programs are compiled with -H to use a very small data/stack
segment.  There is the chance that there won't be the stack available
for this.  Are you concerned that if the child executes a return it will
pop too much off the stack, or is it actual corruption you're worried about?

Greg

Reply via email to