Fix misuse of _KMEMUSER in i86pc
There was some discussion of this on the developers list. See the subject:
Request 417: 8007 uts: sysmacros.h should allow offsetof for early boot
Basically, some time (long ago) someone apparently hacked their way around
some kind of symbol exposure problem by adding -D_KMEMUSER in places that
really are not what that define was meant for, which is:
User-level code that needs to compile with some structures (etc.)
that would otherwise only be exposed when building kernel components.
Kernel components normally build with -D_KERNEL so in headers,
when defining structures etc, those are often inside an:
#if defined(_KERNEL) || defined(_KMEMUSRER)
On the other hand, function prototypes etc. normall are in just:
Also relevant to this is "stand-alone" boot programs, which also
use many of the system heders with -D_BOOT which works similarly
to -D_KERNEL but may expose a different subset of things.
For that reason, many system headers have #if conditionals like:
#if defined(_KERNEL) || defined(_KMEMUSRER) || defined(_BOOT)
Anyway, that's the normal purpose of all those defines.
The uts/i86pc code uses -D_KMEMUSER (apparently) to
work around some problems with missing symbols,
probably in sys/param.h and sys/cpuvar.h that
mostly affect the dboot code. If we add _BOOT to some
of those #if conditions, we can remove _KMEMUSER
from the i86pc Makefile.rules Seems more correct.
Updated by Electric Monk almost 5 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 3c4c5929f4f5a266089758e0d018685b379767ad Author: Gordon Ross <email@example.com> Date: 2017-09-22T22:46:01.000Z 8643 Fix misuse of _KMEMUSER in i86pc Reviewed by: Toomas Soome <firstname.lastname@example.org> Reviewed by: Igor Kozhukhov <email@example.com> Approved by: Garrett D'Amore <firstname.lastname@example.org>