mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-24 14:41:06 +08:00
Update.
2003-02-07 Jakub Jelinek <jakub@redhat.com> * tst-popen2.c: New test. * Makefile (tests): Add tst-popen2. * sysdeps/unix/sysv/linux/alpha/vfork.S (__vfork): Branch to __fork whenever libpthread.so is loaded. * sysdeps/unix/sysv/linux/i386/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/ia64/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/x86_64/vfork.S (__vfork): Likewise.
This commit is contained in:
parent
ce96c93de5
commit
65c6899079
@ -1,3 +1,17 @@
|
|||||||
|
2003-02-07 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* tst-popen2.c: New test.
|
||||||
|
* Makefile (tests): Add tst-popen2.
|
||||||
|
* sysdeps/unix/sysv/linux/alpha/vfork.S (__vfork): Branch to __fork
|
||||||
|
whenever libpthread.so is loaded.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/vfork.S (__vfork): Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/ia64/vfork.S (__vfork): Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/s390/s390-64/vfork.S (__vfork): Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork): Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S (__vfork): Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S (__vfork): Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/vfork.S (__vfork): Likewise.
|
||||||
|
|
||||||
2003-02-05 Ulrich Drepper <drepper@redhat.com>
|
2003-02-05 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* sysdeps/pthread/bits/libc-lock.h (__libc_once): Set control
|
* sysdeps/pthread/bits/libc-lock.h (__libc_once): Set control
|
||||||
|
@ -88,7 +88,7 @@ tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \
|
|||||||
tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \
|
tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \
|
||||||
ex17 ex18 tst-cancel tst-context bug-sleep \
|
ex17 ex18 tst-cancel tst-context bug-sleep \
|
||||||
tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
|
tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
|
||||||
tst-cancel6 tst-popen
|
tst-cancel6 tst-popen tst-popen2
|
||||||
test-srcs = tst-signal
|
test-srcs = tst-signal
|
||||||
# These tests are linked with libc before libpthread
|
# These tests are linked with libc before libpthread
|
||||||
tests-reverse += tst-cancel5
|
tests-reverse += tst-cancel5
|
||||||
|
@ -27,10 +27,12 @@ __LABEL(__vfork)
|
|||||||
.prologue 1
|
.prologue 1
|
||||||
PSEUDO_PROF
|
PSEUDO_PROF
|
||||||
|
|
||||||
SINGLE_THREAD_P(t0)
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
|
ldq t0, __libc_pthread_functions(gp) !gprel
|
||||||
bne t0, HIDDEN_JUMPTARGET (__fork) !samegp
|
bne t0, HIDDEN_JUMPTARGET (__fork) !samegp
|
||||||
#else
|
#else
|
||||||
|
.weak __pthread_fork
|
||||||
|
ldq t0, __pthread_fork(gp) !literal
|
||||||
bne t0, $do_fork
|
bne t0, $do_fork
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,7 +31,19 @@ ENTRY (__vfork)
|
|||||||
|
|
||||||
#ifdef __NR_vfork
|
#ifdef __NR_vfork
|
||||||
|
|
||||||
SINGLE_THREAD_P
|
# ifdef SHARED
|
||||||
|
# if !defined HAVE_HIDDEN || !USE___THREAD
|
||||||
|
SETUP_PIC_REG (cx)
|
||||||
|
# else
|
||||||
|
call __i686.get_pc_thunk.cx
|
||||||
|
# endif
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_, %ecx
|
||||||
|
cmpl $0, __libc_pthread_functions@GOTOFF(%ecx)
|
||||||
|
# else
|
||||||
|
.weak __pthread_fork
|
||||||
|
movl $__pthread_fork, %eax
|
||||||
|
testl %eax, %eax
|
||||||
|
# endif
|
||||||
jne HIDDEN_JUMPTARGET (__fork)
|
jne HIDDEN_JUMPTARGET (__fork)
|
||||||
|
|
||||||
/* Pop the return PC value into ECX. */
|
/* Pop the return PC value into ECX. */
|
||||||
|
@ -30,7 +30,14 @@
|
|||||||
/* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */
|
/* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */
|
||||||
|
|
||||||
ENTRY(__vfork)
|
ENTRY(__vfork)
|
||||||
SINGLE_THREAD_P
|
#ifdef SHARED
|
||||||
|
addl r14 = @gprel(__libc_pthread_functions#), gp;;
|
||||||
|
#else
|
||||||
|
.weak __pthread_fork
|
||||||
|
addl r14 = @ltoff(@fptr(__pthread_fork#)), gp;;
|
||||||
|
#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
|
alloc r2=ar.pfs,0,0,2,0
|
||||||
mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
|
mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
|
||||||
|
@ -29,11 +29,20 @@
|
|||||||
ENTRY (__vfork)
|
ENTRY (__vfork)
|
||||||
|
|
||||||
#ifdef __NR_vfork
|
#ifdef __NR_vfork
|
||||||
|
|
||||||
SINGLE_THREAD_P
|
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
|
mflr 9
|
||||||
|
bl _GLOBAL_OFFSET_TABLE_@local-4
|
||||||
|
mflr 10
|
||||||
|
mtlr 9
|
||||||
|
lwz 10,__libc_pthread_functions@got(10)
|
||||||
|
lwz 10,0(10)
|
||||||
|
cmpwi 10,0
|
||||||
bne- HIDDEN_JUMPTARGET(__fork)
|
bne- HIDDEN_JUMPTARGET(__fork)
|
||||||
# else
|
# else
|
||||||
|
.weak __pthread_fork
|
||||||
|
lis 9,__pthread_fork@ha
|
||||||
|
la 9,__pthread_fork@l(9)
|
||||||
|
cmpwi 9,0
|
||||||
bne- .Lhidden_fork
|
bne- .Lhidden_fork
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -27,7 +27,14 @@
|
|||||||
and the process ID of the new process to the old process. */
|
and the process ID of the new process to the old process. */
|
||||||
|
|
||||||
ENTRY (__vfork)
|
ENTRY (__vfork)
|
||||||
SINGLE_THREAD_P
|
#ifdef SHARED
|
||||||
|
larl %r1,__libc_pthread_functions
|
||||||
|
lg %r1,0(%r1)
|
||||||
|
#else
|
||||||
|
.weak __pthread_fork
|
||||||
|
larl %r1,__pthread_fork
|
||||||
|
#endif
|
||||||
|
ltgr %r1,%r1
|
||||||
jgne HIDDEN_JUMPTARGET(__fork)
|
jgne HIDDEN_JUMPTARGET(__fork)
|
||||||
|
|
||||||
/* Do vfork system call. */
|
/* Do vfork system call. */
|
||||||
|
@ -20,9 +20,28 @@
|
|||||||
#include <sysdep-cancel.h>
|
#include <sysdep-cancel.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
#ifdef SHARED
|
||||||
|
.LLGETPC0:
|
||||||
|
retl
|
||||||
|
addl %o7, %o0, %o0
|
||||||
|
#endif
|
||||||
ENTRY(__vfork)
|
ENTRY(__vfork)
|
||||||
ld [%g7 + MULTIPLE_THREADS_OFFSET], %o0
|
#ifdef SHARED
|
||||||
cmp %o0, 0
|
mov %o7, %o1
|
||||||
|
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0
|
||||||
|
call .LLGETPC0
|
||||||
|
add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0
|
||||||
|
sethi %hi(__libc_pthread_functions), %o2
|
||||||
|
mov %o1, %o7
|
||||||
|
or %o2, %lo(__libc_pthread_functions), %o2
|
||||||
|
ld [%o0 + %o2], %o2
|
||||||
|
ld [%o2], %o2
|
||||||
|
cmp %o2, 0
|
||||||
|
#else
|
||||||
|
.weak __pthread_fork
|
||||||
|
sethi %hi(__pthread_fork), %o0
|
||||||
|
orcc %o0, %lo(__pthread_fork), %o0
|
||||||
|
#endif
|
||||||
#if defined SHARED && !defined BROKEN_SPARC_WDISP22
|
#if defined SHARED && !defined BROKEN_SPARC_WDISP22
|
||||||
bne HIDDEN_JUMPTARGET(__fork)
|
bne HIDDEN_JUMPTARGET(__fork)
|
||||||
#else
|
#else
|
||||||
|
@ -19,13 +19,28 @@
|
|||||||
|
|
||||||
#include <sysdep-cancel.h>
|
#include <sysdep-cancel.h>
|
||||||
|
|
||||||
.text
|
|
||||||
ENTRY(__vfork)
|
|
||||||
ld [%g7 + MULTIPLE_THREADS_OFFSET], %o0
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
cmp %o0, 0
|
.LLGETPC0:
|
||||||
|
retl
|
||||||
|
addl %o7, %o0, %o0
|
||||||
|
#endif
|
||||||
|
ENTRY(__vfork)
|
||||||
|
#ifdef SHARED
|
||||||
|
mov %o7, %o1
|
||||||
|
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0
|
||||||
|
call .LLGETPC0
|
||||||
|
add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0
|
||||||
|
sethi %hi(__libc_pthread_functions), %o2
|
||||||
|
mov %o1, %o7
|
||||||
|
or %o2, %lo(__libc_pthread_functions), %o2
|
||||||
|
ldx [%o0 + %o2], %o2
|
||||||
|
ldx [%o2], %o2
|
||||||
|
cmp %o2, 0
|
||||||
bne HIDDEN_JUMPTARGET(__fork)
|
bne HIDDEN_JUMPTARGET(__fork)
|
||||||
#else
|
#else
|
||||||
|
.weak __pthread_fork
|
||||||
|
sethi %hi(__pthread_fork), %o0
|
||||||
|
or %o0, %lo(__pthread_fork), %o0
|
||||||
brnz,pn %o0, 1f
|
brnz,pn %o0, 1f
|
||||||
#endif
|
#endif
|
||||||
mov __NR_vfork, %g1
|
mov __NR_vfork, %g1
|
||||||
|
@ -27,7 +27,13 @@
|
|||||||
|
|
||||||
ENTRY (__vfork)
|
ENTRY (__vfork)
|
||||||
|
|
||||||
SINGLE_THREAD_P
|
#ifdef SHARED
|
||||||
|
cmpq $0, __libc_pthread_functions(%rip)
|
||||||
|
#else
|
||||||
|
.weak __pthread_fork
|
||||||
|
movq $__pthread_fork, %eax
|
||||||
|
testq %rax, %rax
|
||||||
|
#endif
|
||||||
jne HIDDEN_JUMPTARGET (__fork)
|
jne HIDDEN_JUMPTARGET (__fork)
|
||||||
|
|
||||||
/* Pop the return PC value into RDI. We need a register that
|
/* Pop the return PC value into RDI. We need a register that
|
||||||
|
41
linuxthreads/tst-popen2.c
Normal file
41
linuxthreads/tst-popen2.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include <errno.h>
|
||||||
|
#include <error.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static void *
|
||||||
|
dummy (void *x)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char buf[sizeof "something\n"];
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_test (void)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
pthread_t p;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
f = popen ("echo something", "r");
|
||||||
|
if (f == NULL)
|
||||||
|
error (EXIT_FAILURE, errno, "popen failed");
|
||||||
|
if (fgets (buf, sizeof (buf), f) == NULL)
|
||||||
|
error (EXIT_FAILURE, 0, "fgets failed");
|
||||||
|
if (strcmp (buf, "something\n"))
|
||||||
|
error (EXIT_FAILURE, 0, "read wrong data");
|
||||||
|
if (pclose (f))
|
||||||
|
error (EXIT_FAILURE, errno, "pclose returned non-zero");
|
||||||
|
if ((err = pthread_create (&p, NULL, dummy, NULL)))
|
||||||
|
error (EXIT_FAILURE, err, "pthread_create failed");
|
||||||
|
if ((err = pthread_join (p, NULL)))
|
||||||
|
error (EXIT_FAILURE, err, "pthread_join failed");
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
#include "../test-skeleton.c"
|
@ -1,5 +1,8 @@
|
|||||||
2003-02-06 Ulrich Drepper <drepper@redhat.com>
|
2003-02-06 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* Makefile (tests): Add tst-popen1.
|
||||||
|
* tst-popen1.c: New file.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Remove wrong
|
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Remove wrong
|
||||||
but inactive generalization.
|
but inactive generalization.
|
||||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
|
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
|
||||||
|
@ -151,7 +151,8 @@ tests = tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
|
|||||||
tst-unload \
|
tst-unload \
|
||||||
tst-sysconf \
|
tst-sysconf \
|
||||||
tst-locale1 tst-locale2 \
|
tst-locale1 tst-locale2 \
|
||||||
tst-umask1
|
tst-umask1 \
|
||||||
|
tst-popen1
|
||||||
|
|
||||||
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
|
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user