about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/linux/clone.c19
-rw-r--r--src/thread/arm/clone.s3
-rw-r--r--src/thread/clone.c7
-rw-r--r--src/thread/i386/clone.s3
-rw-r--r--src/thread/microblaze/clone.s5
-rw-r--r--src/thread/x86_64/clone.s3
6 files changed, 22 insertions, 18 deletions
diff --git a/src/linux/clone.c b/src/linux/clone.c
new file mode 100644
index 00000000..b9e55945
--- /dev/null
+++ b/src/linux/clone.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <unistd.h>
+#include "pthread_impl.h"
+#include "syscall.h"
+
+int clone(int (*func)(void *), void *stack, int flags, void *arg, ...)
+{
+	va_list ap;
+	pid_t *ptid, *ctid;
+	void  *tls;
+
+	va_start(ap, arg);
+	ptid = va_arg(ap, pid_t *);
+	tls  = va_arg(ap, void *);
+	ctid = va_arg(ap, pid_t *);
+	va_end(ap);
+
+	return __syscall_ret(__clone(func, stack, flags, arg, ptid, tls, ctid));
+}
diff --git a/src/thread/arm/clone.s b/src/thread/arm/clone.s
index daf8f556..d146999b 100644
--- a/src/thread/arm/clone.s
+++ b/src/thread/arm/clone.s
@@ -1,10 +1,7 @@
 .text
 .global __clone
-.weak clone
 .type   __clone,%function
-.type   clone,%function
 __clone:
-clone:
 	stmfd sp!,{r4,r5,r6,r7}
 	mov r7,#120
 	mov r6,r3
diff --git a/src/thread/clone.c b/src/thread/clone.c
index 339e28a3..be80c8ea 100644
--- a/src/thread/clone.c
+++ b/src/thread/clone.c
@@ -1,10 +1,7 @@
 #include <errno.h>
-#include "libc.h"
+#include "pthread_impl.h"
 
 int __clone(int (*func)(void *), void *stack, int flags, void *arg, ...)
 {
-	errno = ENOSYS;
-	return -1;
+	return -ENOSYS;
 }
-
-weak_alias(__clone, clone);
diff --git a/src/thread/i386/clone.s b/src/thread/i386/clone.s
index bebf01a3..52fe7efb 100644
--- a/src/thread/i386/clone.s
+++ b/src/thread/i386/clone.s
@@ -1,10 +1,7 @@
 .text
 .global __clone
-.weak clone
 .type   __clone,@function
-.type   clone,@function
 __clone:
-clone:
 	push %ebp
 	mov %esp,%ebp
 	push %ebx
diff --git a/src/thread/microblaze/clone.s b/src/thread/microblaze/clone.s
index 030a9c31..13448a33 100644
--- a/src/thread/microblaze/clone.s
+++ b/src/thread/microblaze/clone.s
@@ -1,14 +1,11 @@
 .global __clone
-.weak clone
 .type   __clone,@function
-.type   clone,@function
 
 # r5, r6, r7, r8, r9, r10, stack
 # fn, st, fl, ar, pt, tl, ct
 # fl, st, __, pt, ct, tl
 
 __clone:
-clone:
 	andi    r6, r6, -16
 	addi    r6, r6, -16
 	swi     r5, r6, 0
@@ -23,7 +20,7 @@ clone:
 	beqi	r3, 1f
 	rtsd    r15, 8
 	nop
-	
+
 1:	lwi     r3, r1, 0
 	lwi     r5, r1, 4
 	brald   r15, r3
diff --git a/src/thread/x86_64/clone.s b/src/thread/x86_64/clone.s
index 4db081cd..ee59903a 100644
--- a/src/thread/x86_64/clone.s
+++ b/src/thread/x86_64/clone.s
@@ -1,10 +1,7 @@
 .text
 .global __clone
-.weak clone
 .type   __clone,@function
-.type   clone,@function
 __clone:
-clone:
 	xor %eax,%eax
 	mov $56,%al
 	mov %rdi,%r11