NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/59685 CVS commit: src/lib
The following reply was made to PR lib/59685; it has been noted by GNATS.
From: "Taylor R Campbell" <riastradh%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc:
Subject: PR/59685 CVS commit: src/lib
Date: Mon, 6 Oct 2025 13:12:30 +0000
Module Name: src
Committed By: riastradh
Date: Mon Oct 6 13:12:30 UTC 2025
Modified Files:
src/lib/libc/include: reentrant.h
src/lib/libc/thread-stub: thread-stub.c
src/lib/libpthread: pthread.c pthread.h pthread_attr.c
pthread_mi.expsym
Log Message:
libc: Expose some more pthread stubs.
Additionally, provide the option for pthread.h to expose
pthread_create so that libc can provide a weak stub for it, if you
define _NETBSD_PTHREAD_CREATE_WEAK.
This allows libraries to use the functions without linking against
libpthread for applications that don't need threads. For example,
with OpenSSL's libcrypto, as long as you don't try to raise
OSSL_set_max_threads above 0, it won't ever try pthread_create.
New pthread.h macros defined:
pthread_attr_destroy __libc_thr_attr_destroy
pthread_attr_init __libc_thr_attr_init
pthread_attr_setdetachstate __libc_thr_attr_setdetachstate
pthread_detach __libc_thr_detach
pthread_join __libc_thr_join
New pthread.h macros defined if _NETBSD_PTHREAD_CREATE_WEAK is
defined first:
pthread_create __libc_thr_create
New symbols defined by libc as weak aliases for stubs that always
fail but can be overridden by libpthread:
__libc_thr_attr_destroy
__libc_thr_attr_init
__libc_thr_attr_setdetachstate
__libc_thr_detach
__libc_thr_join
Note that libc already defined __libc_thr_create.
New internal stubs, not for overriding:
__libc_thr_detach_stub
__libc_thr_join_stub
These were formerly called __libc_pthread_detach and
__libc_pthread_join, respectively, and libc has defined weak aliases
pthread_detach and pthread_join for them since 2013. I retained all
four of those symbols, but defined new ones in the __ namespace that
match the pattern for other thread stubs to avoid raising questions
about why the pattern seems to be broken. I left a comment noting
this fact too.
New pthread strong aliases to override the libc symbols:
__libc_thr_attr_destroy
__libc_thr_attr_init
__libc_thr_attr_setdetachstate
__libc_thr_detach
__libc_thr_join
Note that pthread already defined a strong __libc_thr_create alias
for the real pthread_create, so there is no need to add a new one.
PR lib/59685: libcrypto should not depend on libpthread
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/include/reentrant.h
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/thread-stub/thread-stub.c
cvs rdiff -u -r1.187 -r1.188 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.41 -r1.42 src/lib/libpthread/pthread.h
cvs rdiff -u -r1.21 -r1.22 src/lib/libpthread/pthread_attr.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libpthread/pthread_mi.expsym
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index