summary refs log tree commit diff
path: root/sysdeps/nptl/setxid.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:51 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:51 +0200
commit486010a3c8cb59df19995eac964ef51e627287a4 (patch)
treea2a3f987c5ed5446355fed93a1b9c4be57ada486 /sysdeps/nptl/setxid.h
parent08129b155e50f01588ec6e675fc76637cb22eb01 (diff)
downloadglibc-486010a3c8cb59df19995eac964ef51e627287a4.tar.gz
glibc-486010a3c8cb59df19995eac964ef51e627287a4.tar.xz
glibc-486010a3c8cb59df19995eac964ef51e627287a4.zip
nptl: Move setxid broadcast implementation into libc
The signal handler is exported as __nptl_setxid_sighandler, so
that the libpthread initialization code can install it.  This
is sufficient for now because it is guarantueed to happen before
the first pthread_create call.
Diffstat (limited to 'sysdeps/nptl/setxid.h')
-rw-r--r--sysdeps/nptl/setxid.h26
1 files changed, 3 insertions, 23 deletions
diff --git a/sysdeps/nptl/setxid.h b/sysdeps/nptl/setxid.h
index 57b665cb5b..8b49d11550 100644
--- a/sysdeps/nptl/setxid.h
+++ b/sysdeps/nptl/setxid.h
@@ -16,6 +16,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <nptl/pthreadP.h>
+#include <sys/single_threaded.h>
 #include <sysdep.h>
 
 #define __SETXID_1(cmd, arg1) \
@@ -25,30 +26,10 @@
 #define __SETXID_3(cmd, arg1, arg2, arg3) \
   __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = (long int) arg3
 
-#ifdef SINGLE_THREAD
-# define INLINE_SETXID_SYSCALL(name, nr, args...) \
-  INLINE_SYSCALL (name, nr, args)
-#elif defined SHARED
-# define INLINE_SETXID_SYSCALL(name, nr, args...) \
+#define INLINE_SETXID_SYSCALL(name, nr, args...) \
   ({									\
     int __result;							\
-    if (__builtin_expect (__libc_pthread_functions_init, 0))		\
-      {									\
-	struct xid_command __cmd;					\
-	__cmd.syscall_no = __NR_##name;					\
-	__SETXID_##nr (__cmd, args);					\
-	__result = PTHFCT_CALL (ptr__nptl_setxid, (&__cmd));		\
-	}								\
-    else								\
-      __result = INLINE_SYSCALL (name, nr, args);			\
-    __result;								\
-   })
-#else
-# define INLINE_SETXID_SYSCALL(name, nr, args...) \
-  ({									\
-    extern __typeof (__nptl_setxid) __nptl_setxid __attribute__((weak));\
-    int __result;							\
-    if (__glibc_unlikely (__nptl_setxid	!= NULL))			      \
+    if (!__libc_single_threaded)					\
       {									\
 	struct xid_command __cmd;					\
 	__cmd.syscall_no = __NR_##name;					\
@@ -59,4 +40,3 @@
       __result = INLINE_SYSCALL (name, nr, args);			\
     __result;								\
    })
-#endif