From a99155555c2134a6397584b7cdc30d7e55e070cf Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 9 Feb 2020 01:13:56 +0100 Subject: htl: Remove unused files These have never been used. --- .../htl/bits/types/struct___pthread_mutexattr.h | 4 - sysdeps/htl/pt-kill.c | 33 ---- sysdeps/htl/pt-mutex-destroy.c | 38 ---- sysdeps/htl/pt-mutex-getprioceiling.c | 28 --- sysdeps/htl/pt-mutex-init.c | 50 ------ sysdeps/htl/pt-mutex-lock.c | 36 ---- sysdeps/htl/pt-mutex-setprioceiling.c | 28 --- sysdeps/htl/pt-mutex-timedlock.c | 197 --------------------- sysdeps/htl/pt-mutex-transfer-np.c | 66 ------- sysdeps/htl/pt-mutex-trylock.c | 111 ------------ sysdeps/htl/pt-mutex-unlock.c | 107 ----------- sysdeps/htl/pt-mutexattr-destroy.c | 27 --- sysdeps/htl/pt-mutexattr-getprioceiling.c | 29 --- sysdeps/htl/pt-mutexattr-getprotocol.c | 27 --- sysdeps/htl/pt-mutexattr-getpshared.c | 27 --- sysdeps/htl/pt-mutexattr-gettype.c | 27 --- sysdeps/htl/pt-mutexattr-init.c | 30 ---- sysdeps/htl/pt-mutexattr-setprioceiling.c | 28 --- sysdeps/htl/pt-mutexattr-setprotocol.c | 40 ----- sysdeps/htl/pt-mutexattr-setpshared.c | 38 ---- sysdeps/htl/pt-mutexattr-settype.c | 37 ---- sysdeps/htl/pt-mutexattr.c | 41 ----- sysdeps/htl/pt-spin.c | 50 ------ 23 files changed, 1099 deletions(-) delete mode 100644 sysdeps/htl/pt-kill.c delete mode 100644 sysdeps/htl/pt-mutex-destroy.c delete mode 100644 sysdeps/htl/pt-mutex-getprioceiling.c delete mode 100644 sysdeps/htl/pt-mutex-init.c delete mode 100644 sysdeps/htl/pt-mutex-lock.c delete mode 100644 sysdeps/htl/pt-mutex-setprioceiling.c delete mode 100644 sysdeps/htl/pt-mutex-timedlock.c delete mode 100644 sysdeps/htl/pt-mutex-transfer-np.c delete mode 100644 sysdeps/htl/pt-mutex-trylock.c delete mode 100644 sysdeps/htl/pt-mutex-unlock.c delete mode 100644 sysdeps/htl/pt-mutexattr-destroy.c delete mode 100644 sysdeps/htl/pt-mutexattr-getprioceiling.c delete mode 100644 sysdeps/htl/pt-mutexattr-getprotocol.c delete mode 100644 sysdeps/htl/pt-mutexattr-getpshared.c delete mode 100644 sysdeps/htl/pt-mutexattr-gettype.c delete mode 100644 sysdeps/htl/pt-mutexattr-init.c delete mode 100644 sysdeps/htl/pt-mutexattr-setprioceiling.c delete mode 100644 sysdeps/htl/pt-mutexattr-setprotocol.c delete mode 100644 sysdeps/htl/pt-mutexattr-setpshared.c delete mode 100644 sysdeps/htl/pt-mutexattr-settype.c delete mode 100644 sysdeps/htl/pt-mutexattr.c delete mode 100644 sysdeps/htl/pt-spin.c (limited to 'sysdeps/htl') diff --git a/sysdeps/htl/bits/types/struct___pthread_mutexattr.h b/sysdeps/htl/bits/types/struct___pthread_mutexattr.h index bfb786a064..b3f6ebdf68 100644 --- a/sysdeps/htl/bits/types/struct___pthread_mutexattr.h +++ b/sysdeps/htl/bits/types/struct___pthread_mutexattr.h @@ -33,8 +33,4 @@ struct __pthread_mutexattr enum __pthread_mutex_type __mutex_type; }; -/* Attributes for a recursive mutex. */ -extern const struct __pthread_mutexattr __pthread_errorcheck_mutexattr; -extern const struct __pthread_mutexattr __pthread_recursive_mutexattr; - #endif /* bits/types/struct___pthread_mutexattr.h */ diff --git a/sysdeps/htl/pt-kill.c b/sysdeps/htl/pt-kill.c deleted file mode 100644 index c6fad8f162..0000000000 --- a/sysdeps/htl/pt-kill.c +++ /dev/null @@ -1,33 +0,0 @@ -/* pthread-kill.c - Generic pthread-kill implementation. - Copyright (C) 2008-2020 Free Software Foundation, Inc. - Written by Neal H. Walfield . - - This file is part of the GNU Hurd. - - The GNU Hurd 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 3 of - the License, or (at your option) any later version. - - The GNU Hurd 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 this program. If not, see - . */ - -#include -#include "sig-internal.h" - -int -__pthread_kill (pthread_t tid, int signo) -{ - siginfo_t si; - memset (&si, 0, sizeof (si)); - si.si_signo = signo; - - return pthread_kill_siginfo_np (tid, si); -} -strong_alias (__pthread_kill, pthread_kill) diff --git a/sysdeps/htl/pt-mutex-destroy.c b/sysdeps/htl/pt-mutex-destroy.c deleted file mode 100644 index 3824e62dd4..0000000000 --- a/sysdeps/htl/pt-mutex-destroy.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Destroy a mutex. Generic version. - Copyright (C) 2000-2020 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, see - . */ - -#include -#include -#include - -#include - -int -_pthread_mutex_destroy (pthread_mutex_t *mutex) -{ - if (mutex->__attr == __PTHREAD_ERRORCHECK_MUTEXATTR - || mutex->__attr == __PTHREAD_RECURSIVE_MUTEXATTR) - /* Static attributes. */ - ; - else - free (mutex->__attr); - - return 0; -} - -strong_alias (_pthread_mutex_destroy, pthread_mutex_destroy); diff --git a/sysdeps/htl/pt-mutex-getprioceiling.c b/sysdeps/htl/pt-mutex-getprioceiling.c deleted file mode 100644 index 57e0877fad..0000000000 --- a/sysdeps/htl/pt-mutex-getprioceiling.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Get a mutex' priority ceiling. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, int *prioceiling) -{ - return ENOSYS; -} - -stub_warning (pthread_mutex_getprioceiling) diff --git a/sysdeps/htl/pt-mutex-init.c b/sysdeps/htl/pt-mutex-init.c deleted file mode 100644 index c59bd8a3f5..0000000000 --- a/sysdeps/htl/pt-mutex-init.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Initialize a mutex. Generic version. - Copyright (C) 2000-2020 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, see - . */ - -#include -#include -#include -#include - -#include - -int -_pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) -{ - *mutex = (pthread_mutex_t) __PTHREAD_MUTEX_INITIALIZER; - - ASSERT_TYPE_SIZE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T); - - if (attr == NULL - || memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr)) == 0) - /* The default attributes. */ - return 0; - - if (mutex->__attr == NULL - || mutex->__attr == __PTHREAD_ERRORCHECK_MUTEXATTR - || mutex->__attr == __PTHREAD_RECURSIVE_MUTEXATTR) - mutex->__attr = malloc (sizeof *attr); - - if (mutex->__attr == NULL) - return ENOMEM; - - *mutex->__attr = *attr; - return 0; -} - -strong_alias (_pthread_mutex_init, pthread_mutex_init); diff --git a/sysdeps/htl/pt-mutex-lock.c b/sysdeps/htl/pt-mutex-lock.c deleted file mode 100644 index 85d98422d8..0000000000 --- a/sysdeps/htl/pt-mutex-lock.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Lock a mutex. Generic version. - Copyright (C) 2000-2020 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, see - . */ - -#include -#include - -#include - -/* Implemented in pt-mutex-timedlock.c. */ -extern int __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, - const struct timespec *abstime); - -/* Lock MUTEX, block if we can't get it. */ -int -__pthread_mutex_lock (struct __pthread_mutex *mutex) -{ - return __pthread_mutex_timedlock_internal (mutex, 0); -} - -strong_alias (__pthread_mutex_lock, _pthread_mutex_lock); -strong_alias (__pthread_mutex_lock, pthread_mutex_lock); diff --git a/sysdeps/htl/pt-mutex-setprioceiling.c b/sysdeps/htl/pt-mutex-setprioceiling.c deleted file mode 100644 index b905daf0d9..0000000000 --- a/sysdeps/htl/pt-mutex-setprioceiling.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Set a mutex' priority ceiling. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prio, int *oldprio) -{ - return ENOSYS; -} - -stub_warning (pthread_mutex_setprioceiling) diff --git a/sysdeps/htl/pt-mutex-timedlock.c b/sysdeps/htl/pt-mutex-timedlock.c deleted file mode 100644 index 0e50f38ef2..0000000000 --- a/sysdeps/htl/pt-mutex-timedlock.c +++ /dev/null @@ -1,197 +0,0 @@ -/* Lock a mutex with a timeout. Generic version. - Copyright (C) 2000-2020 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, see - . */ - -#include -#include -#include - -#include - -#define LOSE do { * (int *) 0 = 0; } while (1) - -/* Try to lock MUTEX, block until *ABSTIME if it is already held. As - a GNU extension, if TIMESPEC is NULL then wait forever. */ -int -__pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, - const struct timespec *abstime) -{ - error_t err; - int drain; - struct __pthread *self; - const struct __pthread_mutexattr *attr = mutex->__attr; - - if (attr == __PTHREAD_ERRORCHECK_MUTEXATTR) - attr = &__pthread_errorcheck_mutexattr; - if (attr == __PTHREAD_RECURSIVE_MUTEXATTR) - attr = &__pthread_recursive_mutexattr; - - __pthread_spin_lock (&mutex->__lock); - if (__pthread_spin_trylock (&mutex->__held) == 0) - /* Successfully acquired the lock. */ - { -#ifdef ALWAYS_TRACK_MUTEX_OWNER -# ifndef NDEBUG - self = _pthread_self (); - if (self != NULL) - /* 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 == NULL); - mutex->__owner = _pthread_self (); - } -# endif -#endif - - if (attr != NULL) - switch (attr->__mutex_type) - { - case PTHREAD_MUTEX_NORMAL: - break; - - case PTHREAD_MUTEX_RECURSIVE: - mutex->__locks = 1; - case PTHREAD_MUTEX_ERRORCHECK: - mutex->__owner = _pthread_self (); - break; - - default: - LOSE; - } - - __pthread_spin_unlock (&mutex->__lock); - return 0; - } - - /* The lock is busy. */ - - self = _pthread_self (); - assert (self); - - if (attr == NULL || attr->__mutex_type == PTHREAD_MUTEX_NORMAL) - { -#if defined(ALWAYS_TRACK_MUTEX_OWNER) - assert (mutex->__owner != self); -#endif - } - else - { - switch (attr->__mutex_type) - { - case PTHREAD_MUTEX_ERRORCHECK: - if (mutex->__owner == self) - { - __pthread_spin_unlock (&mutex->__lock); - return EDEADLK; - } - break; - - case PTHREAD_MUTEX_RECURSIVE: - if (mutex->__owner == self) - { - mutex->__locks++; - __pthread_spin_unlock (&mutex->__lock); - return 0; - } - break; - - default: - LOSE; - } - } - -#if !defined(ALWAYS_TRACK_MUTEX_OWNER) - if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) -#endif - assert (mutex->__owner); - - if (abstime != NULL && ! valid_nanoseconds (abstime->tv_nsec)) - return EINVAL; - - /* Add ourselves to the queue. */ - __pthread_enqueue (&mutex->__queue, self); - __pthread_spin_unlock (&mutex->__lock); - - /* Block the thread. */ - if (abstime != NULL) - err = __pthread_timedblock (self, abstime, CLOCK_REALTIME); - else - { - err = 0; - __pthread_block (self); - } - - __pthread_spin_lock (&mutex->__lock); - if (self->prevp == NULL) - /* Another thread removed us from the queue, which means a wakeup message - has been sent. It was either consumed while we were blocking, or - queued after we timed out and before we acquired the mutex lock, in - which case the message queue must be drained. */ - drain = err ? 1 : 0; - else - { - /* We're still in the queue. Noone attempted to wake us up, i.e. we - timed out. */ - __pthread_dequeue (self); - drain = 0; - } - __pthread_spin_unlock (&mutex->__lock); - - if (drain) - __pthread_block (self); - - if (err) - { - assert (err == ETIMEDOUT); - return err; - } - -#if !defined(ALWAYS_TRACK_MUTEX_OWNER) - if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) -#endif - { - assert (mutex->__owner == self); - } - - if (attr != NULL) - switch (attr->__mutex_type) - { - case PTHREAD_MUTEX_NORMAL: - break; - - case PTHREAD_MUTEX_RECURSIVE: - assert (mutex->__locks == 0); - mutex->__locks = 1; - case PTHREAD_MUTEX_ERRORCHECK: - mutex->__owner = self; - break; - - default: - LOSE; - } - - return 0; -} - -int -__pthread_mutex_timedlock (struct __pthread_mutex *mutex, - const struct timespec *abstime) -{ - return __pthread_mutex_timedlock_internal (mutex, abstime); -} -strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock) diff --git a/sysdeps/htl/pt-mutex-transfer-np.c b/sysdeps/htl/pt-mutex-transfer-np.c deleted file mode 100644 index 8819563613..0000000000 --- a/sysdeps/htl/pt-mutex-transfer-np.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Transfer ownership of a mutex. Generic version. - Copyright (C) 2008-2020 Free Software Foundation, Inc. - Written by Neal H. Walfield . - - This file is part of the GNU Hurd. - - The GNU Hurd 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 3 of - the License, or (at your option) any later version. - - The GNU Hurd 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 this program. If not, see - . */ - -#include -#include - -#include - -int -__pthread_mutex_transfer_np (struct __pthread_mutex *mutex, pthread_t tid) -{ - assert (mutex->__owner == _pthread_self ()); - - struct __pthread *thread = __pthread_getid (tid); - const struct __pthread_mutexattr *attr = mutex->__attr; - - if (thread == NULL) - return ESRCH; - - if (thread == _pthread_self ()) - return 0; - - if (attr == __PTHREAD_ERRORCHECK_MUTEXATTR) - attr = &__pthread_errorcheck_mutexattr; - if (attr == __PTHREAD_RECURSIVE_MUTEXATTR) - attr = &__pthread_recursive_mutexattr; - - if (attr != NULL && attr->__mutex_type == PTHREAD_MUTEX_ERRORCHECK) - { - - if (mutex->__owner != _pthread_self ()) - return EPERM; - - mutex->__owner = thread; - } - -#ifndef NDEBUG -# if !defined(ALWAYS_TRACK_MUTEX_OWNER) - if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) -# endif - { - mutex->__owner = thread; - } -#endif - - return 0; -} - -strong_alias (__pthread_mutex_transfer_np, pthread_mutex_transfer_np) diff --git a/sysdeps/htl/pt-mutex-trylock.c b/sysdeps/htl/pt-mutex-trylock.c deleted file mode 100644 index e52632ada3..0000000000 --- a/sysdeps/htl/pt-mutex-trylock.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Try to Lock a mutex. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include - -#include - -#define LOSE do { * (int *) 0 = 0; } while (1) - -/* Lock MUTEX, return EBUSY if we can't get it. */ -int -__pthread_mutex_trylock (struct __pthread_mutex *mutex) -{ - int err; - struct __pthread *self; - const struct __pthread_mutexattr *attr = mutex->__attr; - - if (attr == __PTHREAD_ERRORCHECK_MUTEXATTR) - attr = &__pthread_errorcheck_mutexattr; - if (attr == __PTHREAD_RECURSIVE_MUTEXATTR) - attr = &__pthread_recursive_mutexattr; - - __pthread_spin_lock (&mutex->__lock); - if (__pthread_spin_trylock (&mutex->__held) == 0) - /* Acquired the lock. */ - { -#if defined(ALWAYS_TRACK_MUTEX_OWNER) -# ifndef NDEBUG - self = _pthread_self (); - if (self != NULL) - /* 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 == NULL); - mutex->__owner = _pthread_self (); - } -# endif -#endif - - if (attr != NULL) - switch (attr->__mutex_type) - { - case PTHREAD_MUTEX_NORMAL: - break; - - case PTHREAD_MUTEX_RECURSIVE: - mutex->__locks = 1; - case PTHREAD_MUTEX_ERRORCHECK: - mutex->__owner = _pthread_self (); - break; - - default: - LOSE; - } - - __pthread_spin_unlock (&mutex->__lock); - return 0; - } - - err = EBUSY; - - if (attr != NULL) - { - self = _pthread_self (); - switch (attr->__mutex_type) - { - case PTHREAD_MUTEX_NORMAL: - break; - - case PTHREAD_MUTEX_ERRORCHECK: - /* We could check if MUTEX->OWNER is SELF, however, POSIX - does not permit pthread_mutex_trylock to return EDEADLK - instead of EBUSY, only pthread_mutex_lock. */ - break; - - case PTHREAD_MUTEX_RECURSIVE: - if (mutex->__owner == self) - { - mutex->__locks++; - err = 0; - } - break; - - default: - LOSE; - } - } - - __pthread_spin_unlock (&mutex->__lock); - - return err; -} - -strong_alias (__pthread_mutex_trylock, _pthread_mutex_trylock); -strong_alias (__pthread_mutex_trylock, pthread_mutex_trylock); diff --git a/sysdeps/htl/pt-mutex-unlock.c b/sysdeps/htl/pt-mutex-unlock.c deleted file mode 100644 index 646bdb6c57..0000000000 --- a/sysdeps/htl/pt-mutex-unlock.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Unlock a mutex. Generic version. - Copyright (C) 2000-2020 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, see - . */ - -#include - -#include - -#define LOSE do { * (int *) 0 = 0; } while (1) - -/* Unlock MUTEX, rescheduling a waiting thread. */ -int -__pthread_mutex_unlock (pthread_mutex_t *mutex) -{ - struct __pthread *wakeup; - const struct __pthread_mutexattr *attr = mutex->__attr; - - if (attr == __PTHREAD_ERRORCHECK_MUTEXATTR) - attr = &__pthread_errorcheck_mutexattr; - if (attr == __PTHREAD_RECURSIVE_MUTEXATTR) - attr = &__pthread_recursive_mutexattr; - - __pthread_spin_lock (&mutex->__lock); - - if (attr == NULL || attr->__mutex_type == PTHREAD_MUTEX_NORMAL) - { -#if defined(ALWAYS_TRACK_MUTEX_OWNER) -# ifndef NDEBUG - if (_pthread_self ()) - { - assert (mutex->__owner); - assert (mutex->__owner == _pthread_self ()); - mutex->__owner = NULL; - } -# endif -#endif - } - else - switch (attr->__mutex_type) - { - case PTHREAD_MUTEX_ERRORCHECK: - case PTHREAD_MUTEX_RECURSIVE: - if (mutex->__owner != _pthread_self ()) - { - __pthread_spin_unlock (&mutex->__lock); - return EPERM; - } - - if (attr->__mutex_type == PTHREAD_MUTEX_RECURSIVE) - if (--mutex->__locks > 0) - { - __pthread_spin_unlock (&mutex->__lock); - return 0; - } - - mutex->__owner = 0; - break; - - default: - LOSE; - } - - - if (mutex->__queue == NULL) - { - __pthread_spin_unlock (&mutex->__held); - __pthread_spin_unlock (&mutex->__lock); - return 0; - } - - wakeup = mutex->__queue; - __pthread_dequeue (wakeup); - -#ifndef NDEBUG -# if !defined (ALWAYS_TRACK_MUTEX_OWNER) - if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) -# endif - { - mutex->__owner = wakeup; - } -#endif - - /* We do not unlock MUTEX->held: we are transferring the ownership - to the thread that we are waking up. */ - - __pthread_spin_unlock (&mutex->__lock); - __pthread_wakeup (wakeup); - - return 0; -} - -strong_alias (__pthread_mutex_unlock, _pthread_mutex_unlock); -strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock); diff --git a/sysdeps/htl/pt-mutexattr-destroy.c b/sysdeps/htl/pt-mutexattr-destroy.c deleted file mode 100644 index 9184563e7f..0000000000 --- a/sysdeps/htl/pt-mutexattr-destroy.c +++ /dev/null @@ -1,27 +0,0 @@ -/* pthread_mutexattr_destroy. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -__pthread_mutexattr_destroy (pthread_mutexattr_t *attr) -{ - return 0; -} -weak_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy) diff --git a/sysdeps/htl/pt-mutexattr-getprioceiling.c b/sysdeps/htl/pt-mutexattr-getprioceiling.c deleted file mode 100644 index 5c6f758af5..0000000000 --- a/sysdeps/htl/pt-mutexattr-getprioceiling.c +++ /dev/null @@ -1,29 +0,0 @@ -/* pthread_mutexattr_getprioceiling. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *attr, - int *prioceiling) -{ - return ENOSYS; -} - -stub_warning (pthread_mutexattr_getprioceiling) diff --git a/sysdeps/htl/pt-mutexattr-getprotocol.c b/sysdeps/htl/pt-mutexattr-getprotocol.c deleted file mode 100644 index 40d8d15394..0000000000 --- a/sysdeps/htl/pt-mutexattr-getprotocol.c +++ /dev/null @@ -1,27 +0,0 @@ -/* pthread_mutexattr_getprotocol. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_getprotocol (const pthread_mutexattr_t *attr, int *protocol) -{ - *protocol = attr->__protocol; - return 0; -} diff --git a/sysdeps/htl/pt-mutexattr-getpshared.c b/sysdeps/htl/pt-mutexattr-getpshared.c deleted file mode 100644 index ed4a86d3af..0000000000 --- a/sysdeps/htl/pt-mutexattr-getpshared.c +++ /dev/null @@ -1,27 +0,0 @@ -/* pthread_mutexattr_getpshared. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_getpshared (const pthread_mutexattr_t *attr, int *pshared) -{ - *pshared = attr->__pshared; - return 0; -} diff --git a/sysdeps/htl/pt-mutexattr-gettype.c b/sysdeps/htl/pt-mutexattr-gettype.c deleted file mode 100644 index f93db939eb..0000000000 --- a/sysdeps/htl/pt-mutexattr-gettype.c +++ /dev/null @@ -1,27 +0,0 @@ -/* pthread_mutexattr_gettype. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type) -{ - *type = attr->__mutex_type; - return 0; -} diff --git a/sysdeps/htl/pt-mutexattr-init.c b/sysdeps/htl/pt-mutexattr-init.c deleted file mode 100644 index a96e52dedf..0000000000 --- a/sysdeps/htl/pt-mutexattr-init.c +++ /dev/null @@ -1,30 +0,0 @@ -/* pthread_mutexattr_init. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -__pthread_mutexattr_init (pthread_mutexattr_t *attr) -{ - ASSERT_TYPE_SIZE (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T); - - *attr = __pthread_default_mutexattr; - return 0; -} -weak_alias (__pthread_mutexattr_init, pthread_mutexattr_init) diff --git a/sysdeps/htl/pt-mutexattr-setprioceiling.c b/sysdeps/htl/pt-mutexattr-setprioceiling.c deleted file mode 100644 index 8bbc13fe47..0000000000 --- a/sysdeps/htl/pt-mutexattr-setprioceiling.c +++ /dev/null @@ -1,28 +0,0 @@ -/* pthread_mutexattr_setprioceiling. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_setprioceiling (pthread_mutexattr_t *attr, int prioceiling) -{ - return ENOSYS; -} - -stub_warning (pthread_mutexattr_setprioceiling) diff --git a/sysdeps/htl/pt-mutexattr-setprotocol.c b/sysdeps/htl/pt-mutexattr-setprotocol.c deleted file mode 100644 index dc15d9d8f8..0000000000 --- a/sysdeps/htl/pt-mutexattr-setprotocol.c +++ /dev/null @@ -1,40 +0,0 @@ -/* pthread_mutexattr_setprotocol. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, int protocol) -{ - if (protocol == __pthread_default_mutexattr.__protocol) - { - attr->__protocol = protocol; - return 0; - } - - switch (protocol) - { - case PTHREAD_PRIO_NONE: - case PTHREAD_PRIO_INHERIT: - case PTHREAD_PRIO_PROTECT: - return ENOTSUP; - default: - return EINVAL; - } -} diff --git a/sysdeps/htl/pt-mutexattr-setpshared.c b/sysdeps/htl/pt-mutexattr-setpshared.c deleted file mode 100644 index d5294764ef..0000000000 --- a/sysdeps/htl/pt-mutexattr-setpshared.c +++ /dev/null @@ -1,38 +0,0 @@ -/* pthread_mutexattr_setpshared. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int pshared) -{ - switch (pshared) - { - case PTHREAD_PROCESS_PRIVATE: - attr->__pshared = pshared; - return 0; - - case PTHREAD_PROCESS_SHARED: - return ENOTSUP; - - default: - return EINVAL; - } -} -stub_warning (pthread_mutexattr_setpshared) diff --git a/sysdeps/htl/pt-mutexattr-settype.c b/sysdeps/htl/pt-mutexattr-settype.c deleted file mode 100644 index 045132f8a9..0000000000 --- a/sysdeps/htl/pt-mutexattr-settype.c +++ /dev/null @@ -1,37 +0,0 @@ -/* pthread_mutexattr_settype. Generic version. - Copyright (C) 2002-2020 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, see - . */ - -#include -#include - -int -__pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type) -{ - switch (type) - { - case PTHREAD_MUTEX_NORMAL: - case PTHREAD_MUTEX_ERRORCHECK: - case PTHREAD_MUTEX_RECURSIVE: - attr->__mutex_type = type; - return 0; - - default: - return EINVAL; - } -} -weak_alias (__pthread_mutexattr_settype, pthread_mutexattr_settype) diff --git a/sysdeps/htl/pt-mutexattr.c b/sysdeps/htl/pt-mutexattr.c deleted file mode 100644 index b55f016078..0000000000 --- a/sysdeps/htl/pt-mutexattr.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Default mutex attributes. Generic version. - Copyright (C) 2000-2020 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, see - . */ - -#include -#include - -const struct __pthread_mutexattr __pthread_default_mutexattr = { - __prioceiling: 0, - __protocol: PTHREAD_PRIO_NONE, - __pshared: PTHREAD_PROCESS_PRIVATE, - __mutex_type: PTHREAD_MUTEX_DEFAULT -}; - -const struct __pthread_mutexattr __pthread_errorcheck_mutexattr = { - __prioceiling: 0, - __protocol: PTHREAD_PRIO_NONE, - __pshared: PTHREAD_PROCESS_PRIVATE, - __mutex_type: PTHREAD_MUTEX_ERRORCHECK -}; - -const struct __pthread_mutexattr __pthread_recursive_mutexattr = { - __prioceiling: 0, - __protocol: PTHREAD_PRIO_NONE, - __pshared: PTHREAD_PROCESS_PRIVATE, - __mutex_type: PTHREAD_MUTEX_RECURSIVE -}; diff --git a/sysdeps/htl/pt-spin.c b/sysdeps/htl/pt-spin.c deleted file mode 100644 index 7ec1b49f7a..0000000000 --- a/sysdeps/htl/pt-spin.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Spin locks. - Copyright (C) 2000-2020 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, see - . */ - -#include -#include - -/* The default for single processor machines; don't spin, it's - pointless. */ -#ifndef __PTHREAD_SPIN_COUNT -# define __PTHREAD_SPIN_COUNT 1 -#endif - -/* The number of times to spin while trying to lock a spin lock object - before yielding the processor. */ -int __pthread_spin_count = __PTHREAD_SPIN_COUNT; - - -/* Lock the spin lock object LOCK. If the lock is held by another - thread spin until it becomes available. */ -int -_pthread_spin_lock (__pthread_spinlock_t *lock) -{ - int i; - - while (1) - { - for (i = 0; i < __pthread_spin_count; i++) - { - if (__pthread_spin_trylock (lock) == 0) - return 0; - } - - __sched_yield (); - } -} -- cgit 1.4.1