mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
htl: move pthread_setcancelstate into libc.
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>
This commit is contained in:
@@ -50,7 +50,6 @@ libpthread-routines := \
|
|||||||
pt-join \
|
pt-join \
|
||||||
pt-spin-inlines \
|
pt-spin-inlines \
|
||||||
pt-cleanup \
|
pt-cleanup \
|
||||||
pt-setcancelstate \
|
|
||||||
pt-testcancel \
|
pt-testcancel \
|
||||||
pt-cancel \
|
pt-cancel \
|
||||||
pt-mutex-transfer-np \
|
pt-mutex-transfer-np \
|
||||||
@@ -203,6 +202,7 @@ routines := \
|
|||||||
pt-nthreads \
|
pt-nthreads \
|
||||||
pt-pthread_self \
|
pt-pthread_self \
|
||||||
pt-self pt-equal \
|
pt-self pt-equal \
|
||||||
|
pt-setcancelstate \
|
||||||
pt-setcanceltype \
|
pt-setcanceltype \
|
||||||
pt-setschedparam \
|
pt-setschedparam \
|
||||||
pt-sigmask \
|
pt-sigmask \
|
||||||
|
@@ -56,6 +56,7 @@ libc {
|
|||||||
pthread_mutexattr_setprotocol;
|
pthread_mutexattr_setprotocol;
|
||||||
pthread_mutexattr_setpshared;
|
pthread_mutexattr_setpshared;
|
||||||
pthread_mutexattr_settype;
|
pthread_mutexattr_settype;
|
||||||
|
pthread_setcancelstate;
|
||||||
pthread_setcanceltype;
|
pthread_setcanceltype;
|
||||||
pthread_sigmask;
|
pthread_sigmask;
|
||||||
}
|
}
|
||||||
@@ -146,6 +147,7 @@ libc {
|
|||||||
__pthread_attr_setstacksize;
|
__pthread_attr_setstacksize;
|
||||||
__pthread_attr_setstackaddr;
|
__pthread_attr_setstackaddr;
|
||||||
__pthread_attr_setstack;
|
__pthread_attr_setstack;
|
||||||
|
__pthread_setcancelstate;
|
||||||
__pthread_cond_broadcast;
|
__pthread_cond_broadcast;
|
||||||
__pthread_cond_destroy;
|
__pthread_cond_destroy;
|
||||||
__pthread_cond_init;
|
__pthread_cond_init;
|
||||||
@@ -232,7 +234,6 @@ libpthread {
|
|||||||
pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared;
|
pthread_rwlockattr_destroy; pthread_rwlockattr_getpshared;
|
||||||
pthread_rwlockattr_init; pthread_rwlockattr_setpshared;
|
pthread_rwlockattr_init; pthread_rwlockattr_setpshared;
|
||||||
|
|
||||||
pthread_setcancelstate;
|
|
||||||
pthread_setconcurrency;
|
pthread_setconcurrency;
|
||||||
pthread_setschedprio; pthread_setspecific;
|
pthread_setschedprio; pthread_setspecific;
|
||||||
|
|
||||||
|
@@ -58,9 +58,5 @@ FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
|
|||||||
exit (EXIT_SUCCESS))
|
exit (EXIT_SUCCESS))
|
||||||
strong_alias (__pthread_exit, pthread_exit);
|
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 **,
|
FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
|
||||||
(void), (), return &__pthread_cleanup_stack);
|
(void), (), return &__pthread_cleanup_stack);
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#if IS_IN (libpthread)
|
#if IS_IN (libpthread)
|
||||||
static const struct pthread_functions pthread_functions = {
|
static const struct pthread_functions pthread_functions = {
|
||||||
.ptr___pthread_exit = __pthread_exit,
|
.ptr___pthread_exit = __pthread_exit,
|
||||||
.ptr___pthread_setcancelstate = __pthread_setcancelstate,
|
|
||||||
.ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
|
.ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack,
|
||||||
.ptr_pthread_once = __pthread_once,
|
.ptr_pthread_once = __pthread_once,
|
||||||
.ptr_pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
|
.ptr_pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
#include <pt-internal.h>
|
#include <pt-internal.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -42,5 +42,9 @@ __pthread_setcancelstate (int state, int *oldstate)
|
|||||||
|
|
||||||
return 0;
|
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
|
||||||
|
@@ -75,7 +75,6 @@
|
|||||||
|
|
||||||
extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
|
extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
|
||||||
const pthread_mutexattr_t *__mutex_attr);
|
const pthread_mutexattr_t *__mutex_attr);
|
||||||
|
|
||||||
extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
|
extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
|
||||||
libc_hidden_proto (__pthread_mutex_destroy)
|
libc_hidden_proto (__pthread_mutex_destroy)
|
||||||
|
|
||||||
@@ -113,6 +112,8 @@ extern int __pthread_atfork (void (*__prepare) (void),
|
|||||||
void (*__parent) (void),
|
void (*__parent) (void),
|
||||||
void (*__child) (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
|
/* Make the pthread functions weak so that we can elide them from
|
||||||
single-threaded processes. */
|
single-threaded processes. */
|
||||||
#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
|
#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
|
||||||
@@ -130,7 +131,6 @@ weak_extern (__pthread_getspecific)
|
|||||||
weak_extern (__pthread_once)
|
weak_extern (__pthread_once)
|
||||||
weak_extern (__pthread_initialize)
|
weak_extern (__pthread_initialize)
|
||||||
weak_extern (__pthread_atfork)
|
weak_extern (__pthread_atfork)
|
||||||
weak_extern (__pthread_setcancelstate)
|
|
||||||
# else
|
# else
|
||||||
# pragma weak __pthread_rwlock_destroy
|
# pragma weak __pthread_rwlock_destroy
|
||||||
# pragma weak __pthread_rwlock_rdlock
|
# pragma weak __pthread_rwlock_rdlock
|
||||||
@@ -144,7 +144,6 @@ weak_extern (__pthread_setcancelstate)
|
|||||||
# pragma weak __pthread_once
|
# pragma weak __pthread_once
|
||||||
# pragma weak __pthread_initialize
|
# pragma weak __pthread_initialize
|
||||||
# pragma weak __pthread_atfork
|
# pragma weak __pthread_atfork
|
||||||
# pragma weak __pthread_setcancelstate
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
void __pthread_exit (void *) __attribute__ ((__noreturn__));
|
void __pthread_exit (void *) __attribute__ ((__noreturn__));
|
||||||
int __pthread_setcancelstate (int, int *);
|
|
||||||
struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
|
struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
|
||||||
int __pthread_once (pthread_once_t *, void (*) (void));
|
int __pthread_once (pthread_once_t *, void (*) (void));
|
||||||
int __pthread_rwlock_rdlock (pthread_rwlock_t *);
|
int __pthread_rwlock_rdlock (pthread_rwlock_t *);
|
||||||
@@ -42,7 +41,6 @@ int _cthreads_ftrylockfile (FILE *);
|
|||||||
struct pthread_functions
|
struct pthread_functions
|
||||||
{
|
{
|
||||||
void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
|
void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
|
||||||
int (*ptr___pthread_setcancelstate) (int, int *);
|
|
||||||
struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
|
struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
|
||||||
int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
|
int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
|
||||||
int (*ptr_pthread_rwlock_rdlock) (pthread_rwlock_t *);
|
int (*ptr_pthread_rwlock_rdlock) (pthread_rwlock_t *);
|
||||||
|
@@ -146,8 +146,6 @@ int __pthread_setspecific (pthread_key_t key, const void *value);
|
|||||||
int __pthread_key_delete (pthread_key_t key);
|
int __pthread_key_delete (pthread_key_t key);
|
||||||
int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void));
|
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_getattr_np (pthread_t, pthread_attr_t *);
|
||||||
int __pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
|
int __pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
|
||||||
void **__restrict __stackaddr);
|
void **__restrict __stackaddr);
|
||||||
|
@@ -82,6 +82,7 @@ GLIBC_2.12 pthread_mutexattr_setprotocol F
|
|||||||
GLIBC_2.12 pthread_mutexattr_setpshared F
|
GLIBC_2.12 pthread_mutexattr_setpshared F
|
||||||
GLIBC_2.12 pthread_mutexattr_settype F
|
GLIBC_2.12 pthread_mutexattr_settype F
|
||||||
GLIBC_2.12 pthread_self F
|
GLIBC_2.12 pthread_self F
|
||||||
|
GLIBC_2.12 pthread_setcancelstate F
|
||||||
GLIBC_2.12 pthread_setcanceltype F
|
GLIBC_2.12 pthread_setcanceltype F
|
||||||
GLIBC_2.12 pthread_setschedparam F
|
GLIBC_2.12 pthread_setschedparam F
|
||||||
GLIBC_2.12 pthread_sigmask F
|
GLIBC_2.12 pthread_sigmask F
|
||||||
|
@@ -56,7 +56,6 @@ GLIBC_2.12 pthread_rwlockattr_destroy F
|
|||||||
GLIBC_2.12 pthread_rwlockattr_getpshared F
|
GLIBC_2.12 pthread_rwlockattr_getpshared F
|
||||||
GLIBC_2.12 pthread_rwlockattr_init F
|
GLIBC_2.12 pthread_rwlockattr_init F
|
||||||
GLIBC_2.12 pthread_rwlockattr_setpshared F
|
GLIBC_2.12 pthread_rwlockattr_setpshared F
|
||||||
GLIBC_2.12 pthread_setcancelstate F
|
|
||||||
GLIBC_2.12 pthread_setconcurrency F
|
GLIBC_2.12 pthread_setconcurrency F
|
||||||
GLIBC_2.12 pthread_setschedprio F
|
GLIBC_2.12 pthread_setschedprio F
|
||||||
GLIBC_2.12 pthread_setspecific F
|
GLIBC_2.12 pthread_setspecific F
|
||||||
|
@@ -78,7 +78,6 @@ GLIBC_2.38 pthread_rwlockattr_destroy F
|
|||||||
GLIBC_2.38 pthread_rwlockattr_getpshared F
|
GLIBC_2.38 pthread_rwlockattr_getpshared F
|
||||||
GLIBC_2.38 pthread_rwlockattr_init F
|
GLIBC_2.38 pthread_rwlockattr_init F
|
||||||
GLIBC_2.38 pthread_rwlockattr_setpshared F
|
GLIBC_2.38 pthread_rwlockattr_setpshared F
|
||||||
GLIBC_2.38 pthread_setcancelstate F
|
|
||||||
GLIBC_2.38 pthread_setconcurrency F
|
GLIBC_2.38 pthread_setconcurrency F
|
||||||
GLIBC_2.38 pthread_setschedprio F
|
GLIBC_2.38 pthread_setschedprio F
|
||||||
GLIBC_2.38 pthread_setspecific F
|
GLIBC_2.38 pthread_setspecific F
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include <futex-internal.h>
|
#include <futex-internal.h>
|
||||||
#include <libc-lock.h>
|
#include <libc-lock.h>
|
||||||
|
|
||||||
|
|
||||||
#if !PTHREAD_IN_LIBC
|
#if !PTHREAD_IN_LIBC
|
||||||
/* The private names are not exported from libc. */
|
/* The private names are not exported from libc. */
|
||||||
# define __link link
|
# define __link link
|
||||||
@@ -57,11 +58,7 @@ __sem_open (const char *name, int oflag, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable asynchronous cancellation. */
|
/* Disable asynchronous cancellation. */
|
||||||
#ifdef __libc_ptf_call
|
int state = __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
|
||||||
int state;
|
|
||||||
__libc_ptf_call (__pthread_setcancelstate,
|
|
||||||
(PTHREAD_CANCEL_DISABLE, &state), 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If the semaphore object has to exist simply open it. */
|
/* If the semaphore object has to exist simply open it. */
|
||||||
if ((oflag & O_CREAT) == 0 || (oflag & O_EXCL) == 0)
|
if ((oflag & O_CREAT) == 0 || (oflag & O_EXCL) == 0)
|
||||||
@@ -214,9 +211,7 @@ __sem_open (const char *name, int oflag, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
#ifdef __libc_ptf_call
|
__pthread_setcancelstate (state, NULL);
|
||||||
__libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user