diff options
| author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-04-02 01:43:22 +0200 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-04-02 01:44:14 +0200 |
| commit | 33574c17eefcf326c1cd30eb9f915ad26d3d9ef2 (patch) | |
| tree | 2c1b143f2b7a0ceba9fba000b70dd2889d56e60f /sysdeps/htl/bits | |
| parent | 03e2aa50fd512449025bba8c244d16338d8526a4 (diff) | |
| download | glibc-33574c17eefcf326c1cd30eb9f915ad26d3d9ef2.tar.xz glibc-33574c17eefcf326c1cd30eb9f915ad26d3d9ef2.zip | |
hurd: Add hurd thread library
Contributed by
Agustina Arzille <avarzille@riseup.net>
Amos Jeffries <squid3@treenet.co.nz>
David Michael <fedora.dm0@gmail.com>
Marco Gerards <marco@gnu.org>
Marcus Brinkmann <marcus@gnu.org>
Neal H. Walfield <neal@gnu.org>
Pino Toscano <toscano.pino@tiscali.it>
Richard Braun <rbraun@sceen.net>
Roland McGrath <roland@gnu.org>
Samuel Thibault <samuel.thibault@ens-lyon.org>
Thomas DiModica <ricinwich@yahoo.com>
Thomas Schwinge <tschwinge@gnu.org>
* htl: New directory.
* sysdeps/htl: New directory.
* sysdeps/hurd/htl: New directory.
* sysdeps/i386/htl: New directory.
* sysdeps/mach/htl: New directory.
* sysdeps/mach/hurd/htl: New directory.
* sysdeps/mach/hurd/i386/htl: New directory.
* nscd/Depend, resolv/Depend, rt/Depend: Add htl dependency.
* sysdeps/mach/hurd/i386/Implies: Add mach/hurd/i386/htl imply.
* sysdeps/mach/hurd/i386/libpthread.abilist: New file.
Diffstat (limited to 'sysdeps/htl/bits')
| -rw-r--r-- | sysdeps/htl/bits/cancelation.h | 50 | ||||
| -rw-r--r-- | sysdeps/htl/bits/pthread-np.h | 26 | ||||
| -rw-r--r-- | sysdeps/htl/bits/pthread.h | 36 | ||||
| -rw-r--r-- | sysdeps/htl/bits/pthreadtypes.h | 131 | ||||
| -rw-r--r-- | sysdeps/htl/bits/semaphore.h | 47 | ||||
| -rw-r--r-- | sysdeps/htl/bits/thread-shared-types.h | 24 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/__pthread_key.h | 24 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_attr.h | 45 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_barrier.h | 38 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_barrierattr.h | 31 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_cond.h | 38 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_condattr.h | 33 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_mutex.h | 62 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_mutexattr.h | 40 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_once.h | 33 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_rwlock.h | 45 | ||||
| -rw-r--r-- | sysdeps/htl/bits/types/struct___pthread_rwlockattr.h | 31 |
17 files changed, 734 insertions, 0 deletions
diff --git a/sysdeps/htl/bits/cancelation.h b/sysdeps/htl/bits/cancelation.h new file mode 100644 index 0000000000..56cf1af154 --- /dev/null +++ b/sysdeps/htl/bits/cancelation.h @@ -0,0 +1,50 @@ +/* Cancelation. Generic version. + Copyright (C) 2002-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_CANCELATION_H +#define _BITS_CANCELATION_H 1 + +struct __pthread_cancelation_handler +{ + void (*__handler) (void *); + void *__arg; + struct __pthread_cancelation_handler *__next; +}; + +/* 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) \ + { \ + struct __pthread_cancelation_handler **__handlers \ + = __pthread_get_cleanup_stack (); \ + struct __pthread_cancelation_handler __handler = \ + { \ + (rt), \ + (rtarg), \ + *__handlers \ + }; \ + *__handlers = &__handler; + +#define __pthread_cleanup_pop(execute) \ + if (execute) \ + __handler.__handler (__handler.__arg); \ + *__handlers = __handler.__next; \ + } + +#endif /* _BITS_CANCELATION_H */ diff --git a/sysdeps/htl/bits/pthread-np.h b/sysdeps/htl/bits/pthread-np.h new file mode 100644 index 0000000000..b9587efba8 --- /dev/null +++ b/sysdeps/htl/bits/pthread-np.h @@ -0,0 +1,26 @@ +/* Non-portable functions. Generic version. + Copyright (C) 2008-2018 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, see <http://www.gnu.org/licenses/>. */ + +/* + * Never include this file directly; use <pthread.h> or <cthreads.h> instead. + */ + +#ifndef _BITS_PTHREAD_NP_H +#define _BITS_PTHREAD_NP_H 1 + +#endif /* bits/pthread-np.h */ diff --git a/sysdeps/htl/bits/pthread.h b/sysdeps/htl/bits/pthread.h new file mode 100644 index 0000000000..593ab06ba8 --- /dev/null +++ b/sysdeps/htl/bits/pthread.h @@ -0,0 +1,36 @@ +/* Pthread data structures. Generic version. + Copyright (C) 2002-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_PTHREAD_H +#define _BITS_PTHREAD_H 1 + +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); + +#ifdef __USE_EXTERN_INLINES +__extern_inline int +__pthread_equal (__pthread_t __t1, __pthread_t __t2) +{ + return __t1 == __t2; +} +#endif + +#endif /* bits/pthread.h */ diff --git a/sysdeps/htl/bits/pthreadtypes.h b/sysdeps/htl/bits/pthreadtypes.h new file mode 100644 index 0000000000..95ccf513ff --- /dev/null +++ b/sysdeps/htl/bits/pthreadtypes.h @@ -0,0 +1,131 @@ +/* Declaration of common pthread types for all architectures. Hurd version. + Copyright (C) 2000-2018 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, see <http://www.gnu.org/licenses/>. */ + +#if !defined _BITS_TYPES_H && !defined _PTHREAD_H +# error "Never include <bits/pthreadtypes.h> directly; use <sys/types.h> instead." +#endif + +#ifndef _BITS_PTHREADTYPES_H +#define _BITS_PTHREADTYPES_H 1 + +#include <bits/thread-shared-types.h> + +#include <features.h> + +#include <bits/types.h> + +__BEGIN_DECLS +#include <bits/pthread.h> +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 <bits/types/struct___pthread_attr.h> +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 +}; + +enum __pthread_mutex_robustness +{ + __PTHREAD_MUTEX_STALLED, + __PTHREAD_MUTEX_ROBUST = 0x100 +}; + +#include <bits/types/struct___pthread_mutexattr.h> +typedef struct __pthread_mutexattr pthread_mutexattr_t; + +#include <bits/types/struct___pthread_mutex.h> +typedef struct __pthread_mutex pthread_mutex_t; + +#include <bits/types/struct___pthread_condattr.h> +typedef struct __pthread_condattr pthread_condattr_t; + +#include <bits/types/struct___pthread_cond.h> +typedef struct __pthread_cond pthread_cond_t; + +#ifdef __USE_XOPEN2K +# include <bits/types/__pthread_spinlock_t.h> +typedef __pthread_spinlock_t pthread_spinlock_t; +#endif /* XPG6. */ + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K + +# include <bits/types/struct___pthread_rwlockattr.h> +typedef struct __pthread_rwlockattr pthread_rwlockattr_t; + +# include <bits/types/struct___pthread_rwlock.h> +typedef struct __pthread_rwlock pthread_rwlock_t; + +#endif /* __USE_UNIX98 || __USE_XOPEN2K */ + +#ifdef __USE_XOPEN2K + +# include <bits/types/struct___pthread_barrierattr.h> +typedef struct __pthread_barrierattr pthread_barrierattr_t; + +# include <bits/types/struct___pthread_barrier.h> +typedef struct __pthread_barrier pthread_barrier_t; + +#endif /* __USE_XOPEN2K */ + +#include <bits/types/__pthread_key.h> +typedef __pthread_key pthread_key_t; + +#include <bits/types/struct___pthread_once.h> +typedef struct __pthread_once pthread_once_t; + +__END_DECLS +#endif /* bits/pthreadtypes.h */ diff --git a/sysdeps/htl/bits/semaphore.h b/sysdeps/htl/bits/semaphore.h new file mode 100644 index 0000000000..b1789be55f --- /dev/null +++ b/sysdeps/htl/bits/semaphore.h @@ -0,0 +1,47 @@ +/* Semaphore type. Generic version. + Copyright (C) 2005-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_SEMAPHORE_H +#define _BITS_SEMAPHORE_H 1 + +#ifndef _SEMAPHORE_H +# error Never include <bits/semaphore.h> directly. +#endif + +#include <bits/types/__pthread_spinlock_t.h> +#include <bits/pthread.h> + +/* User visible part of a semaphore. */ +struct __semaphore +{ + __pthread_spinlock_t __lock; + struct __pthread *__queue; + int __pshared; + int __value; + void *__data; +}; + +typedef struct __semaphore sem_t; + +#define SEM_FAILED ((void *) 0) + +/* Initializer for a semaphore. */ +#define __SEMAPHORE_INITIALIZER(pshared, value) \ + { __PTHREAD_SPIN_LOCK_INITIALIZER, NULL, (pshared), (value), NULL } + +#endif /* bits/semaphore.h */ diff --git a/sysdeps/htl/bits/thread-shared-types.h b/sysdeps/htl/bits/thread-shared-types.h new file mode 100644 index 0000000000..054cbf201f --- /dev/null +++ b/sysdeps/htl/bits/thread-shared-types.h @@ -0,0 +1,24 @@ +/* Common threading primitives definitions for both POSIX and C11. + Copyright (C) 2017-2018 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 + <http://www.gnu.org/licenses/>. */ + +#ifndef _THREAD_SHARED_TYPES_H +#define _THREAD_SHARED_TYPES_H 1 + +#include <bits/pthreadtypes-arch.h> + +#endif /* _THREAD_SHARED_TYPES_H */ diff --git a/sysdeps/htl/bits/types/__pthread_key.h b/sysdeps/htl/bits/types/__pthread_key.h new file mode 100644 index 0000000000..c558f478b0 --- /dev/null +++ b/sysdeps/htl/bits/types/__pthread_key.h @@ -0,0 +1,24 @@ +/* Thread specific data. Generic version. + Copyright (C) 2002-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_TYPES___PTHREAD_KEY_H +#define _BITS_TYPES___PTHREAD_KEY_H 1 + +typedef int __pthread_key; + +#endif /* bits/types/__pthread_key.h */ diff --git a/sysdeps/htl/bits/types/struct___pthread_attr.h b/sysdeps/htl/bits/types/struct___pthread_attr.h new file mode 100644 index 0000000000..44f9543a84 --- /dev/null +++ b/sysdeps/htl/bits/types/struct___pthread_attr.h @@ -0,0 +1,45 @@ +/* Thread attribute type. Generic version. + Copyright (C) 2000-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_TYPES_STRUCT___PTHREAD_ATTR +#define _BITS_TYPES_STRUCT___PTHREAD_ATTR 1 + +#include <sched.h> + +#define __need_size_t +#include <stddef.h> + +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 +{ + struct sched_param __schedparam; + void *__stackaddr; + size_t __stacksize; + size_t __guardsize; + enum __pthread_detachstate __detachstate; + enum __pthread_inheritsched __inheritsched; + enum __pthread_contentionscope __contentionscope; + int __schedpolicy; +}; + +#endif /* bits/types/struct___pthread_attr.h */ diff --git a/sysdeps/htl/bits/types/struct___pthread_barrier.h b/sysdeps/htl/bits/types/struct___pthread_barrier.h new file mode 100644 index 0000000000..27a6b84212 --- /dev/null +++ b/sysdeps/htl/bits/types/struct___pthread_barrier.h @@ -0,0 +1,38 @@ +/* Thread barrier attribute type. Generic version. + Copyright (C) 2002-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_TYPES_STRUCT___PTHREAD_BARRIER_H +#define _BITS_TYPES_STRUCT___PTHREAD_BARRIER_H 1 + +#include <bits/types/__pthread_spinlock_t.h> + +/* This structure describes the attributes of a POSIX barrier. */ +struct __pthread_barrier +{ + __pthread_spinlock_t __lock; + struct __pthread *__queue; /* List of waiters. */ + unsigned __pending; /* Number of that still need to wait on + barrier. */ + unsigned __count; /* Number of threads that must wait before + barrier is passed. */ + struct __pthread_barrierattr *__attr; + void *__data; +}; + + +#endif /* bits/types/struct___pthread_barrier.h */ diff --git a/sysdeps/htl/bits/types/struct___pthread_barrierattr.h b/sysdeps/htl/bits/types/struct___pthread_barrierattr.h new file mode 100644 index 0000000000..5ac2c34d88 --- /dev/null +++ b/sysdeps/htl/bits/types/struct___pthread_barrierattr.h @@ -0,0 +1,31 @@ +/* Thread barrier attribute type. Generic version. + Copyright (C) 2002-2018 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, see <http://www.gnu.org/licenses/>. */ + +#ifndef _BITS_TYPES_STRUCT___PTHREAD_BARRIERATTR_H +#define _BITS_TYPES_STRUCT___PTHREAD_BARRIERATTR_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 +{ + enum __pthread_process_shared __pshared; +}; + +#endif /* bits/types/struct___pthread_barrierattr.h */ diff --git a/sysdeps/htl/bits/types/struct___pthread_cond.h b/sysdeps/htl/bits/types/struct___pthread_cond.h new file mode 100644 index 0000000000..d84cde0887 --- /dev/null +++ b/sysdeps/htl/bits/types/struct___pthread_cond.h @@ -0,0 +1,38 @@ +/* Condition type. Generic version. + Copyright (C) 2000-2018 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 |
