htl: Remove unused files

These have never been used.
This commit is contained in:
Samuel Thibault 2020-02-09 01:13:56 +01:00
parent d4e209d355
commit a99155555c
27 changed files with 0 additions and 1106 deletions

View file

@ -61,7 +61,6 @@ libpthread-routines := pt-attr pt-attr-destroy pt-attr-getdetachstate \
pt-testcancel \
pt-cancel \
\
pt-mutexattr \
pt-mutexattr-destroy pt-mutexattr-init \
pt-mutexattr-getprioceiling pt-mutexattr-getprotocol \
pt-mutexattr-getpshared pt-mutexattr-gettype \

View file

@ -32,8 +32,6 @@ libpthread {
__errno_location; __h_errno_location;
}
GLIBC_2.12 {
__pthread_errorcheck_mutexattr; __pthread_recursive_mutexattr;
__pthread_get_cleanup_stack;
__pthread_mutex_transfer_np;

View file

@ -306,9 +306,6 @@ extern const struct __pthread_attr __pthread_default_attr;
/* Default barrier attributes. */
extern const struct __pthread_barrierattr __pthread_default_barrierattr;
/* Default mutex attributes. */
extern const struct __pthread_mutexattr __pthread_default_mutexattr;
/* Default rdlock attributes. */
extern const struct __pthread_rwlockattr __pthread_default_rwlockattr;

View file

@ -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 */

View file

@ -1,33 +0,0 @@
/* pthread-kill.c - Generic pthread-kill implementation.
Copyright (C) 2008-2020 Free Software Foundation, Inc.
Written by Neal H. Walfield <neal@gnu.org>.
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
<https://www.gnu.org/licenses/>. */
#include <pthreadP.h>
#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)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <stdlib.h>
#include <assert.h>
#include <pt-internal.h>
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);

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, int *prioceiling)
{
return ENOSYS;
}
stub_warning (pthread_mutex_getprioceiling)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <pt-internal.h>
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);

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <assert.h>
#include <pt-internal.h>
/* 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);

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prio, int *oldprio)
{
return ENOSYS;
}
stub_warning (pthread_mutex_setprioceiling)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <assert.h>
#include <time.h>
#include <pt-internal.h>
#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)

View file

@ -1,66 +0,0 @@
/* Transfer ownership of a mutex. Generic version.
Copyright (C) 2008-2020 Free Software Foundation, Inc.
Written by Neal H. Walfield <neal@gnu.org>.
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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <assert.h>
#include <pt-internal.h>
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)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
#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);

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
#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);

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
__pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
{
return 0;
}
weak_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *attr,
int *prioceiling)
{
return ENOSYS;
}
stub_warning (pthread_mutexattr_getprioceiling)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutexattr_getprotocol (const pthread_mutexattr_t *attr, int *protocol)
{
*protocol = attr->__protocol;
return 0;
}

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutexattr_getpshared (const pthread_mutexattr_t *attr, int *pshared)
{
*pshared = attr->__pshared;
return 0;
}

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type)
{
*type = attr->__mutex_type;
return 0;
}

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
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)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
int
pthread_mutexattr_setprioceiling (pthread_mutexattr_t *attr, int prioceiling)
{
return ENOSYS;
}
stub_warning (pthread_mutexattr_setprioceiling)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
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;
}
}

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
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)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
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)

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <pt-internal.h>
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
};

View file

@ -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
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <sched.h>
/* 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 ();
}
}

View file

@ -1 +0,0 @@
/* empty */