[PATCH] crond for no-mmu
Alex Landau
landau_alex at yahoo.com
Sun Dec 16 23:21:03 PST 2007
----- Original Message ----
> From: Mike Frysinger <vapier at gentoo.org>
> To: busybox at busybox.net
> Cc: Alex Landau <landau_alex at yahoo.com>
> Sent: Thursday, December 13, 2007 9:32:00 AM
> Subject: Re: [PATCH] crond for no-mmu
>
> On Tuesday 11 December 2007, Alex Landau wrote:
> > The attached trivial patch changes fork() to vfork() in two places in
> > crond.c. With this change, cron works on no-mmu. Maybe it's
> even
>
worth
> > adding an #if BB_MMU to choose between fork and vfork...
>
> this isnt completely correct. you cannot use exit() in vfork
> children.
>
the
> dupe2()/close() looks suspicious, but i havent audited the source
> to
>
make
> sure it's OK. the ChangeUser() is probably OK for vfork-ed children.
> crondlog() cannot call exit() either.
> -mike
>
While using exit() with vfork() may lead to bad situations, I think we're fine in this case.
There are no atexit()s; dup2(), close() are fine as they do not affect the memory map,
but the descriptor table, and crondlog exit()s only from the parent (unless I missed anything).
I do agree that a cleaner approach would be to audit and change all crond code,
but that would mean A LOT of #ifdefs and different versions of several functions that differ
only in exit() vs. _exit(). And, we had a similar dilemma way back in September when changing
perror() and _exit() to perror_msg_and_die() in open_transformer(), and the decision was that it's OK.
Not to mention that "it works for me" :-)
Alex
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the busybox
mailing list