diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-09-20 14:56:08 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-09-20 14:56:08 +0200 |
commit | 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93 (patch) | |
tree | 0a20e738355959c33d3e61fc66bd07bf57845e0b /sysdeps/pthread | |
parent | a93d9e03a31ec14405cb3a09aa95413b67067380 (diff) | |
download | glibc-95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93.tar glibc-95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93.tar.gz glibc-95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93.tar.bz2 glibc-95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93.zip |
nptl: pthread_kill needs to return ESRCH for old programs (bug 19193)
The fix for bug 19193 breaks some old applications which appear
to use pthread_kill to probe if a thread is still running, something
that is not supported by POSIX.
Diffstat (limited to 'sysdeps/pthread')
-rw-r--r-- | sysdeps/pthread/tst-pthread_kill-exited.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sysdeps/pthread/tst-pthread_kill-exited.c b/sysdeps/pthread/tst-pthread_kill-exited.c index 7575fb6d58..a2fddad526 100644 --- a/sysdeps/pthread/tst-pthread_kill-exited.c +++ b/sysdeps/pthread/tst-pthread_kill-exited.c @@ -16,11 +16,15 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -/* This test verifies that pthread_kill returns 0 (and not ESRCH) for - a thread that has exited on the kernel side. */ +/* This test verifies that the default pthread_kill returns 0 (and not + ESRCH) for a thread that has exited on the kernel side. */ +#include <errno.h> +#include <pthread.h> +#include <shlib-compat.h> #include <signal.h> #include <stddef.h> +#include <support/check.h> #include <support/support.h> #include <support/xthread.h> @@ -30,6 +34,12 @@ noop_thread (void *closure) return NULL; } +#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC +extern __typeof (pthread_kill) compat_pthread_kill; +compat_symbol_reference (libpthread, compat_pthread_kill, pthread_kill, + GLIBC_2_0); +#endif + static int do_test (void) { @@ -37,7 +47,14 @@ do_test (void) support_wait_for_thread_exit (); + /* NB: Always uses the default symbol due to separate compilation. */ xpthread_kill (thr, SIGUSR1); + +#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC + /* Old binaries need the non-conforming ESRCH error code. */ + TEST_COMPARE (compat_pthread_kill (thr, SIGUSR1), ESRCH); +#endif + xpthread_join (thr); return 0; |