about summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/htl/pt-pthread_self.c10
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.c12
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.h2
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist10
-rw-r--r--sysdeps/mach/sleep.c3
5 files changed, 26 insertions, 11 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-pthread_self.c b/sysdeps/mach/hurd/htl/pt-pthread_self.c
index 04fa283aab..d11d0ec676 100644
--- a/sysdeps/mach/hurd/htl/pt-pthread_self.c
+++ b/sysdeps/mach/hurd/htl/pt-pthread_self.c
@@ -17,6 +17,14 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <pt-sysdep.h>
+#include <pt-internal.h>
 
-__thread struct __pthread *___pthread_self;
+/* Initial thread structure used before libpthread is initialized, so various
+ * functions can already work at least basically.  */
+struct __pthread __pthread_init_thread = {
+	.thread = 1,
+};
+libc_hidden_def (__pthread_init_thread)
+
+__thread struct __pthread *___pthread_self = &__pthread_init_thread;
 libc_hidden_tls_def (___pthread_self)
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 5372cbf77f..f5c1c246eb 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -26,10 +26,6 @@
 #include <pt-internal.h>
 #include <pthreadP.h>
 
-/* Initial thread structure used temporarily during initialization, so various
- * functions can already work at least basically.  */
-static struct __pthread init_thread;
-
 static void
 reset_pthread_total (void)
 {
@@ -51,10 +47,6 @@ _init_routine (void *stack)
     /* Already initialized */
     return;
 
-  /* Initialize early thread structure.  */
-  init_thread.thread = 1;
-  ___pthread_self = &init_thread;
-
   /* Initialize the library.  */
   ___pthread_init ();
 
@@ -116,9 +108,9 @@ _init_routine (void *stack)
 #endif
 
   /* Copy over the thread-specific state */
-  assert (!init_thread.thread_specifics);
+  assert (!__pthread_init_thread.thread_specifics);
   memcpy (&thread->static_thread_specifics,
-          &init_thread.static_thread_specifics,
+          &__pthread_init_thread.static_thread_specifics,
           sizeof (thread->static_thread_specifics));
 
   ___pthread_self = thread;
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.h b/sysdeps/mach/hurd/htl/pt-sysdep.h
index 09d9547a8e..8e94395be7 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.h
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.h
@@ -34,6 +34,8 @@
 
 extern __thread struct __pthread *___pthread_self;
 libc_hidden_tls_proto (___pthread_self)
+extern struct __pthread __pthread_init_thread;
+libc_hidden_proto (__pthread_init_thread)
 
 #ifdef DEBUG
 #define _pthread_self()                                            \
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 2adf98e71d..dc2c6b505b 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -29,7 +29,17 @@ GLIBC_2.11 mkostemps64 F
 GLIBC_2.11 mkstemps F
 GLIBC_2.11 mkstemps64 F
 GLIBC_2.12 __pthread_self F
+GLIBC_2.12 pthread_attr_getdetachstate F
+GLIBC_2.12 pthread_attr_getinheritsched F
+GLIBC_2.12 pthread_attr_getschedparam F
+GLIBC_2.12 pthread_attr_getschedpolicy F
+GLIBC_2.12 pthread_attr_setdetachstate F
+GLIBC_2.12 pthread_attr_setinheritsched F
+GLIBC_2.12 pthread_attr_setschedpolicy F
+GLIBC_2.12 pthread_equal F
+GLIBC_2.12 pthread_getschedparam F
 GLIBC_2.12 pthread_self F
+GLIBC_2.12 pthread_setschedparam F
 GLIBC_2.13 __fentry__ F
 GLIBC_2.14 syncfs F
 GLIBC_2.15 __fdelt_chk F
diff --git a/sysdeps/mach/sleep.c b/sysdeps/mach/sleep.c
index 572be150bc..aa750c13c5 100644
--- a/sysdeps/mach/sleep.c
+++ b/sysdeps/mach/sleep.c
@@ -43,6 +43,9 @@ __sleep (unsigned int seconds)
   after = time_now ();
   __mach_port_destroy (__mach_task_self (), recv);
 
+  if (after - before > seconds)
+    return 0;
+
   return seconds - (after - before);
 }
 weak_alias (__sleep, sleep)