diff options
Diffstat (limited to 'libc/sysdeps')
-rw-r--r-- | libc/sysdeps/linux/common/fork.c | 18 | ||||
-rw-r--r-- | libc/sysdeps/linux/cris/fork.c | 12 | ||||
-rw-r--r-- | libc/sysdeps/linux/ia64/fork.S | 14 | ||||
-rw-r--r-- | libc/sysdeps/linux/sparc/fork.S | 17 | ||||
-rw-r--r-- | libc/sysdeps/linux/xtensa/fork.c | 17 |
5 files changed, 47 insertions, 31 deletions
diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 88958b144..fa1f4affa 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -8,15 +8,15 @@ */ #include <sys/syscall.h> -#include <unistd.h> -#ifdef __ARCH_USE_MMU__ - -#ifdef __NR_fork -#define __NR___libc_fork __NR_fork -_syscall0(pid_t, __libc_fork) -weak_alias(__libc_fork,fork) +#if defined __NR_fork && defined __ARCH_USE_MMU__ +# include <unistd.h> +# include <cancel.h> +_syscall0(pid_t, fork) +# ifdef __UCLIBC_HAS_THREADS__ +strong_alias(fork,__libc_fork) libc_hidden_weak(fork) -#endif - +# else +libc_hidden_def(fork) +# endif #endif diff --git a/libc/sysdeps/linux/cris/fork.c b/libc/sysdeps/linux/cris/fork.c index 19aa17271..7aff48974 100644 --- a/libc/sysdeps/linux/cris/fork.c +++ b/libc/sysdeps/linux/cris/fork.c @@ -6,13 +6,17 @@ #include "sysdep.h" -#define __NR___libc_fork __NR_fork -SYSCALL__ (__libc_fork, 0) +#if defined __NR_fork && defined __ARCH_USE_MMU__ +# include <cancel.h> + +SYSCALL__ (fork, 0) /* R1 is now 0 for the parent and 1 for the child. Decrement it to make it -1 (all bits set) for the parent, and 0 (no bits set) for the child. Then AND it with R0, so the parent gets R0&-1==R0, and the child gets R0&0==0. */ /* i dunno what the blurb above is useful for. we just return. */ __asm__("ret\n\tnop"); -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) + +lt_strong_alias(fork) +lt_libc_hidden(fork) +#endif diff --git a/libc/sysdeps/linux/ia64/fork.S b/libc/sysdeps/linux/ia64/fork.S index 0023a3be4..968bb1c73 100644 --- a/libc/sysdeps/linux/ia64/fork.S +++ b/libc/sysdeps/linux/ia64/fork.S @@ -24,7 +24,10 @@ /* pid_t fork(void); */ /* Implemented as a clone system call with parameters SIGCHLD and 0 */ -ENTRY(__libc_fork) +#ifdef __UCLIBC_HAS_THREADS__ +.weak fork +#endif +ENTRY(fork) alloc r2=ar.pfs,0,0,2,0 mov out0=SIGCHLD /* Return SIGCHLD when child finishes */ /* no other clone flags; nothing shared */ @@ -34,7 +37,8 @@ ENTRY(__libc_fork) cmp.eq p6,p0=-1,r10 (p6) br.cond.spnt.few __syscall_error ret -PSEUDO_END(__libc_fork) - -weak_alias (__libc_fork, fork) -libc_hidden_weak (fork) +PSEUDO_END(fork) +#ifdef __UCLIBC_HAS_THREADS__ +strong_alias(fork,__libc_fork) +#endif +libc_hidden_def(fork) diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index 7ead409f0..1795eb638 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -23,11 +23,14 @@ #include <sys/syscall.h> .text -.global __libc_fork -.type __libc_fork,%function +.global fork +#ifdef __UCLIBC_HAS_THREADS__ +.weak fork +#endif +.type fork,%function .align 4 -__libc_fork: +fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -44,6 +47,8 @@ __libc_fork: retl and %o0, %o1, %o0 -.size __libc_fork,.-__libc_fork -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) +.size fork,.-fork +#ifdef __UCLIBC_HAS_THREADS__ +strong_alias(fork,__libc_fork) +#endif +libc_hidden_def(fork) diff --git a/libc/sysdeps/linux/xtensa/fork.c b/libc/sysdeps/linux/xtensa/fork.c index f8b77bfb5..e9b681c67 100644 --- a/libc/sysdeps/linux/xtensa/fork.c +++ b/libc/sysdeps/linux/xtensa/fork.c @@ -7,16 +7,19 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <unistd.h> -#include <sys/syscall.h> -#define _SIGNAL_H -#include <bits/signum.h> /* Xtensa doesn't provide a 'fork' system call, so we use 'clone'. */ +#include <sys/syscall.h> + +#if defined __NR_clone && defined __ARCH_USE_MMU__ +# include <unistd.h> +# include <signal.h> +# include <cancel.h> -pid_t __libc_fork(void) +pid_t fork(void) { return (pid_t) INLINE_SYSCALL(clone, 2, SIGCHLD, 0); } -weak_alias(__libc_fork, fork) -libc_hidden_weak(fork) +lt_strong_alias(fork) +lt_libc_hidden(fork) +#endif |