Subject: Re: is obsolete?
To: walt <wa1ter@myrealbox.com>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: current-users
Date: 03/10/2006 09:57:01
walt wrote:
> On Fri, 2006-03-10 at 11:00 -0500, Chris Ross wrote:
>   
>> On Mar 10, 2006, at 9:16 AM, walt wrote:
>>     
>>> Thanks.  This is my real problem:  building libgtop2 from pkgsrc:
>>>
>>>
>>> _KERNEL is indeed defined in the source code of libgtop2 which is
>>> why msg.h wants to include systm.h.  But systm.h has been deleted
>>> by postinstall, which doesn't seem to make sense.
>>>       
>
>   
>>    Any software that defines _KERNEL (because it needs internal
>> interface stuff) needs to include files from /sys (or /usr/src/sys, or
>> the like), rather than /usr/include.  The stuff in /usr/include is
>> for user-land software, not kernel software.
>>     
>
> I've always been confused about this subject -- still am.  Maybe you
> can clear this up for me.
>
> For example, take this snippet from /usr/include/sys/msg.h:
> #include <sys/systm.h>
>
> Given that _KERNEL is defined (as it is in libgtop2) what is
> cpp supposed to do with that line?  How/why would it look anywhere
> but /usr/include?  (I understand that the <> brackets mean that
> the header is to be found in /usr/include -- am I mistaken about
> this?)
>   
The short answer is that it is *wrong* for gtop to #define _KERNEL. 
That macro should *only* be used by kernel software.

If gtop needs some definition that is protected by _KERNEL, then someone
needs to figure out a proper way to export it to userland processes
without requiring this macro.

Ideally this stuff shouldn't be groveling around in kmem anyway.  :-)

    -- Garrett


-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191