Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Oct 2011 16:09:30 -0400
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        =?ISO-8859-1?Q?Ren=E9_Ladan?= <rene@freebsd.org>, freebsd-current@freebsd.org, Dimitry Andric <dim@freebsd.org>, Larry Rosenman <ler@lerctr.org>
Subject:   Re: System headers with clang?
Message-ID:  <CACqU3MVz46g-a3K1KvpDYpCDJL-W=JrokyV9BRjRyhbRdG0c5w@mail.gmail.com>
In-Reply-To: <CAGH67wTLLfYNonJUmSBH=BfFnag7J69Wy%2B9TMu8Y=DAZ0kL59Q@mail.gmail.com>
References:  <alpine.BSF.2.00.1110091229550.43656@lrosenman.dyndns.org> <4E942FF1.9000805@FreeBSD.org> <CACqU3MV9vP%2BVUR%2B2Qpzc4mCS1w3R17yvMGNPT%2BxnsGUiYr8VFQ@mail.gmail.com> <CAGH67wTLLfYNonJUmSBH=BfFnag7J69Wy%2B9TMu8Y=DAZ0kL59Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Tue, Oct 11, 2011 at 3:24 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Tue, Oct 11, 2011 at 11:36 AM, Arnaud Lacombe <lacombar@gmail.com> wro=
te:
>> Hi,
>>
>> On Tue, Oct 11, 2011 at 8:00 AM, Dimitry Andric <dim@freebsd.org> wrote:
>>> On 2011-10-09 19:32, Larry Rosenman wrote:
>>>>
>>>> I had gotten a PR about sysutils/lsof not compiling with clang. =A0I h=
ad
>>>> Vic Abell check it out, and the problem is NOT with lsof per se, but
>>>> with the system headers.
>>>>
>>>> Is there a project afoot to update the system headers to make them cla=
ng
>>>> compilable?
>>>
>>> The problem isn't that clang can't compile the system headers, but
>>> normally these don't get included from userspace. =A0And they certainly
>>> won't work as expected when you define _KERNEL in userspace, as the lso=
f
>>> port foolishly does. =A0It probably can't be avoided in such a tool, th=
ough.
>>>
>> #ifdef _KERNEL/#endif protected part of system headers shall NEVER be
>> accessed by userland. It is a fault to have them present in
>> /usr/include. Linux got it right there, all those part are removed
>> upon headers' installation.
>
> Yes, but instead Linux encourages mucking around with /proc and /sys,
> which have varying levels of formatting and provided output.
>
At least, interfaces exist (/proc and /sys) and the data are formatted
enough (ASCII text) to abstract the underlying binary format.

> The data needs to be exported properly via sysctl. If it's not done
> that way to userland, then the API/KPI is flawed and needs to be
> revised.
>
just exporting raw data would not do the job; it can already be done
with KVM. What is needed is a defined ABI (ie. interface, data and
format) between the kernel and userland. I'm not even considering it
being stable for now, this would be the subject of another thread.

NetBSD has done the interesting move of using property list for
kernel/userland structure encoding. I haven't looked for a while so
I'm not sure how much interface are now using them.

 - Arnaud



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACqU3MVz46g-a3K1KvpDYpCDJL-W=JrokyV9BRjRyhbRdG0c5w>