public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Linux: set_robust_list syscall number is always available
@ 2020-03-03 13:27 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2020-03-03 13:27 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b03604b1b8c92d9af2d61d09654b06fccdeac8d5

commit b03604b1b8c92d9af2d61d09654b06fccdeac8d5
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sun Feb 9 16:38:33 2020 +0100

    Linux: set_robust_list syscall number is always available
    
    Due to the built-in tables, __NR_set_robust_list is always defined
    (although it may not be available at run time).
    
    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

Diff:
---
 nptl/nptl-init.c      |  4 ----
 nptl/pthread_create.c |  6 ++----
 sysdeps/nptl/fork.c   | 10 ++++------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 95ac91d..96b1444 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -117,10 +117,8 @@ static
 void
 __nptl_set_robust (struct pthread *self)
 {
-#ifdef __NR_set_robust_list
   INTERNAL_SYSCALL_CALL (set_robust_list, &self->robust_head,
 			 sizeof (struct robust_list_head));
-#endif
 }
 
 
@@ -240,14 +238,12 @@ __pthread_initialize_minimal_internal (void)
     pd->robust_prev = &pd->robust_head;
 #endif
     pd->robust_head.list = &pd->robust_head;
-#ifdef __NR_set_robust_list
     pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
 				    - offsetof (pthread_mutex_t,
 						__data.__list.__next));
     int res = INTERNAL_SYSCALL_CALL (set_robust_list, &pd->robust_head,
 				     sizeof (struct robust_list_head));
     if (INTERNAL_SYSCALL_ERROR_P (res))
-#endif
       set_robust_list_not_avail ();
   }
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 8614ec6..7c752d0 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -389,17 +389,15 @@ START_THREAD_DEFN
   if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
     futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
 
-#ifdef __NR_set_robust_list
-# ifndef __ASSUME_SET_ROBUST_LIST
+#ifndef __ASSUME_SET_ROBUST_LIST
   if (__set_robust_list_avail >= 0)
-# endif
+#endif
     {
       /* This call should never fail because the initial call in init.c
 	 succeeded.  */
       INTERNAL_SYSCALL_CALL (set_robust_list, &pd->robust_head,
 			     sizeof (struct robust_list_head));
     }
-#endif
 
   /* If the parent was running cancellation handlers while creating
      the thread the new thread inherited the signal mask.  Reset the
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index f5cf88d..5091a00 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -83,7 +83,6 @@ __libc_fork (void)
       if (__fork_generation_pointer != NULL)
 	*__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR;
 
-#ifdef __NR_set_robust_list
       /* Initialize the robust mutex list setting in the kernel which has
 	 been reset during the fork.  We do not check for errors because if
 	 it fails here, it must have failed at process startup as well and
@@ -94,19 +93,18 @@ __libc_fork (void)
 	 inherit the correct value from the parent.  We do not need to clear
 	 the pending operation because it must have been zero when fork was
 	 called.  */
-# if __PTHREAD_MUTEX_HAVE_PREV
+#if __PTHREAD_MUTEX_HAVE_PREV
       self->robust_prev = &self->robust_head;
-# endif
+#endif
       self->robust_head.list = &self->robust_head;
-# ifdef SHARED
+#ifdef SHARED
       if (__builtin_expect (__libc_pthread_functions_init, 0))
 	PTHFCT_CALL (ptr_set_robust, (self));
-# else
+#else
       extern __typeof (__nptl_set_robust) __nptl_set_robust
 	__attribute__((weak));
       if (__builtin_expect (__nptl_set_robust != NULL, 0))
 	__nptl_set_robust (self);
-# endif
 #endif
 
       /* Reset the lock state in the multi-threaded case.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-03 13:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 13:27 [glibc] Linux: set_robust_list syscall number is always available Florian Weimer

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).