freebsd-dev/lib/libthr
Konstantin Belousov 9be6046a47 Some third-party malloc(3) implementations use pthread_setspecific(3)
to handle per-thread information.  Since our pthread_setspecific()
implementation calls calloc(3) to allocate per-thread specific data
storage, things get complicated.

Switch the allocator to use bare mmap(2).  There is some loss of the
allocated page, since e.g. on amd64, PTHREAD_KEYS_MAX * sizeof(struct
pthread_specific_elem) is 3K (it actually spans whole page due to
padding), but I believe it is more acceptable than additional code for
specialized allocator().

The alternatives would either to make the specific data array be part of
the struct thread, or use internal bindings to call the libc malloc,
avoiding interposing.

Also do the style pass over the thr_spec.c, esp. simplify the
conditionals nesting by returning early when an error detected.
Remove trivial comments.

Found by:	yuri@rawbw.com
PR:	200138
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-05-15 08:40:17 +00:00
..
arch Add pthread_md.h for arm64. 2015-03-30 19:10:09 +00:00
support
sys Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
tests Disable the tests that use makecontext on arm64, it still needs to be 2015-04-27 13:56:20 +00:00
thread Some third-party malloc(3) implementations use pthread_setspecific(3) 2015-05-15 08:40:17 +00:00
libthr.3 Update libthr(3) man page to reflect the work done to support dlopen. 2015-02-12 17:16:54 +00:00
Makefile Build/install libc, librt, libthr, and msun NetBSD test suites on all 2015-04-27 06:49:27 +00:00
plockstat.d Add the DTrace probe definitions for plockstat support. 2014-07-05 19:49:31 +00:00
pthread.map Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00