mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-05 00:02:41 +03:00
htl: Drop pthread-functions infrastructure
All previously forwarded functions are now called directly (either via local call in libc, or through a __export).t
This commit is contained in:
@@ -8029,7 +8029,6 @@ configure.ac
|
|||||||
tst-mqueue8x.c
|
tst-mqueue8x.c
|
||||||
Subdirs
|
Subdirs
|
||||||
pthread.h
|
pthread.h
|
||||||
pthread-functions.h
|
|
||||||
alpha
|
alpha
|
||||||
bsd-setjmp.S
|
bsd-setjmp.S
|
||||||
ldiv.S
|
ldiv.S
|
||||||
@@ -12602,7 +12601,6 @@ tst-atfork1.c
|
|||||||
tst-mutex4.c
|
tst-mutex4.c
|
||||||
tst-mutex1.c
|
tst-mutex1.c
|
||||||
tst-exit3.c
|
tst-exit3.c
|
||||||
libc_pthread_init.c
|
|
||||||
sem_open.c
|
sem_open.c
|
||||||
pthread_mutexattr_setprotocol.c
|
pthread_mutexattr_setprotocol.c
|
||||||
tst-popen1.c
|
tst-popen1.c
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ LCLHDRS :=
|
|||||||
|
|
||||||
libpthread-routines := \
|
libpthread-routines := \
|
||||||
pt-create \
|
pt-create \
|
||||||
pt-initialize \
|
|
||||||
pt-spin-inlines \
|
pt-spin-inlines \
|
||||||
pt-hurd-cond-wait \
|
pt-hurd-cond-wait \
|
||||||
pt-hurd-cond-timedwait \
|
pt-hurd-cond-timedwait \
|
||||||
@@ -69,9 +68,7 @@ distribute :=
|
|||||||
|
|
||||||
routines := \
|
routines := \
|
||||||
alloca_cutoff \
|
alloca_cutoff \
|
||||||
forward \
|
|
||||||
htlfreeres \
|
htlfreeres \
|
||||||
libc_pthread_init \
|
|
||||||
pt-alloc \
|
pt-alloc \
|
||||||
pt-attr \
|
pt-attr \
|
||||||
pt-attr-destroy \
|
pt-attr-destroy \
|
||||||
@@ -210,7 +207,6 @@ routines := \
|
|||||||
sem_routines \
|
sem_routines \
|
||||||
sem_unlink \
|
sem_unlink \
|
||||||
# routines
|
# routines
|
||||||
shared-only-routines = forward
|
|
||||||
|
|
||||||
extra-libs := libpthread
|
extra-libs := libpthread
|
||||||
extra-libs-others := $(extra-libs)
|
extra-libs-others := $(extra-libs)
|
||||||
|
|||||||
@@ -247,7 +247,6 @@ libc {
|
|||||||
|
|
||||||
GLIBC_PRIVATE {
|
GLIBC_PRIVATE {
|
||||||
__libc_alloca_cutoff;
|
__libc_alloca_cutoff;
|
||||||
__libc_pthread_init;
|
|
||||||
__pthread_total;
|
__pthread_total;
|
||||||
___pthread_self;
|
___pthread_self;
|
||||||
__pthread_alloc;
|
__pthread_alloc;
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
/* Libc stubs for pthread functions. Hurd pthread version.
|
|
||||||
Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <shlib-compat.h>
|
|
||||||
#include <pthread-functions.h>
|
|
||||||
#include <libc-lock.h>
|
|
||||||
#include <pt-internal.h>
|
|
||||||
|
|
||||||
/* Pointers to the libc functions. */
|
|
||||||
struct pthread_functions __libc_pthread_functions attribute_hidden;
|
|
||||||
int __libc_pthread_functions_init attribute_hidden;
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/* libc initialization for libpthread. Hurd pthread version.
|
|
||||||
Copyright (C) 2002-2025 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <pthread-functions.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
__libc_pthread_init (const struct pthread_functions *functions)
|
|
||||||
{
|
|
||||||
#ifdef SHARED
|
|
||||||
/* We copy the content of the variable pointed to by the FUNCTIONS
|
|
||||||
parameter to one in libc.so since this means access to the array
|
|
||||||
can be done with one memory access instead of two. */
|
|
||||||
memcpy (&__libc_pthread_functions, functions,
|
|
||||||
sizeof (__libc_pthread_functions));
|
|
||||||
__libc_pthread_functions_init = 1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/* Initialize pthreads library.
|
|
||||||
Copyright (C) 2000-2025 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <pt-internal.h>
|
|
||||||
#include <set-hooks.h>
|
|
||||||
#include <libio/libio.h>
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <pthread-functions.h>
|
|
||||||
|
|
||||||
#if IS_IN (libpthread)
|
|
||||||
static const struct pthread_functions pthread_functions = {
|
|
||||||
};
|
|
||||||
#endif /* IS_IN (libpthread) */
|
|
||||||
|
|
||||||
/* Initialize the pthreads library. */
|
|
||||||
void
|
|
||||||
___pthread_init (void)
|
|
||||||
{
|
|
||||||
#if IS_IN (libpthread)
|
|
||||||
__libc_pthread_init (&pthread_functions);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -194,9 +194,6 @@ extern struct __pthread *_pthread_self (void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the pthreads library. */
|
|
||||||
extern void ___pthread_init (void);
|
|
||||||
|
|
||||||
/* Internal version of pthread_create. Rather than return the new
|
/* Internal version of pthread_create. Rather than return the new
|
||||||
tid, we return the whole __pthread structure in *PTHREAD. */
|
tid, we return the whole __pthread structure in *PTHREAD. */
|
||||||
extern int __pthread_create_internal (struct __pthread **__restrict pthread,
|
extern int __pthread_create_internal (struct __pthread **__restrict pthread,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#define _BITS_LIBC_LOCKP_H 1
|
#define _BITS_LIBC_LOCKP_H 1
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pthread-functions.h>
|
|
||||||
|
|
||||||
/* If we check for a weakly referenced symbol and then perform a
|
/* If we check for a weakly referenced symbol and then perform a
|
||||||
normal jump to it te code generated for some platforms in case of
|
normal jump to it te code generated for some platforms in case of
|
||||||
@@ -36,40 +35,6 @@
|
|||||||
(FUNC != NULL ? FUNC ARGS : ELSE)
|
(FUNC != NULL ? FUNC ARGS : ELSE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Call thread functions through the function pointer table. */
|
|
||||||
#if defined SHARED && IS_IN (libc)
|
|
||||||
# define PTFAVAIL(NAME) __libc_pthread_functions_init
|
|
||||||
# define __libc_ptf_call(FUNC, ARGS, ELSE) \
|
|
||||||
(__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE)
|
|
||||||
# define __libc_ptf_call_always(FUNC, ARGS) \
|
|
||||||
PTHFCT_CALL (ptr_##FUNC, ARGS)
|
|
||||||
#elif IS_IN (libpthread)
|
|
||||||
# define PTFAVAIL(NAME) 1
|
|
||||||
# define __libc_ptf_call(FUNC, ARGS, ELSE) \
|
|
||||||
FUNC ARGS
|
|
||||||
# define __libc_ptf_call_always(FUNC, ARGS) \
|
|
||||||
FUNC ARGS
|
|
||||||
#else
|
|
||||||
# define PTFAVAIL(NAME) (NAME != NULL)
|
|
||||||
# define __libc_ptf_call(FUNC, ARGS, ELSE) \
|
|
||||||
__libc_maybe_call (FUNC, ARGS, ELSE)
|
|
||||||
# define __libc_ptf_call_always(FUNC, ARGS) \
|
|
||||||
FUNC ARGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Create thread-specific key. */
|
|
||||||
#define __libc_key_create(KEY, DESTRUCTOR) \
|
|
||||||
__libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1)
|
|
||||||
|
|
||||||
/* Get thread-specific data. */
|
|
||||||
#define __libc_getspecific(KEY) \
|
|
||||||
__libc_ptf_call (__pthread_getspecific, (KEY), NULL)
|
|
||||||
|
|
||||||
/* Set thread-specific data. */
|
|
||||||
#define __libc_setspecific(KEY, VALUE) \
|
|
||||||
__libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0)
|
|
||||||
|
|
||||||
|
|
||||||
/* Functions that are used by this file and are internal to the GNU C
|
/* Functions that are used by this file and are internal to the GNU C
|
||||||
library. */
|
library. */
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/* Declaration of libc stubs for pthread functions. Hurd version.
|
|
||||||
Copyright (C) 2003-2025 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#ifndef _PTHREAD_FUNCTIONS_H
|
|
||||||
#define _PTHREAD_FUNCTIONS_H 1
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
/* Data type shared with libc. The libc uses it to pass on calls to
|
|
||||||
the thread functions. Wine pokes directly into this structure,
|
|
||||||
so if possible avoid breaking it and append new hooks to the end. */
|
|
||||||
struct pthread_functions
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Variable in libc.so. */
|
|
||||||
extern struct pthread_functions __libc_pthread_functions attribute_hidden;
|
|
||||||
extern int __libc_pthread_functions_init attribute_hidden;
|
|
||||||
|
|
||||||
void __libc_pthread_init (const struct pthread_functions *functions);
|
|
||||||
|
|
||||||
#define PTHFCT_CALL(fct, params) \
|
|
||||||
__libc_pthread_functions.fct params
|
|
||||||
|
|
||||||
#endif /* pthread-functions.h */
|
|
||||||
@@ -48,9 +48,6 @@ _init_routine (void *stack)
|
|||||||
/* Already initialized */
|
/* Already initialized */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Initialize the library. */
|
|
||||||
___pthread_init ();
|
|
||||||
|
|
||||||
if (stack != NULL)
|
if (stack != NULL)
|
||||||
{
|
{
|
||||||
/* We are given a stack, use it. */
|
/* We are given a stack, use it. */
|
||||||
|
|||||||
@@ -90,13 +90,6 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
|
|||||||
(FUNC != NULL ? FUNC ARGS : ELSE)
|
(FUNC != NULL ? FUNC ARGS : ELSE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* All previously forwarded functions are now called directly (either
|
|
||||||
via local call in libc, or through a __export), but __libc_ptf_call
|
|
||||||
is still used in generic code shared with Hurd. */
|
|
||||||
#define PTFAVAIL(NAME) 1
|
|
||||||
#define __libc_ptf_call(FUNC, ARGS, ELSE) FUNC ARGS
|
|
||||||
#define __libc_ptf_call_always(FUNC, ARGS) FUNC ARGS
|
|
||||||
|
|
||||||
/* Initialize the named lock variable, leaving it in a consistent, unlocked
|
/* Initialize the named lock variable, leaving it in a consistent, unlocked
|
||||||
state. */
|
state. */
|
||||||
#define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER))
|
#define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER))
|
||||||
|
|||||||
Reference in New Issue
Block a user