[PATCH] htl: move pthread_setcancelstate into libc.
gfleury
gfleury@disroot.org
Tue Nov 19 19:22:38 GMT 2024
---
htl/Makefile | 2 +-
htl/Versions | 4 +++-
htl/forward.c | 4 ----
htl/pt-initialize.c | 1 -
htl/pt-setcancelstate.c | 8 ++++++--
sysdeps/htl/libc-lockP.h | 5 ++---
sysdeps/htl/pthread-functions.h | 2 --
sysdeps/htl/pthreadP.h | 3 ---
sysdeps/mach/hurd/i386/libc.abilist | 1 +
sysdeps/mach/hurd/i386/libpthread.abilist | 1 -
sysdeps/mach/hurd/x86_64/libpthread.abilist | 1 -
11 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/htl/Makefile b/htl/Makefile
index 25eb7910..3ebb76c2 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -51,7 +51,6 @@ libpthread-routines := \
pt-sigmask \
pt-spin-inlines \
pt-cleanup \
- pt-setcancelstate \
pt-setcanceltype \
pt-testcancel \
pt-cancel \
@@ -210,6 +209,7 @@ routines := \
pt-nthreads \
pt-pthread_self \
pt-self pt-equal \
+ pt-setcancelstate \
pt-setschedparam \
# routines
shared-only-routines = forward
diff --git a/htl/Versions b/htl/Versions
index afc2495e..ffe79fcb 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -26,6 +26,7 @@ libc {
pthread_attr_setscope;
pthread_attr_setschedparam;
pthread_attr_init;
+ pthread_setcancelstate;
}
GLIBC_2.21 {
@@ -82,6 +83,7 @@ libc {
__pthread_attr_setstacksize;
__pthread_attr_setstackaddr;
__pthread_attr_setstack;
+ __pthread_setcancelstate;
}
}
@@ -159,7 +161,7 @@ libpthread {
pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared;
pthread_rwlockattr_init; pthread_rwlockattr_setpshared;
- pthread_setcancelstate; pthread_setcanceltype;
+ pthread_setcanceltype;
pthread_setconcurrency;
pthread_setschedprio; pthread_setspecific;
diff --git a/htl/forward.c b/htl/forward.c
index 7c0e16dc..860d9f69 100644
--- a/htl/forward.c
+++ b/htl/forward.c
@@ -84,10 +84,6 @@ FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
-FORWARD (__pthread_setcancelstate, (int state, int *oldstate),
- (state, oldstate), 0)
-strong_alias (__pthread_setcancelstate, pthread_setcancelstate);
-
FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c
index b082a13b..07435171 100644
--- a/htl/pt-initialize.c
+++ b/htl/pt-initialize.c
@@ -41,7 +41,6 @@ static const struct pthread_functions pthread_functions = {
.ptr_pthread_mutex_lock = __pthread_mutex_lock,
.ptr_pthread_mutex_trylock = __pthread_mutex_trylock,
.ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
- .ptr___pthread_setcancelstate = __pthread_setcancelstate,
.ptr_pthread_setcanceltype = __pthread_setcanceltype,
.ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
.ptr_pthread_once = __pthread_once,
diff --git a/htl/pt-setcancelstate.c b/htl/pt-setcancelstate.c
index b427a74e..4c812aef 100644
--- a/htl/pt-setcancelstate.c
+++ b/htl/pt-setcancelstate.c
@@ -17,7 +17,7 @@
<https://www.gnu.org/licenses/>. */
#include <pthread.h>
-
+#include <shlib-compat.h>
#include <pt-internal.h>
int
@@ -42,5 +42,9 @@ __pthread_setcancelstate (int state, int *oldstate)
return 0;
}
+libc_hidden_def (__pthread_setcancelstate)
+versioned_symbol (libc, __pthread_setcancelstate, pthread_setcancelstate, GLIBC_2_21);
-weak_alias (__pthread_setcancelstate, pthread_setcancelstate);
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21)
+compat_symbol (libc, __pthread_setcancelstate, pthread_setcancelstate, GLIBC_2_12);
+#endif
diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h
index fbb3e14f..3840d4ae 100644
--- a/sysdeps/htl/libc-lockP.h
+++ b/sysdeps/htl/libc-lockP.h
@@ -113,7 +113,8 @@ extern int __pthread_atfork (void (*__prepare) (void),
void (*__parent) (void),
void (*__child) (void));
-
+extern int __pthread_setcancelstate (int state, int *oldstate);
+libc_hidden_proto (__pthread_setcancelstate)
/* Make the pthread functions weak so that we can elide them from
single-threaded processes. */
@@ -140,7 +141,6 @@ weak_extern (__pthread_getspecific)
weak_extern (__pthread_once)
weak_extern (__pthread_initialize)
weak_extern (__pthread_atfork)
-weak_extern (__pthread_setcancelstate)
# else
# pragma weak __pthread_mutex_init
# pragma weak __pthread_mutex_destroy
@@ -162,7 +162,6 @@ weak_extern (__pthread_setcancelstate)
# pragma weak __pthread_once
# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
-# pragma weak __pthread_setcancelstate
# endif
#endif
diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h
index d380d17b..4596e92d 100644
--- a/sysdeps/htl/pthread-functions.h
+++ b/sysdeps/htl/pthread-functions.h
@@ -38,7 +38,6 @@ int _pthread_mutex_init (pthread_mutex_t *,
int __pthread_mutex_lock (pthread_mutex_t *);
int __pthread_mutex_trylock (pthread_mutex_t *);
int __pthread_mutex_unlock (pthread_mutex_t *);
-int __pthread_setcancelstate (int, int *);
int __pthread_setcanceltype (int, int *);
struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
int __pthread_once (pthread_once_t *, void (*) (void));
@@ -75,7 +74,6 @@ struct pthread_functions
int (*ptr_pthread_mutex_lock) (pthread_mutex_t *);
int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *);
int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *);
- int (*ptr___pthread_setcancelstate) (int, int *);
int (*ptr_pthread_setcanceltype) (int, int *);
struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index 68e6cf17..70ef9664 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -77,9 +77,6 @@ void *__pthread_getspecific (pthread_key_t key);
int __pthread_setspecific (pthread_key_t key, const void *value);
int __pthread_key_delete (pthread_key_t key);
int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void));
-
-int __pthread_setcancelstate (int state, int *oldstate);
-
int __pthread_getattr_np (pthread_t, pthread_attr_t *);
int __pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
void **__restrict __stackaddr);
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 101d5b80..ab677b31 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -52,6 +52,7 @@ GLIBC_2.12 pthread_attr_setstacksize F
GLIBC_2.12 pthread_equal F
GLIBC_2.12 pthread_getschedparam F
GLIBC_2.12 pthread_self F
+GLIBC_2.12 pthread_setcancelstate F
GLIBC_2.12 pthread_setschedparam F
GLIBC_2.13 __fentry__ F
GLIBC_2.14 syncfs F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index 4e287c2e..0dc37f66 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -86,7 +86,6 @@ GLIBC_2.12 pthread_rwlockattr_destroy F
GLIBC_2.12 pthread_rwlockattr_getpshared F
GLIBC_2.12 pthread_rwlockattr_init F
GLIBC_2.12 pthread_rwlockattr_setpshared F
-GLIBC_2.12 pthread_setcancelstate F
GLIBC_2.12 pthread_setcanceltype F
GLIBC_2.12 pthread_setconcurrency F
GLIBC_2.12 pthread_setschedprio F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index 3396ea9e..26c735c4 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -116,7 +116,6 @@ GLIBC_2.38 pthread_rwlockattr_destroy F
GLIBC_2.38 pthread_rwlockattr_getpshared F
GLIBC_2.38 pthread_rwlockattr_init F
GLIBC_2.38 pthread_rwlockattr_setpshared F
-GLIBC_2.38 pthread_setcancelstate F
GLIBC_2.38 pthread_setcanceltype F
GLIBC_2.38 pthread_setconcurrency F
GLIBC_2.38 pthread_setschedprio F
--
2.39.5
More information about the Libc-alpha
mailing list