diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-01-05 10:55:15 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-01-05 10:55:15 +0000 |
commit | 73e9ae887fab0918165e49d783328c891c1b1bdb (patch) | |
tree | f20298d0dd2e59958be2e3fcd1cc708ae8c3bece /nptl/sysdeps | |
parent | a7f7b879fbe6fb58b670ad41d2b6e40f14730cb8 (diff) | |
download | glibc-73e9ae887fab0918165e49d783328c891c1b1bdb.tar.gz glibc-73e9ae887fab0918165e49d783328c891c1b1bdb.tar.xz glibc-73e9ae887fab0918165e49d783328c891c1b1bdb.zip |
Update.
2003-01-04 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile: New file.
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r-- | nptl/sysdeps/pthread/bits/libc-lock.h | 38 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/pthread-functions.h | 91 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S | 8 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S | 11 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S | 6 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/internaltypes.h | 11 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/jmp-unwind.c | 16 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S | 6 |
8 files changed, 157 insertions, 30 deletions
diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h index d46f74817e..e4b5b802ee 100644 --- a/nptl/sysdeps/pthread/bits/libc-lock.h +++ b/nptl/sysdeps/pthread/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. NPTL version. - Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,6 +34,7 @@ #ifdef _LIBC # include <lowlevellock.h> # include <tls.h> +# include <pthread-functions.h> #endif /* Mutex type. */ @@ -144,6 +145,17 @@ typedef pthread_key_t __libc_key_t; (FUNC != NULL ? FUNC ARGS : ELSE) #endif +/* Call thread functions through the function pointer table. */ +#if defined SHARED && !defined NOT_IN_libc +# define PTF(NAME) __libc_pthread_functions.ptr_##NAME +# define __libc_ptf_call(FUNC, ARGS, ELSE) \ + (PTF(FUNC) != NULL ? PTF(FUNC) ARGS : ELSE) +#else +# define PTF(NAME) NAME +# define __libc_ptf_call(FUNC, ARGS, ELSE) \ + __libc_maybe_call (FUNC, ARGS, ELSE) +#endif + /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ @@ -215,9 +227,9 @@ typedef pthread_key_t __libc_key_t; __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) #endif #define __libc_rwlock_rdlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_rdlock, (&(NAME)), 0) + __libc_ptf_call (__pthread_rwlock_rdlock, (&(NAME)), 0) #define __libc_rwlock_wrlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_wrlock, (&(NAME)), 0) + __libc_ptf_call (__pthread_rwlock_wrlock, (&(NAME)), 0) /* Lock the recursive named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) @@ -289,7 +301,7 @@ typedef pthread_key_t __libc_key_t; __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) #endif #define __libc_rwlock_unlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_unlock, (&(NAME)), 0) + __libc_ptf_call (__pthread_rwlock_unlock, (&(NAME)), 0) /* Unlock the recursive named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) @@ -324,8 +336,8 @@ typedef pthread_key_t __libc_key_t; /* Call handler iff the first call. */ #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ do { \ - if (__pthread_once != NULL) \ - __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ + if (PTF(__pthread_once) != NULL) \ + PTF(__pthread_once) (&(ONCE_CONTROL), INIT_FUNCTION); \ else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ INIT_FUNCTION (); \ (ONCE_CONTROL) = !PTHREAD_ONCE_INIT; \ @@ -336,9 +348,9 @@ typedef pthread_key_t __libc_key_t; /* Start critical region with cleanup. */ #define __libc_cleanup_region_start(DOIT, FCT, ARG) \ { struct _pthread_cleanup_buffer _buffer; \ - int _avail = _pthread_cleanup_push_defer != NULL; \ + int _avail = PTF(_pthread_cleanup_push_defer) != NULL; \ if (_avail) { \ - _pthread_cleanup_push_defer (&_buffer, (FCT), (ARG)); \ + PTF(_pthread_cleanup_push_defer) (&_buffer, FCT, ARG); \ } else if (DOIT) { \ _buffer.__routine = (FCT); \ _buffer.__arg = (ARG); \ @@ -347,7 +359,7 @@ typedef pthread_key_t __libc_key_t; /* End critical region with cleanup. */ #define __libc_cleanup_region_end(DOIT) \ if (_avail) { \ - _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ + PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT); \ } else if (DOIT) \ _buffer.__routine (_buffer.__arg); \ } @@ -355,21 +367,21 @@ typedef pthread_key_t __libc_key_t; /* Sometimes we have to exit the block in the middle. */ #define __libc_cleanup_end(DOIT) \ if (_avail) { \ - _pthread_cleanup_pop_restore (&_buffer, (DOIT)); \ + PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT); \ } else if (DOIT) \ _buffer.__routine (_buffer.__arg) /* Create thread-specific key. */ #define __libc_key_create(KEY, DESTRUCTOR) \ - __libc_maybe_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) + __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) /* Get thread-specific data. */ #define __libc_getspecific(KEY) \ - __libc_maybe_call (__pthread_getspecific, (KEY), NULL) + __libc_ptf_call (__pthread_getspecific, (KEY), NULL) /* Set thread-specific data. */ #define __libc_setspecific(KEY, VALUE) \ - __libc_maybe_call (__pthread_setspecific, (KEY, VALUE), 0) + __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0) /* Register handlers to execute before and after `fork'. Note that the diff --git a/nptl/sysdeps/pthread/pthread-functions.h b/nptl/sysdeps/pthread/pthread-functions.h new file mode 100644 index 0000000000..17e3f83216 --- /dev/null +++ b/nptl/sysdeps/pthread/pthread-functions.h @@ -0,0 +1,91 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _PTHREAD_FUNCTIONS_H +#define _PTHREAD_FUNCTIONS_H 1 + +#include <pthread.h> +#include <setjmp.h> +#include <internaltypes.h> + + +/* Data type shared with libc. The libc uses it to pass on calls to + the thread functions. */ +struct pthread_functions +{ + int (*ptr_pthread_attr_destroy) (pthread_attr_t *); + int (*ptr___pthread_attr_init_2_0) (pthread_attr_t *); + int (*ptr___pthread_attr_init_2_1) (pthread_attr_t *); + int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *); + int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int); + int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *); + int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int); + int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *, + struct sched_param *); + int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *, + const struct sched_param *); + int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *); + int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int); + int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *); + int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int); + int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *); + int (*ptr_pthread_condattr_init) (pthread_condattr_t *); + int (*ptr___pthread_cond_broadcast) (pthread_cond_t *); + int (*ptr___pthread_cond_destroy) (pthread_cond_t *); + int (*ptr___pthread_cond_init) (pthread_cond_t *, + const pthread_condattr_t *); + int (*ptr___pthread_cond_signal) (pthread_cond_t *); + int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); + int (*ptr___pthread_cond_broadcast_2_0) (pthread_cond_2_0_t *); + int (*ptr___pthread_cond_destroy_2_0) (pthread_cond_2_0_t *); + int (*ptr___pthread_cond_init_2_0) (pthread_cond_2_0_t *, + const pthread_condattr_t *); + int (*ptr___pthread_cond_signal_2_0) (pthread_cond_2_0_t *); + int (*ptr___pthread_cond_wait_2_0) (pthread_cond_2_0_t *, pthread_mutex_t *); + int (*ptr_pthread_equal) (pthread_t, pthread_t); + void (*ptr___pthread_exit) (void *); + int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); + int (*ptr_pthread_setschedparam) (pthread_t, int, + const struct sched_param *); + int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); + int (*ptr_pthread_mutex_init) (pthread_mutex_t *, + const pthread_mutexattr_t *); + int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); + int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); + pthread_t (*ptr_pthread_self) (void); + int (*ptr_pthread_setcancelstate) (int, int *); + int (*ptr_pthread_setcanceltype) (int, int *); + void (*ptr___pthread_cleanup_upto) (jmp_buf, char *); + int (*ptr___pthread_once) (pthread_once_t *, void (*) (void)); + int (*ptr___pthread_rwlock_rdlock) (pthread_rwlock_t *); + int (*ptr___pthread_rwlock_wrlock) (pthread_rwlock_t *); + int (*ptr___pthread_rwlock_unlock) (pthread_rwlock_t *); + int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *)); + int (*ptr___pthread_getspecific) (pthread_key_t); + int (*ptr___pthread_setspecific) (pthread_key_t, const void *); + void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer *, + void (*) (void *), void *); + void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer *, + int); +}; + +/* Variable in libc.so. */ +extern struct pthread_functions __libc_pthread_functions attribute_hidden; + +#endif /* pthread-functions.h */ diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S index 5afe53d484..83a4fb330b 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S @@ -136,7 +136,7 @@ __pthread_cond_wait: movl %ebx, 8(%esp) movl %eax, 4(%esp) movl %edx, (%esp) - call _GI_pthread_cleanup_push + call __pthread_cleanup_push /* Get and store current wakeup_seq value. */ movl wakeup_seq(%ebx), %edi @@ -209,7 +209,7 @@ __pthread_cond_wait: 11: leal 12(%esp), %edx movl $0, 4(%esp) movl %edx, (%esp) - call _GI_pthread_cleanup_pop + call __pthread_cleanup_pop movl 48(%esp), %eax movl %eax, (%esp) @@ -316,7 +316,7 @@ __pthread_cond_timedwait: movl %ebx, 8(%esp) movl %eax, 4(%esp) movl %edx, (%esp) - call _GI_pthread_cleanup_push + call __pthread_cleanup_push /* Get and store current wakeup_seq value. */ movl wakeup_seq(%ebx), %edi @@ -425,7 +425,7 @@ __pthread_cond_timedwait: 11: leal 20(%esp), %edx movl $0, 4(%esp) movl %edx, (%esp) - call _GI_pthread_cleanup_pop + call __pthread_cleanup_pop movl 60(%esp), %ecx movl %ecx, (%esp) diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S index 72df31b40b..cc2885ebc9 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -164,6 +164,9 @@ __pthread_rwlock_rdlock: .globl pthread_rwlock_rdlock pthread_rwlock_rdlock = __pthread_rwlock_rdlock + .globl __pthread_rwlock_rdlock_internal +__pthread_rwlock_rdlock_internal = __pthread_rwlock_rdlock + .globl pthread_rwlock_timedrdlock .type pthread_rwlock_timedrdlock,@function @@ -425,6 +428,9 @@ __pthread_rwlock_wrlock: .globl pthread_rwlock_wrlock pthread_rwlock_wrlock = __pthread_rwlock_wrlock + .globl __pthread_rwlock_wrlock_internal +__pthread_rwlock_wrlock_internal = __pthread_rwlock_wrlock + .globl pthread_rwlock_timedwrlock .type pthread_rwlock_timedwrlock,@function @@ -643,3 +649,6 @@ __pthread_rwlock_unlock: .globl pthread_rwlock_unlock pthread_rwlock_unlock = __pthread_rwlock_unlock + + .globl __pthread_rwlock_unlock_internal +__pthread_rwlock_unlock_internal = __pthread_rwlock_unlock diff --git a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S index f35ae27a33..fce1529e54 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -103,7 +103,7 @@ __pthread_once: pushl %ebx pushl %eax pushl %edx - call _GI_pthread_cleanup_push /* Note: no @PLT. */ + call __pthread_cleanup_push /* Note: no @PLT. */ movl 44(%esp), %eax call *%eax @@ -113,7 +113,7 @@ __pthread_once: of the stack. Otherwise the first parameter would have to be reloaded. */ movl $0, 4(%esp) - call _GI_pthread_cleanup_pop /* Note: no @PLT. */ + call __pthread_cleanup_pop /* Note: no @PLT. */ addl $28, %esp diff --git a/nptl/sysdeps/unix/sysv/linux/internaltypes.h b/nptl/sysdeps/unix/sysv/linux/internaltypes.h index 24ead1b5ce..9ae35eff9a 100644 --- a/nptl/sysdeps/unix/sysv/linux/internaltypes.h +++ b/nptl/sysdeps/unix/sysv/linux/internaltypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -20,6 +20,8 @@ #ifndef _INTERNALTYPES_H #define _INTERNALTYPES_H 1 +#include <stdint.h> + struct pthread_attr { @@ -127,4 +129,11 @@ struct sem unsigned int count; }; + +/* Compatibility type for old conditional variable interfaces. */ +typedef struct +{ + pthread_cond_t *cond; +} pthread_cond_2_0_t; + #endif /* internaltypes.h */ diff --git a/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c b/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c index 0fd3c9aa58..f0a290ae4b 100644 --- a/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c +++ b/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c @@ -1,5 +1,5 @@ -/* _longjmp_unwind -- Clean up stack frames unwound by longjmp. Linux version. - Copyright (C) 1995, 1997, 2002 Free Software Foundation, Inc. +/* Clean up stack frames unwound by longjmp. Linux version. + Copyright (C) 1995, 1997, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,7 +19,7 @@ #include <setjmp.h> #include <stddef.h> - +#include <pthread-functions.h> extern void __pthread_cleanup_upto (jmp_buf env, char *targetframe); #pragma weak __pthread_cleanup_upto @@ -28,6 +28,12 @@ extern void __pthread_cleanup_upto (jmp_buf env, char *targetframe); void _longjmp_unwind (jmp_buf env, int val) { - if (__pthread_cleanup_upto != NULL) - __pthread_cleanup_upto (env, __builtin_frame_address (0)); +#ifdef SHARED +# define fptr __libc_pthread_functions.ptr___pthread_cleanup_upto +#else +# define fptr __pthread_cleanup_upto +#endif + + if (fptr != NULL) + fptr (env, __builtin_frame_address (0)); } diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S index 422412901c..3871c0e1a2 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -86,7 +86,7 @@ __pthread_once: leaq clear_once_control(%rip), %rsi movq %rdi, %rdx movq %rsp, %rdi - call _GI_pthread_cleanup_push /* Note: no @PLT. */ + call __pthread_cleanup_push /* Note: no @PLT. */ movq 48(%rsp), %rax call *%rax @@ -96,7 +96,7 @@ __pthread_once: of the stack. Otherwise the first parameter would have to be reloaded. */ xorq %rdi, %rdi - call _GI_pthread_cleanup_pop /* Note: no @PLT. */ + call __pthread_cleanup_pop /* Note: no @PLT. */ addq $32, %rsp |