diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:51 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:51 +0200 |
commit | 486010a3c8cb59df19995eac964ef51e627287a4 (patch) | |
tree | a2a3f987c5ed5446355fed93a1b9c4be57ada486 /sysdeps/nptl | |
parent | 08129b155e50f01588ec6e675fc76637cb22eb01 (diff) | |
download | glibc-486010a3c8cb59df19995eac964ef51e627287a4.tar glibc-486010a3c8cb59df19995eac964ef51e627287a4.tar.gz glibc-486010a3c8cb59df19995eac964ef51e627287a4.tar.bz2 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')
-rw-r--r-- | sysdeps/nptl/pthread-functions.h | 1 | ||||
-rw-r--r-- | sysdeps/nptl/setxid.h | 26 |
2 files changed, 3 insertions, 24 deletions
diff --git a/sysdeps/nptl/pthread-functions.h b/sysdeps/nptl/pthread-functions.h index 56c746a01c..d76b2cdecf 100644 --- a/sysdeps/nptl/pthread-functions.h +++ b/sysdeps/nptl/pthread-functions.h @@ -30,7 +30,6 @@ struct xid_command; the thread functions. */ struct pthread_functions { - int (*ptr__nptl_setxid) (struct xid_command *); }; /* Variable in libc.so. */ 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 |