Keep only fork (and it's hidden variant) and __libc_fork.
Common __libc_fork prototype in unistd.h.
Get rid of __fork, by changing HIDDEN_JUMPTARGET(__fork) to use fork
I can't see the reason to have fork() in libpthread, but kept it for now
making __fork static in these files.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
extern __pid_t fork (void) __THROW;
+# ifdef _LIBC
+extern __typeof(fork) __libc_fork;
libc_hidden_proto(fork)
+# endif
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#ifdef __NR_fork
#define __NR___libc_fork __NR_fork
-extern __typeof(fork) __libc_fork;
_syscall0(pid_t, __libc_fork)
weak_alias(__libc_fork,fork)
libc_hidden_weak(fork)
ret
PSEUDO_END(__libc_fork)
-weak_alias (__libc_fork, __fork)
-libc_hidden_def (__fork)
weak_alias (__libc_fork, fork)
libc_hidden_weak (fork)
/* Xtensa doesn't provide a 'fork' system call, so we use 'clone'. */
-extern __typeof(fork) __libc_fork;
-
-libc_hidden_proto(fork)
pid_t __libc_fork(void)
{
return (pid_t) INLINE_SYSCALL(clone, 2, SIGCHLD, 0);
void __pthread_once_fork_child(void);
void __pthread_once_fork_parent(void);
-extern __typeof(fork) __libc_fork;
-
-pid_t __fork(void) attribute_hidden;
-pid_t __fork(void)
+static pid_t __fork(void)
{
pid_t pid;
struct handler_list * prepare, * child, * parent;
#include <bits/libc-lock.h>
#include "fork.h"
-extern int __libc_fork (void);
-
pid_t __pthread_fork (struct fork_block *b)
{
pid_t pid;
#ifdef SHARED
ldq t0, __libc_pthread_functions(gp) !gprel
- bne t0, HIDDEN_JUMPTARGET (__fork) !samegp
+ bne t0, HIDDEN_JUMPTARGET (fork) !samegp
#else
.weak pthread_create
ldq t0, pthread_create(gp) !literal
cfi_adjust_cfa_offset(16)
stq ra, 0(sp)
cfi_offset(ra, -16)
- jsr ra, HIDDEN_JUMPTARGET (__fork)
+ jsr ra, HIDDEN_JUMPTARGET (fork)
ldgp gp, 0(ra)
ldq ra, 0(sp)
addq sp, 16, sp
ldr r0, 1f
#endif
movs r0, r0
- bne HIDDEN_JUMPTARGET (__fork)
+ bne HIDDEN_JUMPTARGET (fork)
DO_CALL (vfork, 0)
cmn a1, #4096
movl $pthread_create, %eax
testl %eax, %eax
# endif
- jne HIDDEN_JUMPTARGET (__fork)
+ jne HIDDEN_JUMPTARGET (fork)
/* Pop the return PC value into ECX. */
popl %ecx
#endif
ld8 r14 = [r14];;
cmp.ne p6, p7 = 0, r14
-(p6) br.cond.spnt.few HIDDEN_JUMPTARGET (__fork);;
+(p6) br.cond.spnt.few HIDDEN_JUMPTARGET (fork);;
alloc r2=ar.pfs,0,0,2,0
mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
mov out1=0 /* Standard sp value. */
.weak pthread_create
movel #pthread_create, %d0
#endif
- jbne HIDDEN_JUMPTARGET (__fork)
+ jbne HIDDEN_JUMPTARGET (fork)
#ifdef __NR_vfork
# endif
.Lhidden_fork:
- b HIDDEN_JUMPTARGET(__fork)
+ b HIDDEN_JUMPTARGET(fork)
#endif
ld 10,.LC0@toc(2)
ld 10,0(10)
cmpwi 10,0
- bne- HIDDEN_JUMPTARGET(__fork)
+ bne- HIDDEN_JUMPTARGET(fork)
# else
.weak pthread_create
lis 10,pthread_create@highest
# ifndef SHARED
.Lhidden_fork:
- b HIDDEN_JUMPTARGET(__fork)
+ b HIDDEN_JUMPTARGET(fork)
.Lsyscall_error:
b JUMPTARGET(__syscall_error)
# endif
al %r1,3f-2b(%r1)
br %r1
3:
- .long HIDDEN_JUMPTARGET(__fork)-2b
+ .long HIDDEN_JUMPTARGET(fork)-2b
4:
#ifdef SHARED
.long __libc_pthread_functions-0b
larl %r1,pthread_create
#endif
ltgr %r1,%r1
- jgne HIDDEN_JUMPTARGET(__fork)
+ jgne HIDDEN_JUMPTARGET(fork)
/* Do vfork system call. */
svc SYS_ify (vfork)
nop
1:
.align 2
-.L2: .long HIDDEN_JUMPTARGET(__fork)-1b
+.L2: .long HIDDEN_JUMPTARGET(fork)-1b
PSEUDO_END (__vfork)
libc_hidden_def (__vfork)
orcc %o0, %lo(pthread_create), %o0
#endif
#if defined SHARED && !defined BROKEN_SPARC_WDISP22
- bne HIDDEN_JUMPTARGET(__fork)
+ bne HIDDEN_JUMPTARGET(fork)
#else
bne 1f
#endif
and %o0, %o1, %o0
#if !defined SHARED || defined BROKEN_SPARC_WDISP22
1: mov %o7, %g1
- call HIDDEN_JUMPTARGET(__fork)
+ call HIDDEN_JUMPTARGET(fork)
mov %g1, %o7
#endif
SYSCALL_ERROR_HANDLER
#endif
#if defined SHARED && !defined BROKEN_SPARC_WDISP22
cmp %o0, 0
- bne HIDDEN_JUMPTARGET(__fork)
+ bne HIDDEN_JUMPTARGET(fork)
#else
brnz,pn %o0, 1f
#endif
and %o0, %o1, %o0
#if !defined SHARED || defined BROKEN_SPARC_WDISP22
1: mov %o7, %g1
- call HIDDEN_JUMPTARGET(__fork)
+ call HIDDEN_JUMPTARGET(fork)
mov %g1, %o7
#endif
SYSCALL_ERROR_HANDLER
movq $pthread_create, %rax
testq %rax, %rax
#endif
- jne HIDDEN_JUMPTARGET (__fork)
+ jne HIDDEN_JUMPTARGET (fork)
/* Pop the return PC value into RDI. We need a register that
is preserved by the syscall and that we're allowed to destroy. */
#endif
}
-extern __typeof(fork) __libc_fork;
pid_t
__libc_fork (void)
{
return pid;
}
-weak_alias(__libc_fork,__fork)
-libc_hidden_proto(fork)
weak_alias(__libc_fork,fork)
libc_hidden_weak(fork)
#include <unistd.h>
-extern int __libc_fork (void);
-
-pid_t
+static pid_t
__fork (void)
{
return __libc_fork ();