]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: move pthread_setcancelstate into libc.
authorgfleury <gfleury@disroot.org>
Sat, 1 Feb 2025 08:02:02 +0000 (10:02 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 1 Feb 2025 10:24:14 +0000 (11:24 +0100)
sysdeps/pthread/sem_open.c: call pthread_setcancelstate directely
since forward declaration is gone on hurd too
Message-ID: <20250201080202.494671-1-gfleury@disroot.org>

12 files changed:
htl/Makefile
htl/Versions
htl/forward.c
htl/pt-initialize.c
htl/pt-setcancelstate.c
sysdeps/htl/libc-lockP.h
sysdeps/htl/pthread-functions.h
sysdeps/htl/pthreadP.h
sysdeps/mach/hurd/i386/libc.abilist
sysdeps/mach/hurd/i386/libpthread.abilist
sysdeps/mach/hurd/x86_64/libpthread.abilist
sysdeps/pthread/sem_open.c

index d4418ab9f91b76dfe627b184d31f445cbe3c1cda..a4192a56b468477c05b3e441fdf44c65d5df9df0 100644 (file)
@@ -50,7 +50,6 @@ libpthread-routines := \
   pt-join \
   pt-spin-inlines \
   pt-cleanup \
-  pt-setcancelstate \
   pt-testcancel \
   pt-cancel \
   pt-mutex-transfer-np \
@@ -203,6 +202,7 @@ routines := \
   pt-nthreads \
   pt-pthread_self \
   pt-self pt-equal \
+  pt-setcancelstate \
   pt-setcanceltype \
   pt-setschedparam \
   pt-sigmask \
index 6801d121821ddc2eed60d6f70fd7fad4163c8094..d8f1c7f43786e82f691f87863abf799048be6a89 100644 (file)
@@ -56,6 +56,7 @@ libc {
     pthread_mutexattr_setprotocol;
     pthread_mutexattr_setpshared;
     pthread_mutexattr_settype;
+    pthread_setcancelstate;
     pthread_setcanceltype;
     pthread_sigmask;
   }
@@ -146,6 +147,7 @@ libc {
     __pthread_attr_setstacksize;
     __pthread_attr_setstackaddr;
     __pthread_attr_setstack;
+    __pthread_setcancelstate;
     __pthread_cond_broadcast;
     __pthread_cond_destroy;
     __pthread_cond_init;
@@ -232,7 +234,6 @@ libpthread {
     pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared;
     pthread_rwlockattr_init; pthread_rwlockattr_setpshared;
 
-    pthread_setcancelstate;
     pthread_setconcurrency;
     pthread_setschedprio; pthread_setspecific;
 
index 9455df7316b8f0066f6956572373c0352e725956..0a7a69644d8db33c0338d60e671a5e101a7cb5a2 100644 (file)
@@ -58,9 +58,5 @@ FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
                  exit (EXIT_SUCCESS))
 strong_alias (__pthread_exit, pthread_exit);
 
-FORWARD (__pthread_setcancelstate, (int state, int *oldstate),
-        (state, oldstate), 0)
-strong_alias (__pthread_setcancelstate, pthread_setcancelstate);
-
 FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
          (void), (), return &__pthread_cleanup_stack);
index eba9e12d73e5d8d428461479b6882839c8bd6102..53b9c76e8f4629c359416312ae032acc9e0f8cca 100644 (file)
@@ -28,7 +28,6 @@
 #if IS_IN (libpthread)
 static const struct pthread_functions pthread_functions = {
   .ptr___pthread_exit = __pthread_exit,
-  .ptr___pthread_setcancelstate = __pthread_setcancelstate,
   .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
   .ptr_pthread_once = __pthread_once,
   .ptr_pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
index 57894de7189a29a0335fabe9e8760244d2e5892b..6e09c260ea6deb1bbbfcd581b10d463f5dff1a4d 100644 (file)
@@ -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
index f39c8bba87c4ad80342a80f35f0c25633a274ede..6804c0d6361407f6cbf8839c7440242003ca8e46 100644 (file)
@@ -75,7 +75,6 @@
 
 extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
                                 const pthread_mutexattr_t *__mutex_attr);
-
 extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
 libc_hidden_proto (__pthread_mutex_destroy)
 
@@ -113,6 +112,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.  */
 #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
@@ -130,7 +131,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_rwlock_destroy
 #  pragma weak __pthread_rwlock_rdlock
@@ -144,7 +144,6 @@ weak_extern (__pthread_setcancelstate)
 #  pragma weak __pthread_once
 #  pragma weak __pthread_initialize
 #  pragma weak __pthread_atfork
-#  pragma weak __pthread_setcancelstate
 # endif
 #endif
 
index 9788085b83c29c2c355206e248e0512698bacdf6..56b5b2383e840a3ef680f27df467b055d18ab93b 100644 (file)
@@ -22,7 +22,6 @@
 #include <pthread.h>
 
 void __pthread_exit (void *) __attribute__ ((__noreturn__));
-int __pthread_setcancelstate (int, int *);
 struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
 int __pthread_once (pthread_once_t *, void (*) (void));
 int __pthread_rwlock_rdlock (pthread_rwlock_t *);
@@ -42,7 +41,6 @@ int _cthreads_ftrylockfile (FILE *);
 struct pthread_functions
 {
   void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
-  int (*ptr___pthread_setcancelstate) (int, int *);
   struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
   int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
   int (*ptr_pthread_rwlock_rdlock) (pthread_rwlock_t *);
index 889a63200dc225cd3c67008c8533fd55dfdcb69c..1a1b9ff39abbab96cc580c5d330dc4de734482cf 100644 (file)
@@ -146,8 +146,6 @@ 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);
index c26eddba3dffbea41a06eb1afc3ca0f19f41ac09..30c01aaf2358554ad40605d442310c376e80f161 100644 (file)
@@ -82,6 +82,7 @@ GLIBC_2.12 pthread_mutexattr_setprotocol F
 GLIBC_2.12 pthread_mutexattr_setpshared F
 GLIBC_2.12 pthread_mutexattr_settype F
 GLIBC_2.12 pthread_self F
+GLIBC_2.12 pthread_setcancelstate F
 GLIBC_2.12 pthread_setcanceltype F
 GLIBC_2.12 pthread_setschedparam F
 GLIBC_2.12 pthread_sigmask F
index 30b598ffd936ba9d55bf134877d3310fa0d9d412..0cefd914957b85e78421a3c3b4431c37777f8fb5 100644 (file)
@@ -56,7 +56,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_setconcurrency F
 GLIBC_2.12 pthread_setschedprio F
 GLIBC_2.12 pthread_setspecific F
index 800b7935fbd01b236813d43c42e6e59e0d4b814d..0812c7c7357d3a275525fc9558239a52049ff59c 100644 (file)
@@ -78,7 +78,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_setconcurrency F
 GLIBC_2.38 pthread_setschedprio F
 GLIBC_2.38 pthread_setspecific F
index 9f242599d5c9ff230ba0462f986dae1b0c9d3dee..e5eacb5fed0f0ecbf3dc70dac064d58f53f0c6f3 100644 (file)
@@ -26,6 +26,7 @@
 #include <futex-internal.h>
 #include <libc-lock.h>
 
+
 #if !PTHREAD_IN_LIBC
 /* The private names are not exported from libc.  */
 # define __link link
@@ -57,11 +58,7 @@ __sem_open (const char *name, int oflag, ...)
     }
 
   /* Disable asynchronous cancellation.  */
-#ifdef __libc_ptf_call
-  int state;
-  __libc_ptf_call (__pthread_setcancelstate,
-                   (PTHREAD_CANCEL_DISABLE, &state), 0);
-#endif
+  int state = __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
 
   /* If the semaphore object has to exist simply open it.  */
   if ((oflag & O_CREAT) == 0 || (oflag & O_EXCL) == 0)
@@ -214,9 +211,7 @@ __sem_open (const char *name, int oflag, ...)
     }
 
 out:
-#ifdef __libc_ptf_call
-  __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
-#endif
+  __pthread_setcancelstate (state, NULL);
 
   return result;
 }