unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock
@ 2020-01-13 19:42 Samuel Thibault
  0 siblings, 0 replies; 32+ messages in thread
From: Samuel Thibault @ 2020-01-13 19:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

The C11 threads implementation will need it.
---
 htl/Versions                               | 1 +
 sysdeps/htl/pt-mutex-timedlock.c           | 3 ++-
 sysdeps/htl/pthreadP.h                     | 2 ++
 sysdeps/mach/hurd/htl/pt-mutex-timedlock.c | 3 ++-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/htl/Versions b/htl/Versions
index 1c306acf5c..77f7335b9c 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -155,5 +155,6 @@ libpthread {
     __pthread_setspecific;
     __pthread_getattr_np;
     __pthread_attr_getstack;
+    __pthread_mutex_timedlock;
   }
 }
diff --git a/sysdeps/htl/pt-mutex-timedlock.c b/sysdeps/htl/pt-mutex-timedlock.c
index d0ebb2975e..0e50f38ef2 100644
--- a/sysdeps/htl/pt-mutex-timedlock.c
+++ b/sysdeps/htl/pt-mutex-timedlock.c
@@ -189,8 +189,9 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex,
 }
 
 int
-pthread_mutex_timedlock (struct __pthread_mutex *mutex,
+__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/pthreadP.h b/sysdeps/htl/pthreadP.h
index af0154538a..affe7cdf53 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -29,6 +29,8 @@ extern struct __pthread **__pthread_threads;
 
 extern int _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
+extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
+     const struct timespec *__abstime);
 extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
 
 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
index 13136ddfe1..e83bc57875 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
@@ -24,7 +24,7 @@
 #include <hurdlock.h>
 
 int
-pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
+__pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
 {
   struct __pthread *self;
   int ret, flags = mtxp->__flags & GSYNC_SHARED;
@@ -76,3 +76,4 @@ pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
 
   return ret;
 }
+strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 00/10] Port C11 threads to GNU/Hurd
@ 2020-01-14 18:52 Samuel Thibault
  2020-01-14 18:52 ` [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock Samuel Thibault
                   ` (10 more replies)
  0 siblings, 11 replies; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

Hello,

This patch series basiscally moves the C11 threads implementation to
sysdeps/pthread, thus making it available on GNU/Hurd as well.  There
are a few changes that are needed, I'm here proposing them for review,
so we can probably commit them early in the 2.32 development.

Samuel

Samuel Thibault (10):
  htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy
  htl: Add missing internal functions declarations
  htl: Add support for C11 threads behavior
  htl: Make __PTHREAD_ONCE_INIT more flexible
  nptl: Move nptl-specific types to separate header
  C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS
  C11 threads: Fix thrd_t / pthread_t compatibility assertion
  C11 threads: make thrd_join more portable
  htl: Add C11 threads types definitions
  C11 threads: Move implementation to sysdeps/pthread

 htl/Versions                                  | 18 ++++++
 htl/pt-create.c                               | 20 +++++-
 htl/pt-initialize.c                           |  4 +-
 htl/pt-internal.h                             |  3 +
 nptl/Makefile                                 | 14 +----
 sysdeps/htl/bits/thread-shared-types.h        | 13 ++++
 .../htl/bits/types/struct___pthread_once.h    |  2 +-
 sysdeps/htl/pt-key.h                          |  2 +-
 sysdeps/htl/pt-mutex-destroy.c                |  5 +-
 sysdeps/htl/pt-mutex-init.c                   |  4 +-
 sysdeps/htl/pt-mutex-timedlock.c              |  1 +
 sysdeps/htl/pthread.h                         |  2 +-
 sysdeps/htl/pthreadP.h                        | 23 ++++++-
 sysdeps/htl/thrd_current.c                    | 31 +++++++++
 sysdeps/htl/threads.h                         |  1 -
 sysdeps/hurd/stdc-predef.h                    | 63 -------------------
 sysdeps/mach/htl/thrd_yield.c                 | 26 ++++++++
 sysdeps/mach/hurd/htl/pt-mutex-destroy.c      |  5 +-
 sysdeps/mach/hurd/htl/pt-mutex-init.c         |  6 +-
 sysdeps/mach/hurd/htl/pt-mutex-timedlock.c    |  1 +
 sysdeps/mach/hurd/i386/libc.abilist           |  4 ++
 sysdeps/mach/hurd/i386/libpthread.abilist     | 23 ++++++-
 sysdeps/nptl/bits/thread-shared-types.h       | 10 +++
 sysdeps/nptl/thrd_create.c                    |  2 +
 sysdeps/pthread/Makefile                      | 18 ++++++
 {nptl => sysdeps/pthread}/call_once.c         |  2 +-
 {nptl => sysdeps/pthread}/cnd_broadcast.c     |  0
 {nptl => sysdeps/pthread}/cnd_destroy.c       |  0
 {nptl => sysdeps/pthread}/cnd_init.c          |  0
 {nptl => sysdeps/pthread}/cnd_signal.c        |  0
 {nptl => sysdeps/pthread}/cnd_timedwait.c     |  0
 {nptl => sysdeps/pthread}/cnd_wait.c          |  0
 {nptl => sysdeps/pthread}/mtx_destroy.c       |  0
 {nptl => sysdeps/pthread}/mtx_init.c          |  0
 {nptl => sysdeps/pthread}/mtx_lock.c          |  0
 {nptl => sysdeps/pthread}/mtx_timedlock.c     |  0
 {nptl => sysdeps/pthread}/mtx_trylock.c       |  0
 {nptl => sysdeps/pthread}/mtx_unlock.c        |  0
 {nptl => sysdeps/pthread}/thrd_create.c       |  8 +--
 {nptl => sysdeps/pthread}/thrd_detach.c       |  0
 {nptl => sysdeps/pthread}/thrd_equal.c        |  0
 {nptl => sysdeps/pthread}/thrd_exit.c         |  0
 {nptl => sysdeps/pthread}/thrd_join.c         |  2 +-
 {nptl => sysdeps/pthread}/thrd_priv.h         |  0
 {nptl => sysdeps/pthread}/thrd_sleep.c        |  0
 sysdeps/{nptl => pthread}/threads.h           | 13 ++--
 {nptl => sysdeps/pthread}/tss_create.c        |  2 +
 {nptl => sysdeps/pthread}/tss_delete.c        |  0
 {nptl => sysdeps/pthread}/tss_get.c           |  0
 {nptl => sysdeps/pthread}/tss_set.c           |  0
 {nptl => sysdeps/pthread}/tst-call-once.c     |  0
 {nptl => sysdeps/pthread}/tst-cnd-basic.c     |  0
 {nptl => sysdeps/pthread}/tst-cnd-broadcast.c |  0
 {nptl => sysdeps/pthread}/tst-cnd-timedwait.c |  0
 {nptl => sysdeps/pthread}/tst-mtx-basic.c     |  0
 {nptl => sysdeps/pthread}/tst-mtx-recursive.c |  0
 {nptl => sysdeps/pthread}/tst-mtx-timedlock.c |  0
 {nptl => sysdeps/pthread}/tst-mtx-trylock.c   |  0
 {nptl => sysdeps/pthread}/tst-thrd-detach.c   |  0
 {nptl => sysdeps/pthread}/tst-thrd-sleep.c    |  0
 {nptl => sysdeps/pthread}/tst-tss-basic.c     |  0
 61 files changed, 220 insertions(+), 108 deletions(-)
 create mode 100644 sysdeps/htl/thrd_current.c
 delete mode 100644 sysdeps/htl/threads.h
 delete mode 100644 sysdeps/hurd/stdc-predef.h
 create mode 100644 sysdeps/mach/htl/thrd_yield.c
 create mode 100644 sysdeps/nptl/thrd_create.c
 rename {nptl => sysdeps/pthread}/call_once.c (95%)
 rename {nptl => sysdeps/pthread}/cnd_broadcast.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_destroy.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_init.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_signal.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_timedwait.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_wait.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_destroy.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_init.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_lock.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_timedlock.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_trylock.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_unlock.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_create.c (82%)
 rename {nptl => sysdeps/pthread}/thrd_detach.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_equal.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_exit.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_join.c (92%)
 rename {nptl => sysdeps/pthread}/thrd_priv.h (100%)
 rename {nptl => sysdeps/pthread}/thrd_sleep.c (100%)
 rename sysdeps/{nptl => pthread}/threads.h (97%)
 rename {nptl => sysdeps/pthread}/tss_create.c (96%)
 rename {nptl => sysdeps/pthread}/tss_delete.c (100%)
 rename {nptl => sysdeps/pthread}/tss_get.c (100%)
 rename {nptl => sysdeps/pthread}/tss_set.c (100%)
 rename {nptl => sysdeps/pthread}/tst-call-once.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cnd-basic.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cnd-broadcast.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cnd-timedwait.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-basic.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-recursive.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-timedlock.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-trylock.c (100%)
 rename {nptl => sysdeps/pthread}/tst-thrd-detach.c (100%)
 rename {nptl => sysdeps/pthread}/tst-thrd-sleep.c (100%)
 rename {nptl => sysdeps/pthread}/tst-tss-basic.c (100%)

-- 
2.24.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-14 18:52 ` [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy Samuel Thibault
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

The C11 threads implementation will need it.
---
 htl/Versions                               | 1 +
 sysdeps/htl/pt-mutex-timedlock.c           | 3 ++-
 sysdeps/htl/pthreadP.h                     | 2 ++
 sysdeps/mach/hurd/htl/pt-mutex-timedlock.c | 3 ++-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/htl/Versions b/htl/Versions
index 1c306acf5c..77f7335b9c 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -155,5 +155,6 @@ libpthread {
     __pthread_setspecific;
     __pthread_getattr_np;
     __pthread_attr_getstack;
+    __pthread_mutex_timedlock;
   }
 }
diff --git a/sysdeps/htl/pt-mutex-timedlock.c b/sysdeps/htl/pt-mutex-timedlock.c
index d0ebb2975e..0e50f38ef2 100644
--- a/sysdeps/htl/pt-mutex-timedlock.c
+++ b/sysdeps/htl/pt-mutex-timedlock.c
@@ -189,8 +189,9 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex,
 }
 
 int
-pthread_mutex_timedlock (struct __pthread_mutex *mutex,
+__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/pthreadP.h b/sysdeps/htl/pthreadP.h
index af0154538a..affe7cdf53 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -29,6 +29,8 @@ extern struct __pthread **__pthread_threads;
 
 extern int _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
+extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
+     const struct timespec *__abstime);
 extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
 
 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
index 13136ddfe1..e83bc57875 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
@@ -24,7 +24,7 @@
 #include <hurdlock.h>
 
 int
-pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
+__pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
 {
   struct __pthread *self;
   int ret, flags = mtxp->__flags & GSYNC_SHARED;
@@ -76,3 +76,4 @@ pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
 
   return ret;
 }
+strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
  2020-01-14 18:52 ` [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-17 20:40   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 02/10] htl: Add missing internal functions declarations Samuel Thibault
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

---
 htl/Versions                              | 2 ++
 htl/pt-initialize.c                       | 4 ++--
 sysdeps/htl/pt-key.h                      | 2 +-
 sysdeps/htl/pt-mutex-destroy.c            | 4 ++--
 sysdeps/htl/pt-mutex-init.c               | 4 ++--
 sysdeps/htl/pthreadP.h                    | 5 +++--
 sysdeps/mach/hurd/htl/pt-mutex-destroy.c  | 4 ++--
 sysdeps/mach/hurd/htl/pt-mutex-init.c     | 6 +++---
 sysdeps/mach/hurd/i386/libpthread.abilist | 2 --
 9 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/htl/Versions b/htl/Versions
index 77f7335b9c..3ae4b5c17d 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -155,6 +155,8 @@ libpthread {
     __pthread_setspecific;
     __pthread_getattr_np;
     __pthread_attr_getstack;
+    __pthread_mutex_init;
+    __pthread_mutex_destroy;
     __pthread_mutex_timedlock;
   }
 }
diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c
index d5a64f7cd9..89ed742422 100644
--- a/htl/pt-initialize.c
+++ b/htl/pt-initialize.c
@@ -51,8 +51,8 @@ static const struct pthread_functions pthread_functions = {
   .ptr___pthread_exit = __pthread_exit,
   .ptr_pthread_getschedparam = __pthread_getschedparam,
   .ptr_pthread_setschedparam = __pthread_setschedparam,
-  .ptr_pthread_mutex_destroy = _pthread_mutex_destroy,
-  .ptr_pthread_mutex_init = _pthread_mutex_init,
+  .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
+  .ptr_pthread_mutex_init = __pthread_mutex_init,
   .ptr_pthread_mutex_lock = __pthread_mutex_lock,
   .ptr_pthread_mutex_trylock = __pthread_mutex_trylock,
   .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
diff --git a/sysdeps/htl/pt-key.h b/sysdeps/htl/pt-key.h
index bfaa19900a..b547e8ad29 100644
--- a/sysdeps/htl/pt-key.h
+++ b/sysdeps/htl/pt-key.h
@@ -66,7 +66,7 @@ __pthread_key_lock_ready (void)
     err = __pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
     assert_perror (err);
 
-    err = _pthread_mutex_init (&__pthread_key_lock, &attr);
+    err = __pthread_mutex_init (&__pthread_key_lock, &attr);
     assert_perror (err);
 
     err = __pthread_mutexattr_destroy (&attr);
diff --git a/sysdeps/htl/pt-mutex-destroy.c b/sysdeps/htl/pt-mutex-destroy.c
index 3824e62dd4..796fc11b8d 100644
--- a/sysdeps/htl/pt-mutex-destroy.c
+++ b/sysdeps/htl/pt-mutex-destroy.c
@@ -23,7 +23,7 @@
 #include <pt-internal.h>
 
 int
-_pthread_mutex_destroy (pthread_mutex_t *mutex)
+__pthread_mutex_destroy (pthread_mutex_t *mutex)
 {
   if (mutex->__attr == __PTHREAD_ERRORCHECK_MUTEXATTR
       || mutex->__attr == __PTHREAD_RECURSIVE_MUTEXATTR)
@@ -35,4 +35,4 @@ _pthread_mutex_destroy (pthread_mutex_t *mutex)
   return 0;
 }
 
-strong_alias (_pthread_mutex_destroy, pthread_mutex_destroy);
+strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy);
diff --git a/sysdeps/htl/pt-mutex-init.c b/sysdeps/htl/pt-mutex-init.c
index c59bd8a3f5..77f041352e 100644
--- a/sysdeps/htl/pt-mutex-init.c
+++ b/sysdeps/htl/pt-mutex-init.c
@@ -24,7 +24,7 @@
 #include <pt-internal.h>
 
 int
-_pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
+__pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
 {
   *mutex = (pthread_mutex_t) __PTHREAD_MUTEX_INITIALIZER;
 
@@ -47,4 +47,4 @@ _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
   return 0;
 }
 
-strong_alias (_pthread_mutex_init, pthread_mutex_init);
+strong_alias (__pthread_mutex_init, pthread_mutex_init);
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index affe7cdf53..c6ddf76fd4 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -27,7 +27,8 @@ extern pthread_t __pthread_self (void);
 extern int __pthread_kill (pthread_t threadid, int signo);
 extern struct __pthread **__pthread_threads;
 
-extern int _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
+extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr);
+extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
      const struct timespec *__abstime);
@@ -73,7 +74,7 @@ struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void) attri
 hidden_proto (__pthread_key_create)
 hidden_proto (__pthread_getspecific)
 hidden_proto (__pthread_setspecific)
-hidden_proto (_pthread_mutex_init)
+hidden_proto (__pthread_mutex_init)
 #endif
 
 #define ASSERT_TYPE_SIZE(type, size) 					\
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
index afab03234e..a8a0adc03f 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
@@ -24,7 +24,7 @@
 #include <hurdlock.h>
 
 int
-_pthread_mutex_destroy (pthread_mutex_t *mtxp)
+__pthread_mutex_destroy (pthread_mutex_t *mtxp)
 {
   atomic_read_barrier ();
   if (*(volatile unsigned int *) &mtxp->__lock != 0)
@@ -34,4 +34,4 @@ _pthread_mutex_destroy (pthread_mutex_t *mtxp)
   return 0;
 }
 
-strong_alias (_pthread_mutex_destroy, pthread_mutex_destroy)
+strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-init.c b/sysdeps/mach/hurd/htl/pt-mutex-init.c
index 6b804116a5..7a2cc462f3 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-init.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-init.c
@@ -32,7 +32,7 @@ static const pthread_mutexattr_t dfl_attr = {
 };
 
 int
-_pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
+__pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
 {
   ASSERT_TYPE_SIZE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T);
 
@@ -55,5 +55,5 @@ _pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
   return 0;
 }
 
-strong_alias (_pthread_mutex_init, pthread_mutex_init)
-hidden_def (_pthread_mutex_init)
+strong_alias (__pthread_mutex_init, pthread_mutex_init)
+hidden_def (__pthread_mutex_init)
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index 0ede90859c..cda8755960 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -14,8 +14,6 @@ GLIBC_2.12 _cthread_init_routine D 0x4
 GLIBC_2.12 _cthreads_flockfile F
 GLIBC_2.12 _cthreads_ftrylockfile F
 GLIBC_2.12 _cthreads_funlockfile F
-GLIBC_2.12 _pthread_mutex_destroy F
-GLIBC_2.12 _pthread_mutex_init F
 GLIBC_2.12 _pthread_mutex_lock F
 GLIBC_2.12 _pthread_mutex_trylock F
 GLIBC_2.12 _pthread_mutex_unlock F
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/10] htl: Add missing internal functions declarations
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
  2020-01-14 18:52 ` [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock Samuel Thibault
  2020-01-14 18:52 ` [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 17:11   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 03/10] htl: Add support for C11 threads behavior Samuel Thibault
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

---
 sysdeps/htl/pthreadP.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index c6ddf76fd4..b1c7575f89 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -30,11 +30,22 @@ extern struct __pthread **__pthread_threads;
 extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr);
 extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
+extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex);
 extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
      const struct timespec *__abstime);
 extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
+extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr);
+extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind);
 
+extern int __pthread_cond_init (pthread_cond_t *cond,
+				const pthread_condattr_t *cond_attr);
+extern int __pthread_cond_signal (pthread_cond_t *cond);
 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
+extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex);
+extern int __pthread_cond_timedwait (pthread_cond_t *cond,
+				     pthread_mutex_t *mutex,
+				     const struct timespec *abstime);
+extern int __pthread_cond_destroy (pthread_cond_t *cond);
 
 typedef struct __cthread *__cthread_t;
 typedef int __cthread_key_t;
@@ -55,6 +66,8 @@ int __cthread_setspecific (__cthread_key_t, void *);
 int __pthread_key_create (pthread_key_t *key, void (*destr) (void *));
 void *__pthread_getspecific (pthread_key_t key);
 int __pthread_setspecific (pthread_key_t key, const void *value);
+int __pthread_key_delete (pthread_key_t key);
+int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void));
 
 int __pthread_setcancelstate (int state, int *oldstate);
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/10] htl: Add support for C11 threads behavior
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (2 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 02/10] htl: Add missing internal functions declarations Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 17:15   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible Samuel Thibault
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

Essentially properly calling the thread function which returns an int
instead of a void*.
---
 htl/pt-create.c        | 20 +++++++++++++++++++-
 htl/pt-internal.h      |  3 +++
 sysdeps/htl/pthreadP.h |  3 +++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/htl/pt-create.c b/htl/pt-create.c
index 0b3237f46a..090d394f53 100644
--- a/htl/pt-create.c
+++ b/htl/pt-create.c
@@ -59,7 +59,17 @@ entry_point (struct __pthread *self, void *(*start_routine) (void *), void *arg)
 
   __pthread_startup ();
 
-  __pthread_exit (start_routine (arg));
+  if (self->c11)
+    {
+      /* The function pointer of the c11 thread start is cast to an incorrect
+         type on __pthread_create call, however it is casted back to correct
+         one so the call behavior is well-defined (it is assumed that pointers
+         to void are able to represent all values of int).  */
+      int (*start)(void*) = (int (*) (void*)) start_routine;
+      __pthread_exit ((void*) (uintptr_t) start (arg));
+    }
+  else
+    __pthread_exit (start_routine (arg));
 }
 
 /* Create a thread with attributes given by ATTR, executing
@@ -99,6 +109,14 @@ __pthread_create_internal (struct __pthread **thread,
   if (err)
     goto failed;
 
+  if (attr == ATTR_C11_THREAD)
+    {
+      attr = NULL;
+      pthread->c11 = true;
+    }
+  else
+    pthread->c11 = false;
+
   /* Use the default attributes if ATTR is NULL.  */
   setup = attr ? attr : &__pthread_default_attr;
 
diff --git a/htl/pt-internal.h b/htl/pt-internal.h
index f8d7d74244..8a45854070 100644
--- a/htl/pt-internal.h
+++ b/htl/pt-internal.h
@@ -100,6 +100,9 @@ struct __pthread
   /* Resolver state.  */
   struct __res_state res_state;
 
+  /* Indicates whether is a C11 thread created by thrd_creat.  */
+  bool c11;
+
   /* Thread context.  */
   struct pthread_mcontext mcontext;
 
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index b1c7575f89..fc8c9bc591 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -21,6 +21,9 @@
 
 #include <pthread.h>
 
+/* Attribute to indicate thread creation was issued from C11 thrd_create.  */
+#define ATTR_C11_THREAD ((void*)(uintptr_t)-1)
+
 /* These represent the interface used by glibc itself.  */
 
 extern pthread_t __pthread_self (void);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (3 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 03/10] htl: Add support for C11 threads behavior Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 18:01   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 05/10] nptl: Move nptl-specific types to separate header Samuel Thibault
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

by moving its (struct __pthread_once) cast into PTHREAD_ONCE_INIT.
---
 sysdeps/htl/bits/types/struct___pthread_once.h | 2 +-
 sysdeps/htl/pthread.h                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/htl/bits/types/struct___pthread_once.h b/sysdeps/htl/bits/types/struct___pthread_once.h
index 31a0c0817b..a6b6db708c 100644
--- a/sysdeps/htl/bits/types/struct___pthread_once.h
+++ b/sysdeps/htl/bits/types/struct___pthread_once.h
@@ -28,6 +28,6 @@ struct __pthread_once
 };
 
 #define __PTHREAD_ONCE_INIT \
-	(struct __pthread_once) { 0, __PTHREAD_SPIN_LOCK_INITIALIZER }
+	0, __PTHREAD_SPIN_LOCK_INITIALIZER
 
 #endif /* bits/types/struct___pthread_once.h */
diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h
index 3216860493..38c61e8da3 100644
--- a/sysdeps/htl/pthread.h
+++ b/sysdeps/htl/pthread.h
@@ -802,7 +802,7 @@ extern int pthread_setspecific (pthread_key_t __key, const void *__value)
 
 #include <bits/types/struct___pthread_once.h>
 
-#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
+#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
 
 /* Call INIT_ROUTINE if this function has never been called with
    *ONCE_CONTROL, otherwise do nothing.  */
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/10] nptl: Move nptl-specific types to separate header
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (4 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 18:31   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS Samuel Thibault
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

---
 nptl/call_once.c                        |  2 +-
 sysdeps/nptl/bits/thread-shared-types.h | 10 ++++++++++
 sysdeps/nptl/threads.h                  | 13 +++++--------
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/nptl/call_once.c b/nptl/call_once.c
index 3f880a9073..25e2964c76 100644
--- a/nptl/call_once.c
+++ b/nptl/call_once.c
@@ -27,5 +27,5 @@ call_once (once_flag *flag, void (*func)(void))
 		  "sizeof (once_flag) != sizeof (pthread_once_t)");
   _Static_assert (alignof (once_flag) == alignof (pthread_once_t),
 		  "alignof (once_flag) != alignof (pthread_once_t)");
-  __pthread_once (&flag->__data, func);
+  __pthread_once ((pthread_once_t *) flag, func);
 }
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
index fd08b6916a..fbbdd0bb36 100644
--- a/sysdeps/nptl/bits/thread-shared-types.h
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -116,4 +116,14 @@ struct __pthread_cond_s
   unsigned int __g_signals[2];
 };
 
+typedef unsigned int __tss_t;
+typedef unsigned long int __thrd_t;
+
+typedef struct
+{
+  int __data __ONCE_ALIGNMENT;
+} __once_flag;
+
+#define __ONCE_FLAG_INIT { 0 }
+
 #endif /* _THREAD_SHARED_TYPES_H  */
diff --git a/sysdeps/nptl/threads.h b/sysdeps/nptl/threads.h
index 6d5e4bfe02..0ac489b4a1 100644
--- a/sysdeps/nptl/threads.h
+++ b/sysdeps/nptl/threads.h
@@ -24,7 +24,7 @@
 
 __BEGIN_DECLS
 
-#include <bits/pthreadtypes-arch.h>
+#include <bits/thread-shared-types.h>
 #include <bits/types/struct_timespec.h>
 
 #ifndef __cplusplus
@@ -32,10 +32,10 @@ __BEGIN_DECLS
 #endif
 
 #define TSS_DTOR_ITERATIONS 4
-typedef unsigned int tss_t;
+typedef __tss_t tss_t;
 typedef void (*tss_dtor_t) (void*);
 
-typedef unsigned long int thrd_t;
+typedef __thrd_t thrd_t;
 typedef int (*thrd_start_t) (void*);
 
 /* Exit and error codes.  */
@@ -56,11 +56,8 @@ enum
   mtx_timed     = 2
 };
 
-typedef struct
-{
-  int __data __ONCE_ALIGNMENT;
-} once_flag;
-#define ONCE_FLAG_INIT { 0 }
+typedef __once_flag once_flag;
+#define ONCE_FLAG_INIT __ONCE_FLAG_INIT
 
 typedef union
 {
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (5 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 05/10] nptl: Move nptl-specific types to separate header Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 18:40   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 07/10] C11 threads: Fix thrd_t / pthread_t compatibility assertion Samuel Thibault
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

It is optional in POSIX.
---
 nptl/tss_create.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nptl/tss_create.c b/nptl/tss_create.c
index ea1f2e0fba..4e170dd4fc 100644
--- a/nptl/tss_create.c
+++ b/nptl/tss_create.c
@@ -23,8 +23,10 @@ tss_create (tss_t *tss_id, tss_dtor_t destructor)
 {
   _Static_assert (sizeof (tss_t) == sizeof (pthread_key_t),
 		  "sizeof (tss_t) != sizeof (pthread_key_t)");
+#ifdef PTHREAD_DESTRUCTOR_ITERATIONS
   _Static_assert (TSS_DTOR_ITERATIONS == PTHREAD_DESTRUCTOR_ITERATIONS,
 		  "TSS_DTOR_ITERATIONS != PTHREAD_DESTRUCTOR_ITERATIONS");
+#endif
 
   int err_code = __pthread_key_create (tss_id, destructor);
   return thrd_err_map (err_code);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/10] C11 threads: Fix thrd_t / pthread_t compatibility assertion
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (6 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 18:52   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 08/10] C11 threads: make thrd_join more portable Samuel Thibault
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

---
 nptl/thrd_create.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nptl/thrd_create.c b/nptl/thrd_create.c
index 8474e234c9..fe08e22973 100644
--- a/nptl/thrd_create.c
+++ b/nptl/thrd_create.c
@@ -21,8 +21,8 @@
 int
 thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
 {
-  _Static_assert (sizeof (thr) == sizeof (pthread_t),
-		  "sizeof (thr) != sizeof (pthread_t)");
+  _Static_assert (sizeof (*thr) == sizeof (pthread_t),
+		  "sizeof (*thr) != sizeof (pthread_t)");
 
   int err_code = __pthread_create_2_1 (thr, ATTR_C11_THREAD,
 				       (void* (*) (void*))func, arg);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/10] C11 threads: make thrd_join more portable
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (7 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 07/10] C11 threads: Fix thrd_t / pthread_t compatibility assertion Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 18:53   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 09/10] htl: Add C11 threads types definitions Samuel Thibault
  2020-01-14 18:52 ` [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread Samuel Thibault
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

by making a __pthread_join call instead of an equivalent __pthread_clockjoin_ex
call.
---
 nptl/thrd_join.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nptl/thrd_join.c b/nptl/thrd_join.c
index 783e36f02b..0c482959d5 100644
--- a/nptl/thrd_join.c
+++ b/nptl/thrd_join.c
@@ -22,7 +22,7 @@ int
 thrd_join (thrd_t thr, int *res)
 {
   void *pthread_res;
-  int err_code = __pthread_clockjoin_ex (thr, &pthread_res, 0, NULL, true);
+  int err_code = __pthread_join (thr, &pthread_res);
   if (res)
    *res = (int) (uintptr_t) pthread_res;
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/10] htl: Add C11 threads types definitions
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (8 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 08/10] C11 threads: make thrd_join more portable Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-20 19:08   ` Adhemerval Zanella
  2020-01-14 18:52 ` [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread Samuel Thibault
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

---
 sysdeps/htl/bits/thread-shared-types.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sysdeps/htl/bits/thread-shared-types.h b/sysdeps/htl/bits/thread-shared-types.h
index c280f2e182..819682a07b 100644
--- a/sysdeps/htl/bits/thread-shared-types.h
+++ b/sysdeps/htl/bits/thread-shared-types.h
@@ -20,5 +20,18 @@
 #define _THREAD_SHARED_TYPES_H 1
 
 #include <bits/pthreadtypes-arch.h>
+#include <bits/types/struct___pthread_once.h>
+
+typedef int __tss_t;
+typedef int __thrd_t;
+
+typedef union
+{
+  struct __pthread_once __data;
+  int __align __ONCE_ALIGNMENT;
+  char __size[__SIZEOF_PTHREAD_ONCE_T];
+} __once_flag;
+
+#define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } }
 
 #endif /* _THREAD_SHARED_TYPES_H  */
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread
  2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
                   ` (9 preceding siblings ...)
  2020-01-14 18:52 ` [PATCH 09/10] htl: Add C11 threads types definitions Samuel Thibault
@ 2020-01-14 18:52 ` Samuel Thibault
  2020-01-21 12:39   ` Adhemerval Zanella
  10 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-14 18:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

so it gets shared by nptl and htl. Also add htl versions of thrd_current and
thrd_yield.
---
 htl/Versions                                  | 16 +++++
 nptl/Makefile                                 | 14 +----
 sysdeps/htl/pt-mutex-destroy.c                |  1 +
 sysdeps/htl/pt-mutex-timedlock.c              |  1 +
 sysdeps/htl/pthreadP.h                        |  2 +
 sysdeps/htl/thrd_current.c                    | 31 +++++++++
 sysdeps/htl/threads.h                         |  1 -
 sysdeps/hurd/stdc-predef.h                    | 63 -------------------
 sysdeps/mach/htl/thrd_yield.c                 | 26 ++++++++
 sysdeps/mach/hurd/htl/pt-mutex-destroy.c      |  1 +
 sysdeps/mach/hurd/htl/pt-mutex-timedlock.c    |  1 +
 sysdeps/mach/hurd/i386/libc.abilist           |  4 ++
 sysdeps/mach/hurd/i386/libpthread.abilist     | 21 +++++++
 sysdeps/nptl/thrd_create.c                    |  2 +
 sysdeps/pthread/Makefile                      | 18 ++++++
 {nptl => sysdeps/pthread}/call_once.c         |  0
 {nptl => sysdeps/pthread}/cnd_broadcast.c     |  0
 {nptl => sysdeps/pthread}/cnd_destroy.c       |  0
 {nptl => sysdeps/pthread}/cnd_init.c          |  0
 {nptl => sysdeps/pthread}/cnd_signal.c        |  0
 {nptl => sysdeps/pthread}/cnd_timedwait.c     |  0
 {nptl => sysdeps/pthread}/cnd_wait.c          |  0
 {nptl => sysdeps/pthread}/mtx_destroy.c       |  0
 {nptl => sysdeps/pthread}/mtx_init.c          |  0
 {nptl => sysdeps/pthread}/mtx_lock.c          |  0
 {nptl => sysdeps/pthread}/mtx_timedlock.c     |  0
 {nptl => sysdeps/pthread}/mtx_trylock.c       |  0
 {nptl => sysdeps/pthread}/mtx_unlock.c        |  0
 {nptl => sysdeps/pthread}/thrd_create.c       |  4 +-
 {nptl => sysdeps/pthread}/thrd_detach.c       |  0
 {nptl => sysdeps/pthread}/thrd_equal.c        |  0
 {nptl => sysdeps/pthread}/thrd_exit.c         |  0
 {nptl => sysdeps/pthread}/thrd_join.c         |  0
 {nptl => sysdeps/pthread}/thrd_priv.h         |  0
 {nptl => sysdeps/pthread}/thrd_sleep.c        |  0
 sysdeps/{nptl => pthread}/threads.h           |  0
 {nptl => sysdeps/pthread}/tss_create.c        |  0
 {nptl => sysdeps/pthread}/tss_delete.c        |  0
 {nptl => sysdeps/pthread}/tss_get.c           |  0
 {nptl => sysdeps/pthread}/tss_set.c           |  0
 {nptl => sysdeps/pthread}/tst-call-once.c     |  0
 {nptl => sysdeps/pthread}/tst-cnd-basic.c     |  0
 {nptl => sysdeps/pthread}/tst-cnd-broadcast.c |  0
 {nptl => sysdeps/pthread}/tst-cnd-timedwait.c |  0
 {nptl => sysdeps/pthread}/tst-mtx-basic.c     |  0
 {nptl => sysdeps/pthread}/tst-mtx-recursive.c |  0
 {nptl => sysdeps/pthread}/tst-mtx-timedlock.c |  0
 {nptl => sysdeps/pthread}/tst-mtx-trylock.c   |  0
 {nptl => sysdeps/pthread}/tst-thrd-detach.c   |  0
 {nptl => sysdeps/pthread}/tst-thrd-sleep.c    |  0
 {nptl => sysdeps/pthread}/tst-tss-basic.c     |  0
 51 files changed, 129 insertions(+), 77 deletions(-)
 create mode 100644 sysdeps/htl/thrd_current.c
 delete mode 100644 sysdeps/htl/threads.h
 delete mode 100644 sysdeps/hurd/stdc-predef.h
 create mode 100644 sysdeps/mach/htl/thrd_yield.c
 create mode 100644 sysdeps/nptl/thrd_create.c
 rename {nptl => sysdeps/pthread}/call_once.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_broadcast.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_destroy.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_init.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_signal.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_timedwait.c (100%)
 rename {nptl => sysdeps/pthread}/cnd_wait.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_destroy.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_init.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_lock.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_timedlock.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_trylock.c (100%)
 rename {nptl => sysdeps/pthread}/mtx_unlock.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_create.c (91%)
 rename {nptl => sysdeps/pthread}/thrd_detach.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_equal.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_exit.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_join.c (100%)
 rename {nptl => sysdeps/pthread}/thrd_priv.h (100%)
 rename {nptl => sysdeps/pthread}/thrd_sleep.c (100%)
 rename sysdeps/{nptl => pthread}/threads.h (100%)
 rename {nptl => sysdeps/pthread}/tss_create.c (100%)
 rename {nptl => sysdeps/pthread}/tss_delete.c (100%)
 rename {nptl => sysdeps/pthread}/tss_get.c (100%)
 rename {nptl => sysdeps/pthread}/tss_set.c (100%)
 rename {nptl => sysdeps/pthread}/tst-call-once.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cnd-basic.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cnd-broadcast.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cnd-timedwait.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-basic.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-recursive.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-timedlock.c (100%)
 rename {nptl => sysdeps/pthread}/tst-mtx-trylock.c (100%)
 rename {nptl => sysdeps/pthread}/tst-thrd-detach.c (100%)
 rename {nptl => sysdeps/pthread}/tst-thrd-sleep.c (100%)
 rename {nptl => sysdeps/pthread}/tst-tss-basic.c (100%)

diff --git a/htl/Versions b/htl/Versions
index 3ae4b5c17d..c44507c21d 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -20,6 +20,12 @@ libc {
   GLIBC_2.22 {
     __register_atfork;
   }
+
+  # C11 thread symbols.
+  GLIBC_2.32 {
+    thrd_current; thrd_equal; thrd_sleep; thrd_yield;
+  }
+
   GLIBC_PRIVATE {
     __libc_alloca_cutoff;
     __libc_pthread_init;
@@ -142,6 +148,16 @@ libpthread {
     pthread_hurd_cond_wait_np;
     pthread_hurd_cond_timedwait_np;
   }
+
+  # C11 thread symbols.
+  GLIBC_2.32 {
+    thrd_create; thrd_detach; thrd_exit; thrd_join;
+    mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy;
+    call_once;
+    cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; cnd_timedwait; cnd_wait;
+    tss_create; tss_delete; tss_get; tss_set;
+  }
+
   GLIBC_PRIVATE {
     __shm_directory;
     __pthread_threads;
diff --git a/nptl/Makefile b/nptl/Makefile
index 584e0ffd96..820b757692 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -22,7 +22,7 @@ subdir	:= nptl
 
 include ../Makeconfig
 
-headers := pthread.h semaphore.h bits/semaphore.h threads.h \
+headers := pthread.h semaphore.h bits/semaphore.h \
 	   bits/struct_mutex.h bits/struct_rwlock.h
 
 extra-libs := libpthread
@@ -30,8 +30,7 @@ extra-libs-others := $(extra-libs)
 
 routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
 	   libc-cleanup libc_pthread_init libc_multiple_threads \
-	   register-atfork pthread_atfork pthread_self thrd_current \
-	   thrd_equal thrd_sleep thrd_yield pthread_equal \
+	   register-atfork pthread_atfork pthread_self pthread_equal \
 	   pthread_attr_destroy pthread_attr_init pthread_attr_getdetachstate \
 	   pthread_attr_setdetachstate pthread_attr_getinheritsched \
 	   pthread_attr_setinheritsched pthread_attr_getschedparam \
@@ -141,11 +140,7 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
 		      pthread_mutex_setprioceiling \
 		      pthread_setname pthread_getname \
 		      pthread_setattr_default_np pthread_getattr_default_np \
-		      thrd_create thrd_detach thrd_exit thrd_join \
-		      mtx_destroy mtx_init mtx_lock mtx_timedlock \
-		      mtx_trylock mtx_unlock call_once cnd_broadcast \
-		      cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \
-		      tss_create tss_delete tss_get tss_set pthread_mutex_conf \
+		      pthread_mutex_conf \
 		      libpthread-compat
 #		      pthread_setuid pthread_seteuid pthread_setreuid \
 #		      pthread_setresuid \
@@ -319,9 +314,6 @@ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
 	tst-robust-fork tst-create-detached tst-memstream \
 	tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
 	tst-minstack-throw \
-	tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
-	tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
-	tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock \
 	tst-rwlock-pwn \
 	tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
 	tst-unwind-thread
diff --git a/sysdeps/htl/pt-mutex-destroy.c b/sysdeps/htl/pt-mutex-destroy.c
index 796fc11b8d..6a3b5be874 100644
--- a/sysdeps/htl/pt-mutex-destroy.c
+++ b/sysdeps/htl/pt-mutex-destroy.c
@@ -36,3 +36,4 @@ __pthread_mutex_destroy (pthread_mutex_t *mutex)
 }
 
 strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy);
+hidden_def (__pthread_mutex_destroy)
diff --git a/sysdeps/htl/pt-mutex-timedlock.c b/sysdeps/htl/pt-mutex-timedlock.c
index 0e50f38ef2..81013984a6 100644
--- a/sysdeps/htl/pt-mutex-timedlock.c
+++ b/sysdeps/htl/pt-mutex-timedlock.c
@@ -195,3 +195,4 @@ __pthread_mutex_timedlock (struct __pthread_mutex *mutex,
   return __pthread_mutex_timedlock_internal (mutex, abstime);
 }
 strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
+hidden_def (__pthread_mutex_timedlock)
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index fc8c9bc591..fd1e697e39 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -91,6 +91,8 @@ hidden_proto (__pthread_key_create)
 hidden_proto (__pthread_getspecific)
 hidden_proto (__pthread_setspecific)
 hidden_proto (__pthread_mutex_init)
+hidden_proto (__pthread_mutex_destroy)
+hidden_proto (__pthread_mutex_timedlock)
 #endif
 
 #define ASSERT_TYPE_SIZE(type, size) 					\
diff --git a/sysdeps/htl/thrd_current.c b/sysdeps/htl/thrd_current.c
new file mode 100644
index 0000000000..efc0d11b5d
--- /dev/null
+++ b/sysdeps/htl/thrd_current.c
@@ -0,0 +1,31 @@
+/* C11 threads current thread implementation.
+   Copyright (C) 2018-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 "thrd_priv.h"
+
+#pragma weak __pthread_self
+#pragma weak __pthread_threads
+
+thrd_t
+thrd_current (void)
+{
+  if (__pthread_threads)
+    return (thrd_t) __pthread_self ();
+
+  return (thrd_t) 0;
+}
diff --git a/sysdeps/htl/threads.h b/sysdeps/htl/threads.h
deleted file mode 100644
index 3c04fbcc79..0000000000
--- a/sysdeps/htl/threads.h
+++ /dev/null
@@ -1 +0,0 @@
-#error "HTL does not implement ISO C threads"
diff --git a/sysdeps/hurd/stdc-predef.h b/sysdeps/hurd/stdc-predef.h
deleted file mode 100644
index a7bb5f7c5f..0000000000
--- a/sysdeps/hurd/stdc-predef.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 2018-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/>.  */
-
-#ifndef	_STDC_PREDEF_H
-#define	_STDC_PREDEF_H	1
-
-/* This header is separate from features.h so that the compiler can
-   include it implicitly at the start of every compilation.  It must
-   not itself include <features.h> or any other header that includes
-   <features.h> because the implicit include comes before any feature
-   test macros that may be defined in a source file before it first
-   explicitly includes a system header.  GCC knows the name of this
-   header in order to preinclude it.  */
-
-/* glibc's intent is to support the IEC 559 math functionality, real
-   and complex.  If the GCC (4.9 and later) predefined macros
-   specifying compiler intent are available, use them to determine
-   whether the overall intent is to support these features; otherwise,
-   presume an older compiler has intent to support these features and
-   define these macros by default.  */
-
-#ifdef __GCC_IEC_559
-# if __GCC_IEC_559 > 0
-#  define __STDC_IEC_559__		1
-# endif
-#else
-# define __STDC_IEC_559__		1
-#endif
-
-#ifdef __GCC_IEC_559_COMPLEX
-# if __GCC_IEC_559_COMPLEX > 0
-#  define __STDC_IEC_559_COMPLEX__	1
-# endif
-#else
-# define __STDC_IEC_559_COMPLEX__	1
-#endif
-
-/* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
-   synchronized with ISO/IEC 10646:2017, fifth edition, plus
-   the following additions from Amendment 1 to the fifth edition:
-   - 56 emoji characters
-   - 285 hentaigana
-   - 3 additional Zanabazar Square characters */
-#define __STDC_ISO_10646__		201706L
-
-/* We do not support C11 <threads.h>.  */
-#define __STDC_NO_THREADS__		1
-
-#endif
diff --git a/sysdeps/mach/htl/thrd_yield.c b/sysdeps/mach/htl/thrd_yield.c
new file mode 100644
index 0000000000..09e218cf2e
--- /dev/null
+++ b/sysdeps/mach/htl/thrd_yield.c
@@ -0,0 +1,26 @@
+/* sched_yield -- yield the processor.  Mach 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 <mach.h>
+#include "thrd_priv.h"
+
+void
+thrd_yield (void)
+{
+  (void) __swtch ();
+}
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
index a8a0adc03f..a5bfaddcb2 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
@@ -35,3 +35,4 @@ __pthread_mutex_destroy (pthread_mutex_t *mtxp)
 }
 
 strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
+hidden_def (__pthread_mutex_destroy)
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
index e83bc57875..3aa7d798b2 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
@@ -77,3 +77,4 @@ __pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
   return ret;
 }
 strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
+hidden_def (__pthread_mutex_timedlock)
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 7c2cb2b05a..dd0d3c7317 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2181,6 +2181,10 @@ GLIBC_2.3.4 setsourcefilter F
 GLIBC_2.3.4 xdr_quad_t F
 GLIBC_2.3.4 xdr_u_quad_t F
 GLIBC_2.30 twalk_r F
+GLIBC_2.32 thrd_current F
+GLIBC_2.32 thrd_equal F
+GLIBC_2.32 thrd_sleep F
+GLIBC_2.32 thrd_yield F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index cda8755960..0b90f9bf63 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -147,3 +147,24 @@ GLIBC_2.2.6 __errno_location F
 GLIBC_2.2.6 __h_errno_location F
 GLIBC_2.21 pthread_hurd_cond_timedwait_np F
 GLIBC_2.21 pthread_hurd_cond_wait_np F
+GLIBC_2.32 call_once F
+GLIBC_2.32 cnd_broadcast F
+GLIBC_2.32 cnd_destroy F
+GLIBC_2.32 cnd_init F
+GLIBC_2.32 cnd_signal F
+GLIBC_2.32 cnd_timedwait F
+GLIBC_2.32 cnd_wait F
+GLIBC_2.32 mtx_destroy F
+GLIBC_2.32 mtx_init F
+GLIBC_2.32 mtx_lock F
+GLIBC_2.32 mtx_timedlock F
+GLIBC_2.32 mtx_trylock F
+GLIBC_2.32 mtx_unlock F
+GLIBC_2.32 thrd_create F
+GLIBC_2.32 thrd_detach F
+GLIBC_2.32 thrd_exit F
+GLIBC_2.32 thrd_join F
+GLIBC_2.32 tss_create F
+GLIBC_2.32 tss_delete F
+GLIBC_2.32 tss_get F
+GLIBC_2.32 tss_set F
diff --git a/sysdeps/nptl/thrd_create.c b/sysdeps/nptl/thrd_create.c
new file mode 100644
index 0000000000..a9219db7bc
--- /dev/null
+++ b/sysdeps/nptl/thrd_create.c
@@ -0,0 +1,2 @@
+#define __pthread_create __pthread_create_2_1
+#include "../pthread/thrd_create.c"
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 7f9eadd0e2..889f10d8b1 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -25,3 +25,21 @@ $(objpfx)tst-timer: $(objpfx)librt.a $(static-thread-library)
 endif
 
 endif
+
+ifneq (,$(filter $(subdir),htl nptl))
+headers += threads.h
+
+routines += thrd_current thrd_equal thrd_sleep thrd_yield
+
+libpthread-routines += thrd_create thrd_detach thrd_exit thrd_join \
+		       call_once \
+		       mtx_destroy mtx_init mtx_lock mtx_timedlock \
+		       mtx_trylock mtx_unlock \
+		       cnd_broadcast \
+		       cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \
+		       tss_create tss_delete tss_get tss_set
+
+tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
+	 tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
+	 tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock
+endif
diff --git a/nptl/call_once.c b/sysdeps/pthread/call_once.c
similarity index 100%
rename from nptl/call_once.c
rename to sysdeps/pthread/call_once.c
diff --git a/nptl/cnd_broadcast.c b/sysdeps/pthread/cnd_broadcast.c
similarity index 100%
rename from nptl/cnd_broadcast.c
rename to sysdeps/pthread/cnd_broadcast.c
diff --git a/nptl/cnd_destroy.c b/sysdeps/pthread/cnd_destroy.c
similarity index 100%
rename from nptl/cnd_destroy.c
rename to sysdeps/pthread/cnd_destroy.c
diff --git a/nptl/cnd_init.c b/sysdeps/pthread/cnd_init.c
similarity index 100%
rename from nptl/cnd_init.c
rename to sysdeps/pthread/cnd_init.c
diff --git a/nptl/cnd_signal.c b/sysdeps/pthread/cnd_signal.c
similarity index 100%
rename from nptl/cnd_signal.c
rename to sysdeps/pthread/cnd_signal.c
diff --git a/nptl/cnd_timedwait.c b/sysdeps/pthread/cnd_timedwait.c
similarity index 100%
rename from nptl/cnd_timedwait.c
rename to sysdeps/pthread/cnd_timedwait.c
diff --git a/nptl/cnd_wait.c b/sysdeps/pthread/cnd_wait.c
similarity index 100%
rename from nptl/cnd_wait.c
rename to sysdeps/pthread/cnd_wait.c
diff --git a/nptl/mtx_destroy.c b/sysdeps/pthread/mtx_destroy.c
similarity index 100%
rename from nptl/mtx_destroy.c
rename to sysdeps/pthread/mtx_destroy.c
diff --git a/nptl/mtx_init.c b/sysdeps/pthread/mtx_init.c
similarity index 100%
rename from nptl/mtx_init.c
rename to sysdeps/pthread/mtx_init.c
diff --git a/nptl/mtx_lock.c b/sysdeps/pthread/mtx_lock.c
similarity index 100%
rename from nptl/mtx_lock.c
rename to sysdeps/pthread/mtx_lock.c
diff --git a/nptl/mtx_timedlock.c b/sysdeps/pthread/mtx_timedlock.c
similarity index 100%
rename from nptl/mtx_timedlock.c
rename to sysdeps/pthread/mtx_timedlock.c
diff --git a/nptl/mtx_trylock.c b/sysdeps/pthread/mtx_trylock.c
similarity index 100%
rename from nptl/mtx_trylock.c
rename to sysdeps/pthread/mtx_trylock.c
diff --git a/nptl/mtx_unlock.c b/sysdeps/pthread/mtx_unlock.c
similarity index 100%
rename from nptl/mtx_unlock.c
rename to sysdeps/pthread/mtx_unlock.c
diff --git a/nptl/thrd_create.c b/sysdeps/pthread/thrd_create.c
similarity index 91%
rename from nptl/thrd_create.c
rename to sysdeps/pthread/thrd_create.c
index fe08e22973..25af955419 100644
--- a/nptl/thrd_create.c
+++ b/sysdeps/pthread/thrd_create.c
@@ -24,7 +24,7 @@ thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
   _Static_assert (sizeof (*thr) == sizeof (pthread_t),
 		  "sizeof (*thr) != sizeof (pthread_t)");
 
-  int err_code = __pthread_create_2_1 (thr, ATTR_C11_THREAD,
-				       (void* (*) (void*))func, arg);
+  int err_code = __pthread_create (thr, ATTR_C11_THREAD,
+				   (void* (*) (void*))func, arg);
   return thrd_err_map (err_code);
 }
diff --git a/nptl/thrd_detach.c b/sysdeps/pthread/thrd_detach.c
similarity index 100%
rename from nptl/thrd_detach.c
rename to sysdeps/pthread/thrd_detach.c
diff --git a/nptl/thrd_equal.c b/sysdeps/pthread/thrd_equal.c
similarity index 100%
rename from nptl/thrd_equal.c
rename to sysdeps/pthread/thrd_equal.c
diff --git a/nptl/thrd_exit.c b/sysdeps/pthread/thrd_exit.c
similarity index 100%
rename from nptl/thrd_exit.c
rename to sysdeps/pthread/thrd_exit.c
diff --git a/nptl/thrd_join.c b/sysdeps/pthread/thrd_join.c
similarity index 100%
rename from nptl/thrd_join.c
rename to sysdeps/pthread/thrd_join.c
diff --git a/nptl/thrd_priv.h b/sysdeps/pthread/thrd_priv.h
similarity index 100%
rename from nptl/thrd_priv.h
rename to sysdeps/pthread/thrd_priv.h
diff --git a/nptl/thrd_sleep.c b/sysdeps/pthread/thrd_sleep.c
similarity index 100%
rename from nptl/thrd_sleep.c
rename to sysdeps/pthread/thrd_sleep.c
diff --git a/sysdeps/nptl/threads.h b/sysdeps/pthread/threads.h
similarity index 100%
rename from sysdeps/nptl/threads.h
rename to sysdeps/pthread/threads.h
diff --git a/nptl/tss_create.c b/sysdeps/pthread/tss_create.c
similarity index 100%
rename from nptl/tss_create.c
rename to sysdeps/pthread/tss_create.c
diff --git a/nptl/tss_delete.c b/sysdeps/pthread/tss_delete.c
similarity index 100%
rename from nptl/tss_delete.c
rename to sysdeps/pthread/tss_delete.c
diff --git a/nptl/tss_get.c b/sysdeps/pthread/tss_get.c
similarity index 100%
rename from nptl/tss_get.c
rename to sysdeps/pthread/tss_get.c
diff --git a/nptl/tss_set.c b/sysdeps/pthread/tss_set.c
similarity index 100%
rename from nptl/tss_set.c
rename to sysdeps/pthread/tss_set.c
diff --git a/nptl/tst-call-once.c b/sysdeps/pthread/tst-call-once.c
similarity index 100%
rename from nptl/tst-call-once.c
rename to sysdeps/pthread/tst-call-once.c
diff --git a/nptl/tst-cnd-basic.c b/sysdeps/pthread/tst-cnd-basic.c
similarity index 100%
rename from nptl/tst-cnd-basic.c
rename to sysdeps/pthread/tst-cnd-basic.c
diff --git a/nptl/tst-cnd-broadcast.c b/sysdeps/pthread/tst-cnd-broadcast.c
similarity index 100%
rename from nptl/tst-cnd-broadcast.c
rename to sysdeps/pthread/tst-cnd-broadcast.c
diff --git a/nptl/tst-cnd-timedwait.c b/sysdeps/pthread/tst-cnd-timedwait.c
similarity index 100%
rename from nptl/tst-cnd-timedwait.c
rename to sysdeps/pthread/tst-cnd-timedwait.c
diff --git a/nptl/tst-mtx-basic.c b/sysdeps/pthread/tst-mtx-basic.c
similarity index 100%
rename from nptl/tst-mtx-basic.c
rename to sysdeps/pthread/tst-mtx-basic.c
diff --git a/nptl/tst-mtx-recursive.c b/sysdeps/pthread/tst-mtx-recursive.c
similarity index 100%
rename from nptl/tst-mtx-recursive.c
rename to sysdeps/pthread/tst-mtx-recursive.c
diff --git a/nptl/tst-mtx-timedlock.c b/sysdeps/pthread/tst-mtx-timedlock.c
similarity index 100%
rename from nptl/tst-mtx-timedlock.c
rename to sysdeps/pthread/tst-mtx-timedlock.c
diff --git a/nptl/tst-mtx-trylock.c b/sysdeps/pthread/tst-mtx-trylock.c
similarity index 100%
rename from nptl/tst-mtx-trylock.c
rename to sysdeps/pthread/tst-mtx-trylock.c
diff --git a/nptl/tst-thrd-detach.c b/sysdeps/pthread/tst-thrd-detach.c
similarity index 100%
rename from nptl/tst-thrd-detach.c
rename to sysdeps/pthread/tst-thrd-detach.c
diff --git a/nptl/tst-thrd-sleep.c b/sysdeps/pthread/tst-thrd-sleep.c
similarity index 100%
rename from nptl/tst-thrd-sleep.c
rename to sysdeps/pthread/tst-thrd-sleep.c
diff --git a/nptl/tst-tss-basic.c b/sysdeps/pthread/tst-tss-basic.c
similarity index 100%
rename from nptl/tst-tss-basic.c
rename to sysdeps/pthread/tst-tss-basic.c
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy
  2020-01-14 18:52 ` [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy Samuel Thibault
@ 2020-01-17 20:40   ` Adhemerval Zanella
  2020-01-21 21:28     ` Samuel Thibault
  0 siblings, 1 reply; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-17 20:40 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> ---
>  htl/Versions                              | 2 ++
>  htl/pt-initialize.c                       | 4 ++--
>  sysdeps/htl/pt-key.h                      | 2 +-
>  sysdeps/htl/pt-mutex-destroy.c            | 4 ++--
>  sysdeps/htl/pt-mutex-init.c               | 4 ++--
>  sysdeps/htl/pthreadP.h                    | 5 +++--
>  sysdeps/mach/hurd/htl/pt-mutex-destroy.c  | 4 ++--
>  sysdeps/mach/hurd/htl/pt-mutex-init.c     | 6 +++---
>  sysdeps/mach/hurd/i386/libpthread.abilist | 2 --
>  9 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/htl/Versions b/htl/Versions
> index 77f7335b9c..3ae4b5c17d 100644
> --- a/htl/Versions
> +++ b/htl/Versions
> @@ -155,6 +155,8 @@ libpthread {
>      __pthread_setspecific;
>      __pthread_getattr_np;
>      __pthread_attr_getstack;
> +    __pthread_mutex_init;
> +    __pthread_mutex_destroy;
>      __pthread_mutex_timedlock;
>    }
>  }
> diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c
> index d5a64f7cd9..89ed742422 100644
> --- a/htl/pt-initialize.c
> +++ b/htl/pt-initialize.c
> @@ -51,8 +51,8 @@ static const struct pthread_functions pthread_functions = {
>    .ptr___pthread_exit = __pthread_exit,
>    .ptr_pthread_getschedparam = __pthread_getschedparam,
>    .ptr_pthread_setschedparam = __pthread_setschedparam,
> -  .ptr_pthread_mutex_destroy = _pthread_mutex_destroy,
> -  .ptr_pthread_mutex_init = _pthread_mutex_init,
> +  .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
> +  .ptr_pthread_mutex_init = __pthread_mutex_init,
>    .ptr_pthread_mutex_lock = __pthread_mutex_lock,
>    .ptr_pthread_mutex_trylock = __pthread_mutex_trylock,
>    .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
> diff --git a/sysdeps/htl/pt-key.h b/sysdeps/htl/pt-key.h
> index bfaa19900a..b547e8ad29 100644
> --- a/sysdeps/htl/pt-key.h
> +++ b/sysdeps/htl/pt-key.h
> @@ -66,7 +66,7 @@ __pthread_key_lock_ready (void)
>      err = __pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
>      assert_perror (err);
>  
> -    err = _pthread_mutex_init (&__pthread_key_lock, &attr);
> +    err = __pthread_mutex_init (&__pthread_key_lock, &attr);
>      assert_perror (err);
>  
>      err = __pthread_mutexattr_destroy (&attr);
> diff --git a/sysdeps/htl/pt-mutex-destroy.c b/sysdeps/htl/pt-mutex-destroy.c
> index 3824e62dd4..796fc11b8d 100644
> --- a/sysdeps/htl/pt-mutex-destroy.c
> +++ b/sysdeps/htl/pt-mutex-destroy.c
> @@ -23,7 +23,7 @@
>  #include <pt-internal.h>
>  
>  int
> -_pthread_mutex_destroy (pthread_mutex_t *mutex)
> +__pthread_mutex_destroy (pthread_mutex_t *mutex)
>  {
>    if (mutex->__attr == __PTHREAD_ERRORCHECK_MUTEXATTR
>        || mutex->__attr == __PTHREAD_RECURSIVE_MUTEXATTR)
> @@ -35,4 +35,4 @@ _pthread_mutex_destroy (pthread_mutex_t *mutex)
>    return 0;
>  }
>  
> -strong_alias (_pthread_mutex_destroy, pthread_mutex_destroy);
> +strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy);
> diff --git a/sysdeps/htl/pt-mutex-init.c b/sysdeps/htl/pt-mutex-init.c
> index c59bd8a3f5..77f041352e 100644
> --- a/sysdeps/htl/pt-mutex-init.c
> +++ b/sysdeps/htl/pt-mutex-init.c
> @@ -24,7 +24,7 @@
>  #include <pt-internal.h>
>  
>  int
> -_pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
> +__pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
>  {
>    *mutex = (pthread_mutex_t) __PTHREAD_MUTEX_INITIALIZER;
>  
> @@ -47,4 +47,4 @@ _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
>    return 0;
>  }
>  
> -strong_alias (_pthread_mutex_init, pthread_mutex_init);
> +strong_alias (__pthread_mutex_init, pthread_mutex_init);

Why do we need both htl and Hurd implementation of pt-mutex-init.c
(same for pt-mutex-destroy)?

For Linux, some pthread implementation are at sysdeps folder
because either they issues syscalls directly (through
{INLINE,INTERNAL}_SYSCALL macros) or implement some arch-specific
facily (such as HLE or spinlocks).

> diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
> index affe7cdf53..c6ddf76fd4 100644
> --- a/sysdeps/htl/pthreadP.h
> +++ b/sysdeps/htl/pthreadP.h
> @@ -27,7 +27,8 @@ extern pthread_t __pthread_self (void);
>  extern int __pthread_kill (pthread_t threadid, int signo);
>  extern struct __pthread **__pthread_threads;
>  
> -extern int _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
> +extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr);
> +extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
>  extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
>  extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
>       const struct timespec *__abstime);
> @@ -73,7 +74,7 @@ struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void) attri
>  hidden_proto (__pthread_key_create)
>  hidden_proto (__pthread_getspecific)
>  hidden_proto (__pthread_setspecific)
> -hidden_proto (_pthread_mutex_init)
> +hidden_proto (__pthread_mutex_init)
>  #endif
>  
>  #define ASSERT_TYPE_SIZE(type, size) 					\
> diff --git a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
> index afab03234e..a8a0adc03f 100644
> --- a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
> +++ b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
> @@ -24,7 +24,7 @@
>  #include <hurdlock.h>
>  
>  int
> -_pthread_mutex_destroy (pthread_mutex_t *mtxp)
> +__pthread_mutex_destroy (pthread_mutex_t *mtxp)
>  {
>    atomic_read_barrier ();
>    if (*(volatile unsigned int *) &mtxp->__lock != 0)
> @@ -34,4 +34,4 @@ _pthread_mutex_destroy (pthread_mutex_t *mtxp)
>    return 0;
>  }
>  
> -strong_alias (_pthread_mutex_destroy, pthread_mutex_destroy)
> +strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
> diff --git a/sysdeps/mach/hurd/htl/pt-mutex-init.c b/sysdeps/mach/hurd/htl/pt-mutex-init.c
> index 6b804116a5..7a2cc462f3 100644
> --- a/sysdeps/mach/hurd/htl/pt-mutex-init.c
> +++ b/sysdeps/mach/hurd/htl/pt-mutex-init.c
> @@ -32,7 +32,7 @@ static const pthread_mutexattr_t dfl_attr = {
>  };
>  
>  int
> -_pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
> +__pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
>  {
>    ASSERT_TYPE_SIZE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T);
>  
> @@ -55,5 +55,5 @@ _pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp)
>    return 0;
>  }
>  
> -strong_alias (_pthread_mutex_init, pthread_mutex_init)
> -hidden_def (_pthread_mutex_init)
> +strong_alias (__pthread_mutex_init, pthread_mutex_init)
> +hidden_def (__pthread_mutex_init)
> diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
> index 0ede90859c..cda8755960 100644
> --- a/sysdeps/mach/hurd/i386/libpthread.abilist
> +++ b/sysdeps/mach/hurd/i386/libpthread.abilist
> @@ -14,8 +14,6 @@ GLIBC_2.12 _cthread_init_routine D 0x4
>  GLIBC_2.12 _cthreads_flockfile F
>  GLIBC_2.12 _cthreads_ftrylockfile F
>  GLIBC_2.12 _cthreads_funlockfile F
> -GLIBC_2.12 _pthread_mutex_destroy F
> -GLIBC_2.12 _pthread_mutex_init F
>  GLIBC_2.12 _pthread_mutex_lock F
>  GLIBC_2.12 _pthread_mutex_trylock F
>  GLIBC_2.12 _pthread_mutex_unlock F
> 

I understand this change is follow Linux internal implementation
and make mtx_init.c generic, but I don't think changing hurd 
libpthread exported symbols is the correct solution. 

Since the symbol won't be used anymore I think we can move to
a compat symbol, something like:

+strong_alias (__pthread_mutex_init, pthread_mutex_init);
+hidden_def (__pthread_mutex_init)
+#if SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_31)
+compat_symbol (libpthread, __pthread_mutex_init, _pthread_mutex_init, GLIBC_2_12);
+#endif

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 02/10] htl: Add missing internal functions declarations
  2020-01-14 18:52 ` [PATCH 02/10] htl: Add missing internal functions declarations Samuel Thibault
@ 2020-01-20 17:11   ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 17:11 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> ---
>  sysdeps/htl/pthreadP.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
> index c6ddf76fd4..b1c7575f89 100644
> --- a/sysdeps/htl/pthreadP.h
> +++ b/sysdeps/htl/pthreadP.h
> @@ -30,11 +30,22 @@ extern struct __pthread **__pthread_threads;
>  extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr);
>  extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
>  extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
> +extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex);
>  extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
>       const struct timespec *__abstime);
>  extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
> +extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr);
> +extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind);
>  
> +extern int __pthread_cond_init (pthread_cond_t *cond,
> +				const pthread_condattr_t *cond_attr);
> +extern int __pthread_cond_signal (pthread_cond_t *cond);
>  extern int __pthread_cond_broadcast (pthread_cond_t *cond);
> +extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex);
> +extern int __pthread_cond_timedwait (pthread_cond_t *cond,
> +				     pthread_mutex_t *mutex,
> +				     const struct timespec *abstime);
> +extern int __pthread_cond_destroy (pthread_cond_t *cond);
>  
>  typedef struct __cthread *__cthread_t;
>  typedef int __cthread_key_t;
> @@ -55,6 +66,8 @@ int __cthread_setspecific (__cthread_key_t, void *);
>  int __pthread_key_create (pthread_key_t *key, void (*destr) (void *));
>  void *__pthread_getspecific (pthread_key_t key);
>  int __pthread_setspecific (pthread_key_t key, const void *value);
> +int __pthread_key_delete (pthread_key_t key);
> +int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void));
>  
>  int __pthread_setcancelstate (int state, int *oldstate);

LGTM, although I can't really tests. 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 03/10] htl: Add support for C11 threads behavior
  2020-01-14 18:52 ` [PATCH 03/10] htl: Add support for C11 threads behavior Samuel Thibault
@ 2020-01-20 17:15   ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 17:15 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> Essentially properly calling the thread function which returns an int
> instead of a void*.

LGTM, it seems to follow the required nptl changes for Linux.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  htl/pt-create.c        | 20 +++++++++++++++++++-
>  htl/pt-internal.h      |  3 +++
>  sysdeps/htl/pthreadP.h |  3 +++
>  3 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/htl/pt-create.c b/htl/pt-create.c
> index 0b3237f46a..090d394f53 100644
> --- a/htl/pt-create.c
> +++ b/htl/pt-create.c
> @@ -59,7 +59,17 @@ entry_point (struct __pthread *self, void *(*start_routine) (void *), void *arg)
>  
>    __pthread_startup ();
>  
> -  __pthread_exit (start_routine (arg));
> +  if (self->c11)
> +    {
> +      /* The function pointer of the c11 thread start is cast to an incorrect
> +         type on __pthread_create call, however it is casted back to correct
> +         one so the call behavior is well-defined (it is assumed that pointers
> +         to void are able to represent all values of int).  */
> +      int (*start)(void*) = (int (*) (void*)) start_routine;
> +      __pthread_exit ((void*) (uintptr_t) start (arg));
> +    }
> +  else
> +    __pthread_exit (start_routine (arg));
>  }
>  
>  /* Create a thread with attributes given by ATTR, executing

Ok.

> @@ -99,6 +109,14 @@ __pthread_create_internal (struct __pthread **thread,
>    if (err)
>      goto failed;
>  
> +  if (attr == ATTR_C11_THREAD)
> +    {
> +      attr = NULL;
> +      pthread->c11 = true;
> +    }
> +  else
> +    pthread->c11 = false;
> +
>    /* Use the default attributes if ATTR is NULL.  */
>    setup = attr ? attr : &__pthread_default_attr;
>  

Ok.

> diff --git a/htl/pt-internal.h b/htl/pt-internal.h
> index f8d7d74244..8a45854070 100644
> --- a/htl/pt-internal.h
> +++ b/htl/pt-internal.h
> @@ -100,6 +100,9 @@ struct __pthread
>    /* Resolver state.  */
>    struct __res_state res_state;
>  
> +  /* Indicates whether is a C11 thread created by thrd_creat.  */
> +  bool c11;
> +
>    /* Thread context.  */
>    struct pthread_mcontext mcontext;
>  

Ok.

> diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
> index b1c7575f89..fc8c9bc591 100644
> --- a/sysdeps/htl/pthreadP.h
> +++ b/sysdeps/htl/pthreadP.h
> @@ -21,6 +21,9 @@
>  
>  #include <pthread.h>
>  
> +/* Attribute to indicate thread creation was issued from C11 thrd_create.  */
> +#define ATTR_C11_THREAD ((void*)(uintptr_t)-1)
> +
>  /* These represent the interface used by glibc itself.  */
>  
>  extern pthread_t __pthread_self (void);
> 

Ok.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible
  2020-01-14 18:52 ` [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible Samuel Thibault
@ 2020-01-20 18:01   ` Adhemerval Zanella
  2020-01-20 18:29     ` Samuel Thibault
  0 siblings, 1 reply; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 18:01 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> by moving its (struct __pthread_once) cast into PTHREAD_ONCE_INIT.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/htl/bits/types/struct___pthread_once.h | 2 +-
>  sysdeps/htl/pthread.h                          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/htl/bits/types/struct___pthread_once.h b/sysdeps/htl/bits/types/struct___pthread_once.h
> index 31a0c0817b..a6b6db708c 100644
> --- a/sysdeps/htl/bits/types/struct___pthread_once.h
> +++ b/sysdeps/htl/bits/types/struct___pthread_once.h
> @@ -28,6 +28,6 @@ struct __pthread_once
>  };
>  
>  #define __PTHREAD_ONCE_INIT \
> -	(struct __pthread_once) { 0, __PTHREAD_SPIN_LOCK_INITIALIZER }
> +	0, __PTHREAD_SPIN_LOCK_INITIALIZER
>  
>  #endif /* bits/types/struct___pthread_once.h */

Ok.

> diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h
> index 3216860493..38c61e8da3 100644
> --- a/sysdeps/htl/pthread.h
> +++ b/sysdeps/htl/pthread.h
> @@ -802,7 +802,7 @@ extern int pthread_setspecific (pthread_key_t __key, const void *__value)
>  
>  #include <bits/types/struct___pthread_once.h>
>  
> -#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
> +#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
>  
>  /* Call INIT_ROUTINE if this function has never been called with
>     *ONCE_CONTROL, otherwise do nothing.  */
> 

Ok, although I think the cast is superfluous.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible
  2020-01-20 18:01   ` Adhemerval Zanella
@ 2020-01-20 18:29     ` Samuel Thibault
  0 siblings, 0 replies; 32+ messages in thread
From: Samuel Thibault @ 2020-01-20 18:29 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

Adhemerval Zanella, le lun. 20 janv. 2020 15:01:13 -0300, a ecrit:
> > -	(struct __pthread_once) { 0, __PTHREAD_SPIN_LOCK_INITIALIZER }
> > +	0, __PTHREAD_SPIN_LOCK_INITIALIZER

> > -#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
> > +#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
> 
> Ok, although I think the cast is superfluous.

I think so as well, but preferred to keep it for now, so that this
series is a no-op in that regard :)

Samuel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/10] nptl: Move nptl-specific types to separate header
  2020-01-14 18:52 ` [PATCH 05/10] nptl: Move nptl-specific types to separate header Samuel Thibault
@ 2020-01-20 18:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 18:31 UTC (permalink / raw)
  To: libc-alpha

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

On 14/01/2020 15:52, Samuel Thibault wrote:
> ---
>  nptl/call_once.c                        |  2 +-
>  sysdeps/nptl/bits/thread-shared-types.h | 10 ++++++++++
>  sysdeps/nptl/threads.h                  | 13 +++++--------
>  3 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/nptl/call_once.c b/nptl/call_once.c
> index 3f880a9073..25e2964c76 100644
> --- a/nptl/call_once.c
> +++ b/nptl/call_once.c
> @@ -27,5 +27,5 @@ call_once (once_flag *flag, void (*func)(void))
>  		  "sizeof (once_flag) != sizeof (pthread_once_t)");
>    _Static_assert (alignof (once_flag) == alignof (pthread_once_t),
>  		  "alignof (once_flag) != alignof (pthread_once_t)");
> -  __pthread_once (&flag->__data, func);
> +  __pthread_once ((pthread_once_t *) flag, func);
>  }

Ok.

> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
> index fd08b6916a..fbbdd0bb36 100644
> --- a/sysdeps/nptl/bits/thread-shared-types.h
> +++ b/sysdeps/nptl/bits/thread-shared-types.h
> @@ -116,4 +116,14 @@ struct __pthread_cond_s
>    unsigned int __g_signals[2];
>  };
>  
> +typedef unsigned int __tss_t;
> +typedef unsigned long int __thrd_t;
> +
> +typedef struct
> +{
> +  int __data __ONCE_ALIGNMENT;
> +} __once_flag;
> +
> +#define __ONCE_FLAG_INIT { 0 }
> +
>  #endif /* _THREAD_SHARED_TYPES_H  */

Ok.

> diff --git a/sysdeps/nptl/threads.h b/sysdeps/nptl/threads.h
> index 6d5e4bfe02..0ac489b4a1 100644
> --- a/sysdeps/nptl/threads.h
> +++ b/sysdeps/nptl/threads.h
> @@ -24,7 +24,7 @@
>  
>  __BEGIN_DECLS
>  
> -#include <bits/pthreadtypes-arch.h>
> +#include <bits/thread-shared-types.h>
>  #include <bits/types/struct_timespec.h>
>  
>  #ifndef __cplusplus

Ok, thread-shared-types.h includes pthreadtypes-arch.h.

> @@ -32,10 +32,10 @@ __BEGIN_DECLS
>  #endif
>  
>  #define TSS_DTOR_ITERATIONS 4
> -typedef unsigned int tss_t;
> +typedef __tss_t tss_t;
>  typedef void (*tss_dtor_t) (void*);
>  
> -typedef unsigned long int thrd_t;
> +typedef __thrd_t thrd_t;
>  typedef int (*thrd_start_t) (void*);
>  
>  /* Exit and error codes.  */
> @@ -56,11 +56,8 @@ enum
>    mtx_timed     = 2
>  };
>  
> -typedef struct
> -{
> -  int __data __ONCE_ALIGNMENT;
> -} once_flag;
> -#define ONCE_FLAG_INIT { 0 }
> +typedef __once_flag once_flag;
> +#define ONCE_FLAG_INIT __ONCE_FLAG_INIT
>  
>  typedef union
>  {
> 

Ok.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS
  2020-01-14 18:52 ` [PATCH 06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS Samuel Thibault
@ 2020-01-20 18:40   ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 18:40 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> It is optional in POSIX.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  nptl/tss_create.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/nptl/tss_create.c b/nptl/tss_create.c
> index ea1f2e0fba..4e170dd4fc 100644
> --- a/nptl/tss_create.c
> +++ b/nptl/tss_create.c
> @@ -23,8 +23,10 @@ tss_create (tss_t *tss_id, tss_dtor_t destructor)
>  {
>    _Static_assert (sizeof (tss_t) == sizeof (pthread_key_t),
>  		  "sizeof (tss_t) != sizeof (pthread_key_t)");
> +#ifdef PTHREAD_DESTRUCTOR_ITERATIONS
>    _Static_assert (TSS_DTOR_ITERATIONS == PTHREAD_DESTRUCTOR_ITERATIONS,
>  		  "TSS_DTOR_ITERATIONS != PTHREAD_DESTRUCTOR_ITERATIONS");
> +#endif
>  
>    int err_code = __pthread_key_create (tss_id, destructor);
>    return thrd_err_map (err_code);
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 07/10] C11 threads: Fix thrd_t / pthread_t compatibility assertion
  2020-01-14 18:52 ` [PATCH 07/10] C11 threads: Fix thrd_t / pthread_t compatibility assertion Samuel Thibault
@ 2020-01-20 18:52   ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 18:52 UTC (permalink / raw)
  To: libc-alpha

LGTM with a small nit below.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

On 14/01/2020 15:52, Samuel Thibault wrote:
> ---
>  nptl/thrd_create.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/nptl/thrd_create.c b/nptl/thrd_create.c
> index 8474e234c9..fe08e22973 100644
> --- a/nptl/thrd_create.c
> +++ b/nptl/thrd_create.c
> @@ -21,8 +21,8 @@
>  int
>  thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
>  {
> -  _Static_assert (sizeof (thr) == sizeof (pthread_t),
> -		  "sizeof (thr) != sizeof (pthread_t)");
> +  _Static_assert (sizeof (*thr) == sizeof (pthread_t),
> +		  "sizeof (*thr) != sizeof (pthread_t)");
>  
>    int err_code = __pthread_create_2_1 (thr, ATTR_C11_THREAD,
>  				       (void* (*) (void*))func, arg);
> 

I think it is better to use the type direct as other C11 implementation,
_Static_assert (sizeof (thrd_t) == sizeof (pthread_t), ...).

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 08/10] C11 threads: make thrd_join more portable
  2020-01-14 18:52 ` [PATCH 08/10] C11 threads: make thrd_join more portable Samuel Thibault
@ 2020-01-20 18:53   ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 18:53 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> by making a __pthread_join call instead of an equivalent __pthread_clockjoin_ex
> call.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  nptl/thrd_join.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nptl/thrd_join.c b/nptl/thrd_join.c
> index 783e36f02b..0c482959d5 100644
> --- a/nptl/thrd_join.c
> +++ b/nptl/thrd_join.c
> @@ -22,7 +22,7 @@ int
>  thrd_join (thrd_t thr, int *res)
>  {
>    void *pthread_res;
> -  int err_code = __pthread_clockjoin_ex (thr, &pthread_res, 0, NULL, true);
> +  int err_code = __pthread_join (thr, &pthread_res);
>    if (res)
>     *res = (int) (uintptr_t) pthread_res;
>  
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/10] htl: Add C11 threads types definitions
  2020-01-14 18:52 ` [PATCH 09/10] htl: Add C11 threads types definitions Samuel Thibault
@ 2020-01-20 19:08   ` Adhemerval Zanella
  2020-01-20 20:58     ` Samuel Thibault
  0 siblings, 1 reply; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-20 19:08 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> ---
>  sysdeps/htl/bits/thread-shared-types.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/sysdeps/htl/bits/thread-shared-types.h b/sysdeps/htl/bits/thread-shared-types.h
> index c280f2e182..819682a07b 100644
> --- a/sysdeps/htl/bits/thread-shared-types.h
> +++ b/sysdeps/htl/bits/thread-shared-types.h
> @@ -20,5 +20,18 @@
>  #define _THREAD_SHARED_TYPES_H 1
>  
>  #include <bits/pthreadtypes-arch.h>
> +#include <bits/types/struct___pthread_once.h>
> +
> +typedef int __tss_t;
> +typedef int __thrd_t;
> +
> +typedef union
> +{
> +  struct __pthread_once __data;
> +  int __align __ONCE_ALIGNMENT;
> +  char __size[__SIZEOF_PTHREAD_ONCE_T];
> +} __once_flag;
> +
> +#define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } }
>  
>  #endif /* _THREAD_SHARED_TYPES_H  */
> 

Does Hurd really need both __align and __size flag? Its 
__pthread_once definition does not seem to require any
alignment constraint.

Rest looks good.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/10] htl: Add C11 threads types definitions
  2020-01-20 19:08   ` Adhemerval Zanella
@ 2020-01-20 20:58     ` Samuel Thibault
  2020-01-21 11:35       ` Adhemerval Zanella
  0 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-20 20:58 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

Adhemerval Zanella, le lun. 20 janv. 2020 16:08:03 -0300, a ecrit:
> On 14/01/2020 15:52, Samuel Thibault wrote:
> > diff --git a/sysdeps/htl/bits/thread-shared-types.h b/sysdeps/htl/bits/thread-shared-types.h
> > index c280f2e182..819682a07b 100644
> > --- a/sysdeps/htl/bits/thread-shared-types.h
> > +++ b/sysdeps/htl/bits/thread-shared-types.h
> > @@ -20,5 +20,18 @@
> > +typedef union
> > +{
> > +  struct __pthread_once __data;
> > +  int __align __ONCE_ALIGNMENT;
> > +  char __size[__SIZEOF_PTHREAD_ONCE_T];
> > +} __once_flag;
> > +
> > +#define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } }
> >  
> >  #endif /* _THREAD_SHARED_TYPES_H  */
> 
> Does Hurd really need both __align and __size flag?

I am here reproducing what we have for mtx_t and cnd_t. I agree that the
current structure does not need more than int alignment, but we could
need more than this in the future for some archs.

Samuel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/10] htl: Add C11 threads types definitions
  2020-01-20 20:58     ` Samuel Thibault
@ 2020-01-21 11:35       ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-21 11:35 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha



On 20/01/2020 17:58, Samuel Thibault wrote:
> Adhemerval Zanella, le lun. 20 janv. 2020 16:08:03 -0300, a ecrit:
>> On 14/01/2020 15:52, Samuel Thibault wrote:
>>> diff --git a/sysdeps/htl/bits/thread-shared-types.h b/sysdeps/htl/bits/thread-shared-types.h
>>> index c280f2e182..819682a07b 100644
>>> --- a/sysdeps/htl/bits/thread-shared-types.h
>>> +++ b/sysdeps/htl/bits/thread-shared-types.h
>>> @@ -20,5 +20,18 @@
>>> +typedef union
>>> +{
>>> +  struct __pthread_once __data;
>>> +  int __align __ONCE_ALIGNMENT;
>>> +  char __size[__SIZEOF_PTHREAD_ONCE_T];
>>> +} __once_flag;
>>> +
>>> +#define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } }
>>>  
>>>  #endif /* _THREAD_SHARED_TYPES_H  */
>>
>> Does Hurd really need both __align and __size flag?
> 
> I am here reproducing what we have for mtx_t and cnd_t. I agree that the
> current structure does not need more than int alignment, but we could
> need more than this in the future for some archs.
> 

But you can redefine for possible new architecture on Hurd when
you really need it. Also I would expect that C11 thread functions
to provide simple API than POSIX ones, which most likely require
less possible extensions over time.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread
  2020-01-14 18:52 ` [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread Samuel Thibault
@ 2020-01-21 12:39   ` Adhemerval Zanella
  2020-01-21 22:01     ` Samuel Thibault
  0 siblings, 1 reply; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-21 12:39 UTC (permalink / raw)
  To: libc-alpha



On 14/01/2020 15:52, Samuel Thibault wrote:
> so it gets shared by nptl and htl. Also add htl versions of thrd_current and
> thrd_yield.

LGTM with a small nit below.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  htl/Versions                                  | 16 +++++
>  nptl/Makefile                                 | 14 +----
>  sysdeps/htl/pt-mutex-destroy.c                |  1 +
>  sysdeps/htl/pt-mutex-timedlock.c              |  1 +
>  sysdeps/htl/pthreadP.h                        |  2 +
>  sysdeps/htl/thrd_current.c                    | 31 +++++++++
>  sysdeps/htl/threads.h                         |  1 -
>  sysdeps/hurd/stdc-predef.h                    | 63 -------------------
>  sysdeps/mach/htl/thrd_yield.c                 | 26 ++++++++
>  sysdeps/mach/hurd/htl/pt-mutex-destroy.c      |  1 +
>  sysdeps/mach/hurd/htl/pt-mutex-timedlock.c    |  1 +
>  sysdeps/mach/hurd/i386/libc.abilist           |  4 ++
>  sysdeps/mach/hurd/i386/libpthread.abilist     | 21 +++++++
>  sysdeps/nptl/thrd_create.c                    |  2 +
>  sysdeps/pthread/Makefile                      | 18 ++++++
>  {nptl => sysdeps/pthread}/call_once.c         |  0
>  {nptl => sysdeps/pthread}/cnd_broadcast.c     |  0
>  {nptl => sysdeps/pthread}/cnd_destroy.c       |  0
>  {nptl => sysdeps/pthread}/cnd_init.c          |  0
>  {nptl => sysdeps/pthread}/cnd_signal.c        |  0
>  {nptl => sysdeps/pthread}/cnd_timedwait.c     |  0
>  {nptl => sysdeps/pthread}/cnd_wait.c          |  0
>  {nptl => sysdeps/pthread}/mtx_destroy.c       |  0
>  {nptl => sysdeps/pthread}/mtx_init.c          |  0
>  {nptl => sysdeps/pthread}/mtx_lock.c          |  0
>  {nptl => sysdeps/pthread}/mtx_timedlock.c     |  0
>  {nptl => sysdeps/pthread}/mtx_trylock.c       |  0
>  {nptl => sysdeps/pthread}/mtx_unlock.c        |  0
>  {nptl => sysdeps/pthread}/thrd_create.c       |  4 +-
>  {nptl => sysdeps/pthread}/thrd_detach.c       |  0
>  {nptl => sysdeps/pthread}/thrd_equal.c        |  0
>  {nptl => sysdeps/pthread}/thrd_exit.c         |  0
>  {nptl => sysdeps/pthread}/thrd_join.c         |  0
>  {nptl => sysdeps/pthread}/thrd_priv.h         |  0
>  {nptl => sysdeps/pthread}/thrd_sleep.c        |  0
>  sysdeps/{nptl => pthread}/threads.h           |  0
>  {nptl => sysdeps/pthread}/tss_create.c        |  0
>  {nptl => sysdeps/pthread}/tss_delete.c        |  0
>  {nptl => sysdeps/pthread}/tss_get.c           |  0
>  {nptl => sysdeps/pthread}/tss_set.c           |  0
>  {nptl => sysdeps/pthread}/tst-call-once.c     |  0
>  {nptl => sysdeps/pthread}/tst-cnd-basic.c     |  0
>  {nptl => sysdeps/pthread}/tst-cnd-broadcast.c |  0
>  {nptl => sysdeps/pthread}/tst-cnd-timedwait.c |  0
>  {nptl => sysdeps/pthread}/tst-mtx-basic.c     |  0
>  {nptl => sysdeps/pthread}/tst-mtx-recursive.c |  0
>  {nptl => sysdeps/pthread}/tst-mtx-timedlock.c |  0
>  {nptl => sysdeps/pthread}/tst-mtx-trylock.c   |  0
>  {nptl => sysdeps/pthread}/tst-thrd-detach.c   |  0
>  {nptl => sysdeps/pthread}/tst-thrd-sleep.c    |  0
>  {nptl => sysdeps/pthread}/tst-tss-basic.c     |  0
>  51 files changed, 129 insertions(+), 77 deletions(-)
>  create mode 100644 sysdeps/htl/thrd_current.c
>  delete mode 100644 sysdeps/htl/threads.h
>  delete mode 100644 sysdeps/hurd/stdc-predef.h
>  create mode 100644 sysdeps/mach/htl/thrd_yield.c
>  create mode 100644 sysdeps/nptl/thrd_create.c
>  rename {nptl => sysdeps/pthread}/call_once.c (100%)
>  rename {nptl => sysdeps/pthread}/cnd_broadcast.c (100%)
>  rename {nptl => sysdeps/pthread}/cnd_destroy.c (100%)
>  rename {nptl => sysdeps/pthread}/cnd_init.c (100%)
>  rename {nptl => sysdeps/pthread}/cnd_signal.c (100%)
>  rename {nptl => sysdeps/pthread}/cnd_timedwait.c (100%)
>  rename {nptl => sysdeps/pthread}/cnd_wait.c (100%)
>  rename {nptl => sysdeps/pthread}/mtx_destroy.c (100%)
>  rename {nptl => sysdeps/pthread}/mtx_init.c (100%)
>  rename {nptl => sysdeps/pthread}/mtx_lock.c (100%)
>  rename {nptl => sysdeps/pthread}/mtx_timedlock.c (100%)
>  rename {nptl => sysdeps/pthread}/mtx_trylock.c (100%)
>  rename {nptl => sysdeps/pthread}/mtx_unlock.c (100%)
>  rename {nptl => sysdeps/pthread}/thrd_create.c (91%)
>  rename {nptl => sysdeps/pthread}/thrd_detach.c (100%)
>  rename {nptl => sysdeps/pthread}/thrd_equal.c (100%)
>  rename {nptl => sysdeps/pthread}/thrd_exit.c (100%)
>  rename {nptl => sysdeps/pthread}/thrd_join.c (100%)
>  rename {nptl => sysdeps/pthread}/thrd_priv.h (100%)
>  rename {nptl => sysdeps/pthread}/thrd_sleep.c (100%)
>  rename sysdeps/{nptl => pthread}/threads.h (100%)
>  rename {nptl => sysdeps/pthread}/tss_create.c (100%)
>  rename {nptl => sysdeps/pthread}/tss_delete.c (100%)
>  rename {nptl => sysdeps/pthread}/tss_get.c (100%)
>  rename {nptl => sysdeps/pthread}/tss_set.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-call-once.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-cnd-basic.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-cnd-broadcast.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-cnd-timedwait.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-mtx-basic.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-mtx-recursive.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-mtx-timedlock.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-mtx-trylock.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-thrd-detach.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-thrd-sleep.c (100%)
>  rename {nptl => sysdeps/pthread}/tst-tss-basic.c (100%)
> 
> diff --git a/htl/Versions b/htl/Versions
> index 3ae4b5c17d..c44507c21d 100644
> --- a/htl/Versions
> +++ b/htl/Versions
> @@ -20,6 +20,12 @@ libc {
>    GLIBC_2.22 {
>      __register_atfork;
>    }
> +
> +  # C11 thread symbols.
> +  GLIBC_2.32 {
> +    thrd_current; thrd_equal; thrd_sleep; thrd_yield;
> +  }
> +
>    GLIBC_PRIVATE {
>      __libc_alloca_cutoff;
>      __libc_pthread_init;


Ok.

> @@ -142,6 +148,16 @@ libpthread {
>      pthread_hurd_cond_wait_np;
>      pthread_hurd_cond_timedwait_np;
>    }
> +
> +  # C11 thread symbols.
> +  GLIBC_2.32 {
> +    thrd_create; thrd_detach; thrd_exit; thrd_join;
> +    mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy;
> +    call_once;
> +    cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; cnd_timedwait; cnd_wait;
> +    tss_create; tss_delete; tss_get; tss_set;
> +  }
> +
>    GLIBC_PRIVATE {
>      __shm_directory;
>      __pthread_threads;

Ok.

> diff --git a/nptl/Makefile b/nptl/Makefile
> index 584e0ffd96..820b757692 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -22,7 +22,7 @@ subdir	:= nptl
>  
>  include ../Makeconfig
>  
> -headers := pthread.h semaphore.h bits/semaphore.h threads.h \
> +headers := pthread.h semaphore.h bits/semaphore.h \
>  	   bits/struct_mutex.h bits/struct_rwlock.h
>  
>  extra-libs := libpthread
> @@ -30,8 +30,7 @@ extra-libs-others := $(extra-libs)
>  
>  routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
>  	   libc-cleanup libc_pthread_init libc_multiple_threads \
> -	   register-atfork pthread_atfork pthread_self thrd_current \
> -	   thrd_equal thrd_sleep thrd_yield pthread_equal \
> +	   register-atfork pthread_atfork pthread_self pthread_equal \
>  	   pthread_attr_destroy pthread_attr_init pthread_attr_getdetachstate \
>  	   pthread_attr_setdetachstate pthread_attr_getinheritsched \
>  	   pthread_attr_setinheritsched pthread_attr_getschedparam \

Ok.

> @@ -141,11 +140,7 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
>  		      pthread_mutex_setprioceiling \
>  		      pthread_setname pthread_getname \
>  		      pthread_setattr_default_np pthread_getattr_default_np \
> -		      thrd_create thrd_detach thrd_exit thrd_join \
> -		      mtx_destroy mtx_init mtx_lock mtx_timedlock \
> -		      mtx_trylock mtx_unlock call_once cnd_broadcast \
> -		      cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \
> -		      tss_create tss_delete tss_get tss_set pthread_mutex_conf \
> +		      pthread_mutex_conf \
>  		      libpthread-compat
>  #		      pthread_setuid pthread_seteuid pthread_setreuid \
>  #		      pthread_setresuid \

Ok.

> @@ -319,9 +314,6 @@ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
>  	tst-robust-fork tst-create-detached tst-memstream \
>  	tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
>  	tst-minstack-throw \
> -	tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
> -	tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
> -	tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock \
>  	tst-rwlock-pwn \
>  	tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
>  	tst-unwind-thread

Ok.

> diff --git a/sysdeps/htl/pt-mutex-destroy.c b/sysdeps/htl/pt-mutex-destroy.c
> index 796fc11b8d..6a3b5be874 100644
> --- a/sysdeps/htl/pt-mutex-destroy.c
> +++ b/sysdeps/htl/pt-mutex-destroy.c
> @@ -36,3 +36,4 @@ __pthread_mutex_destroy (pthread_mutex_t *mutex)
>  }
>  
>  strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy);
> +hidden_def (__pthread_mutex_destroy)

Ok.

> diff --git a/sysdeps/htl/pt-mutex-timedlock.c b/sysdeps/htl/pt-mutex-timedlock.c
> index 0e50f38ef2..81013984a6 100644
> --- a/sysdeps/htl/pt-mutex-timedlock.c
> +++ b/sysdeps/htl/pt-mutex-timedlock.c
> @@ -195,3 +195,4 @@ __pthread_mutex_timedlock (struct __pthread_mutex *mutex,
>    return __pthread_mutex_timedlock_internal (mutex, abstime);
>  }
>  strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
> +hidden_def (__pthread_mutex_timedlock)

Ok.

> diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
> index fc8c9bc591..fd1e697e39 100644
> --- a/sysdeps/htl/pthreadP.h
> +++ b/sysdeps/htl/pthreadP.h
> @@ -91,6 +91,8 @@ hidden_proto (__pthread_key_create)
>  hidden_proto (__pthread_getspecific)
>  hidden_proto (__pthread_setspecific)
>  hidden_proto (__pthread_mutex_init)
> +hidden_proto (__pthread_mutex_destroy)
> +hidden_proto (__pthread_mutex_timedlock)
>  #endif
>  
>  #define ASSERT_TYPE_SIZE(type, size) 	

OK
				\
> diff --git a/sysdeps/htl/thrd_current.c b/sysdeps/htl/thrd_current.c
> new file mode 100644
> index 0000000000..efc0d11b5d
> --- /dev/null
> +++ b/sysdeps/htl/thrd_current.c
> @@ -0,0 +1,31 @@
> +/* C11 threads current thread implementation.
> +   Copyright (C) 2018-2020 Free Software Foundation, Inc.

I think this is new file.

> +   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 "thrd_priv.h"
> +
> +#pragma weak __pthread_self
> +#pragma weak __pthread_threads
> +
> +thrd_t
> +thrd_current (void)
> +{
> +  if (__pthread_threads)
> +    return (thrd_t) __pthread_self ();
> +
> +  return (thrd_t) 0;
> +}

Ok.

> diff --git a/sysdeps/htl/threads.h b/sysdeps/htl/threads.h
> deleted file mode 100644
> index 3c04fbcc79..0000000000
> --- a/sysdeps/htl/threads.h
> +++ /dev/null
> @@ -1 +0,0 @@
> -#error "HTL does not implement ISO C threads"

Ok.

> diff --git a/sysdeps/hurd/stdc-predef.h b/sysdeps/hurd/stdc-predef.h
> deleted file mode 100644
> index a7bb5f7c5f..0000000000
> --- a/sysdeps/hurd/stdc-predef.h
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -/* Copyright (C) 2018-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/>.  */
> -
> -#ifndef	_STDC_PREDEF_H
> -#define	_STDC_PREDEF_H	1
> -
> -/* This header is separate from features.h so that the compiler can
> -   include it implicitly at the start of every compilation.  It must
> -   not itself include <features.h> or any other header that includes
> -   <features.h> because the implicit include comes before any feature
> -   test macros that may be defined in a source file before it first
> -   explicitly includes a system header.  GCC knows the name of this
> -   header in order to preinclude it.  */
> -
> -/* glibc's intent is to support the IEC 559 math functionality, real
> -   and complex.  If the GCC (4.9 and later) predefined macros
> -   specifying compiler intent are available, use them to determine
> -   whether the overall intent is to support these features; otherwise,
> -   presume an older compiler has intent to support these features and
> -   define these macros by default.  */
> -
> -#ifdef __GCC_IEC_559
> -# if __GCC_IEC_559 > 0
> -#  define __STDC_IEC_559__		1
> -# endif
> -#else
> -# define __STDC_IEC_559__		1
> -#endif
> -
> -#ifdef __GCC_IEC_559_COMPLEX
> -# if __GCC_IEC_559_COMPLEX > 0
> -#  define __STDC_IEC_559_COMPLEX__	1
> -# endif
> -#else
> -# define __STDC_IEC_559_COMPLEX__	1
> -#endif
> -
> -/* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
> -   synchronized with ISO/IEC 10646:2017, fifth edition, plus
> -   the following additions from Amendment 1 to the fifth edition:
> -   - 56 emoji characters
> -   - 285 hentaigana
> -   - 3 additional Zanabazar Square characters */
> -#define __STDC_ISO_10646__		201706L
> -
> -/* We do not support C11 <threads.h>.  */
> -#define __STDC_NO_THREADS__		1
> -
> -#endif

Ok.

> diff --git a/sysdeps/mach/htl/thrd_yield.c b/sysdeps/mach/htl/thrd_yield.c
> new file mode 100644
> index 0000000000..09e218cf2e
> --- /dev/null
> +++ b/sysdeps/mach/htl/thrd_yield.c
> @@ -0,0 +1,26 @@
> +/* sched_yield -- yield the processor.  Mach version.
> +   Copyright (C) 2000-2020 Free Software Foundation, Inc.

I think this is new file (even though it is based on sched_yield).

> +   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 <mach.h>
> +#include "thrd_priv.h"
> +
> +void
> +thrd_yield (void)
> +{
> +  (void) __swtch ();
> +}

Ok.

> diff --git a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
> index a8a0adc03f..a5bfaddcb2 100644
> --- a/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
> +++ b/sysdeps/mach/hurd/htl/pt-mutex-destroy.c
> @@ -35,3 +35,4 @@ __pthread_mutex_destroy (pthread_mutex_t *mtxp)
>  }
>  
>  strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
> +hidden_def (__pthread_mutex_destroy)

Ok.

> diff --git a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
> index e83bc57875..3aa7d798b2 100644
> --- a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
> +++ b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c
> @@ -77,3 +77,4 @@ __pthread_mutex_timedlock (pthread_mutex_t *mtxp, const struct timespec *tsp)
>    return ret;
>  }
>  strong_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock)
> +hidden_def (__pthread_mutex_timedlock)

Ok.

> diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
> index 7c2cb2b05a..dd0d3c7317 100644
> --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2181,6 +2181,10 @@ GLIBC_2.3.4 setsourcefilter F
>  GLIBC_2.3.4 xdr_quad_t F
>  GLIBC_2.3.4 xdr_u_quad_t F
>  GLIBC_2.30 twalk_r F
> +GLIBC_2.32 thrd_current F
> +GLIBC_2.32 thrd_equal F
> +GLIBC_2.32 thrd_sleep F
> +GLIBC_2.32 thrd_yield F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F

Ok.

> diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
> index cda8755960..0b90f9bf63 100644
> --- a/sysdeps/mach/hurd/i386/libpthread.abilist
> +++ b/sysdeps/mach/hurd/i386/libpthread.abilist
> @@ -147,3 +147,24 @@ GLIBC_2.2.6 __errno_location F
>  GLIBC_2.2.6 __h_errno_location F
>  GLIBC_2.21 pthread_hurd_cond_timedwait_np F
>  GLIBC_2.21 pthread_hurd_cond_wait_np F
> +GLIBC_2.32 call_once F
> +GLIBC_2.32 cnd_broadcast F
> +GLIBC_2.32 cnd_destroy F
> +GLIBC_2.32 cnd_init F
> +GLIBC_2.32 cnd_signal F
> +GLIBC_2.32 cnd_timedwait F
> +GLIBC_2.32 cnd_wait F
> +GLIBC_2.32 mtx_destroy F
> +GLIBC_2.32 mtx_init F
> +GLIBC_2.32 mtx_lock F
> +GLIBC_2.32 mtx_timedlock F
> +GLIBC_2.32 mtx_trylock F
> +GLIBC_2.32 mtx_unlock F
> +GLIBC_2.32 thrd_create F
> +GLIBC_2.32 thrd_detach F
> +GLIBC_2.32 thrd_exit F
> +GLIBC_2.32 thrd_join F
> +GLIBC_2.32 tss_create F
> +GLIBC_2.32 tss_delete F
> +GLIBC_2.32 tss_get F
> +GLIBC_2.32 tss_set F

Ok.

> diff --git a/sysdeps/nptl/thrd_create.c b/sysdeps/nptl/thrd_create.c
> new file mode 100644
> index 0000000000..a9219db7bc
> --- /dev/null
> +++ b/sysdeps/nptl/thrd_create.c
> @@ -0,0 +1,2 @@
> +#define __pthread_create __pthread_create_2_1
> +#include "../pthread/thrd_create.c"

I think it better to include fall path instead of relative one.

> diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
> index 7f9eadd0e2..889f10d8b1 100644
> --- a/sysdeps/pthread/Makefile
> +++ b/sysdeps/pthread/Makefile
> @@ -25,3 +25,21 @@ $(objpfx)tst-timer: $(objpfx)librt.a $(static-thread-library)
>  endif
>  
>  endif
> +
> +ifneq (,$(filter $(subdir),htl nptl))
> +headers += threads.h
> +
> +routines += thrd_current thrd_equal thrd_sleep thrd_yield
> +
> +libpthread-routines += thrd_create thrd_detach thrd_exit thrd_join \
> +		       call_once \
> +		       mtx_destroy mtx_init mtx_lock mtx_timedlock \
> +		       mtx_trylock mtx_unlock \
> +		       cnd_broadcast \
> +		       cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \
> +		       tss_create tss_delete tss_get tss_set
> +
> +tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
> +	 tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
> +	 tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock
> +endif

Ok.

> diff --git a/nptl/call_once.c b/sysdeps/pthread/call_once.c
> similarity index 100%
> rename from nptl/call_once.c
> rename to sysdeps/pthread/call_once.c

Ok.

> diff --git a/nptl/cnd_broadcast.c b/sysdeps/pthread/cnd_broadcast.c
> similarity index 100%
> rename from nptl/cnd_broadcast.c
> rename to sysdeps/pthread/cnd_broadcast.c

Ok.

> diff --git a/nptl/cnd_destroy.c b/sysdeps/pthread/cnd_destroy.c
> similarity index 100%
> rename from nptl/cnd_destroy.c
> rename to sysdeps/pthread/cnd_destroy.c

Ok.

> diff --git a/nptl/cnd_init.c b/sysdeps/pthread/cnd_init.c
> similarity index 100%
> rename from nptl/cnd_init.c
> rename to sysdeps/pthread/cnd_init.c

Ok.

> diff --git a/nptl/cnd_signal.c b/sysdeps/pthread/cnd_signal.c
> similarity index 100%
> rename from nptl/cnd_signal.c
> rename to sysdeps/pthread/cnd_signal.c

Ok.

> diff --git a/nptl/cnd_timedwait.c b/sysdeps/pthread/cnd_timedwait.c
> similarity index 100%
> rename from nptl/cnd_timedwait.c
> rename to sysdeps/pthread/cnd_timedwait.c

Ok.

> diff --git a/nptl/cnd_wait.c b/sysdeps/pthread/cnd_wait.c
> similarity index 100%
> rename from nptl/cnd_wait.c
> rename to sysdeps/pthread/cnd_wait.c

Ok.

> diff --git a/nptl/mtx_destroy.c b/sysdeps/pthread/mtx_destroy.c
> similarity index 100%
> rename from nptl/mtx_destroy.c
> rename to sysdeps/pthread/mtx_destroy.c

Ok.

> diff --git a/nptl/mtx_init.c b/sysdeps/pthread/mtx_init.c
> similarity index 100%
> rename from nptl/mtx_init.c
> rename to sysdeps/pthread/mtx_init.c

Ok.

> diff --git a/nptl/mtx_lock.c b/sysdeps/pthread/mtx_lock.c
> similarity index 100%
> rename from nptl/mtx_lock.c
> rename to sysdeps/pthread/mtx_lock.c

Ok.

> diff --git a/nptl/mtx_timedlock.c b/sysdeps/pthread/mtx_timedlock.c
> similarity index 100%
> rename from nptl/mtx_timedlock.c
> rename to sysdeps/pthread/mtx_timedlock.c

Ok.

> diff --git a/nptl/mtx_trylock.c b/sysdeps/pthread/mtx_trylock.c
> similarity index 100%
> rename from nptl/mtx_trylock.c
> rename to sysdeps/pthread/mtx_trylock.c

Ok.

> diff --git a/nptl/mtx_unlock.c b/sysdeps/pthread/mtx_unlock.c
> similarity index 100%
> rename from nptl/mtx_unlock.c
> rename to sysdeps/pthread/mtx_unlock.c

Ok.

> diff --git a/nptl/thrd_create.c b/sysdeps/pthread/thrd_create.c
> similarity index 91%
> rename from nptl/thrd_create.c
> rename to sysdeps/pthread/thrd_create.c

Ok.

> index fe08e22973..25af955419 100644
> --- a/nptl/thrd_create.c
> +++ b/sysdeps/pthread/thrd_create.c
> @@ -24,7 +24,7 @@ thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
>    _Static_assert (sizeof (*thr) == sizeof (pthread_t),
>  		  "sizeof (*thr) != sizeof (pthread_t)");
>  
> -  int err_code = __pthread_create_2_1 (thr, ATTR_C11_THREAD,
> -				       (void* (*) (void*))func, arg);
> +  int err_code = __pthread_create (thr, ATTR_C11_THREAD,
> +				   (void* (*) (void*))func, arg);
>    return thrd_err_map (err_code);
>  }

Ok.

> diff --git a/nptl/thrd_detach.c b/sysdeps/pthread/thrd_detach.c
> similarity index 100%
> rename from nptl/thrd_detach.c
> rename to sysdeps/pthread/thrd_detach.c

Ok.

> diff --git a/nptl/thrd_equal.c b/sysdeps/pthread/thrd_equal.c
> similarity index 100%
> rename from nptl/thrd_equal.c
> rename to sysdeps/pthread/thrd_equal.c

Ok.

> diff --git a/nptl/thrd_exit.c b/sysdeps/pthread/thrd_exit.c
> similarity index 100%
> rename from nptl/thrd_exit.c
> rename to sysdeps/pthread/thrd_exit.c

Ok.

> diff --git a/nptl/thrd_join.c b/sysdeps/pthread/thrd_join.c
> similarity index 100%
> rename from nptl/thrd_join.c
> rename to sysdeps/pthread/thrd_join.c

Ok.

> diff --git a/nptl/thrd_priv.h b/sysdeps/pthread/thrd_priv.h
> similarity index 100%
> rename from nptl/thrd_priv.h
> rename to sysdeps/pthread/thrd_priv.h

Ok.

> diff --git a/nptl/thrd_sleep.c b/sysdeps/pthread/thrd_sleep.c
> similarity index 100%
> rename from nptl/thrd_sleep.c
> rename to sysdeps/pthread/thrd_sleep.c

Ok.

> diff --git a/sysdeps/nptl/threads.h b/sysdeps/pthread/threads.h
> similarity index 100%
> rename from sysdeps/nptl/threads.h
> rename to sysdeps/pthread/threads.h

Ok.

> diff --git a/nptl/tss_create.c b/sysdeps/pthread/tss_create.c
> similarity index 100%
> rename from nptl/tss_create.c
> rename to sysdeps/pthread/tss_create.c

Ok.

> diff --git a/nptl/tss_delete.c b/sysdeps/pthread/tss_delete.c
> similarity index 100%
> rename from nptl/tss_delete.c
> rename to sysdeps/pthread/tss_delete.c

Ok.

> diff --git a/nptl/tss_get.c b/sysdeps/pthread/tss_get.c
> similarity index 100%
> rename from nptl/tss_get.c
> rename to sysdeps/pthread/tss_get.c

Ok.

> diff --git a/nptl/tss_set.c b/sysdeps/pthread/tss_set.c
> similarity index 100%
> rename from nptl/tss_set.c
> rename to sysdeps/pthread/tss_set.c

Ok.

> diff --git a/nptl/tst-call-once.c b/sysdeps/pthread/tst-call-once.c
> similarity index 100%
> rename from nptl/tst-call-once.c
> rename to sysdeps/pthread/tst-call-once.c

Ok.

> diff --git a/nptl/tst-cnd-basic.c b/sysdeps/pthread/tst-cnd-basic.c
> similarity index 100%
> rename from nptl/tst-cnd-basic.c
> rename to sysdeps/pthread/tst-cnd-basic.c

Ok.

> diff --git a/nptl/tst-cnd-broadcast.c b/sysdeps/pthread/tst-cnd-broadcast.c
> similarity index 100%
> rename from nptl/tst-cnd-broadcast.c
> rename to sysdeps/pthread/tst-cnd-broadcast.c

Ok.

> diff --git a/nptl/tst-cnd-timedwait.c b/sysdeps/pthread/tst-cnd-timedwait.c
> similarity index 100%
> rename from nptl/tst-cnd-timedwait.c

Ok.

> rename to sysdeps/pthread/tst-cnd-timedwait.c
> diff --git a/nptl/tst-mtx-basic.c b/sysdeps/pthread/tst-mtx-basic.c
> similarity index 100%
> rename from nptl/tst-mtx-basic.c
> rename to sysdeps/pthread/tst-mtx-basic.c

Ok.

> diff --git a/nptl/tst-mtx-recursive.c b/sysdeps/pthread/tst-mtx-recursive.c
> similarity index 100%
> rename from nptl/tst-mtx-recursive.c
> rename to sysdeps/pthread/tst-mtx-recursive.c

Ok.

> diff --git a/nptl/tst-mtx-timedlock.c b/sysdeps/pthread/tst-mtx-timedlock.c
> similarity index 100%
> rename from nptl/tst-mtx-timedlock.c
> rename to sysdeps/pthread/tst-mtx-timedlock.c

Ok.

> diff --git a/nptl/tst-mtx-trylock.c b/sysdeps/pthread/tst-mtx-trylock.c
> similarity index 100%
> rename from nptl/tst-mtx-trylock.c
> rename to sysdeps/pthread/tst-mtx-trylock.c

Ok.

> diff --git a/nptl/tst-thrd-detach.c b/sysdeps/pthread/tst-thrd-detach.c
> similarity index 100%
> rename from nptl/tst-thrd-detach.c
> rename to sysdeps/pthread/tst-thrd-detach.c

Ok.

> diff --git a/nptl/tst-thrd-sleep.c b/sysdeps/pthread/tst-thrd-sleep.c
> similarity index 100%
> rename from nptl/tst-thrd-sleep.c
> rename to sysdeps/pthread/tst-thrd-sleep.c

Ok.

> diff --git a/nptl/tst-tss-basic.c b/sysdeps/pthread/tst-tss-basic.c
> similarity index 100%
> rename from nptl/tst-tss-basic.c
> rename to sysdeps/pthread/tst-tss-basic.c
> 

Ok.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy
  2020-01-17 20:40   ` Adhemerval Zanella
@ 2020-01-21 21:28     ` Samuel Thibault
  2020-01-27 21:55       ` Removing internal symbols (Was: htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy) Samuel Thibault
  0 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-21 21:28 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

Hello,

Adhemerval Zanella, le ven. 17 janv. 2020 17:40:09 -0300, a ecrit:
> > diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
> > index 0ede90859c..cda8755960 100644
> > --- a/sysdeps/mach/hurd/i386/libpthread.abilist
> > +++ b/sysdeps/mach/hurd/i386/libpthread.abilist
> > @@ -14,8 +14,6 @@ GLIBC_2.12 _cthread_init_routine D 0x4
> >  GLIBC_2.12 _cthreads_flockfile F
> >  GLIBC_2.12 _cthreads_ftrylockfile F
> >  GLIBC_2.12 _cthreads_funlockfile F
> > -GLIBC_2.12 _pthread_mutex_destroy F
> > -GLIBC_2.12 _pthread_mutex_init F
> >  GLIBC_2.12 _pthread_mutex_lock F
> >  GLIBC_2.12 _pthread_mutex_trylock F
> >  GLIBC_2.12 _pthread_mutex_unlock F
> 
> I understand this change is follow Linux internal implementation
> and make mtx_init.c generic, but I don't think changing hurd 
> libpthread exported symbols is the correct solution. 
> 
> Since the symbol won't be used anymore I think we can move to
> a compat symbol, something like:
> 
> +strong_alias (__pthread_mutex_init, pthread_mutex_init);
> +hidden_def (__pthread_mutex_init)
> +#if SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_31)
> +compat_symbol (libpthread, __pthread_mutex_init, _pthread_mutex_init, GLIBC_2_12);
> +#endif

But do we need to keep the compat symbols at all? 

_pthread_mutex_lock has never been exposed in a .h file, it should have
gotten version GLIBC_PRIVATE actually since it's only used between
libc.so and libpthread.so.

Samuel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread
  2020-01-21 12:39   ` Adhemerval Zanella
@ 2020-01-21 22:01     ` Samuel Thibault
  2020-01-22 12:36       ` Adhemerval Zanella
  0 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-21 22:01 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

Adhemerval Zanella, le mar. 21 janv. 2020 09:39:31 -0300, a ecrit:
> LGTM with a small nit below.
> 
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> 
> > --- /dev/null
> > +++ b/sysdeps/htl/thrd_current.c
> > @@ -0,0 +1,31 @@
> > +/* C11 threads current thread implementation.
> > +   Copyright (C) 2018-2020 Free Software Foundation, Inc.
> 
> I think this is new file.

Right, I did copy from another file, but nothing copyrightable was kept
from the original file.

> > diff --git a/sysdeps/mach/htl/thrd_yield.c b/sysdeps/mach/htl/thrd_yield.c
> > new file mode 100644
> > index 0000000000..09e218cf2e
> > --- /dev/null
> > +++ b/sysdeps/mach/htl/thrd_yield.c
> > @@ -0,0 +1,26 @@
> > +/* sched_yield -- yield the processor.  Mach version.
> > +   Copyright (C) 2000-2020 Free Software Foundation, Inc.
> 
> I think this is new file (even though it is based on sched_yield).

Ditto, not really something copyrightable.

> > diff --git a/sysdeps/nptl/thrd_create.c b/sysdeps/nptl/thrd_create.c
> > new file mode 100644
> > index 0000000000..a9219db7bc
> > --- /dev/null
> > +++ b/sysdeps/nptl/thrd_create.c
> > @@ -0,0 +1,2 @@
> > +#define __pthread_create __pthread_create_2_1
> > +#include "../pthread/thrd_create.c"
> 
> I think it better to include fall path instead of relative one.

Do you mean using #include_next ? That does not work, gcc warns that it's
discouraged in primary source file.

Samuel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread
  2020-01-21 22:01     ` Samuel Thibault
@ 2020-01-22 12:36       ` Adhemerval Zanella
  0 siblings, 0 replies; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-22 12:36 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha



On 21/01/2020 19:01, Samuel Thibault wrote:
> 
>>> diff --git a/sysdeps/nptl/thrd_create.c b/sysdeps/nptl/thrd_create.c
>>> new file mode 100644
>>> index 0000000000..a9219db7bc
>>> --- /dev/null
>>> +++ b/sysdeps/nptl/thrd_create.c
>>> @@ -0,0 +1,2 @@
>>> +#define __pthread_create __pthread_create_2_1
>>> +#include "../pthread/thrd_create.c"
>>
>> I think it better to include fall path instead of relative one.
> 
> Do you mean using #include_next ? That does not work, gcc warns that it's
> discouraged in primary source file.

I meant 

#include <sysdeps/pthread/thrd_create.c>

I think it is clearly at source level to which file it refers and
require less change if the file is moved.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Removing internal symbols (Was: htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy)
  2020-01-21 21:28     ` Samuel Thibault
@ 2020-01-27 21:55       ` Samuel Thibault
  2020-01-28 12:56         ` Adhemerval Zanella
  0 siblings, 1 reply; 32+ messages in thread
From: Samuel Thibault @ 2020-01-27 21:55 UTC (permalink / raw)
  To: libc-alpha

Hello,

Expanding the subject a bit to catch more opinions on this:

Samuel Thibault, le mar. 21 janv. 2020 22:28:50 +0100, a ecrit:
> Adhemerval Zanella, le ven. 17 janv. 2020 17:40:09 -0300, a ecrit:
> > > diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
> > > index 0ede90859c..cda8755960 100644
> > > --- a/sysdeps/mach/hurd/i386/libpthread.abilist
> > > +++ b/sysdeps/mach/hurd/i386/libpthread.abilist
> > > @@ -14,8 +14,6 @@ GLIBC_2.12 _cthread_init_routine D 0x4
> > >  GLIBC_2.12 _cthreads_flockfile F
> > >  GLIBC_2.12 _cthreads_ftrylockfile F
> > >  GLIBC_2.12 _cthreads_funlockfile F
> > > -GLIBC_2.12 _pthread_mutex_destroy F
> > > -GLIBC_2.12 _pthread_mutex_init F
> > >  GLIBC_2.12 _pthread_mutex_lock F
> > >  GLIBC_2.12 _pthread_mutex_trylock F
> > >  GLIBC_2.12 _pthread_mutex_unlock F
> > 
> > I understand this change is follow Linux internal implementation
> > and make mtx_init.c generic, but I don't think changing hurd 
> > libpthread exported symbols is the correct solution. 
> > 
> > Since the symbol won't be used anymore I think we can move to
> > a compat symbol, something like:
> > 
> > +strong_alias (__pthread_mutex_init, pthread_mutex_init);
> > +hidden_def (__pthread_mutex_init)
> > +#if SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_31)
> > +compat_symbol (libpthread, __pthread_mutex_init, _pthread_mutex_init, GLIBC_2_12);
> > +#endif
> 
> But do we need to keep the compat symbols at all? 
> 
> _pthread_mutex_lock has never been exposed in a .h file, it should have
> gotten version GLIBC_PRIVATE actually since it's only used between
> libc.so and libpthread.so.

Samuel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Removing internal symbols (Was: htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy)
  2020-01-27 21:55       ` Removing internal symbols (Was: htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy) Samuel Thibault
@ 2020-01-28 12:56         ` Adhemerval Zanella
  2020-01-28 13:58           ` Removing internal symbols Florian Weimer
  0 siblings, 1 reply; 32+ messages in thread
From: Adhemerval Zanella @ 2020-01-28 12:56 UTC (permalink / raw)
  To: libc-alpha



On 27/01/2020 18:55, Samuel Thibault wrote:
> Hello,
> 
> Expanding the subject a bit to catch more opinions on this:
> 
> Samuel Thibault, le mar. 21 janv. 2020 22:28:50 +0100, a ecrit:
>> Adhemerval Zanella, le ven. 17 janv. 2020 17:40:09 -0300, a ecrit:
>>>> diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
>>>> index 0ede90859c..cda8755960 100644
>>>> --- a/sysdeps/mach/hurd/i386/libpthread.abilist
>>>> +++ b/sysdeps/mach/hurd/i386/libpthread.abilist
>>>> @@ -14,8 +14,6 @@ GLIBC_2.12 _cthread_init_routine D 0x4
>>>>  GLIBC_2.12 _cthreads_flockfile F
>>>>  GLIBC_2.12 _cthreads_ftrylockfile F
>>>>  GLIBC_2.12 _cthreads_funlockfile F
>>>> -GLIBC_2.12 _pthread_mutex_destroy F
>>>> -GLIBC_2.12 _pthread_mutex_init F
>>>>  GLIBC_2.12 _pthread_mutex_lock F
>>>>  GLIBC_2.12 _pthread_mutex_trylock F
>>>>  GLIBC_2.12 _pthread_mutex_unlock F
>>>
>>> I understand this change is follow Linux internal implementation
>>> and make mtx_init.c generic, but I don't think changing hurd 
>>> libpthread exported symbols is the correct solution. 
>>>
>>> Since the symbol won't be used anymore I think we can move to
>>> a compat symbol, something like:
>>>
>>> +strong_alias (__pthread_mutex_init, pthread_mutex_init);
>>> +hidden_def (__pthread_mutex_init)
>>> +#if SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_31)
>>> +compat_symbol (libpthread, __pthread_mutex_init, _pthread_mutex_init, GLIBC_2_12);
>>> +#endif
>>
>> But do we need to keep the compat symbols at all? 
>>
>> _pthread_mutex_lock has never been exposed in a .h file, it should have
>> gotten version GLIBC_PRIVATE actually since it's only used between
>> libc.so and libpthread.so.

I think it might be fine in this case, assuming there is no external linkage
possible with header redirection. It is still a ABI break, but if an
application is using such symbol it is abusing the API.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: Removing internal symbols
  2020-01-28 12:56         ` Adhemerval Zanella
@ 2020-01-28 13:58           ` Florian Weimer
  0 siblings, 0 replies; 32+ messages in thread
From: Florian Weimer @ 2020-01-28 13:58 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

> On 27/01/2020 18:55, Samuel Thibault wrote:
>> Hello,
>> 
>> Expanding the subject a bit to catch more opinions on this:
>> 
>> Samuel Thibault, le mar. 21 janv. 2020 22:28:50 +0100, a ecrit:
>>> Adhemerval Zanella, le ven. 17 janv. 2020 17:40:09 -0300, a ecrit:
>>>>> diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
>>>>> index 0ede90859c..cda8755960 100644
>>>>> --- a/sysdeps/mach/hurd/i386/libpthread.abilist
>>>>> +++ b/sysdeps/mach/hurd/i386/libpthread.abilist
>>>>> @@ -14,8 +14,6 @@ GLIBC_2.12 _cthread_init_routine D 0x4
>>>>>  GLIBC_2.12 _cthreads_flockfile F
>>>>>  GLIBC_2.12 _cthreads_ftrylockfile F
>>>>>  GLIBC_2.12 _cthreads_funlockfile F
>>>>> -GLIBC_2.12 _pthread_mutex_destroy F
>>>>> -GLIBC_2.12 _pthread_mutex_init F
>>>>>  GLIBC_2.12 _pthread_mutex_lock F
>>>>>  GLIBC_2.12 _pthread_mutex_trylock F
>>>>>  GLIBC_2.12 _pthread_mutex_unlock F
>>>>
>>>> I understand this change is follow Linux internal implementation
>>>> and make mtx_init.c generic, but I don't think changing hurd 
>>>> libpthread exported symbols is the correct solution. 
>>>>
>>>> Since the symbol won't be used anymore I think we can move to
>>>> a compat symbol, something like:
>>>>
>>>> +strong_alias (__pthread_mutex_init, pthread_mutex_init);
>>>> +hidden_def (__pthread_mutex_init)
>>>> +#if SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_31)
>>>> +compat_symbol (libpthread, __pthread_mutex_init, _pthread_mutex_init, GLIBC_2_12);
>>>> +#endif
>>>
>>> But do we need to keep the compat symbols at all? 
>>>
>>> _pthread_mutex_lock has never been exposed in a .h file, it should have
>>> gotten version GLIBC_PRIVATE actually since it's only used between
>>> libc.so and libpthread.so.
>
> I think it might be fine in this case, assuming there is no external
> linkage possible with header redirection. It is still a ABI break, but
> if an application is using such symbol it is abusing the API.

I don't have any ABI tooling for Hurd.  But on GNU/Linux, GNU packages
often use internal APIs of other GNU packages, without much coordination
(probably assuming that's okay because it's all GNU).  For glibc, we try
to tell developers not to do that, but it's an ongoing effort and very
much incomplete at this point.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2020-01-28 13:58 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14 18:52 [PATCH 00/10] Port C11 threads to GNU/Hurd Samuel Thibault
2020-01-14 18:52 ` [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock Samuel Thibault
2020-01-14 18:52 ` [PATCH 01/10] htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy Samuel Thibault
2020-01-17 20:40   ` Adhemerval Zanella
2020-01-21 21:28     ` Samuel Thibault
2020-01-27 21:55       ` Removing internal symbols (Was: htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroy) Samuel Thibault
2020-01-28 12:56         ` Adhemerval Zanella
2020-01-28 13:58           ` Removing internal symbols Florian Weimer
2020-01-14 18:52 ` [PATCH 02/10] htl: Add missing internal functions declarations Samuel Thibault
2020-01-20 17:11   ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 03/10] htl: Add support for C11 threads behavior Samuel Thibault
2020-01-20 17:15   ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 04/10] htl: Make __PTHREAD_ONCE_INIT more flexible Samuel Thibault
2020-01-20 18:01   ` Adhemerval Zanella
2020-01-20 18:29     ` Samuel Thibault
2020-01-14 18:52 ` [PATCH 05/10] nptl: Move nptl-specific types to separate header Samuel Thibault
2020-01-20 18:31   ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 06/10] C11 threads: do not require PTHREAD_DESTRUCTOR_ITERATIONS Samuel Thibault
2020-01-20 18:40   ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 07/10] C11 threads: Fix thrd_t / pthread_t compatibility assertion Samuel Thibault
2020-01-20 18:52   ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 08/10] C11 threads: make thrd_join more portable Samuel Thibault
2020-01-20 18:53   ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 09/10] htl: Add C11 threads types definitions Samuel Thibault
2020-01-20 19:08   ` Adhemerval Zanella
2020-01-20 20:58     ` Samuel Thibault
2020-01-21 11:35       ` Adhemerval Zanella
2020-01-14 18:52 ` [PATCH 10/10] C11 threads: Move implementation to sysdeps/pthread Samuel Thibault
2020-01-21 12:39   ` Adhemerval Zanella
2020-01-21 22:01     ` Samuel Thibault
2020-01-22 12:36       ` Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2020-01-13 19:42 [hurd,commited] htl: Add internal version of __pthread_mutex_timedlock Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).