[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] how to use vfork() system call instead of fork() ???



Hi Ujwal,

Ujwal wrote:

> can any one tell me how to use vfork() system call instead of fork();
> what are the parameters im supposed to take care of during the change?

If your app does an exec immediately after the fork, then it's usually
really easy.  Just replace fork with vfork, and that's about it.

If not, then life is more difficult - you need to very carefully audit,
and sometimes re-factor, the application flow around the fork.

Things to remember:

1. The parent blocks until the child calls exec() or _exit()

2. The child shares all data and stack with parent, so must not return
from a function call (unwinds the stack).

3. Any variable modifications (local or global) by the child must be
carefully checked for side effects in the parent.  Watch for side
effects in library calls, like the "errno" variable.

I hope this helps,

John


___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/