Switch to OpenBSD res_random.

Change-Id: Ia971d647832893e9bb4601697132a105524d2f96
Make string tests check all alignment combinations

 Reduce randomization of the test by (1) replacing random() & 255
 with hard-coded char and (2) by making State *Iteration function
 visit every possible alignment combination instead of 10 random ones.

Change-Id: I0ff0b4ca817ba9fbbcce53e09b25eb10a1a853c2
Add standard throw() spec to delete operators.

Without these specs, clang will reports mismatch between standard definitions and these declarations/definitions. These specs are ignored when compiled with -fno-exceptions.

BUG: 17136236
Change-Id: I386c712a61dc4fc74dfde45f9ec2d3d037f2e9f1
Merge "Add standard throw() spec to delete operators."
Fix pthread_getattr_np for the main thread.

On most architectures the kernel subtracts a random offset to the stack
pointer in create_elf_tables by calling arch_align_stack before writing
the auxval table and so on. On all but x86 this doesn't cause a problem
because the random offset is less than a page, but on x86 it's up to two
pages. This means that our old technique of rounding the stack pointer
doesn't work. (Our old implementation of that technique was wrong too.)

It's also incorrect to assume that the main thread's stack base and size
are constant. Likewise to assume that the main thread has a guard page.
The main thread is not like other threads.

This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK)
whenever we're asked.

Bug: 17111575
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Change-Id: I1d4dbffe7bc7bda1d353c3a295dbf68d29f63158
Merge "Fix pthread_getattr_np for the main thread."
Enable __cxa_atexit && __cxa_finalize for linker

 This allows adding destructors to classes used
 for global variables.

Change-Id: I5e1cd63fe3bf8f66de88cc4f7437cafb350f49b5
Merge "Enable __cxa_atexit && __cxa_finalize for linker"
Remove unnecessary calls to LinkedList::clear()

Change-Id: I981d2700cb17322c634b751715543fd33ee49b7c
libc should use O_CLOEXEC when opening files for its own use.

Change-Id: I159f1d57e0ca090d837f57854fcef5879b8b8248
Undefine _Atomic before redefining

Stdatomic.h was potentially redefining _Atomic, in spite of a
prior definition by <atomic>.  This could cause g++ builds that
included <stdatomic.h> with an available <atomic> header to break.

Change-Id: I562c7115118c0587d594d4d5b62d25101e47bfd8
Merge "Remove unnecessary calls to LinkedList::clear()"
Merge "libc should use O_CLOEXEC when opening files for its own use."
Merge "Switch to OpenBSD res_random."
More cases where libc should use O_CLOEXEC.

Change-Id: Idfa111aeebc5deca2399dae919e8b72eb54c23c0
Merge "More cases where libc should use O_CLOEXEC."
Switch to OpenBSD daemon(3).

Change-Id: I1fd0be09fdb24aa6f1d945410eba5987f8a949b4
Merge "Switch to OpenBSD daemon(3)."
Merge "Undefine _Atomic before redefining"
Switch to OpenBSD <err.h> implementation.

Change-Id: Ia950d88871a30f68e74f9ac7dbd87788e128e02f