From a831c87b798b78c22ef496de6ddb2e6e447aabad Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 1 Jan 2008 04:07:14 +0000 Subject: 2008-01-01 Samuel Thibault Date: Fri, 29 Feb 2008 09:53:35 +0000 Subject: 2008-02-29 Samuel Thibault Date: Tue, 27 May 2008 18:37:29 +0000 Subject: 2008-05-27 Neal H. Walfield * sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Fix assert. --- ChangeLog | 5 +++++ sysdeps/mach/hurd/pt-docancel.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index c052f03..7d60c62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-27 Neal H. Walfield + + * sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Fix + assert. + 2008-05-17 Samuel Thibault * include/pthread/pthread.h (pthread_getattr_np): New declaration. diff --git a/sysdeps/mach/hurd/pt-docancel.c b/sysdeps/mach/hurd/pt-docancel.c index bac62a7..b81a5c7 100644 --- a/sysdeps/mach/hurd/pt-docancel.c +++ b/sysdeps/mach/hurd/pt-docancel.c @@ -1,5 +1,5 @@ /* Cancel a thread. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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,7 +33,7 @@ __pthread_do_cancel (struct __pthread *p) mach_port_t ktid; int me; - assert (p->cancel_pending = 1); + assert (p->cancel_pending == 1); assert (p->cancel_state == PTHREAD_CANCEL_ENABLE); ktid = __mach_thread_self (); -- cgit v1.2.3 From 362912127aa75b78d4f42493ee1783bab9135cd1 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Sun, 22 Jun 2008 09:05:31 +0000 Subject: 2008-06-22 Neal H. Walfield * sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal) [! NDEBUG]: Set MUTEX->OWNER appropriately and assert that it is consistent. * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock) [! NDEBUG]: Set MUTEX->OWNER appropriately and assert that it is consistent. * sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock) [! NDEBUG]: Set MUTEX->OWNER. --- ChangeLog | 11 +++++++++++ sysdeps/generic/pt-mutex-timedlock.c | 24 +++++++++++++++++++++++- sysdeps/generic/pt-mutex-trylock.c | 14 +++++++++++++- sysdeps/generic/pt-mutex-unlock.c | 28 +++++++++++++++++++++++----- 4 files changed, 70 insertions(+), 7 deletions(-) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index e21d34a..f605d71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-06-22 Neal H. Walfield + + * sysdeps/generic/pt-mutex-timedlock.c + (__pthread_mutex_timedlock_internal) [! NDEBUG]: Set MUTEX->OWNER + appropriately and assert that it is consistent. + * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock) [! + NDEBUG]: Set MUTEX->OWNER appropriately and assert that it is + consistent. + * sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock) [! + NDEBUG]: Set MUTEX->OWNER. + 2008-06-07 Neal H. Walfield * pthread/pt-internal.h (__pthread_queue_iterate): Use 1, not diff --git a/sysdeps/generic/pt-mutex-timedlock.c b/sysdeps/generic/pt-mutex-timedlock.c index 5e222bd..265a453 100644 --- a/sysdeps/generic/pt-mutex-timedlock.c +++ b/sysdeps/generic/pt-mutex-timedlock.c @@ -1,5 +1,5 @@ /* Lock a mutex with a timeout. Generic version. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2008 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 @@ -36,6 +36,18 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, if (__pthread_spin_trylock (&mutex->__held) == 0) /* Successfully acquired the lock. */ { +#ifndef NDEBUG + self = _pthread_self (); + if (self) + /* The main thread may take a lock before the library is fully + initialized, in particular, before the main thread has a + TCB. */ + { + assert (! mutex->owner); + mutex->owner = _pthread_self (); + } +#endif + if (mutex->attr) switch (mutex->attr->mutex_type) { @@ -59,12 +71,14 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, /* The lock is busy. */ self = _pthread_self (); + assert (self); if (mutex->attr) { switch (mutex->attr->mutex_type) { case PTHREAD_MUTEX_NORMAL: + assert (mutex->owner != self); break; case PTHREAD_MUTEX_ERRORCHECK: @@ -88,6 +102,10 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, LOSE; } } + else + assert (mutex->owner != self); + + assert (mutex->owner); if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) return EINVAL; @@ -123,6 +141,10 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, else __pthread_block (self); +#ifndef NDEBUG + assert (mutex->owner == self); +#endif + if (mutex->attr) switch (mutex->attr->mutex_type) { diff --git a/sysdeps/generic/pt-mutex-trylock.c b/sysdeps/generic/pt-mutex-trylock.c index d56f6e1..5264dc7 100644 --- a/sysdeps/generic/pt-mutex-trylock.c +++ b/sysdeps/generic/pt-mutex-trylock.c @@ -1,5 +1,5 @@ /* Try to Lock a mutex. Generic version. - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2008 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,18 @@ __pthread_mutex_trylock (struct __pthread_mutex *mutex) if (__pthread_spin_trylock (&mutex->__held) == 0) /* Acquired the lock. */ { +#ifndef NDEBUG + self = _pthread_self (); + if (self) + /* The main thread may take a lock before the library is fully + initialized, in particular, before the main thread has a + TCB. */ + { + assert (! mutex->owner); + mutex->owner = _pthread_self (); + } +#endif + if (mutex->attr) switch (mutex->attr->mutex_type) { diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c index 2f719d3..d2a4257 100644 --- a/sysdeps/generic/pt-mutex-unlock.c +++ b/sysdeps/generic/pt-mutex-unlock.c @@ -1,5 +1,5 @@ /* Unlock a mutex. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2008 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 @@ -31,12 +31,25 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) __pthread_spin_lock (&mutex->__lock); - if (mutex->attr) + if (! mutex->attr || mutex->attr->mutex_type == PTHREAD_MUTEX_NORMAL) + { +#ifndef NDEBUG + if (_pthread_self ()) + { + assert (mutex->owner); + assertx (mutex->owner == _pthread_self (), + "%p(%x) != %p(%x)", + mutex->owner, + ((struct __pthread *) mutex->owner)->threadid, + _pthread_self (), + _pthread_self ()->threadid); + mutex->owner = NULL; + } +#endif + } + else switch (mutex->attr->mutex_type) { - case PTHREAD_MUTEX_NORMAL: - break; - case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_RECURSIVE: if (mutex->owner != _pthread_self ()) @@ -59,6 +72,7 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) LOSE; } + if (mutex->__queue == NULL) { __pthread_spin_unlock (&mutex->__held); @@ -69,6 +83,10 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) wakeup = mutex->__queue; __pthread_dequeue (wakeup); +#ifndef NDEBUG + mutex->owner = wakeup; +#endif + /* We do not unlock MUTEX->held: we are transferring the ownership to the thread that we are waking up. */ -- cgit v1.2.3 From 2b4c17c482b95c079bdd7149a1326601f41dc03e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 27 Jun 2008 22:35:16 +0000 Subject: 2008-06-27 Samuel Thibault * sysdeps/generic/bits/thread-barrier.h: Remove unused file. --- ChangeLog | 4 ++++ sysdeps/generic/bits/thread-barrier.h | 30 ------------------------------ 2 files changed, 4 insertions(+), 30 deletions(-) delete mode 100644 sysdeps/generic/bits/thread-barrier.h (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index f605d71..90d05f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-27 Samuel Thibault + + * sysdeps/generic/bits/thread-barrier.h: Remove unused file. + 2008-06-22 Neal H. Walfield * sysdeps/generic/pt-mutex-timedlock.c diff --git a/sysdeps/generic/bits/thread-barrier.h b/sysdeps/generic/bits/thread-barrier.h deleted file mode 100644 index 23d51ae..0000000 --- a/sysdeps/generic/bits/thread-barrier.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Thread barrier attribute type. Generic version. - Copyright (C) 2002 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_THREAD_BARRIER_H -#define _BITS_THREAD_BARRIER_H 1 - -/* This structure describes the attributes of a POSIX thread barrier. - Note that not all of them are supported on all systems. */ -struct __pthread_attr -{ - enum __ -}; - -#endif /* bits/thread-barrier.h */ -- cgit v1.2.3 From caacc548f4bfa2f6b86ae761bffba8d49f823e24 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 28 Jun 2008 00:06:52 +0000 Subject: 2008-06-27 Samuel Thibault * include/pthread/pthread.h: Do not define __need_clockid_t, include , and define clockid_t if __clockid_defined is not defined. Include (pthread_equal): New extern inline. (pthread_cleanup_push, pthread_cleanup_pop): New macros. (__pthread_process_shared, __pthread_inheritsched, __pthread_contentionscope, __pthread_detachstate, __pthread_mutex_protocol, __pthread_mutex_type, pthread_attr_t, pthread_mutex_attr_t, pthread_mutex_t, pthread_condattr_t, pthread_cond_t, pthread_spinlock_t, pthread_rwlockattr_t, pthread_rwlock_t, pthread_barrierattr_t, pthread_barrier_t, pthread_key_t, pthread_once_t): Move enums and typedefs to... * include/pthread/pthreadtypes.h: ... new file. * sysdeps/generic/bits/cancelation.h (pthread_cleanup_push): Rename macro to __pthread_cleanup_push. (pthread_cleanup_pop): Rename macro to __pthread_cleanup_pop. * sysdeps/generic/bits/barrier-attr.h (__pthread_process_shared): Forward-declare enum. * sysdeps/generic/bits/condition-attr.h (__pthread_process_shared): Likewise. * sysdeps/generic/bits/mutex-attr.h (__pthread_mutex_protocol, __pthread_process_shared, __pthread_mutex_type): Likewise. * sysdeps/generic/bits/rwlock-attr.h (__pthread_process_shared): Likewise. * sysdeps/generic/bits/thread-attr.h (__pthread_detachstate, __pthread_inheritsched, __pthread_contentionscope): Likewise. * sysdeps/generic/bits/pthread.h (pthread_t): Rename type to __pthread_t. (pthread_equal): Rename to __pthread_equal. --- ChangeLog | 35 +++++++++ include/pthread/pthread.h | 126 ++++++++++--------------------- include/pthread/pthreadtypes.h | 136 ++++++++++++++++++++++++++++++++++ sysdeps/generic/bits/barrier-attr.h | 2 + sysdeps/generic/bits/cancelation.h | 4 +- sysdeps/generic/bits/condition-attr.h | 2 + sysdeps/generic/bits/mutex-attr.h | 4 + sysdeps/generic/bits/pthread.h | 6 +- sysdeps/generic/bits/rwlock-attr.h | 2 + sysdeps/generic/bits/thread-attr.h | 4 + 10 files changed, 229 insertions(+), 92 deletions(-) create mode 100644 include/pthread/pthreadtypes.h (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 90d05f3..5713a0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2008-06-27 Samuel Thibault + + * include/pthread/pthread.h: Do not define __need_clockid_t, include + , and define clockid_t if __clockid_defined is not defined. + Include + (pthread_equal): New extern inline. + (pthread_cleanup_push, pthread_cleanup_pop): New macros. + (__pthread_process_shared, __pthread_inheritsched, + __pthread_contentionscope, __pthread_detachstate, + __pthread_mutex_protocol, __pthread_mutex_type, + pthread_attr_t, pthread_mutex_attr_t, pthread_mutex_t, + pthread_condattr_t, pthread_cond_t, pthread_spinlock_t, + pthread_rwlockattr_t, pthread_rwlock_t, pthread_barrierattr_t, + pthread_barrier_t, pthread_key_t, pthread_once_t): Move enums and + typedefs to... + * include/pthread/pthreadtypes.h: ... new file. + * sysdeps/generic/bits/cancelation.h (pthread_cleanup_push): Rename + macro to __pthread_cleanup_push. + (pthread_cleanup_pop): Rename macro to __pthread_cleanup_pop. + * sysdeps/generic/bits/barrier-attr.h (__pthread_process_shared): + Forward-declare enum. + * sysdeps/generic/bits/condition-attr.h (__pthread_process_shared): + Likewise. + * sysdeps/generic/bits/mutex-attr.h (__pthread_mutex_protocol, + __pthread_process_shared, __pthread_mutex_type): + Likewise. + * sysdeps/generic/bits/rwlock-attr.h (__pthread_process_shared): + Likewise. + * sysdeps/generic/bits/thread-attr.h (__pthread_detachstate, + __pthread_inheritsched, __pthread_contentionscope): + Likewise. + * sysdeps/generic/bits/pthread.h (pthread_t): Rename type to + __pthread_t. + (pthread_equal): Rename to __pthread_equal. + 2008-06-27 Samuel Thibault * sysdeps/generic/bits/thread-barrier.h: Remove unused file. diff --git a/include/pthread/pthread.h b/include/pthread/pthread.h index 88fa1dc..16450c7 100644 --- a/include/pthread/pthread.h +++ b/include/pthread/pthread.h @@ -26,66 +26,34 @@ #include #include -#define __need_clockid_t -#include - -/* If we are in a mode where clockid_t is not automatically defined - and another header has already included then defining - __need_clockid_t was not enough. */ -#ifndef __clockid_t_defined -# define __clockid_t_defined 1 -# include -/* Clock ID used in clock and timer functions. */ -typedef __clockid_t clockid_t; -#endif __BEGIN_DECLS +#include + #include /* Possible values for the process shared attribute. */ -enum __pthread_process_shared - { - PTHREAD_PROCESS_PRIVATE = 0, -#define PTHREAD_PROCESS_PRIVATE 0 - PTHREAD_PROCESS_SHARED -#define PTHREAD_PROCESS_SHARED 1 - }; +#define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE +#define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED /* Thread attributes. */ /* Possible values for the inheritsched attribute. */ -enum __pthread_inheritsched - { - PTHREAD_EXPLICIT_SCHED = 0, -#define PTHREAD_EXPLICIT_SCHED 0 - PTHREAD_INHERIT_SCHED -#define PTHREAD_INHERIT_SCHED 1 - }; +#define PTHREAD_EXPLICIT_SCHED __PTHREAD_EXPLICIT_SCHED +#define PTHREAD_INHERIT_SCHED __PTHREAD_INHERIT_SCHED /* Possible values for the `contentionscope' attribute. */ -enum __pthread_contentionscope - { - PTHREAD_SCOPE_SYSTEM = 0, -#define PTHREAD_SCOPE_SYSTEM 0 - PTHREAD_SCOPE_PROCESS, -#define PTHREAD_SCOPE_PROCESS 1 - }; +#define PTHREAD_SCOPE_SYSTEM __PTHREAD_SCOPE_SYSTEM +#define PTHREAD_SCOPE_PROCESS __PTHREAD_SCOPE_PROCESS /* Possible values for the `detachstate' attribute. */ -enum __pthread_detachstate - { - PTHREAD_CREATE_JOINABLE = 0, -#define PTHREAD_CREATE_JOINABLE 0 - PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 - }; +#define PTHREAD_CREATE_JOINABLE __PTHREAD_CREATE_JOINABLE +#define PTHREAD_CREATE_DETACHED __PTHREAD_CREATE_DETACHED #include -typedef struct __pthread_attr pthread_attr_t; - /* Initialize the thread attribute object in *ATTR to the default values. */ extern int pthread_attr_init (pthread_attr_t *attr); @@ -220,47 +188,48 @@ extern int pthread_detach (pthread_t __threadp); if they are not. */ extern int pthread_equal (pthread_t __t1, pthread_t __t2); +# ifdef __USE_EXTERN_INLINES + +__extern_inline int +pthread_equal (pthread_t __t1, pthread_t __t2) +{ + return __pthread_equal (__t1, __t2); +} + +# endif /* Use extern inlines. */ + + /* Return the thread ID of the calling thread. */ extern pthread_t pthread_self (void); /* Mutex attributes. */ -enum __pthread_mutex_protocol - { - PTHREAD_PRIO_NONE_NP = 0, - PTHREAD_PRIO_INHERIT_NP, - PTHREAD_PRIO_PROTECT_NP +#define PTHREAD_PRIO_NONE_NP __PTHREAD_PRIO_NONE +#define PTHREAD_PRIO_INHERIT_NP __PTHREAD_PRIO_INHERIT +#define PTHREAD_PRIO_PROTECT_NP __PTHREAD_PRIO_PROTECT #ifdef __USE_UNIX98 - , - PTHREAD_PRIO_NONE = PTHREAD_PRIO_NONE_NP, - PTHREAD_PRIO_INHERIT = PTHREAD_PRIO_INHERIT_NP, - PTHREAD_PRIO_PROTECT = PTHREAD_PRIO_PROTECT_NP +#define PTHREAD_PRIO_NONE PTHREAD_PRIO_NONE_NP +#define PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT_NP +#define PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT_NP #endif - }; -enum __pthread_mutex_type - { - PTHREAD_MUTEX_TIMED_NP = 0, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_TIMED_NP __PTHREAD_MUTEX_TIMED +#define PTHREAD_MUTEX_ERRORCHECK_NP __PTHREAD_MUTEX_ERRORCHECK +#define PTHREAD_MUTEX_RECURSIVE_NP __PTHREAD_MUTEX_RECURSIVE #ifdef __USE_UNIX98 - , - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +#define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_TIMED_NP +#define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP +#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL #endif #ifdef __USE_GNU - /* For compatibility. */ - , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP +/* For compatibility. */ +#define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_TIMED_NP #endif - }; #include -typedef struct __pthread_mutexattr pthread_mutexattr_t; - /* Initialize the mutex attribute object in *ATTR to the default values. */ extern int pthread_mutexattr_init(pthread_mutexattr_t *attr); @@ -318,8 +287,6 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr, #include -typedef struct __pthread_mutex pthread_mutex_t; - #define PTHREAD_MUTEX_INITIALIZER __PTHREAD_MUTEX_INITIALIZER /* Create a mutex with attributes given by ATTR and store it in @@ -364,8 +331,6 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict mutex, #include -typedef struct __pthread_condattr pthread_condattr_t; - /* Initialize the condition attribute in *ATTR to the default values. */ extern int pthread_condattr_init (pthread_condattr_t *attr); @@ -400,8 +365,6 @@ extern int pthread_condattr_setpshared (pthread_condattr_t *attr, #include -typedef struct __pthread_cond pthread_cond_t; - #define PTHREAD_COND_INITIALIZER __PTHREAD_COND_INITIALIZER extern int pthread_cond_init (pthread_cond_t *__restrict cond, @@ -437,8 +400,6 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, # include -typedef __pthread_spinlock_t pthread_spinlock_t; - #define PTHREAD_SPINLOCK_INITIALIZER __SPIN_LOCK_INITIALIZER /* Destroy the spin lock object LOCK. */ @@ -502,8 +463,6 @@ pthread_spin_unlock (pthread_spinlock_t *__lock) #include -typedef struct __pthread_rwlockattr pthread_rwlockattr_t; - /* Initialize rwlock attribute object in *ATTR to the default values. */ extern int pthread_rwlockattr_init (pthread_rwlockattr_t *attr); @@ -527,8 +486,6 @@ extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, #include -typedef struct __pthread_rwlock pthread_rwlock_t; - /* Create a rwlock object with attributes given by ATTR and strore the result in *RWLOCK. */ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict rwlock, @@ -580,6 +537,9 @@ extern void pthread_cleanup_pop (int execute); #include +#define pthread_cleanup_push(rt, rtarg) __pthread_cleanup_push(rt, rtarg) +#define pthread_cleanup_pop(execute) __pthread_cleanup_pop(execute) + #define PTHREAD_CANCEL_DISABLE 0 #define PTHREAD_CANCEL_ENABLE 1 @@ -611,8 +571,6 @@ extern void pthread_testcancel (void); #include -typedef struct __pthread_barrierattr pthread_barrierattr_t; - /* Initialize barrier attribute object in *ATTR to the default values. */ extern int pthread_barrierattr_init (pthread_barrierattr_t *attr); @@ -636,8 +594,6 @@ extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *attr, #include -typedef struct __pthread_barrier pthread_barrier_t; - /* Returned by pthread_barrier_wait to exactly one thread each time a barrier is passed. */ #define PTHREAD_BARRIER_SERIAL_THREAD -1 @@ -661,8 +617,6 @@ extern int pthread_barrier_wait (pthread_barrier_t *barrier); #include -typedef __pthread_key pthread_key_t; - /* Create a thread specific data key in KEY visible to all threads. On thread destruction, DESTRUCTOR shall be called with the thread specific data associate with KEY if it is not NULL. */ @@ -684,8 +638,6 @@ extern int pthread_setspecific (pthread_key_t key, const void *value); #include -typedef struct __pthread_once pthread_once_t; - #define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT /* Call INIT_ROUTINE if this function has never been called with diff --git a/include/pthread/pthreadtypes.h b/include/pthread/pthreadtypes.h new file mode 100644 index 0000000..690f1e4 --- /dev/null +++ b/include/pthread/pthreadtypes.h @@ -0,0 +1,136 @@ +/* Copyright (C) 2000, 2002, 2005 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. */ + +/* + * POSIX Threads Extension: ??? + */ + +#ifndef _PTHREADTYPES_H +#define _PTHREADTYPES_H 1 + +#include + +#define __need_clockid_t +#include + +/* If we are in a mode where clockid_t is not automatically defined + and another header has already included then defining + __need_clockid_t was not enough. */ +#ifndef __clockid_t_defined +# define __clockid_t_defined 1 +# include +/* Clock ID used in clock and timer functions. */ +typedef __clockid_t clockid_t; +#endif + +__BEGIN_DECLS + +#include +typedef __pthread_t pthread_t; + +/* Possible values for the process shared attribute. */ +enum __pthread_process_shared + { + __PTHREAD_PROCESS_PRIVATE = 0, + __PTHREAD_PROCESS_SHARED + }; + +/* Possible values for the inheritsched attribute. */ +enum __pthread_inheritsched + { + __PTHREAD_EXPLICIT_SCHED = 0, + __PTHREAD_INHERIT_SCHED + }; + +/* Possible values for the `contentionscope' attribute. */ +enum __pthread_contentionscope + { + __PTHREAD_SCOPE_SYSTEM = 0, + __PTHREAD_SCOPE_PROCESS, + }; + +/* Possible values for the `detachstate' attribute. */ +enum __pthread_detachstate + { + __PTHREAD_CREATE_JOINABLE = 0, + __PTHREAD_CREATE_DETACHED + }; + +#include +typedef struct __pthread_attr pthread_attr_t; + +enum __pthread_mutex_protocol + { + __PTHREAD_PRIO_NONE= 0, + __PTHREAD_PRIO_INHERIT, + __PTHREAD_PRIO_PROTECT + }; + +enum __pthread_mutex_type + { + __PTHREAD_MUTEX_TIMED, + __PTHREAD_MUTEX_ERRORCHECK, + __PTHREAD_MUTEX_RECURSIVE + }; + +#include +typedef struct __pthread_mutexattr pthread_mutexattr_t; + +#include +typedef struct __pthread_mutex pthread_mutex_t; + +#include +typedef struct __pthread_condattr pthread_condattr_t; + +#include +typedef struct __pthread_cond pthread_cond_t; + +#ifdef __USE_XOPEN2K +# include +typedef __pthread_spinlock_t pthread_spinlock_t; +#endif /* XPG6. */ + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K + +#include +typedef struct __pthread_rwlockattr pthread_rwlockattr_t; + +#include +typedef struct __pthread_rwlock pthread_rwlock_t; + +#endif /* __USE_UNIX98 || __USE_XOPEN2K */ + +#ifdef __USE_XOPEN2K + +#include +typedef struct __pthread_barrierattr pthread_barrierattr_t; + +#include +typedef struct __pthread_barrier pthread_barrier_t; + +#endif /* __USE_XOPEN2K */ + +#include +typedef __pthread_key pthread_key_t; + +#include +typedef struct __pthread_once pthread_once_t; + +__END_DECLS + +#endif /* pthreadtypes.h */ diff --git a/sysdeps/generic/bits/barrier-attr.h b/sysdeps/generic/bits/barrier-attr.h index 86f3cb0..d8d09db 100644 --- a/sysdeps/generic/bits/barrier-attr.h +++ b/sysdeps/generic/bits/barrier-attr.h @@ -20,6 +20,8 @@ #ifndef _BITS_BARRIER_ATTR_H #define _BITS_BARRIER_ATTR_H 1 +enum __pthread_process_shared; + /* This structure describes the attributes of a POSIX thread barrier. Note that not all of them are supported on all systems. */ struct __pthread_barrierattr diff --git a/sysdeps/generic/bits/cancelation.h b/sysdeps/generic/bits/cancelation.h index bb6b58a..f94b6e3 100644 --- a/sysdeps/generic/bits/cancelation.h +++ b/sysdeps/generic/bits/cancelation.h @@ -32,7 +32,7 @@ struct __pthread_cancelation_handler /* Returns the thread local location of the cleanup handler stack. */ struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); -#define pthread_cleanup_push(rt, rtarg) \ +#define __pthread_cleanup_push(rt, rtarg) \ { \ struct __pthread_cancelation_handler **__handlers \ = __pthread_get_cleanup_stack (); \ @@ -44,7 +44,7 @@ struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); }; \ *__handlers = &__handler; -#define pthread_cleanup_pop(execute) \ +#define __pthread_cleanup_pop(execute) \ if (execute) \ __handler.handler (__handler.arg); \ assert (*__handlers == &__handler); \ diff --git a/sysdeps/generic/bits/condition-attr.h b/sysdeps/generic/bits/condition-attr.h index 2d48dfb..49bbf7f 100644 --- a/sysdeps/generic/bits/condition-attr.h +++ b/sysdeps/generic/bits/condition-attr.h @@ -22,6 +22,8 @@ #include +enum __pthread_process_shared; + /* User visible part of a condition attribute variable. */ struct __pthread_condattr { diff --git a/sysdeps/generic/bits/mutex-attr.h b/sysdeps/generic/bits/mutex-attr.h index 883b074..5d3d611 100644 --- a/sysdeps/generic/bits/mutex-attr.h +++ b/sysdeps/generic/bits/mutex-attr.h @@ -20,6 +20,10 @@ #ifndef _BITS_MUTEX_ATTR_H #define _BITS_MUTEX_ATTR_H 1 +enum __pthread_mutex_protocol; +enum __pthread_process_shared; +enum __pthread_mutex_type; + /* This structure describes the attributes of a POSIX mutex attribute. */ struct __pthread_mutexattr diff --git a/sysdeps/generic/bits/pthread.h b/sysdeps/generic/bits/pthread.h index 5e239d6..0e8ad9e 100644 --- a/sysdeps/generic/bits/pthread.h +++ b/sysdeps/generic/bits/pthread.h @@ -20,16 +20,16 @@ #ifndef _BITS_PTHREAD_H #define _BITS_PTHREAD_H 1 -typedef int pthread_t; +typedef int __pthread_t; /* Return true if __T1 and __T2 both name the same thread. Otherwise, false. */ extern int -pthread_equal (pthread_t __t1, pthread_t __t2); +__pthread_equal (__pthread_t __t1, __pthread_t __t2); #ifdef __USE_EXTERN_INLINES __extern_inline int -pthread_equal (pthread_t __t1, pthread_t __t2) +__pthread_equal (__pthread_t __t1, __pthread_t __t2) { return __t1 == __t2; } diff --git a/sysdeps/generic/bits/rwlock-attr.h b/sysdeps/generic/bits/rwlock-attr.h index 44765bd..b4f26c4 100644 --- a/sysdeps/generic/bits/rwlock-attr.h +++ b/sysdeps/generic/bits/rwlock-attr.h @@ -20,6 +20,8 @@ #ifndef _BITS_RWLOCK_ATTR_H #define _BITS_RWLOCK_ATTR_H 1 +enum __pthread_process_shared; + /* This structure describes the attributes of a POSIX thread rwlock. Note that not all of them are supported on all systems. */ struct __pthread_rwlockattr diff --git a/sysdeps/generic/bits/thread-attr.h b/sysdeps/generic/bits/thread-attr.h index 3163022..3250f51 100644 --- a/sysdeps/generic/bits/thread-attr.h +++ b/sysdeps/generic/bits/thread-attr.h @@ -22,6 +22,10 @@ #include +enum __pthread_detachstate; +enum __pthread_inheritsched; +enum __pthread_contentionscope; + /* This structure describes the attributes of a POSIX thread. Note that not all of them are supported on all systems. */ struct __pthread_attr -- cgit v1.2.3 From c38729c662cba11dca78e03dca23cec3eaec9f92 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 29 Jun 2008 02:43:00 +0000 Subject: 2008-06-29 Samuel Thibault * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): Do not use assertx and threadid. --- ChangeLog | 5 +++++ sysdeps/generic/pt-mutex-unlock.c | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 5713a0c..4c53697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-29 Samuel Thibault + + * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): + Do not use assertx and threadid. + 2008-06-27 Samuel Thibault * include/pthread/pthread.h: Do not define __need_clockid_t, include diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c index d2a4257..bfb9803 100644 --- a/sysdeps/generic/pt-mutex-unlock.c +++ b/sysdeps/generic/pt-mutex-unlock.c @@ -37,12 +37,16 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) if (_pthread_self ()) { assert (mutex->owner); +#if 0 assertx (mutex->owner == _pthread_self (), "%p(%x) != %p(%x)", mutex->owner, ((struct __pthread *) mutex->owner)->threadid, _pthread_self (), _pthread_self ()->threadid); +#else + assert (mutex->owner == _pthread_self ()); +#endif mutex->owner = NULL; } #endif -- cgit v1.2.3 From ec4b0f2734e9c4f43466019bb0cfe800efc651a9 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 1 Jul 2008 11:43:18 +0000 Subject: Update copyright years. --- Makefile | 4 ++-- include/libc-symbols.h | 3 ++- include/pthread/pthread.h | 3 ++- include/pthread/pthreadtypes.h | 2 +- include/semaphore.h | 2 +- pthread/pt-internal.h | 2 +- sysdeps/generic/bits/barrier-attr.h | 2 +- sysdeps/generic/bits/cancelation.h | 2 +- sysdeps/generic/bits/condition-attr.h | 2 +- sysdeps/generic/bits/mutex-attr.h | 2 +- sysdeps/generic/bits/mutex.h | 2 +- sysdeps/generic/bits/pthread.h | 2 +- sysdeps/generic/bits/rwlock-attr.h | 2 +- sysdeps/generic/bits/rwlock.h | 2 +- sysdeps/generic/bits/thread-attr.h | 2 +- sysdeps/generic/pt-mutex-destroy.c | 2 +- sysdeps/generic/pt-mutex-init.c | 2 +- sysdeps/generic/pt-mutex-lock.c | 2 +- sysdeps/generic/pt-mutex-trylock.c | 2 +- sysdeps/generic/pt-mutex-unlock.c | 2 +- sysdeps/generic/pt-rwlock-destroy.c | 2 +- sysdeps/generic/pt-rwlock-init.c | 2 +- sysdeps/generic/sem-destroy.c | 2 +- sysdeps/generic/sem-getvalue.c | 2 +- sysdeps/generic/sem-init.c | 2 +- sysdeps/generic/sem-open.c | 2 +- sysdeps/generic/sem-post.c | 2 +- sysdeps/generic/sem-timedwait.c | 2 +- sysdeps/generic/sem-trywait.c | 2 +- sysdeps/generic/sem-unlink.c | 2 +- sysdeps/generic/sem-wait.c | 2 +- sysdeps/i386/bits/memory.h | 2 +- sysdeps/i386/bits/spin-lock.h | 2 +- sysdeps/i386/machine-sp.h | 2 +- sysdeps/l4/hurd/i386/pt-setup.c | 2 +- sysdeps/mach/bits/spin-lock.h | 2 +- sysdeps/mach/hurd/i386/pt-setup.c | 2 +- 37 files changed, 40 insertions(+), 38 deletions(-) (limited to 'sysdeps') diff --git a/Makefile b/Makefile index dc41950..0fa0096 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # -# Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, 2007 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, 2007, +# 2008 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as diff --git a/include/libc-symbols.h b/include/libc-symbols.h index b435ad3..54dd6e2 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -1,6 +1,7 @@ /* Support macros for making weak and strong aliases for symbols, and for using symbol sets and linker warnings with GNU ld. - Copyright (C) 1995-1998,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 + 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 diff --git a/include/pthread/pthread.h b/include/pthread/pthread.h index 16450c7..ba9c7dc 100644 --- a/include/pthread/pthread.h +++ b/include/pthread/pthread.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008 + 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 diff --git a/include/pthread/pthreadtypes.h b/include/pthread/pthreadtypes.h index 690f1e4..d9c1c6b 100644 --- a/include/pthread/pthreadtypes.h +++ b/include/pthread/pthreadtypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2005, 2008 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 diff --git a/include/semaphore.h b/include/semaphore.h index 06c9e73..657e796 100644 --- a/include/semaphore.h +++ b/include/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. +/* Copyright (C) 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 diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h index d9bf7bc..e7c85fd 100644 --- a/pthread/pt-internal.h +++ b/pthread/pt-internal.h @@ -1,5 +1,5 @@ /* Internal defenitions for pthreads library. - Copyright (C) 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2005, 2006, 2008 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 diff --git a/sysdeps/generic/bits/barrier-attr.h b/sysdeps/generic/bits/barrier-attr.h index d8d09db..a9900b7 100644 --- a/sysdeps/generic/bits/barrier-attr.h +++ b/sysdeps/generic/bits/barrier-attr.h @@ -1,5 +1,5 @@ /* Thread barrier attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/generic/bits/cancelation.h b/sysdeps/generic/bits/cancelation.h index f94b6e3..f446d59 100644 --- a/sysdeps/generic/bits/cancelation.h +++ b/sysdeps/generic/bits/cancelation.h @@ -1,5 +1,5 @@ /* Cancelation. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/generic/bits/condition-attr.h b/sysdeps/generic/bits/condition-attr.h index 49bbf7f..a131128 100644 --- a/sysdeps/generic/bits/condition-attr.h +++ b/sysdeps/generic/bits/condition-attr.h @@ -1,5 +1,5 @@ /* Condition attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/generic/bits/mutex-attr.h b/sysdeps/generic/bits/mutex-attr.h index 5d3d611..7a5c45c 100644 --- a/sysdeps/generic/bits/mutex-attr.h +++ b/sysdeps/generic/bits/mutex-attr.h @@ -1,5 +1,5 @@ /* Mutex attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/generic/bits/mutex.h b/sysdeps/generic/bits/mutex.h index 1aaf80e..b44fa6d 100644 --- a/sysdeps/generic/bits/mutex.h +++ b/sysdeps/generic/bits/mutex.h @@ -1,5 +1,5 @@ /* Mutex type. Generic version. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2006, 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 diff --git a/sysdeps/generic/bits/pthread.h b/sysdeps/generic/bits/pthread.h index 0e8ad9e..80e6b09 100644 --- a/sysdeps/generic/bits/pthread.h +++ b/sysdeps/generic/bits/pthread.h @@ -1,5 +1,5 @@ /* Pthread data structures. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/generic/bits/rwlock-attr.h b/sysdeps/generic/bits/rwlock-attr.h index b4f26c4..dba99f1 100644 --- a/sysdeps/generic/bits/rwlock-attr.h +++ b/sysdeps/generic/bits/rwlock-attr.h @@ -1,5 +1,5 @@ /* Thread rwlock attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/generic/bits/rwlock.h b/sysdeps/generic/bits/rwlock.h index 696f9c2..3d600ec 100644 --- a/sysdeps/generic/bits/rwlock.h +++ b/sysdeps/generic/bits/rwlock.h @@ -1,5 +1,5 @@ /* rwlock type. Generic version. - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006, 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 diff --git a/sysdeps/generic/bits/thread-attr.h b/sysdeps/generic/bits/thread-attr.h index 3250f51..c3a93fd 100644 --- a/sysdeps/generic/bits/thread-attr.h +++ b/sysdeps/generic/bits/thread-attr.h @@ -1,5 +1,5 @@ /* Thread attribute type. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2008 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 diff --git a/sysdeps/generic/pt-mutex-destroy.c b/sysdeps/generic/pt-mutex-destroy.c index 72faefe..71fc692 100644 --- a/sysdeps/generic/pt-mutex-destroy.c +++ b/sysdeps/generic/pt-mutex-destroy.c @@ -1,5 +1,5 @@ /* Destroy a mutex. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2006 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 diff --git a/sysdeps/generic/pt-mutex-init.c b/sysdeps/generic/pt-mutex-init.c index da1781b..9407673 100644 --- a/sysdeps/generic/pt-mutex-init.c +++ b/sysdeps/generic/pt-mutex-init.c @@ -1,5 +1,5 @@ /* Initialize a mutex. Generic version. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2006 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 diff --git a/sysdeps/generic/pt-mutex-lock.c b/sysdeps/generic/pt-mutex-lock.c index 60fc55a..528e593 100644 --- a/sysdeps/generic/pt-mutex-lock.c +++ b/sysdeps/generic/pt-mutex-lock.c @@ -1,5 +1,5 @@ /* Lock a mutex. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2006 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 diff --git a/sysdeps/generic/pt-mutex-trylock.c b/sysdeps/generic/pt-mutex-trylock.c index 5264dc7..d523205 100644 --- a/sysdeps/generic/pt-mutex-trylock.c +++ b/sysdeps/generic/pt-mutex-trylock.c @@ -1,5 +1,5 @@ /* Try to Lock a mutex. Generic version. - Copyright (C) 2002, 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006, 2008 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 diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c index bfb9803..4352042 100644 --- a/sysdeps/generic/pt-mutex-unlock.c +++ b/sysdeps/generic/pt-mutex-unlock.c @@ -1,5 +1,5 @@ /* Unlock a mutex. Generic version. - Copyright (C) 2000, 2002, 2008 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2006, 2008 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 diff --git a/sysdeps/generic/pt-rwlock-destroy.c b/sysdeps/generic/pt-rwlock-destroy.c index 034d930..045eebd 100644 --- a/sysdeps/generic/pt-rwlock-destroy.c +++ b/sysdeps/generic/pt-rwlock-destroy.c @@ -1,5 +1,5 @@ /* Destroy a rwlock. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2006 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 diff --git a/sysdeps/generic/pt-rwlock-init.c b/sysdeps/generic/pt-rwlock-init.c index 8aa495e..c9ff9b2 100644 --- a/sysdeps/generic/pt-rwlock-init.c +++ b/sysdeps/generic/pt-rwlock-init.c @@ -1,5 +1,5 @@ /* Initialize a rwlock. Generic version. - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006 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 diff --git a/sysdeps/generic/sem-destroy.c b/sysdeps/generic/sem-destroy.c index 985f4ad..6486599 100644 --- a/sysdeps/generic/sem-destroy.c +++ b/sysdeps/generic/sem-destroy.c @@ -1,5 +1,5 @@ /* Destroy a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-getvalue.c b/sysdeps/generic/sem-getvalue.c index 8e418e3..7762089 100644 --- a/sysdeps/generic/sem-getvalue.c +++ b/sysdeps/generic/sem-getvalue.c @@ -1,5 +1,5 @@ /* Get the value of a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-init.c b/sysdeps/generic/sem-init.c index 6c6d79e..d2414f5 100644 --- a/sysdeps/generic/sem-init.c +++ b/sysdeps/generic/sem-init.c @@ -1,5 +1,5 @@ /* Initialize a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-open.c b/sysdeps/generic/sem-open.c index 9eb13aa..bae87ed 100644 --- a/sysdeps/generic/sem-open.c +++ b/sysdeps/generic/sem-open.c @@ -1,5 +1,5 @@ /* Open a named semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-post.c b/sysdeps/generic/sem-post.c index 0e20ea7..6d438bf 100644 --- a/sysdeps/generic/sem-post.c +++ b/sysdeps/generic/sem-post.c @@ -1,5 +1,5 @@ /* Post a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-timedwait.c b/sysdeps/generic/sem-timedwait.c index d01bfdb..f904000 100644 --- a/sysdeps/generic/sem-timedwait.c +++ b/sysdeps/generic/sem-timedwait.c @@ -1,5 +1,5 @@ /* Wait on a semaphore with a timeout. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-trywait.c b/sysdeps/generic/sem-trywait.c index 199f317..437e282 100644 --- a/sysdeps/generic/sem-trywait.c +++ b/sysdeps/generic/sem-trywait.c @@ -1,5 +1,5 @@ /* Lock a semaphore if it does not require blocking. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-unlink.c b/sysdeps/generic/sem-unlink.c index 519f4f7..570ed61 100644 --- a/sysdeps/generic/sem-unlink.c +++ b/sysdeps/generic/sem-unlink.c @@ -1,5 +1,5 @@ /* Unlink a named semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/generic/sem-wait.c b/sysdeps/generic/sem-wait.c index 50752f3..8347480 100644 --- a/sysdeps/generic/sem-wait.c +++ b/sysdeps/generic/sem-wait.c @@ -1,5 +1,5 @@ /* Wait on a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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 diff --git a/sysdeps/i386/bits/memory.h b/sysdeps/i386/bits/memory.h index 57c1463..e47a8e2 100644 --- a/sysdeps/i386/bits/memory.h +++ b/sysdeps/i386/bits/memory.h @@ -1,5 +1,5 @@ /* Memory barrier operations. i386 version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 diff --git a/sysdeps/i386/bits/spin-lock.h b/sysdeps/i386/bits/spin-lock.h index d893654..30b0c64 100644 --- a/sysdeps/i386/bits/spin-lock.h +++ b/sysdeps/i386/bits/spin-lock.h @@ -1,5 +1,5 @@ /* Machine-specific definitions for spin locks. i386 version. - Copyright (C) 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2005, 2008 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 diff --git a/sysdeps/i386/machine-sp.h b/sysdeps/i386/machine-sp.h index 945a36b..cef6ab7 100644 --- a/sysdeps/i386/machine-sp.h +++ b/sysdeps/i386/machine-sp.h @@ -1,5 +1,5 @@ /* Machine-specific function to return the stack pointer. i386 version. - Copyright (C) 1994,97,2001 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2001, 2006 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 diff --git a/sysdeps/l4/hurd/i386/pt-setup.c b/sysdeps/l4/hurd/i386/pt-setup.c index 6afcd14..6540ee5 100644 --- a/sysdeps/l4/hurd/i386/pt-setup.c +++ b/sysdeps/l4/hurd/i386/pt-setup.c @@ -1,5 +1,5 @@ /* Setup thread stack. Hurd/i386 version. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2008 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 diff --git a/sysdeps/mach/bits/spin-lock.h b/sysdeps/mach/bits/spin-lock.h index 031e9ce..0cbf11e 100644 --- a/sysdeps/mach/bits/spin-lock.h +++ b/sysdeps/mach/bits/spin-lock.h @@ -1,5 +1,5 @@ /* Definitions of user-visible names for spin locks. - Copyright (C) 1994, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2002, 2008 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 diff --git a/sysdeps/mach/hurd/i386/pt-setup.c b/sysdeps/mach/hurd/i386/pt-setup.c index 71f60e2..5abbcfc 100644 --- a/sysdeps/mach/hurd/i386/pt-setup.c +++ b/sysdeps/mach/hurd/i386/pt-setup.c @@ -1,5 +1,5 @@ /* Setup thread stack. Hurd/i386 version. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2008 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 -- cgit v1.2.3 From ef8de977fc0e72ee149085e5b4b9df23b7660fbe Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 2 Aug 2008 20:21:20 +0000 Subject: 2008-08-02 Samuel Thibault * sysdeps/generic/bits/mutex.h: Do not include and --- ChangeLog | 5 +++++ sysdeps/generic/bits/mutex.h | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 0cd05f5..d01cba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-02 Samuel Thibault + + * sysdeps/generic/bits/mutex.h: Do not include and + + 2008-07-18 Samuel Thibault * Makefile (sysdeps_headers): add pthread/pthreadtypes.h diff --git a/sysdeps/generic/bits/mutex.h b/sysdeps/generic/bits/mutex.h index b44fa6d..5c7fede 100644 --- a/sysdeps/generic/bits/mutex.h +++ b/sysdeps/generic/bits/mutex.h @@ -57,11 +57,4 @@ struct __pthread_mutex # endif #endif /* Not __pthread_mutex_defined. */ -#ifdef _BITS_MUTEX_H - -#include -#include - -#endif - #endif /* bits/mutex.h */ -- cgit v1.2.3 From fc1964a7d295bec777d14b0f96692528bdb79437 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 2 Aug 2008 20:40:14 +0000 Subject: 2008-08-02 Samuel Thibault [libpthread] * sysdeps/i386/bits/memory.h (__memory_barrier): Add memory clobber. * sysdeps/i386/bits/spin-lock.h (__pthread_spin_trylock, __pthread_spin_unlock): Add memory clobbers. [libthreads] * i386/cthreads.h (spin_unlock, spin_try_lock): Add memory clobbers. --- ChangeLog | 3 +++ sysdeps/i386/bits/memory.h | 2 +- sysdeps/i386/bits/spin-lock.h | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index d01cba3..6c7d223 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * sysdeps/generic/bits/mutex.h: Do not include and + * sysdeps/i386/bits/memory.h (__memory_barrier): Add memory clobber. + * sysdeps/i386/bits/spin-lock.h (__pthread_spin_trylock, + __pthread_spin_unlock): Add memory clobbers. 2008-07-18 Samuel Thibault diff --git a/sysdeps/i386/bits/memory.h b/sysdeps/i386/bits/memory.h index e47a8e2..932c408 100644 --- a/sysdeps/i386/bits/memory.h +++ b/sysdeps/i386/bits/memory.h @@ -28,7 +28,7 @@ __memory_barrier (void) /* Any lock'ed instruction will do. We just do a simple increment. */ - __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i)); + __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i) : "memory"); } /* Prevent read reordering across this function. */ diff --git a/sysdeps/i386/bits/spin-lock.h b/sysdeps/i386/bits/spin-lock.h index 30b0c64..a306697 100644 --- a/sysdeps/i386/bits/spin-lock.h +++ b/sysdeps/i386/bits/spin-lock.h @@ -70,7 +70,7 @@ __pthread_spin_trylock (__pthread_spinlock_t *__lock) { int __locked; __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__locked), "=m" (*__lock) : "0" (1)); + : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory"); return __locked ? __EBUSY : 0; } @@ -92,7 +92,7 @@ __pthread_spin_unlock (__pthread_spinlock_t *__lock) { int __unlocked; __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__unlocked), "=m" (*__lock) : "0" (0)); + : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory"); return 0; } -- cgit v1.2.3 From 26ce9018aa473f5282b70d057f6b6de6d1cdca99 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 3 Aug 2008 00:13:13 +0000 Subject: * sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Fix cast from thread to integer. Fix reservation of stack room for initial frame. * sysdeps/l4/hurd/i386/pt-setup.c (stack_setup): Fix reservation of stack room for initial frame. --- ChangeLog | 4 ++++ sysdeps/l4/hurd/i386/pt-setup.c | 2 +- sysdeps/mach/hurd/i386/pt-setup.c | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 6c7d223..17d0c2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ * sysdeps/i386/bits/memory.h (__memory_barrier): Add memory clobber. * sysdeps/i386/bits/spin-lock.h (__pthread_spin_trylock, __pthread_spin_unlock): Add memory clobbers. + * sysdeps/mach/hurd/i386/pt-setup.c (stack_setup): Fix cast from + thread to integer. Fix reservation of stack room for initial frame. + * sysdeps/l4/hurd/i386/pt-setup.c (stack_setup): Fix reservation of + stack room for initial frame. 2008-07-18 Samuel Thibault diff --git a/sysdeps/l4/hurd/i386/pt-setup.c b/sysdeps/l4/hurd/i386/pt-setup.c index 6540ee5..2b7a3e2 100644 --- a/sysdeps/l4/hurd/i386/pt-setup.c +++ b/sysdeps/l4/hurd/i386/pt-setup.c @@ -47,7 +47,7 @@ stack_setup (struct __pthread *thread, if (start_routine) { /* Set up call frame. */ - top -= 2*sizeof(L4_Word_t); + top -= 2; top = (unsigned long) top & ~0xf; top[1] = (L4_Word_t) arg; /* Argument to START_ROUTINE. */ top[0] = (L4_Word_t) start_routine; diff --git a/sysdeps/mach/hurd/i386/pt-setup.c b/sysdeps/mach/hurd/i386/pt-setup.c index 5abbcfc..ba438d6 100644 --- a/sysdeps/mach/hurd/i386/pt-setup.c +++ b/sysdeps/mach/hurd/i386/pt-setup.c @@ -58,12 +58,12 @@ stack_setup (struct __pthread *thread, top -= __hurd_threadvar_max; /* Save the self pointer. */ - top[_HURD_THREADVAR_THREAD] = (void *) thread; + top[_HURD_THREADVAR_THREAD] = (uintptr_t) thread; if (start_routine) { /* And then the call frame. */ - top -= 2*sizeof(uintptr_t); + top -= 2; top = (uintptr_t) top & ~0xf; top[1] = (uintptr_t) arg; /* Argument to START_ROUTINE. */ top[0] = (uintptr_t) start_routine; -- cgit v1.2.3 From 3bcc540d4c6c59dbfa5958d1b59942f8b610bf5e Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sun, 3 Aug 2008 07:02:36 +0000 Subject: Update copyright year. --- sysdeps/generic/bits/mutex.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sysdeps') diff --git a/sysdeps/generic/bits/mutex.h b/sysdeps/generic/bits/mutex.h index 5c7fede..7c77a8d 100644 --- a/sysdeps/generic/bits/mutex.h +++ b/sysdeps/generic/bits/mutex.h @@ -1,5 +1,8 @@ /* Mutex type. Generic version. - Copyright (C) 2000, 2002, 2005, 2006, 2007 Free Software Foundation, Inc. + + Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008 + 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 -- cgit v1.2.3 From 334b9a33a8adcddaf144e8285367c6753b7ab7ec Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 3 Aug 2008 18:56:49 +0000 Subject: * Makefile (sysdeps_headers): Add spin-lock-inline.h. (SYSDEP_PATH): Move sysdeps/i386 right after sysdeps/$(MICROKERNEL)/i386. * include/pthread/pthread.h: Include . * sysdeps/i386/bits/spin-lock.h: Move inlines to... * sysdeps/i386/bits/spin-lock-inline.h: ... new file. * sysdeps/mach/bits/spin-lock.h: Move inlines to... * sysdeps/mach/bits/spin-lock-inline.h: ... new file. --- ChangeLog | 11 ++++ Makefile | 3 +- include/pthread/pthread.h | 2 + sysdeps/i386/bits/spin-lock-inline.h | 98 ++++++++++++++++++++++++++++++++++++ sysdeps/i386/bits/spin-lock.h | 64 ----------------------- sysdeps/mach/bits/spin-lock-inline.h | 90 +++++++++++++++++++++++++++++++++ sysdeps/mach/bits/spin-lock.h | 59 ---------------------- 7 files changed, 203 insertions(+), 124 deletions(-) create mode 100644 sysdeps/i386/bits/spin-lock-inline.h create mode 100644 sysdeps/mach/bits/spin-lock-inline.h (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 17d0c2f..95b19f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-08-03 Samuel Thibault + + * Makefile (sysdeps_headers): Add spin-lock-inline.h. + (SYSDEP_PATH): Move sysdeps/i386 right after + sysdeps/$(MICROKERNEL)/i386. + * include/pthread/pthread.h: Include . + * sysdeps/i386/bits/spin-lock.h: Move inlines to... + * sysdeps/i386/bits/spin-lock-inline.h: ... new file. + * sysdeps/mach/bits/spin-lock.h: Move inlines to... + * sysdeps/mach/bits/spin-lock-inline.h: ... new file. + 2008-08-02 Samuel Thibault * sysdeps/generic/bits/mutex.h: Do not include and diff --git a/Makefile b/Makefile index 0076220..589e3ce 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,7 @@ sysdeps_headers = \ bits/condition.h \ bits/condition-attr.h \ bits/spin-lock.h \ + bits/spin-lock-inline.h \ bits/cancelation.h \ bits/thread-attr.h \ bits/barrier-attr.h \ @@ -158,10 +159,10 @@ sysdeps_headers = \ SYSDEP_PATH = $(srcdir)/sysdeps/$(MICROKERNEL)/hurd/i386 \ $(srcdir)/sysdeps/$(MICROKERNEL)/i386 \ + $(srcdir)/sysdeps/i386 \ $(srcdir)/sysdeps/$(MICROKERNEL)/hurd \ $(srcdir)/sysdeps/$(MICROKERNEL) \ $(srcdir)/sysdeps/hurd \ - $(srcdir)/sysdeps/i386 \ $(srcdir)/sysdeps/generic \ $(srcdir)/sysdeps/posix \ $(srcdir)/pthread \ diff --git a/include/pthread/pthread.h b/include/pthread/pthread.h index ba9c7dc..76733e0 100644 --- a/include/pthread/pthread.h +++ b/include/pthread/pthread.h @@ -423,6 +423,8 @@ extern int pthread_spin_unlock (pthread_spinlock_t *__lock); # ifdef __USE_EXTERN_INLINES +# include + __extern_inline int pthread_spin_destroy (pthread_spinlock_t *__lock) { diff --git a/sysdeps/i386/bits/spin-lock-inline.h b/sysdeps/i386/bits/spin-lock-inline.h new file mode 100644 index 0000000..0f3ca58 --- /dev/null +++ b/sysdeps/i386/bits/spin-lock-inline.h @@ -0,0 +1,98 @@ +/* Machine-specific definitions for spin locks. i386 version. + Copyright (C) 2000, 2005, 2008 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. */ + +/* + * Never include this file directly; use or instead. + */ + +#ifndef _BITS_SPIN_LOCK_INLINE_H +#define _BITS_SPIN_LOCK_INLINE_H 1 + +#include +#include + +__BEGIN_DECLS + +#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES + +# ifndef __EBUSY +# include +# define __EBUSY EBUSY +# endif + +# ifndef __PT_SPIN_INLINE +# define __PT_SPIN_INLINE __extern_inline +# endif + +__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_destroy (__pthread_spinlock_t *__lock) +{ + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock, + int __pshared); + +__PT_SPIN_INLINE int +__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared) +{ + *__lock = __SPIN_LOCK_INITIALIZER; + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_trylock (__pthread_spinlock_t *__lock) +{ + int __locked; + __asm__ __volatile ("xchgl %0, %1" + : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory"); + return __locked ? __EBUSY : 0; +} + +__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock); +extern int _pthread_spin_lock (__pthread_spinlock_t *__lock); + +__extern_inline int +__pthread_spin_lock (__pthread_spinlock_t *__lock) +{ + if (__pthread_spin_trylock (__lock)) + return _pthread_spin_lock (__lock); + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_unlock (__pthread_spinlock_t *__lock) +{ + int __unlocked; + __asm__ __volatile ("xchgl %0, %1" + : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory"); + return 0; +} + +#endif /* Use extern inlines or force inlines. */ + +__END_DECLS + +#endif /* bits/spin-lock.h */ diff --git a/sysdeps/i386/bits/spin-lock.h b/sysdeps/i386/bits/spin-lock.h index a306697..2662b6f 100644 --- a/sysdeps/i386/bits/spin-lock.h +++ b/sysdeps/i386/bits/spin-lock.h @@ -34,70 +34,6 @@ typedef __volatile int __pthread_spinlock_t; /* Initializer for a spin lock object. */ # define __SPIN_LOCK_INITIALIZER (0) -#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES - -# ifndef __EBUSY -# include -# define __EBUSY EBUSY -# endif - -# ifndef __PT_SPIN_INLINE -# define __PT_SPIN_INLINE __extern_inline -# endif - -__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_destroy (__pthread_spinlock_t *__lock) -{ - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock, - int __pshared); - -__PT_SPIN_INLINE int -__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared) -{ - *__lock = __SPIN_LOCK_INITIALIZER; - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_trylock (__pthread_spinlock_t *__lock) -{ - int __locked; - __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory"); - return __locked ? __EBUSY : 0; -} - -__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock); -extern int _pthread_spin_lock (__pthread_spinlock_t *__lock); - -__extern_inline int -__pthread_spin_lock (__pthread_spinlock_t *__lock) -{ - if (__pthread_spin_trylock (__lock)) - return _pthread_spin_lock (__lock); - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_unlock (__pthread_spinlock_t *__lock) -{ - int __unlocked; - __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory"); - return 0; -} - -#endif /* Use extern inlines or force inlines. */ - __END_DECLS #endif /* bits/spin-lock.h */ diff --git a/sysdeps/mach/bits/spin-lock-inline.h b/sysdeps/mach/bits/spin-lock-inline.h new file mode 100644 index 0000000..bb066d0 --- /dev/null +++ b/sysdeps/mach/bits/spin-lock-inline.h @@ -0,0 +1,90 @@ +/* Definitions of user-visible names for spin locks. + Copyright (C) 1994, 1997, 2002, 2008 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 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 _BITS_SPIN_LOCK_INLINE_H +#define _BITS_SPIN_LOCK_INLINE_H 1 + +#include +#include +#include /* This does all the work. */ + +__BEGIN_DECLS + +#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES + +# ifndef __EBUSY +# include +# define __EBUSY EBUSY +# endif + +# ifndef __PT_SPIN_INLINE +# define __PT_SPIN_INLINE __extern_inline +# endif + +__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_destroy (__pthread_spinlock_t *__lock) +{ + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock, + int __pshared); + +__PT_SPIN_INLINE int +__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared) +{ + *__lock = __SPIN_LOCK_INITIALIZER; + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_trylock (__pthread_spinlock_t *__lock) +{ + return __spin_try_lock (__lock) ? 0 : __EBUSY; +} + +__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock); +extern int _pthread_spin_lock (__pthread_spinlock_t *__lock); + +__extern_inline int +__pthread_spin_lock (__pthread_spinlock_t *__lock) +{ + if (__pthread_spin_trylock (__lock)) + return _pthread_spin_lock (__lock); + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_unlock (__pthread_spinlock_t *__lock) +{ + __spin_unlock (__lock); + return 0; +} + +#endif /* Use extern inlines or force inlines. */ + +__END_DECLS + +#endif /* bits/spin-lock.h */ diff --git a/sysdeps/mach/bits/spin-lock.h b/sysdeps/mach/bits/spin-lock.h index 0cbf11e..54425cc 100644 --- a/sysdeps/mach/bits/spin-lock.h +++ b/sysdeps/mach/bits/spin-lock.h @@ -33,65 +33,6 @@ typedef __spin_lock_t __pthread_spinlock_t; #error __SPIN_LOCK_INITIALIZER undefined: should be defined by . #endif -#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES - -# ifndef __EBUSY -# include -# define __EBUSY EBUSY -# endif - -# ifndef __PT_SPIN_INLINE -# define __PT_SPIN_INLINE __extern_inline -# endif - -__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_destroy (__pthread_spinlock_t *__lock) -{ - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock, - int __pshared); - -__PT_SPIN_INLINE int -__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared) -{ - *__lock = __SPIN_LOCK_INITIALIZER; - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_trylock (__pthread_spinlock_t *__lock) -{ - return __spin_try_lock (__lock) ? 0 : __EBUSY; -} - -__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock); -extern int _pthread_spin_lock (__pthread_spinlock_t *__lock); - -__extern_inline int -__pthread_spin_lock (__pthread_spinlock_t *__lock) -{ - if (__pthread_spin_trylock (__lock)) - return _pthread_spin_lock (__lock); - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_unlock (__pthread_spinlock_t *__lock) -{ - __spin_unlock (__lock); - return 0; -} - -#endif /* Use extern inlines or force inlines. */ - __END_DECLS #endif /* bits/spin-lock.h */ -- cgit v1.2.3 From c5441c2e019718a374461106af2b59809cfbdb0e Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Mon, 11 Aug 2008 19:30:30 +0000 Subject: 2008-08-11 Neal H. Walfield * sysdeps/l4/pt-docancel.c: Remove file. * sysdeps/l4/pt-thread-alloc.c: Likewise. * sysdeps/l4/pt-wakeup.c: Likewise. * sysdeps/l4/pt-thread-halt.c: Likewise. * sysdeps/l4/pt-start.c: Likewise. * sysdeps/l4/pt-stack-alloc.c: Likewise. * sysdeps/l4/pt-thread-start.c: Likewise. * sysdeps/l4/pt-block.c: Likewise. * sysdeps/l4/hurd/pt-sysdep.h: Likewise. * sysdeps/l4/hurd/pt-sysdep.c: Likewise. * sysdeps/l4/hurd/i386/pt-setup.c: Likewise. * sysdeps/l4/hurd/i386/pt-machdep.c: Likewise. --- ChangeLog | 15 ++++++ sysdeps/l4/hurd/i386/pt-machdep.c | 20 -------- sysdeps/l4/hurd/i386/pt-setup.c | 74 --------------------------- sysdeps/l4/hurd/pt-sysdep.c | 58 --------------------- sysdeps/l4/hurd/pt-sysdep.h | 52 ------------------- sysdeps/l4/pt-block.c | 29 ----------- sysdeps/l4/pt-docancel.c | 51 ------------------- sysdeps/l4/pt-stack-alloc.c | 70 -------------------------- sysdeps/l4/pt-start.c | 103 -------------------------------------- sysdeps/l4/pt-thread-alloc.c | 52 ------------------- sysdeps/l4/pt-thread-halt.c | 38 -------------- sysdeps/l4/pt-thread-start.c | 92 ---------------------------------- sysdeps/l4/pt-wakeup.c | 29 ----------- 13 files changed, 15 insertions(+), 668 deletions(-) delete mode 100644 sysdeps/l4/hurd/i386/pt-machdep.c delete mode 100644 sysdeps/l4/hurd/i386/pt-setup.c delete mode 100644 sysdeps/l4/hurd/pt-sysdep.c delete mode 100644 sysdeps/l4/hurd/pt-sysdep.h delete mode 100644 sysdeps/l4/pt-block.c delete mode 100644 sysdeps/l4/pt-docancel.c delete mode 100644 sysdeps/l4/pt-stack-alloc.c delete mode 100644 sysdeps/l4/pt-start.c delete mode 100644 sysdeps/l4/pt-thread-alloc.c delete mode 100644 sysdeps/l4/pt-thread-halt.c delete mode 100644 sysdeps/l4/pt-thread-start.c delete mode 100644 sysdeps/l4/pt-wakeup.c (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 3c047ba..78fd677 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-08-11 Neal H. Walfield + + * sysdeps/l4/pt-docancel.c: Remove file. + * sysdeps/l4/pt-thread-alloc.c: Likewise. + * sysdeps/l4/pt-wakeup.c: Likewise. + * sysdeps/l4/pt-thread-halt.c: Likewise. + * sysdeps/l4/pt-start.c: Likewise. + * sysdeps/l4/pt-stack-alloc.c: Likewise. + * sysdeps/l4/pt-thread-start.c: Likewise. + * sysdeps/l4/pt-block.c: Likewise. + * sysdeps/l4/hurd/pt-sysdep.h: Likewise. + * sysdeps/l4/hurd/pt-sysdep.c: Likewise. + * sysdeps/l4/hurd/i386/pt-setup.c: Likewise. + * sysdeps/l4/hurd/i386/pt-machdep.c: Likewise. + 2008-08-04 Samuel Thibault * include/pthread/pthreadtypes.h (__pthread_inheritsched): Remove diff --git a/sysdeps/l4/hurd/i386/pt-machdep.c b/sysdeps/l4/hurd/i386/pt-machdep.c deleted file mode 100644 index dbf5cd7..0000000 --- a/sysdeps/l4/hurd/i386/pt-machdep.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Machine dependent pthreads code. Hurd/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. */ - -/* Nothing to do. */ diff --git a/sysdeps/l4/hurd/i386/pt-setup.c b/sysdeps/l4/hurd/i386/pt-setup.c deleted file mode 100644 index 2b7a3e2..0000000 --- a/sysdeps/l4/hurd/i386/pt-setup.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Setup thread stack. Hurd/i386 version. - Copyright (C) 2000, 2002, 2008 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. */ - -#include - -#include - -/* The stack layout used on the i386 is: - - ----------------- - | ARG | - ----------------- - | START_ROUTINE | - ----------------- - | 0 | - ----------------- */ - -/* Set up the stack for THREAD, such that it appears as if - START_ROUTINE and ARG were passed to the new thread's entry-point. - Return the stack pointer for the new thread. We also take the - opportunity to install THREAD in our utcb. */ -static void * -stack_setup (struct __pthread *thread, - void *(*start_routine)(void *), void *arg) -{ - L4_Word_t *top; - - /* Calculate top of the new stack. */ - top = (L4_Word_t *) ((L4_Word_t) thread->stackaddr + thread->stacksize); - - if (start_routine) - { - /* Set up call frame. */ - top -= 2; - top = (unsigned long) top & ~0xf; - top[1] = (L4_Word_t) arg; /* Argument to START_ROUTINE. */ - top[0] = (L4_Word_t) start_routine; - *--top = 0; /* Fake return address. */ - } - - return top; -} - -int -__pthread_setup (struct __pthread *thread, - void (*entry_point)(void *(*)(void *), void *), - void *(*start_routine)(void *), void *arg) -{ - thread->mcontext.pc = entry_point; - thread->mcontext.sp = stack_setup (thread, start_routine, arg); - - if (L4_SameThreads (thread->threadid, L4_Myself ())) - L4_Set_MyUserDefinedHandle (thread); - else - L4_Set_UserDefinedHandle (thread->threadid, thread); - - return 0; -} diff --git a/sysdeps/l4/hurd/pt-sysdep.c b/sysdeps/l4/hurd/pt-sysdep.c deleted file mode 100644 index 265592c..0000000 --- a/sysdeps/l4/hurd/pt-sysdep.c +++ /dev/null @@ -1,58 +0,0 @@ -/* System dependent pthreads code. Hurd 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. */ - -#include -#include -#include - -#include - -/* Forward. */ -static void *init_routine (void); - -/* OK, the name of this variable isn't really appropriate, but I don't - want to change it yet. */ -void *(*_pthread_init_routine)(void) = &init_routine; - -/* This function is called from the Hurd-specific startup code. It - should return a new stack pointer for the main thread. The caller - will switch to this new stack before doing anything serious. */ -static void * -init_routine (void) -{ - struct __pthread *thread; - int err; - - /* Initialize the library. */ - __pthread_initialize (); - - /* Create the pthread structure for the main thread (i.e. us). */ - err = __pthread_create_internal (&thread, 0, 0, 0); - assert_perror (err); - - __pthread_initialize (); - - /* Decrease the number of threads, to take into account that the - signal thread (which will be created by the startup code when we - return from here) shouldn't be seen as a user thread. */ -#warning Need to implement the signal thread. - // __pthread_total--; - - return (void *) thread->mcontext.sp; -} diff --git a/sysdeps/l4/hurd/pt-sysdep.h b/sysdeps/l4/hurd/pt-sysdep.h deleted file mode 100644 index 8717533..0000000 --- a/sysdeps/l4/hurd/pt-sysdep.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Internal defenitions for pthreads library. - Copyright (C) 2000, 2002 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 _PT_SYSDEP_H -#define _PT_SYSDEP_H 1 - -#include -#include -#include - -/* XXX */ -#define _POSIX_THREAD_THREADS_MAX 64 - -/* The default stack size. */ -#define PTHREAD_STACK_DEFAULT (PAGE_SIZE) - -#define PTHREAD_SYSDEP_MEMBERS \ - L4_ThreadId_t threadid; \ - L4_Word_t my_errno; - -extern inline struct __pthread * -__attribute__((__always_inline__)) -_pthread_self (void) -{ - return (struct __pthread *) L4_MyUserDefinedHandle (); -} - -extern inline void -__pthread_stack_dealloc (void *stackaddr, size_t stacksize) -__attribute__((__always_inline__)) -{ - /* XXX: can only implement this once we have a working memory manager. */ - return; -} - -#endif /* pt-sysdep.h */ diff --git a/sysdeps/l4/pt-block.c b/sysdeps/l4/pt-block.c deleted file mode 100644 index 050c694..0000000 --- a/sysdeps/l4/pt-block.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Block a thread. L4 version. - Copyright (C) 2002 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. */ - -#include - -#include - -/* Block THREAD. */ -void -__pthread_block (struct __pthread *thread) -{ - L4_Receive (L4_anylocalthread); -} diff --git a/sysdeps/l4/pt-docancel.c b/sysdeps/l4/pt-docancel.c deleted file mode 100644 index 9a3bb26..0000000 --- a/sysdeps/l4/pt-docancel.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Cancel a thread. - Copyright (C) 2002 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. */ - -#include - -#include - -static void -call_exit (void) -{ - pthread_exit (0); -} - -int -__pthread_do_cancel (struct __pthread *p) -{ - assert (p->cancel_pending = 1); - assert (p->cancel_state == PTHREAD_CANCEL_ENABLE); - - if (L4_SameThreads (L4_Myself (), p->threadid)) - call_exit (); - else - { - L4_Word_t dummy; - L4_ThreadId_t dummy_id; - - /* Change the ip of the target thread to make it exit. */ - L4_ExchangeRegisters (p->threadid, (1 << 4), 0, call_exit, - 0, 0, L4_nilthread, - &dummy, &dummy, &dummy, &dummy, &dummy, - &dummy_id); - } - - return 0; -} diff --git a/sysdeps/l4/pt-stack-alloc.c b/sysdeps/l4/pt-stack-alloc.c deleted file mode 100644 index e28d531..0000000 --- a/sysdeps/l4/pt-stack-alloc.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Allocate a new stack. L4 Hurd 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. */ - -#include -#include - -#include - -#define __pthread_stacksize __pthread_default_attr.stacksize - -#include -#include - -static void * -allocate_page (void) -{ - L4_Fpage_t p; - /* The Kernel Interface page. */ - static L4_KernelInterfacePage_t *kip; - - if (! kip) - kip = L4_GetKernelInterface (); - -#define sigma0_tid() (L4_GlobalId (kip->ThreadInfo.X.UserBase, 1)) - p = L4_Sigma0_GetPage (sigma0_tid (), - L4_Fpage_Set_Attrs (L4_FpageLog2 (-1UL << 10, - PAGE_SHIFT), - L4_FullyAccessible)); - p.raw &= ~0x3ff; - - printf ("%s: Allocated page %x\n", - __FUNCTION__, p.raw); - - return (void *) p.raw; -} - - -/* Allocate a new stack of size STACKSIZE. If successfull, store the - address of the newly allocated stack in *STACKADDR and return 0. - Otherwise return an error code (EINVAL for an invalid stack size, - EAGAIN if the system lacked the necessary resources to allocate a - new stack). */ -int -__pthread_stack_alloc (void **stackaddr, size_t stacksize) -{ - if (stacksize != __pthread_stacksize) - return EINVAL; - - *stackaddr = allocate_page (); - if (! *stackaddr) - return EAGAIN; - - return 0; -} diff --git a/sysdeps/l4/pt-start.c b/sysdeps/l4/pt-start.c deleted file mode 100644 index fb4e27b..0000000 --- a/sysdeps/l4/pt-start.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Start thread. L4 Hurd version. - Copyright (C) 2002 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. */ - -#include -#include -#include - -#include - -#include "task_client.h" - -extern L4_ThreadId_t __system_pager; -extern L4_ThreadId_t __task_server; - -#ifndef WORKING_EXREGS -static void -send_startup_ipc (L4_ThreadId_t id, L4_Word_t ip, L4_Word_t sp) -{ - L4_Msg_t msg; - - printf ("%s: Sending startup message to %x, " - "(ip=%x, sp=%x)\n", - __FUNCTION__, * (L4_Word_t *) &id, ip, sp); - - L4_Clear (&msg); -#ifdef HAVE_PROPAGATION - L4_Set_VirtualSender (pager_tid); - L4_Set_Propagation (&msg.tag); -#endif - L4_Append_Word (&msg, ip); - L4_Append_Word (&msg, sp); -#ifndef HAVE_PROPAGATION - L4_Append_Word (&msg, *(L4_Word_t *) &id); - id = __system_pager; -#if 0 - DODEBUG (2, printf ("%s: Redirecting start request to pager (%x).\n", - __FUNCTION__, * (L4_Word_t *) &id)); -#endif -#endif - L4_LoadMsg (&msg); - L4_Send (id); -} -#endif - -/* Start THREAD. We allocate all system-specific resources, including - a kernel thread, set it up, and get it running. */ -int -__pthread_start (struct __pthread *thread) -{ - error_t err; - - if (__pthread_num_threads == 1) - /* The main thread is already running: do nothing. */ - { - assert (__pthread_total == 1); - thread->threadid = L4_Myself (); - } - else - { - CORBA_Environment env; - - env = idl4_default_environment; - err = thread_create (__task_server, - L4_Version (L4_Myself ()), - * (L4_Word_t *) &__system_pager, - (L4_Word_t *) &thread->threadid, &env); - if (err) - return EAGAIN; - - env = idl4_default_environment; - err = thread_resume (__task_server, - * (L4_Word_t *) &thread->threadid, - &env); - assert (! err); - -#ifndef WORKING_EXREGS - L4_AbortIpc_and_stop (thread->threadid); - L4_Start_SpIp (thread->threadid, (L4_Word_t) thread->mcontext.sp, - (L4_Word_t) thread->mcontext.pc); -#endif - send_startup_ipc (thread->threadid, (L4_Word_t) thread->mcontext.pc, - (L4_Word_t) thread->mcontext.sp); - - } - - return 0; -} diff --git a/sysdeps/l4/pt-thread-alloc.c b/sysdeps/l4/pt-thread-alloc.c deleted file mode 100644 index a9d5e21..0000000 --- a/sysdeps/l4/pt-thread-alloc.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Start thread. L4 version. - Copyright (C) 2002 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. */ - -#include -#include -#include - -#include - -/* Start THREAD. Get the kernel thread scheduled and running. */ -int -__pthread_thread_start (struct __pthread *thread) -{ - error_t err; - - /* The main thread is already running of course. */ - if (__pthread_num_threads == 1) - { - assert (__pthread_total == 1); - thread->thread_id = L4_Myself (); - } - else - { - CORBA_Environment env; - - env = idl4_default_environment; - err = thread_create (__task_server, - L4_Version (L4_Myself ()), - * (L4_Word_t *) &__system_pager, - (L4_Word_t *) &thread->threadid, &env); - if (err) - return EAGAIN; - } - - return 0; -} diff --git a/sysdeps/l4/pt-thread-halt.c b/sysdeps/l4/pt-thread-halt.c deleted file mode 100644 index 04d622f..0000000 --- a/sysdeps/l4/pt-thread-halt.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Deallocate the kernel thread resources. Mach version. - Copyright (C) 2000,02 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. */ - -#include -#include -#include - -#include - -extern L4_ThreadId_t __task_server; - -/* Deallocate the kernel thread resources associated with THREAD. */ -void -__pthread_thread_halt (struct __pthread *thread) -{ - CORBA_Environment env = idl4_default_environment; - L4_Word_t *t = (L4_Word_t *) &thread->threadid; - - assert (*t); - assert (thread_terminate (__task_server, *t, &env)); - *t = 0; -} diff --git a/sysdeps/l4/pt-thread-start.c b/sysdeps/l4/pt-thread-start.c deleted file mode 100644 index c428d29..0000000 --- a/sysdeps/l4/pt-thread-start.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Start thread. L4 version. - Copyright (C) 2002 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. */ - -#include -#include -#include - -#include - -#include "task_client.h" - -extern L4_ThreadId_t __system_pager; -extern L4_ThreadId_t __task_server; - -#ifndef WORKING_EXREGS -static void -send_startup_ipc (L4_ThreadId_t id, L4_Word_t ip, L4_Word_t sp) -{ - L4_Msg_t msg; - - printf ("%s: Sending startup message to %x, " - "(ip=%x, sp=%x)\n", - __FUNCTION__, * (L4_Word_t *) &id, ip, sp); - - L4_Clear (&msg); -#ifdef HAVE_PROPAGATION - L4_Set_VirtualSender (pager_tid); - L4_Set_Propagation (&msg.tag); -#endif - L4_Append_Word (&msg, ip); - L4_Append_Word (&msg, sp); -#ifndef HAVE_PROPAGATION - L4_Append_Word (&msg, *(L4_Word_t *) &id); - id = __system_pager; -#if 0 - DODEBUG (2, printf ("%s: Redirecting start request to pager (%x).\n", - __FUNCTION__, * (L4_Word_t *) &id)); -#endif -#endif - L4_LoadMsg (&msg); - L4_Send (id); -} -#endif - -/* Start THREAD. Get the kernel thread scheduled and running. */ -int -__pthread_thread_start (struct __pthread *thread) -{ - error_t err; - - /* The main thread is already running of course. */ - if (__pthread_num_threads == 1) - { - assert (__pthread_total == 1); - assert (thread->thread_id == L4_Myself ()); - } - else - { - env = idl4_default_environment; - err = thread_resume (__task_server, - * (L4_Word_t *) &thread->threadid, - &env); - assert (! err); - -#ifndef WORKING_EXREGS - L4_AbortIpc_and_stop (thread->threadid); - L4_Start_SpIp (thread->threadid, (L4_Word_t) thread->mcontext.sp, - (L4_Word_t) thread->mcontext.pc); -#endif - send_startup_ipc (thread->threadid, (L4_Word_t) thread->mcontext.pc, - (L4_Word_t) thread->mcontext.sp); - - } - - return 0; -} diff --git a/sysdeps/l4/pt-wakeup.c b/sysdeps/l4/pt-wakeup.c deleted file mode 100644 index 7b00e4f..0000000 --- a/sysdeps/l4/pt-wakeup.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Wakeup a thread. L4 version. - Copyright (C) 2002 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. */ - -#include - -#include - -/* Wakeup THREAD. */ -void -__pthread_wakeup (struct __pthread *thread) -{ - L4_Send (thread->threadid); -} -- cgit v1.2.3 From 0236089d351775cf41a9a951621b7c083488ec20 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Tue, 12 Aug 2008 07:10:31 +0000 Subject: 2008-08-12 Neal H. Walfield * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): Remove dead code. --- ChangeLog | 5 +++++ sysdeps/generic/pt-mutex-unlock.c | 9 --------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'sysdeps') diff --git a/ChangeLog b/ChangeLog index 78fd677..2568e87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-12 Neal H. Walfield + + * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): + Remove dead code. + 2008-08-11 Neal H. Walfield * sysdeps/l4/pt-docancel.c: Remove file. diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c index 4352042..d1ef23a 100644 --- a/sysdeps/generic/pt-mutex-unlock.c +++ b/sysdeps/generic/pt-mutex-unlock.c @@ -37,16 +37,7 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) if (_pthread_self ()) { assert (mutex->owner); -#if 0 - assertx (mutex->owner == _pthread_self (), - "%p(%x) != %p(%x)", - mutex->owner, - ((struct __pthread *) mutex->owner)->threadid, - _pthread_self (), - _pthread_self ()->threadid); -#else assert (mutex->owner == _pthread_self ()); -#endif mutex->owner = NULL; } #endif -- cgit v1.2.3