1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-11-28 23:44:09 +03:00

hurd: Drop remnants of cthreads

These are not used in GNU/Hurd since very long now.
This commit is contained in:
Samuel Thibault
2025-11-11 22:32:39 +01:00
parent e06a1962e6
commit f851a74346
19 changed files with 17 additions and 289 deletions

View File

@@ -11696,7 +11696,6 @@ spin-lock.h
spin-lock.c
mig-dealloc.c
errsystems.awk
mutex-solid.c
Machrules
lock-intern.h
errorlib.h

View File

@@ -35,7 +35,6 @@ libpthread-routines := \
pt-getname-np \
pt-setname-np \
cancellation \
cthreads-compat \
herrno \
$(SYSDEPS) \
# libpthread-routine

View File

@@ -317,17 +317,6 @@ libpthread {
__errno_location; __h_errno_location;
}
GLIBC_2.12 {
cthread_detach;
cthread_fork;
cthread_keycreate;
cthread_getspecific;
cthread_setspecific;
__mutex_lock_solid;
__mutex_unlock_solid;
_cthreads_flockfile;
_cthreads_ftrylockfile;
_cthreads_funlockfile;
flockfile; ftrylockfile; funlockfile;
pthread_atfork;
@@ -362,12 +351,7 @@ libpthread {
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__cthread_detach;
__cthread_fork;
__pthread_create;
__cthread_keycreate;
__cthread_getspecific;
__cthread_setspecific;
__pthread_enable_asynccancel;
__pthread_disable_asynccancel;
}

View File

@@ -1,102 +0,0 @@
/* Compatibility routines for cthreads.
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 <pthreadP.h>
#define CTHREAD_KEY_INVALID (__cthread_key_t) -1
void
__cthread_detach (__cthread_t thread)
{
int err;
pthread_t pthread = (pthread_t) (uintptr_t) thread;
err = __pthread_detach (pthread);
assert_perror (err);
}
weak_alias (__cthread_detach, cthread_detach)
__cthread_t
__cthread_fork (__cthread_fn_t func, void *arg)
{
pthread_t thread;
int err;
err = __pthread_create (&thread, NULL, func, arg);
assert_perror (err);
return (__cthread_t) (uintptr_t) thread;
}
weak_alias (__cthread_fork, cthread_fork)
int
__cthread_keycreate (__cthread_key_t *key)
{
error_t err;
err = __pthread_key_create (key, 0);
if (err)
{
errno = err;
*key = CTHREAD_KEY_INVALID;
err = -1;
}
return err;
}
weak_alias (__cthread_keycreate, cthread_keycreate)
int
__cthread_getspecific (__cthread_key_t key, void **val)
{
*val = __pthread_getspecific (key);
return 0;
}
weak_alias (__cthread_getspecific, cthread_getspecific)
int
__cthread_setspecific (__cthread_key_t key, void *val)
{
error_t err;
err = __pthread_setspecific (key, (const void *) val);
if (err)
{
errno = err;
err = -1;
}
return err;
}
weak_alias (__cthread_setspecific, cthread_setspecific)
void
__mutex_lock_solid (void *lock)
{
__pthread_mutex_lock (lock);
}
void
__mutex_unlock_solid (void *lock)
{
if (__pthread_spin_trylock (lock) != 0)
/* Somebody already got the lock, that one will manage waking up others */
return;
__pthread_mutex_unlock (lock);
}

View File

@@ -2,19 +2,6 @@
is to start threading. */
EXTERN(__pthread_initialize_minimal)
/* Weak references in glibc that must be filled if glibc is to be
thread safe. */
EXTERN(cthread_detach)
EXTERN(cthread_fork)
EXTERN(cthread_keycreate)
EXTERN(cthread_getspecific)
EXTERN(cthread_setspecific)
EXTERN(__mutex_lock_solid)
EXTERN(__mutex_unlock_solid)
/* For libio stream locking. */
EXTERN(_cthreads_flockfile)
EXTERN(_cthreads_funlockfile)
EXTERN(_cthreads_ftrylockfile)
/* To create the sigthread and get its stack layout on fork */
EXTERN(pthread_create)
EXTERN(pthread_detach)

View File

@@ -19,41 +19,35 @@
#include <pthread.h> /* Must come before <stdio.h>! */
#include <stdio.h>
#undef _IO_flockfile
#undef _IO_funlockfile
#undef _IO_ftrylockfile
void
_cthreads_flockfile (FILE *fp)
_IO_flockfile (FILE *fp)
{
_IO_lock_lock (*fp->_lock);
}
void
_cthreads_funlockfile (FILE *fp)
_IO_funlockfile (FILE *fp)
{
_IO_lock_unlock (*fp->_lock);
}
int
_cthreads_ftrylockfile (FILE *fp)
_IO_ftrylockfile (FILE *fp)
{
return __libc_lock_trylock_recursive (*fp->_lock);
}
#undef _IO_flockfile
#undef _IO_funlockfile
#undef _IO_ftrylockfile
#undef flockfile
#undef funlockfile
#undef ftrylockfile
void _IO_flockfile (FILE *)
__attribute__ ((alias ("_cthreads_flockfile")));
void _IO_funlockfile (FILE *)
__attribute__ ((alias ("_cthreads_funlockfile")));
int _IO_ftrylockfile (FILE *)
__attribute__ ((alias ("_cthreads_ftrylockfile")));
void flockfile (FILE *)
__attribute__ ((weak, alias ("_cthreads_flockfile")));
__attribute__ ((weak, alias ("_IO_flockfile")));
void funlockfile (FILE *)
__attribute__ ((weak, alias ("_cthreads_funlockfile")));
__attribute__ ((weak, alias ("_IO_funlockfile")));
int ftrylockfile (FILE *)
__attribute__ ((weak, alias ("_cthreads_ftrylockfile")));
__attribute__ ((weak, alias ("_IO_ftrylockfile")));

View File

@@ -21,15 +21,16 @@
#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 = {
.ptr__IO_flockfile = _cthreads_flockfile,
.ptr__IO_funlockfile = _cthreads_funlockfile,
.ptr__IO_ftrylockfile = _cthreads_ftrylockfile,
.ptr__IO_flockfile = _IO_flockfile,
.ptr__IO_funlockfile = _IO_funlockfile,
.ptr__IO_ftrylockfile = _IO_ftrylockfile,
};
#endif /* IS_IN (libpthread) */

View File

@@ -140,11 +140,8 @@ libc {
HURD_CTHREADS_0.3 {
# weak refs to libthreads functions that libc calls iff libthreads in use
__cthread_fork; __pthread_create; __cthread_detach; __pthread_detach;
__pthread_create; __pthread_detach;
__pthread_getattr_np; __pthread_attr_getstack;
# cthreads functions with stubs in libc
__cthread_keycreate; __cthread_getspecific; __cthread_setspecific;
}
GLIBC_PRIVATE {

View File

@@ -22,7 +22,7 @@ include ../Makeconfig
headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \
$(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
$(lock-headers) machine-sp.h bits/mach/param.h
lock = spin-solid spin-lock mutex-init mutex-solid
lock = spin-solid spin-lock mutex-init
lock-headers = lock-intern.h spin-lock.h
routines = $(mach-syscalls) $(mach-shortcuts) \
mach_init mig_strncpy mig_strlen mig_memcpy msg \

View File

@@ -63,8 +63,7 @@ libc {
}
HURD_CTHREADS_0.3 {
__mutex_init; __mutex_lock; __mutex_lock_solid; __mutex_trylock;
__mutex_unlock; __mutex_unlock_solid;
__mutex_init; __mutex_lock; __mutex_trylock; __mutex_unlock;
__spin_lock; __spin_lock_init; __spin_lock_solid; __spin_try_lock;
__spin_unlock;
}

View File

@@ -1,35 +0,0 @@
/* Stub versions of mutex_lock_solid/mutex_unlock_solid for no -lthreads.
Copyright (C) 1995-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 <lock-intern.h>
/* If pthread is linked in, it will define these functions itself to do
real pthread mutex locks. This file will only be linked in when
pthread is not used, and `mutexes' are in fact just spin locks (and
some unused storage). */
void
__mutex_lock_solid (void *lock)
{
__spin_lock_solid (lock);
}
void
__mutex_unlock_solid (void *lock)
{
}

View File

@@ -21,10 +21,6 @@
#include <pthread.h>
void _cthreads_flockfile (FILE *);
void _cthreads_funlockfile (FILE *);
int _cthreads_ftrylockfile (FILE *);
/* 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. */

View File

@@ -169,16 +169,10 @@ libc_hidden_proto (__pthread_setcanceltype);
extern int __pthread_sigmask (int, const sigset_t *, sigset_t *);
libc_hidden_proto (__pthread_sigmask);
typedef struct __cthread *__cthread_t;
typedef int __cthread_key_t;
typedef void * (*__cthread_fn_t)(void *__arg);
__cthread_t __cthread_fork (__cthread_fn_t, void *);
int __pthread_create (pthread_t *newthread,
const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
void __cthread_detach (__cthread_t);
int __pthread_detach (pthread_t __threadp);
libc_hidden_proto (__pthread_detach)
void __pthread_exit (void *value) __attribute__ ((__noreturn__));
@@ -194,9 +188,6 @@ int __pthread_clockjoin_np (pthread_t __th, void **__thread_return,
clockid_t __clockid,
const struct timespec *__abstime);
libc_hidden_proto (__pthread_clockjoin_np)
int __cthread_keycreate (__cthread_key_t *);
int __cthread_getspecific (__cthread_key_t, void **);
int __cthread_setspecific (__cthread_key_t, void *);
int __pthread_key_create (pthread_key_t *key, void (*destr) (void *));
libc_hidden_proto (__pthread_key_create)
void *__pthread_getspecific (pthread_key_t key);

View File

@@ -199,10 +199,6 @@ $(objpfx)rcrt0.o: $(objpfx)static-start.o $(objpfx)abi-note.o $(objpfx)init.o
endif
ifeq (hurd, $(subdir))
sysdep_routines += cthreads
endif
ifeq (elf, $(subdir))
sysdep-dl-routines += dl-tls-initialized
endif

View File

@@ -1,48 +0,0 @@
/* Copyright (C) 1997-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 <libc-lock.h>
#include <errno.h>
#include <hurd.h>
#include <stdlib.h>
#include <pthreadP.h>
/* Placeholder for key creation routine from Hurd cthreads library. */
int
weak_function
__cthread_keycreate (__cthread_key_t *key)
{
*key = -1;
return __hurd_fail (ENOSYS);
}
/* Placeholder for key retrieval routine from Hurd cthreads library. */
int
weak_function
__cthread_getspecific (__cthread_key_t key, void **pval)
{
*pval = NULL;
return __hurd_fail (ENOSYS);
}
/* Placeholder for key setting routine from Hurd cthreads library. */
int
weak_function
__cthread_setspecific (__cthread_key_t key, void *val)
{
return __hurd_fail (ENOSYS);
}

View File

@@ -2748,15 +2748,10 @@ GLIBC_2.9 ns_name_skip F
GLIBC_2.9 ns_name_uncompress F
GLIBC_2.9 ns_name_unpack F
GLIBC_2.9 pipe2 F
HURD_CTHREADS_0.3 __cthread_getspecific F
HURD_CTHREADS_0.3 __cthread_keycreate F
HURD_CTHREADS_0.3 __cthread_setspecific F
HURD_CTHREADS_0.3 __mutex_init F
HURD_CTHREADS_0.3 __mutex_lock F
HURD_CTHREADS_0.3 __mutex_lock_solid F
HURD_CTHREADS_0.3 __mutex_trylock F
HURD_CTHREADS_0.3 __mutex_unlock F
HURD_CTHREADS_0.3 __mutex_unlock_solid F
HURD_CTHREADS_0.3 __pthread_detach F
HURD_CTHREADS_0.3 __pthread_getattr_np F
HURD_CTHREADS_0.3 __spin_lock F

View File

@@ -1,19 +1,9 @@
GLIBC_2.12 __mutex_lock_solid F
GLIBC_2.12 __mutex_unlock_solid F
GLIBC_2.12 __pthread_spin_destroy F
GLIBC_2.12 __pthread_spin_init F
GLIBC_2.12 __pthread_spin_lock F
GLIBC_2.12 __pthread_spin_trylock F
GLIBC_2.12 __pthread_spin_unlock F
GLIBC_2.12 _cthreads_flockfile F
GLIBC_2.12 _cthreads_ftrylockfile F
GLIBC_2.12 _cthreads_funlockfile F
GLIBC_2.12 _pthread_spin_lock F
GLIBC_2.12 cthread_detach F
GLIBC_2.12 cthread_fork F
GLIBC_2.12 cthread_getspecific F
GLIBC_2.12 cthread_keycreate F
GLIBC_2.12 cthread_setspecific F
GLIBC_2.12 flockfile F
GLIBC_2.12 ftrylockfile F
GLIBC_2.12 funlockfile F

View File

@@ -2373,15 +2373,10 @@ GLIBC_2.43 sem_trywait F
GLIBC_2.43 sem_unlink F
GLIBC_2.43 sem_wait F
GLIBC_2.43 umaxabs F
HURD_CTHREADS_0.3 __cthread_getspecific F
HURD_CTHREADS_0.3 __cthread_keycreate F
HURD_CTHREADS_0.3 __cthread_setspecific F
HURD_CTHREADS_0.3 __mutex_init F
HURD_CTHREADS_0.3 __mutex_lock F
HURD_CTHREADS_0.3 __mutex_lock_solid F
HURD_CTHREADS_0.3 __mutex_trylock F
HURD_CTHREADS_0.3 __mutex_unlock F
HURD_CTHREADS_0.3 __mutex_unlock_solid F
HURD_CTHREADS_0.3 __pthread_detach F
HURD_CTHREADS_0.3 __pthread_getattr_np F
HURD_CTHREADS_0.3 __spin_lock F

View File

@@ -3,16 +3,11 @@ GLIBC_2.38 _IO_ftrylockfile F
GLIBC_2.38 _IO_funlockfile F
GLIBC_2.38 __errno_location F
GLIBC_2.38 __h_errno_location F
GLIBC_2.38 __mutex_lock_solid F
GLIBC_2.38 __mutex_unlock_solid F
GLIBC_2.38 __pthread_spin_destroy F
GLIBC_2.38 __pthread_spin_init F
GLIBC_2.38 __pthread_spin_lock F
GLIBC_2.38 __pthread_spin_trylock F
GLIBC_2.38 __pthread_spin_unlock F
GLIBC_2.38 _cthreads_flockfile F
GLIBC_2.38 _cthreads_ftrylockfile F
GLIBC_2.38 _cthreads_funlockfile F
GLIBC_2.38 _pthread_spin_lock F
GLIBC_2.38 call_once F
GLIBC_2.38 cnd_broadcast F
@@ -21,11 +16,6 @@ GLIBC_2.38 cnd_init F
GLIBC_2.38 cnd_signal F
GLIBC_2.38 cnd_timedwait F
GLIBC_2.38 cnd_wait F
GLIBC_2.38 cthread_detach F
GLIBC_2.38 cthread_fork F
GLIBC_2.38 cthread_getspecific F
GLIBC_2.38 cthread_keycreate F
GLIBC_2.38 cthread_setspecific F
GLIBC_2.38 flockfile F
GLIBC_2.38 ftrylockfile F
GLIBC_2.38 funlockfile F