From 711ad9f92c1cf992c4a3d9f4f709bd692be7789c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 23 Jul 2009 04:03:17 -0400 Subject: create real common vfork() function Rather than force people to always implement their own vfork(), have the default implementation be sane. For now, only the Blackfin port uses the new code. Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/common/vfork.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'libc/sysdeps/linux/common/vfork.c') diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index eda76aeac..e7c920892 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -4,24 +4,30 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* Trivial implementation for arches that lack vfork */ #include #include #include -#ifdef __ARCH_USE_MMU__ +extern __typeof(vfork) __vfork attribute_hidden; -#ifdef __NR_fork -/* libc_hidden_proto(fork) */ +#ifdef __NR_vfork + +# define __NR___vfork __NR_vfork +_syscall0(pid_t, __vfork) + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) + +#elif defined __ARCH_USE_MMU__ && defined __NR_fork + +/* Trivial implementation for arches that lack vfork */ -extern __typeof(vfork) __vfork attribute_hidden; pid_t __vfork(void) { return fork(); } -/* libc_hidden_proto(vfork) */ + weak_alias(__vfork,vfork) libc_hidden_weak(vfork) -#endif #endif -- cgit v1.2.3