[git commit] vfork: Use clone if arch does not have the vfork syscall

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Feb 20 12:45:12 UTC 2013


commit: http://git.uclibc.org/uClibc/commit/?id=58570fc8e1fd601f15be5758ab95013d56771804
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libc/sysdeps/linux/common/vfork.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c
index a70ed4a..a85156d 100644
--- a/libc/sysdeps/linux/common/vfork.c
+++ b/libc/sysdeps/linux/common/vfork.c
@@ -10,7 +10,24 @@
 # include <unistd.h>
 extern __typeof(vfork) __vfork attribute_hidden;
 
-# ifdef __NR_vfork
+# if defined __NR_clone && !defined __NR_vfork
+# include <signal.h>
+# include <sys/types.h>
+
+pid_t __vfork(void)
+{
+	pid_t pid = INLINE_SYSCALL(clone, 4, SIGCHLD,
+				   NULL, NULL, NULL);
+
+	if (pid < 0)
+		return -1
+
+	return pid;
+}
+weak_alias(__vfork, vfork)
+libc_hidden_weak(vfork)
+
+# elif defined __NR_vfork
 #  define __NR___vfork __NR_vfork
 _syscall0(pid_t, __vfork)
 # else


More information about the uClibc-cvs mailing list