Fix logical error.

MFC after:	3 days
Fix up proc_realparent to always return correct process.

Prior to the change it would always return initproc for non-traced processes.

This fixes ps apparently always returning 1 as ppid.

Pointy hat:	mjg
Reported by:	many
MFC after:	1 week
Partially revert r270964. Don't test for C++11 to define _Thread_local.

In addition to Clang 3.3, it turns out that GCC 4.7 in Ports also does
not support the _Thread_local keyword. Let's document this in a bit more
detail.

Reported by:	antoine@
Fix dereference after NULL check.

CID:		1234607
Sponsored by:	Nginx, Inc.
Right now, thread_single(SINGLE_EXIT) returns after the p_numthreads
reaches 1. The p_numthreads counter is decremented in thread_exit() by
a call to thread_unlink(). This means that the exiting threads may
still execute on other CPUs when thread_single(SINGLE_EXIT) returns.
As result, vmspace could be destroyed while paging structures are
still used on other CPUs by exiting threads.

Delay the return from thread_single(SINGLE_EXIT) until all threads are
really destroyed by thread_stash() after the last switch out. The
p_exitthreads counter already provides the required mechanism, move
the wait from the thread_wait() (which is called from wait(2) code)
into thread_single().

Reported by:	many (as "panic: pmap active <addr>")
Reviewed by:	alc, jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Use CSUM_BITS instead of incorrect copy.

Sponsored by:	Nginx, Inc.
Clean up unused CSUM_FRAGMENT.

Sponsored by:	Nginx, Inc.
Retire thread_unthread(), it has only one caller.  Update comment in
the block of code before the previous call to thread_unthread().

Discussed with:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Style.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Leave the C11 keywords alone when we have a recent version of GCC.

As GCC also gained support for the C11 keywords over time, we can patch
up <sys/cdefs.h> to not define these anymore. This has the advantage
that error messages for static assertions are printed natively and that
_Alignas() will work with even a type outside of C11 mode.

All C11 keywords are supported with GCC 4.7 and higher, with the
exception of _Thread_local and _Generic. These are only supported as of
GCC 4.9.
Remove always false comparison.

Sponsored by:	Nginx, Inc.
Merge remote-tracking branch 'freebsd/master' into hardened/current/master