OSDN Git Service

cleanup fork()
authorPeter S. Mazinger <ps.m@gmx.net>
Mon, 14 Mar 2011 18:58:35 +0000 (19:58 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Fri, 15 Jun 2012 12:00:24 +0000 (14:00 +0200)
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>
21 files changed:
include/unistd.h
libc/sysdeps/linux/common/fork.c
libc/sysdeps/linux/ia64/fork.S
libc/sysdeps/linux/xtensa/fork.c
libpthread/linuxthreads.old/ptfork.c
libpthread/linuxthreads/ptfork.c
libpthread/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/m68k/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
libpthread/linuxthreads/sysdeps/unix/sysv/linux/x86_64/vfork.S
libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c

index a3cf288..65b83bf 100644 (file)
@@ -768,7 +768,10 @@ libc_hidden_proto(setresgid)
    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
index 14e00a2..88958b1 100644 (file)
@@ -14,7 +14,6 @@
 
 #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)
index c657453..0023a3b 100644 (file)
@@ -36,7 +36,5 @@ ENTRY(__libc_fork)
        ret
 PSEUDO_END(__libc_fork)
 
-weak_alias (__libc_fork, __fork)
-libc_hidden_def (__fork)
 weak_alias (__libc_fork, fork)
 libc_hidden_weak (fork)
index f8fae9b..f8b77bf 100644 (file)
@@ -14,9 +14,6 @@
 
 /* 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);
index 47a567d..98c63fe 100644 (file)
@@ -93,10 +93,7 @@ void __pthread_once_fork_prepare(void);
 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;
index 853aeea..71404ac 100644 (file)
@@ -23,8 +23,6 @@
 #include <bits/libc-lock.h>
 #include "fork.h"
 
-extern int __libc_fork (void);
-
 pid_t __pthread_fork (struct fork_block *b)
 {
   pid_t pid;
index cfaae10..a753511 100644 (file)
@@ -30,7 +30,7 @@ __vfork:
 
 #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
@@ -50,7 +50,7 @@ $do_fork:
        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
index 2543f57..0f4c40e 100644 (file)
@@ -40,7 +40,7 @@ ENTRY (__vfork)
        ldr     r0, 1f
 #endif
        movs    r0, r0
-       bne     HIDDEN_JUMPTARGET (__fork)
+       bne     HIDDEN_JUMPTARGET (fork)
 
        DO_CALL (vfork, 0)
        cmn     a1, #4096
index 78eeabf..fec9027 100644 (file)
@@ -44,7 +44,7 @@ ENTRY (__vfork)
        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
index 54aceda..a2c3b1f 100644 (file)
@@ -38,7 +38,7 @@ ENTRY(__vfork)
 #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.                   */
index 8a43ea0..5abe9ce 100644 (file)
@@ -35,7 +35,7 @@ ENTRY (__vfork)
        .weak   pthread_create
        movel   #pthread_create, %d0
 #endif
-       jbne    HIDDEN_JUMPTARGET (__fork)
+       jbne    HIDDEN_JUMPTARGET (fork)
 
 #ifdef __NR_vfork
 
index 353c7d0..bd774f7 100644 (file)
@@ -66,7 +66,7 @@ ENTRY (__vfork)
 # endif
 
 .Lhidden_fork:
-       b       HIDDEN_JUMPTARGET(__fork)
+       b       HIDDEN_JUMPTARGET(fork)
 
 #endif
 
index 7a3cb82..da145e4 100644 (file)
@@ -42,7 +42,7 @@ ENTRY (__vfork)
   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
@@ -80,7 +80,7 @@ ENTRY (__vfork)
 
 # ifndef SHARED
 .Lhidden_fork:
-       b       HIDDEN_JUMPTARGET(__fork)
+       b       HIDDEN_JUMPTARGET(fork)
 .Lsyscall_error:
        b       JUMPTARGET(__syscall_error)
 # endif
index 6dfeca8..e3348d5 100644 (file)
@@ -54,7 +54,7 @@ ENTRY (__vfork)
        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
index 199f001..0a74df9 100644 (file)
@@ -35,7 +35,7 @@ ENTRY (__vfork)
        larl    %r1,pthread_create
 #endif
        ltgr    %r1,%r1
-       jgne    HIDDEN_JUMPTARGET(__fork)
+       jgne    HIDDEN_JUMPTARGET(fork)
 
        /* Do vfork system call.  */
        svc     SYS_ify (vfork)
index e933eef..065fcc8 100644 (file)
@@ -70,7 +70,7 @@ ENTRY (__vfork)
         nop
 1:
        .align 2
-.L2:   .long   HIDDEN_JUMPTARGET(__fork)-1b
+.L2:   .long   HIDDEN_JUMPTARGET(fork)-1b
 
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
index 132da67..2f2ba46 100644 (file)
@@ -43,7 +43,7 @@ ENTRY(__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
@@ -56,7 +56,7 @@ ENTRY(__vfork)
         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
index 8a6d277..2ded688 100644 (file)
@@ -42,7 +42,7 @@ ENTRY(__vfork)
 #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
@@ -55,7 +55,7 @@ ENTRY(__vfork)
         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
index 25d1d3f..e9003cf 100644 (file)
@@ -34,7 +34,7 @@ ENTRY (__vfork)
        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. */
index 6ad9053..ab4a6e6 100644 (file)
@@ -58,7 +58,6 @@ fresetlockfiles (void)
 #endif
 }
 
-extern __typeof(fork) __libc_fork;
 pid_t
 __libc_fork (void)
 {
@@ -223,7 +222,5 @@ __libc_fork (void)
 
   return pid;
 }
-weak_alias(__libc_fork,__fork)
-libc_hidden_proto(fork)
 weak_alias(__libc_fork,fork)
 libc_hidden_weak(fork)
index 3e1b70f..b8a938c 100644 (file)
@@ -19,9 +19,7 @@
 
 #include <unistd.h>
 
-extern int __libc_fork (void);
-
-pid_t
+static pid_t
 __fork (void)
 {
   return __libc_fork ();