The NetBSD Project

CVS log for src/lib/libpthread/pthread_tsd.c

[BACK] Up to [] / src / lib / libpthread

Request diff between arbitrary revisions

Default branch: MAIN
Current tag: netbsd-7-1-1-RELEASE

Revision / (download) - annotate - [select for diffs], Tue Nov 24 17:37:16 2015 UTC (4 years, 4 months ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1
Changes since 1.11: +56 -13 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

Pull up following revision(s) (requested by manu in ticket #829):
	lib/libpthread_dbg/pthread_dbg.c: revision 1.43 (via patch)
	lib/libpthread/pthread_int.h: revision 1.91-1.92 (via patch)
	lib/libc/stdlib/jemalloc.c: revision 1.37-1.38
	lib/libpthread/pthread_tsd.c: revision 1.12-1.14 (via patch)
	include/limits.h: revision 1.34 (via patch)
	lib/libpthread/pthread.c: revision 1.146-1.147 (via patch)
	lib/libpthread/pthread_key_create.3: revision 1.7 (via patch)


Make PTHREAD_KEYS_MAX dynamically adjustable
NetBSD's PTHREAD_KEYS_MAX is set to 256, which is low compared to
other systems like Linux (1024) or MacOS X (512). As a result some
setups tested on Linux will exhibit problems on NetBSD because of
pthread_keys usage beyond the limit. This happens for instance on
Apache with various module loaded, and in this case no particular
developper can be blamed for going beyond the limit, since several
modules from different sources contribute to the problem.
This patch makes the limit conigurable through the PTHREAD_KEYS_MAX
environement variable. If undefined, the default remains unchanged
(256). In any case, the value cannot be lowered below POSIX-mandated

While there:
- use EXIT_FAILURE instead of 1 when calling err(3) in libpthread.
- Reset _POSIX_THREAD_KEYS_MAX to POSIX mandated 128, instead of 256.

Fix previous: Can't use calloc/malloc before we complete initialization
of the thread library, because malloc uses pthread_foo_specific, and it will
end up initializing itself incorrectly.

Thanks rump for not letting us use even mmap during initialization.


Fix non _REENTRANT build.
Defer using pthread keys until we are threaded.
From Christos, fixes PR port-arm/50087 by allowing malloc calls prior
to libpthread initialization.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

CVSweb <>