Subject: Re: NetBSD master CVS tree commits
To: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
From: Chris G Demetriou <>
List: current-users
Date: 09/21/1996 13:10:40
> > When should system.h be included in user-land code, since it's
> > prototypes and declarations for _kernel_ code which won't be
> > available in user-land environments.
> > short answer:
> > systm.h should _never_ be included by user-land code.
> I'd agree with you, except that systm.h also includes a struct
> definition, which is (potentially) useful to kmem readers, kernel
> coredump grovelers, LKMs that want to use that data structure, etc.

(1) LKMs should be compiled with -D_KERNEL, since they run in the
kernel environment.

(2) the only struct definition i can see in systm.h is the sysent
structure definition, and i'm not aware of any kmem readers or
anything else that wants to use that directly, other than potentially

The various 'extern' definitions definitely are not useful to
user-land code, and can in some situations be dangerous.

> (Tangent: is _KERNEL supposed to be defined for LKMs?  Or am I just
> showing I haven't read some manpage?)

_KERNEL should be defined when compiling any code which is to be run
the the kernel environment.