[uClinux-dev] Daemonize a process
davidm at snapgear.com
Wed Mar 12 18:02:11 EST 2003
Jivin Stuart MacDonald lays it down ...
> The classic sequence of:
> doesn't work in uClinux because vfork blocks the parent until an _exit
> or execve().
> What I end up with is two D state processes (zombies) and the final
> child still parented by its real parent instead of init.
> I've checked a number of /user apps, but haven't found one that wants
> to do the same thing, so no example code to follow.
There are a couple of ways to achieve this:
* have init start your daemon
* have your daemon exec itself with a special option to become a daemon.
> Am I missing a simple solution, or is this just not possible until
> uClinux gets fork()? If so, what's required to get fork working? The
> comment in arch/m68knommu/kernel/process.c states that it almost
> works, but doesn't specify which bit is failing.
fork on uClinux is not possible. It gives a short term impression of
working, before your system dies horribly. It cannot be fixed in any
practical way and you can find all the reasons why in the uClinux-dev
David McCullough: Ph: +61 7 3435 2815 http://www.SnapGear.com
davidm at snapgear.com Fx: +61 7 3891 3630 Custom Embedded Solutions + Security
More information about the uClinux-dev