freebsd-skq/lib/libc
Konstantin Belousov b585cd3e2c Add __cxa_thread_atexit(3) API implementation.
This is the backing feature to implement C++11 thread storage duration
specified by the thread_local keyword.  A destructor for given
thread-local object is registered to be executed at the thread
termination time using __cxa_thread_atexit().  Libc calls the
__cxa_thread_calls_dtors() during exit(3), before finalizers and
atexit functions, and libthr calls the function at the thread
termination time, after the stack unwinding and thread-specific key
destruction.

There are several uncertainties in the API which lacks a formal
specification.  Among them:
- is it allowed to register destructors during destructing;
	we allow, but limiting the nesting level.  If too many iterations
	detected, a diagnostic is issued to stderr and thread forcibly
	terminates for now.
- how to handle destructors which belong to an unloading dso;
	for now, we ignore destructor calls for such entries, and
	issue a diagnostic.  Linux does prevent dso unload until all
	threads with destructors from the dso terminated.
It is supposed that the diagnostics allow to detect real-world
applications relying on the above details and possibly adjust
our implementation.  Right now the choices were to provide the slim
API (but that rarely stands the practice test).

Tests are added to check generic functionality and to specify some of
the above implementation choices.

Submitted by:	Mahdi Mokhtari <mokhi64_gmail.com>
Reviewed by:	theraven
Discussed with:	dim (detection of -std=c++11 supoort for tests)
Sponsored by:	The FreeBSD Foundation (my involvement)
MFC after:	2 weeks
Differential revisions:	https://reviews.freebsd.org/D7224,
    https://reviews.freebsd.org/D7427
2016-08-06 13:32:40 +00:00
..
aarch64 Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
amd64 Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
arm Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
capability
compat-43 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:53:24 +00:00
db Fix prototype of dbm_open(). 2016-05-31 18:32:57 +00:00
gdtoa META MODE: Don't create .meta files when symlinking sources into the obj directory. 2015-11-25 19:44:43 +00:00
gen Grammar fixes. 2016-08-04 11:38:53 +00:00
gmon Replace the last non-optional use of sbrk() in the tree with mmap(). 2016-01-21 18:17:19 +00:00
i386 Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
iconv citrus: Remove redundant code in _citrus_esdb_get_list(). 2016-06-02 17:28:39 +00:00
include Add __cxa_thread_atexit(3) API implementation. 2016-08-06 13:32:40 +00:00
inet libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
isc libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
locale Change the return type of freelocale(3) to void. 2016-07-29 17:18:47 +00:00
md Bring the md5 functions into libc for internal use only. 2014-08-12 12:25:56 +00:00
mips Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
nameser libc: spelling fixes. 2016-04-30 01:24:24 +00:00
net Add NI_NUMERICSCOPE. 2016-07-28 10:05:41 +00:00
nls Move logic to destroy a struct catentry to its own function. 2016-02-02 23:33:58 +00:00
posix1e libc: spelling fixes. 2016-04-30 01:24:24 +00:00
powerpc Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
powerpc64 Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
quad Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support 2014-10-01 08:26:51 +00:00
regex 1) Eliminate possibility to call __*collate_range_cmp() with inclomplete 2016-07-14 09:07:25 +00:00
resolv Don't leak addrinfo if ai->ai_addrlen <= minsiz test fails. 2016-06-08 09:40:06 +00:00
riscv Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
rpc Use on crypto.x and rpc.x from the source tree. 2016-06-28 19:53:16 +00:00
secure libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
softfloat libc: replace 0 with NULL for pointers. 2016-04-10 19:33:58 +00:00
sparc64 Replace use of the pipe(2) system call with pipe2(2) with a zero flags 2016-06-22 21:11:27 +00:00
stdio Remove usage of _WITH_DPRINTF 2016-07-30 01:16:06 +00:00
stdlib Add __cxa_thread_atexit(3) API implementation. 2016-08-06 13:32:40 +00:00
stdtime Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally. 2016-03-26 03:46:12 +00:00
string libc: spelling fixes. 2016-04-30 01:24:24 +00:00
sys mprotect(): Change prototype to comply to POSIX. 2016-08-03 06:33:04 +00:00
tests Add __cxa_thread_atexit(3) API implementation. 2016-08-06 13:32:40 +00:00
uuid libc: replace 0 with NULL for pointers. 2016-04-10 19:33:58 +00:00
xdr libc/xdr: unsign some loop indexes. 2016-05-06 16:03:40 +00:00
yp Use on crypto.x and rpc.x from the source tree. 2016-06-28 19:53:16 +00:00
libc.ldscript
Makefile Make armv6 hard float abi by default. Kill armv6hf. 2016-05-18 06:01:18 +00:00
Makefile.depend DIRDEPS_BUILD: Regenerate without local dependencies. 2016-02-24 17:20:11 +00:00
Versions.def Create namespace for the symbols added during 12-CURRENT cycle. 2016-08-06 13:28:58 +00:00