When compiling code for a kernel unit test, we have to define
_KERNEL so that kernel types and API declarations are exposed.
Rework how userland symbols like syscalls are declared in our
headers. Rather than excluding them if _KERNEL is set, add
a new _KERNEL_UT macro that can be defined when compiling the
test. When this macro is defined, kernel declarations will
still be made available, but syscalls and other userland symbols
will also be declared.
However, when compiling a kernel source file for linking into
the unit test, we don't want any userland symbols to be exposed.
Also add a _KERNEL_UT_KSRC macro that can be defined to inhibit
the visibility of userland declarations. It is not sufficient
to only set _KERNEL and not _KERNEL_UT in this case because there
will be rare cases where kernel sources compiled for the kernel and
kernel sources compiled for a unit test need a different set of
declarations.