From: Markos Chandras <markos.chand...@imgtec.com>

Signed-off-by: Markos Chandras <markos.chand...@imgtec.com>
---
 libc/sysdeps/linux/common/fork.c  | 17 ++++++++++++++++-
 libc/sysdeps/linux/common/stubs.c |  2 +-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c
index 14e00a2..7322581 100644
--- a/libc/sysdeps/linux/common/fork.c
+++ b/libc/sysdeps/linux/common/fork.c
@@ -9,10 +9,25 @@
 
 #include <sys/syscall.h>
 #include <unistd.h>
+#include <unistd.h>
+#include <signal.h>
 
 #ifdef __ARCH_USE_MMU__
 
-#ifdef __NR_fork
+#if defined(__NR_clone) && !defined(__NR_fork)
+pid_t __libc_fork(void)
+{
+       pid_t pid = INLINE_SYSCALL(clone, 4, SIGCHLD, NULL, NULL, NULL);
+
+       if (pid<0)
+               return -1;
+
+       return pid;
+}
+weak_alias(__libc_fork, fork)
+libc_hidden_weak(fork)
+
+#elif defined(__NR_fork)
 #define __NR___libc_fork __NR_fork
 extern __typeof(fork) __libc_fork;
 _syscall0(pid_t, __libc_fork)
diff --git a/libc/sysdeps/linux/common/stubs.c 
b/libc/sysdeps/linux/common/stubs.c
index b7e0357..9cb8de0 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -105,7 +105,7 @@ make_stub(fdatasync)
 make_stub(flistxattr)
 #endif
 
-#ifndef __NR_fork
+#if !defined(__NR_fork) && !defined(__NR_clone)
 make_stub(fork)
 #endif
 
-- 
1.8.0


_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to