From 51feb14bff6b4aa70e2f13a54e26a6b270de3e4d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 21 Apr 2012 22:07:49 +0000 Subject: Rename pthread functions to be used for forwarding Libc will need to be able to call them, so they need to have a different name. * pthread/pt-exit.c (pthread_exit): Rename with __ prefix and add strong alias. * pthread/pt-self.c (pthread_self): Likewise. * pthread/pt-setcancelstate.c (pthread_setcancelstate): Likewise * pthread/pt-setcanceltype.c (pthread_setcanceltype): Likewise * sysdeps/generic/pt-attr-destroy.c (pthread_attr_destroy): Likewise * sysdeps/generic/pt-attr-getdetachstate.c (pthread_attr_getdetachstate): Likewise * sysdeps/generic/pt-attr-getinheritsched.c (pthread_attr_getinheritsched): Likewise * sysdeps/generic/pt-attr-getschedparam.c (pthread_attr_getschedparam): Likewise * sysdeps/generic/pt-attr-getschedpolicy.c (pthread_attr_getschedpolicy): Likewise * sysdeps/generic/pt-attr-getscope.c (pthread_attr_getscope): Likewise * sysdeps/generic/pt-attr-init.c (pthread_attr_init): Likewise * sysdeps/generic/pt-attr-setdetachstate.c (pthread_attr_setdetachstate): Likewise * sysdeps/generic/pt-attr-setinheritsched.c (pthread_attr_setinheritsched): Likewise * sysdeps/generic/pt-attr-setschedparam.c (pthread_attr_setschedparam): Likewise * sysdeps/generic/pt-attr-setschedpolicy.c (pthread_attr_setschedpolicy): Likewise * sysdeps/generic/pt-attr-setscope.c (pthread_attr_setscope): Likewise * sysdeps/generic/pt-cond-brdcast.c (pthread_cond_broadcast): Likewise * sysdeps/generic/pt-cond-destroy.c (pthread_cond_destroy): Likewise * sysdeps/generic/pt-cond-init.c (pthread_cond_init): Likewise * sysdeps/generic/pt-cond-signal.c (pthread_cond_signal): Likewise * sysdeps/generic/pt-cond-timedwait.c (pthread_cond_timedwait): Likewise * sysdeps/generic/pt-cond-wait.c (pthread_cond_wait): Likewise * sysdeps/generic/pt-condattr-destroy.c (pthread_condattr_destroy): Likewise * sysdeps/generic/pt-condattr-init.c (pthread_condattr_init): Likewise * sysdeps/generic/pt-equal.c (pthread_equal): Likewise * sysdeps/generic/pt-getschedparam.c (pthread_getschedparam): Likewise * sysdeps/generic/pt-setschedparam.c (pthread_setschedparam): Likewise --- pthread/pt-exit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pthread/pt-exit.c') diff --git a/pthread/pt-exit.c b/pthread/pt-exit.c index c01efda..53a0427 100644 --- a/pthread/pt-exit.c +++ b/pthread/pt-exit.c @@ -30,7 +30,7 @@ /* Terminate the current thread and make STATUS available to any thread that might join it. */ void -pthread_exit (void *status) +__pthread_exit (void *status) { struct __pthread *self = _pthread_self (); struct __pthread_cancelation_handler **handlers; @@ -120,3 +120,5 @@ pthread_exit (void *status) /* NOTREACHED */ abort (); } + +strong_alias (__pthread_exit, pthread_exit); -- cgit v1.2.3 From 608a12659f15d57abf42a972c1e56c6a24cfe244 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 21 Apr 2012 22:14:22 +0000 Subject: Rename bits/atomic.h to bits/pt-atomic.h This avoids a conflict with glibc-provided bits/atomic.h * sysdeps/ia32/bits/atomic.h: Rename to... * sysdeps/ia32/bits/pt-atomic.h: ... this. * pthread/pt-create.c: Include instead of * pthread/pt-exit.c: Likewise. * pthread/pt-internal.h: Likewise. --- pthread/pt-create.c | 2 +- pthread/pt-exit.c | 2 +- pthread/pt-internal.h | 2 +- sysdeps/ia32/bits/atomic.h | 66 ------------------------------------------- sysdeps/ia32/bits/pt-atomic.h | 66 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 69 deletions(-) delete mode 100644 sysdeps/ia32/bits/atomic.h create mode 100644 sysdeps/ia32/bits/pt-atomic.h (limited to 'pthread/pt-exit.c') diff --git a/pthread/pt-create.c b/pthread/pt-create.c index 346c697..ca6b66c 100644 --- a/pthread/pt-create.c +++ b/pthread/pt-create.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include diff --git a/pthread/pt-exit.c b/pthread/pt-exit.c index 53a0427..c47b604 100644 --- a/pthread/pt-exit.c +++ b/pthread/pt-exit.c @@ -24,7 +24,7 @@ #include -#include +#include /* Terminate the current thread and make STATUS available to any diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h index 3f69d2d..94bc9a7 100644 --- a/pthread/pt-internal.h +++ b/pthread/pt-internal.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include diff --git a/sysdeps/ia32/bits/atomic.h b/sysdeps/ia32/bits/atomic.h deleted file mode 100644 index 0dfc1f6..0000000 --- a/sysdeps/ia32/bits/atomic.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Atomic operations. i386 version. - Copyright (C) 2000 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _BITS_ATOMIC_H -#define _BITS_ATOMIC_H 1 - -typedef __volatile int __atomic_t; - -static inline void -__atomic_inc (__atomic_t *__var) -{ - __asm__ __volatile ("lock; incl %0" : "=m" (*__var) : "m" (*__var)); -} - -static inline void -__atomic_dec (__atomic_t *__var) -{ - __asm__ __volatile ("lock; decl %0" : "=m" (*__var) : "m" (*__var)); -} - -static inline int -__atomic_dec_and_test (__atomic_t *__var) -{ - unsigned char __ret; - - __asm__ __volatile ("lock; decl %0; sete %1" - : "=m" (*__var), "=qm" (__ret) : "m" (*__var)); - return __ret != 0; -} - -/* We assume that an __atomicptr_t is only used for pointers to - word-aligned objects, and use the lowest bit for a simple lock. */ -typedef __volatile int * __atomicptr_t; - -/* Actually we don't implement that yet, and assume that we run on - something that has the i486 instruction set. */ -static inline int -__atomicptr_compare_and_swap (__atomicptr_t *__ptr, void *__oldval, - void * __newval) -{ - char __ret; - int __dummy; - - __asm__ __volatile ("lock; cmpxchgl %3, %1; sete %0" - : "=q" (__ret), "=m" (*__ptr), "=a" (__dummy) - : "r" (__newval), "m" (*__ptr), "a" (__oldval)); - return __ret; -} - -#endif diff --git a/sysdeps/ia32/bits/pt-atomic.h b/sysdeps/ia32/bits/pt-atomic.h new file mode 100644 index 0000000..0dfc1f6 --- /dev/null +++ b/sysdeps/ia32/bits/pt-atomic.h @@ -0,0 +1,66 @@ +/* Atomic operations. i386 version. + Copyright (C) 2000 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _BITS_ATOMIC_H +#define _BITS_ATOMIC_H 1 + +typedef __volatile int __atomic_t; + +static inline void +__atomic_inc (__atomic_t *__var) +{ + __asm__ __volatile ("lock; incl %0" : "=m" (*__var) : "m" (*__var)); +} + +static inline void +__atomic_dec (__atomic_t *__var) +{ + __asm__ __volatile ("lock; decl %0" : "=m" (*__var) : "m" (*__var)); +} + +static inline int +__atomic_dec_and_test (__atomic_t *__var) +{ + unsigned char __ret; + + __asm__ __volatile ("lock; decl %0; sete %1" + : "=m" (*__var), "=qm" (__ret) : "m" (*__var)); + return __ret != 0; +} + +/* We assume that an __atomicptr_t is only used for pointers to + word-aligned objects, and use the lowest bit for a simple lock. */ +typedef __volatile int * __atomicptr_t; + +/* Actually we don't implement that yet, and assume that we run on + something that has the i486 instruction set. */ +static inline int +__atomicptr_compare_and_swap (__atomicptr_t *__ptr, void *__oldval, + void * __newval) +{ + char __ret; + int __dummy; + + __asm__ __volatile ("lock; cmpxchgl %3, %1; sete %0" + : "=q" (__ret), "=m" (*__ptr), "=a" (__dummy) + : "r" (__newval), "m" (*__ptr), "a" (__oldval)); + return __ret; +} + +#endif -- cgit v1.2.3