diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-01-17 08:37:26 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-01-17 08:37:26 +0000 |
commit | ea1533e08df4c63e680438ac1dc243cdc37d205a (patch) | |
tree | d7954d886b979b8bea1d7e1f6db05b440a693097 /nptl/sysdeps/pthread | |
parent | d78bce1c01fe67d02d833e026e5acbb88d1d9836 (diff) | |
download | glibc-ea1533e08df4c63e680438ac1dc243cdc37d205a.zip glibc-ea1533e08df4c63e680438ac1dc243cdc37d205a.tar.gz glibc-ea1533e08df4c63e680438ac1dc243cdc37d205a.tar.bz2 |
* sysdeps/unix/sysv/linux/libc_pthread_init.c: Don't just copy the
function table, mangle the pointers.
* sysdeps/pthread/pthread-functions.h: Define PTHFCT_CALL.
* forward.c: Use PTHFCT_CALL and __libc_pthread_functions_init.
* sysdeps/pthread/bits/libc-lock.h: When using __libc_pthread_functions
demangle pointers before use.
* sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Use PTHFCT_CALL to
demangle pointer.
* sysdeps/unix/sysv/linux/jmp-unwind.c: Likewise.
* sysdeps/pthread/setxid.h: Likewise.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r-- | nptl/sysdeps/pthread/bits/libc-lock.h | 26 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/pthread-functions.h | 10 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/setxid.h | 7 |
3 files changed, 28 insertions, 15 deletions
diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h index 795caa7..c4c67ea 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, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1996-2003, 2005, 2007 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 @@ -150,13 +150,17 @@ typedef pthread_key_t __libc_key_t; /* Call thread functions through the function pointer table. */ #if defined SHARED && !defined NOT_IN_libc -# define PTF(NAME) __libc_pthread_functions.ptr_##NAME +# define PTFAVAIL(NAME) __libc_pthread_functions_init # define __libc_ptf_call(FUNC, ARGS, ELSE) \ - (PTF(FUNC) != NULL ? PTF(FUNC) ARGS : ELSE) + (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE) +# define __libc_ptf_call_always(FUNC, ARGS) \ + PTHFCT_CALL (ptr_##FUNC, ARGS) #else -# define PTF(NAME) NAME +# define PTFAVAIL(NAME) (NAME != NULL) # define __libc_ptf_call(FUNC, ARGS, ELSE) \ __libc_maybe_call (FUNC, ARGS, ELSE) +# define __libc_ptf_call_always(FUNC, ARGS) \ + FUNC ARGS #endif @@ -353,8 +357,9 @@ typedef pthread_key_t __libc_key_t; /* Call handler iff the first call. */ #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ do { \ - if (PTF(__pthread_once) != NULL) \ - PTF(__pthread_once) (&(ONCE_CONTROL), INIT_FUNCTION); \ + if (PTFAVAIL (__pthread_once)) \ + __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \ + INIT_FUNCTION)); \ else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ INIT_FUNCTION (); \ (ONCE_CONTROL) |= 2; \ @@ -380,9 +385,10 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer { struct _pthread_cleanup_buffer _buffer; \ int _avail; \ if (DOIT) { \ - _avail = PTF(_pthread_cleanup_push_defer) != NULL; \ + _avail = PTFAVAIL (_pthread_cleanup_push_defer); \ if (_avail) { \ - PTF(_pthread_cleanup_push_defer) (&_buffer, FCT, ARG); \ + __libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT, \ + ARG)); \ } else { \ _buffer.__routine = (FCT); \ _buffer.__arg = (ARG); \ @@ -394,7 +400,7 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer /* End critical region with cleanup. */ #define __libc_cleanup_region_end(DOIT) \ if (_avail) { \ - PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT); \ + __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ } else if (DOIT) \ _buffer.__routine (_buffer.__arg); \ } @@ -402,7 +408,7 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer /* Sometimes we have to exit the block in the middle. */ #define __libc_cleanup_end(DOIT) \ if (_avail) { \ - PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT); \ + __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ } else if (DOIT) \ _buffer.__routine (_buffer.__arg) diff --git a/nptl/sysdeps/pthread/pthread-functions.h b/nptl/sysdeps/pthread/pthread-functions.h index 74d2400..f8c1e92 100644 --- a/nptl/sysdeps/pthread/pthread-functions.h +++ b/nptl/sysdeps/pthread/pthread-functions.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -23,6 +23,7 @@ #include <pthread.h> #include <setjmp.h> #include <internaltypes.h> +#include <sysdep.h> struct xid_command; @@ -100,5 +101,12 @@ struct pthread_functions /* Variable in libc.so. */ extern struct pthread_functions __libc_pthread_functions attribute_hidden; +extern int __libc_pthread_functions_init attribute_hidden; + +#define PTHFCT_CALL(fct, params) \ + ({ __typeof (__libc_pthread_functions.fct) __p; \ + __p = __libc_pthread_functions.fct; \ + PTR_DEMANGLE (__p); \ + __p params; }) #endif /* pthread-functions.h */ diff --git a/nptl/sysdeps/pthread/setxid.h b/nptl/sysdeps/pthread/setxid.h index 8ec382f..aebdbd2 100644 --- a/nptl/sysdeps/pthread/setxid.h +++ b/nptl/sysdeps/pthread/setxid.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2007 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 @@ -33,13 +33,12 @@ # define INLINE_SETXID_SYSCALL(name, nr, args...) \ ({ \ int __result; \ - if (__builtin_expect (__libc_pthread_functions.ptr__nptl_setxid \ - != NULL, 0)) \ + if (__builtin_expect (__libc_pthread_functions_init, 0)) \ { \ struct xid_command __cmd; \ __cmd.syscall_no = __NR_##name; \ __SETXID_##nr (__cmd, args); \ - __result = __libc_pthread_functions.ptr__nptl_setxid (&__cmd); \ + __result = PTHFCT_CALL (ptr__nptl_setxid, (&__cmd)); \ } \ else \ __result = INLINE_SYSCALL (name, nr, args); \ |