[BusyBox] Implement fork using longjmp [PATCH]
Shaun Jackman
sjackman at gmail.com
Fri Mar 4 00:25:02 UTC 2005
I'm using busybox on a single process embedded system that does not
have the fork system call. This patch implements fork using longjmp
when CONFIG_FEATURE_IMPLEMENT_FORK_USING_LONGJMP is selected in the
configuration.
config CONFIG_FEATURE_IMPLEMENT_FORK_USING_LONGJMP
bool "Implement fork using longjmp"
default n
help
Implement fork, exit, and waitpid using macros. This is most
useful for systems missing these functions. Fork is implemented
using setjmp and exit using longjump. The exit value can be
returned by waitpid. The current implementation does not provide
for nested forks.
Cheers,
Shaun
2005-03-03 Shaun Jackman <sjackman at gmail.com>
* include/libbb.h (bb_fork, bb_exit, bb_wait): New function.
(fork, exit, _exit, waitpid): New macro.
* libbb/Makefile.in (LIBBB_SRC): Add fork.c
* libbb/fork.c: New file.
* shell/lash.c (run_command): Do not call close_all after forking
if CONFIG_FEATURE_IMPLEMENT_FORK_USING_LONGJMP is used.
* sysdeps/linux/Config.in: Add CONFIG_FEATURE_IMPLEMENT_FORK_USING_LONGJMP.
$ diffstat busybox-1.00-fork.diff
include/libbb.h | 14 +++++++++++
libbb/Makefile.in | 2 -
libbb/fork.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
shell/lash.c | 2 +
sysdeps/linux/Config.in | 10 ++++++++
5 files changed, 85 insertions(+), 1 deletion(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.00-fork.diff
Type: text/x-patch
Size: 4748 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20050303/6cc3615a/attachment.bin
More information about the busybox
mailing list