Subject: Re: Bacis coding question
To: tiger shiao <>
From: Manuel Bouyer <>
List: current-users
Date: 05/30/2001 17:46:38
On Wed, May 30, 2001 at 09:27:54AM -0500, tiger shiao wrote:
> I have been stuck by a basic coding question for two days, wish somebody can 
> help me out...
> in NetBSD, (or any other xBSD), KERNEL macro is scattered in many source 
> codes, my question is what they're designed for, when i should #def it and 
> when i should #undef it. I don't believe they're designed for in-kernel 
> codes only, since many kernel code doesn't need this Macro to compile...
> Shed me a light please.

This macro (_KERNEL for NetBSD, I don't know for others) is used mostly in
kernel header files which are shared with userland (e.g. sys/*.h,
arch/*/include/*.h), to expose some prototype or definitions only for
kernel soures. This macro is defined by the kernel build process, on the
compiler command line (-D_KERNEL)

Manuel Bouyer, LIP6, Universite Paris VI.