8643 Fix misuse of _KMEMUSER in i86pc

Review Request #658 - Created Sept. 8, 2017 and submitted

Information
Gordon Ross
illumos-gate
8643
Reviewers
general

8643 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:

 #if defined(_KERNEL)

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.
As you can see in the diff shown here, the -D_KMEMUSER
define was mis-used in somewhat odd ways.

I compared the workspace (using wsdiff) before and after this change.
There were no differences other than the expected few things like
dtrace object sections, and executables that compile-in dates.

Andrew Stormont
Gordon Ross
Gordon Ross
Igor Kozhukhov
Toomas Soome
Toomas Soome
Gordon Ross
Review request changed

Status: Closed (submitted)

Loading...