Quoth Muthuselvan Sivam:
> We're having a function call fork_dispatcher inside a function loop() in 
> the avahi-autoip main.c file, which will create a child process. This 
> child will create a pipe to read the IPv4LL address from the parent, 
> which writes the address, interface name etc, into this pipe. Since our 
> child (created by vfork) is currently running and waiting in fread (a 
> blocking call), it is not giving space to the parent to write the data, 
> which the child expects.
> 
> In No-MMU systems there is no fork, hence we have to use vfork, which 
> will block the parent untill child calls _exit.

To get "real" fork behaviour out of vfork (such that both parent and child
are running simultaneously), you must make the child process call one of the
exec functions (usually as soon as possible after the vfork).

Typically, you would re-exec the same binary with a special command-line
parameter telling it to perform the child task workload instead of normal
operation.  Or to save a bit of memory (especially if the child task is
simple), execute a separate helper binary instead.

Note however that after the exec the child process will have its own clean
memory space, so you can't have it inherit state from the parent that way;
you'll either need to pass anything required via the command line or use IPC
mechanisms such as pipes or explicit shared-memory blocks.



_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to