freebsd-nq/lib/libc/stdlib
Konstantin Belousov 8495e8b1e9 Fix known issues which blow up the process after dlopen("libthr.so")
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

- Remove libthr interposers of the libc functions, including
  __error(). Instead, functions calls are indirected through the
  interposing table, similar to how pthread stubs in libc are already
  done.  Libc by default points either to syscall trampolines or to
  existing libc implementations.  On libthr load, libthr rewrites the
  pointers to the cancellable implementations already in libthr.  The
  interposition table is separate from pthreads stubs indirection
  table to not pull pthreads stubs into static binaries.

- Postpone the malloc(3) internal mutexes initialization until libthr
  is loaded.  This avoids recursion between calloc(3) and static
  pthread_mutex_t initialization.

- Reinstall signal handlers with wrapper on libthr load.  The
  _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2)
  when libthr is statically referenced from the main binary.

In the process, fix openat(2), swapcontext(2) and setcontext(2)
interposing.  The libc symbols were exported at different versions
than libthr interposers.  Export both libc and libthr versions from
libc now, with default set to the higher version from libthr.

Remove unused and disconnected swapcontext(3) userspace implementation
from libc/gen.

No objections from:	deischen
Tested by:	pho, antoine (exp-run) (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-03 18:38:46 +00:00
..
jemalloc Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
_Exit.c
a64l.3 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
a64l.c
abort.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
abort.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
abs.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
abs.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
alloca.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
at_quick_exit.3
atexit.3 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
atexit.c Silence a warning with GCC that was breaking the build with Juniper's GCC. 2014-04-05 08:17:48 +00:00
atexit.h Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atof.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atof.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atoi.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atoi.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atol.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atol.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
atoll.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
bsearch_b.c Add support for some block functions that come from OS X. These are 2014-04-02 16:07:48 +00:00
bsearch.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
bsearch.c Add support for some block functions that come from OS X. These are 2014-04-02 16:07:48 +00:00
div.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
div.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
exit.3 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
exit.c Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
getenv.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
getenv.c [fix to r253380] __setenv: be explicit about placing '=' after name 2013-07-17 08:45:27 +00:00
getopt_long.3 getopt_long.3: wording quibbles 2013-12-13 21:50:03 +00:00
getopt_long.c Merge intermediate OpenBSD v1.25 changes (almost identical to ours) 2014-06-22 21:54:57 +00:00
getopt.3 [mdoc] Fix previous change. 2014-07-08 12:19:34 +00:00
getopt.c getopt(3): recognize option:: as GNU extension for "optional options". 2014-06-22 20:13:57 +00:00
getsubopt.3 Renumber clauses to reduce diffs to other versions 2013-05-28 20:57:40 +00:00
getsubopt.c ANSI-fy prototype. 2014-01-14 01:52:34 +00:00
hcreate.3 Add re-entrant versions of the hash functions based on the GNU api. 2014-07-21 15:22:48 +00:00
hcreate.c Fix hdestroy() compliance issue. 2014-07-21 15:44:59 +00:00
heapsort_b.c Add support for some block functions that come from OS X. These are 2014-04-02 16:07:48 +00:00
heapsort.c Silence a warning with GCC that was breaking the build with Juniper's GCC. 2014-04-05 08:17:48 +00:00
imaxabs.3
imaxabs.c
imaxdiv.3
imaxdiv.c
insque.3
insque.c
l64a.c
labs.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
labs.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
ldiv.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
ldiv.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
llabs.3
llabs.c
lldiv.3
lldiv.c
lsearch.3 Add example. 2013-04-21 10:30:19 +00:00
lsearch.c Use the __DECONST macro rather than hand rolling the same thing. 2014-10-24 23:25:44 +00:00
Makefile.inc Add re-entrant versions of the hash functions based on the GNU api. 2014-07-21 15:22:48 +00:00
memory.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
merge.c Add support for some block functions that come from OS X. These are 2014-04-02 16:07:48 +00:00
mergesort_b.c Add support for some block functions that come from OS X. These are 2014-04-02 16:07:48 +00:00
ptsname.3
ptsname.c
qsort_r.c Silence a warning with GCC that was breaking the build with Juniper's GCC. 2014-04-05 08:17:48 +00:00
qsort.3 Add support for some block functions that come from OS X. These are 2014-04-02 16:07:48 +00:00
qsort.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
quick_exit.3 Fix quick_exit(3) manual page to match reality - the status was missing. 2014-12-13 21:13:28 +00:00
quick_exit.c
radixsort.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
radixsort.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
rand.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
rand.c Style fix noted by bde@ 2013-07-04 12:35:39 +00:00
random.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
random.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
reallocf.3
reallocf.c
realpath.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
realpath.c realpath(): Properly fail "." or ".." components after non-directories. 2014-04-13 19:48:28 +00:00
remque.c
strfmon.3 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
strfmon.c strfmon: reduce unnecessary snprintf. 2014-07-12 15:19:30 +00:00
strtod.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtoimax.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtol.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtol.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtoll.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtonum.3 Make example more correct (errstr is a pointer, not boolean). 2013-08-18 10:33:46 +00:00
strtonum.c Minor style tweaks. 2014-08-13 03:44:30 +00:00
strtoq.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtoul.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtoul.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtoull.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtoumax.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
strtouq.c Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
Symbol.map Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
system.3 Renumber clauses to reduce diffs to other versions 2013-06-13 00:19:30 +00:00
system.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
tdelete.c
tfind.c
tsearch.3
tsearch.c libc/stdlib: Minor cleanups to code originating in NetBSD 2014-07-15 03:28:37 +00:00
twalk.c libc/stdlib: Minor cleanups to code originating in NetBSD 2014-07-15 03:28:37 +00:00