From owner-freebsd-current@FreeBSD.ORG Tue Oct 11 20:09:32 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C92D106566B; Tue, 11 Oct 2011 20:09:32 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id A017B8FC15; Tue, 11 Oct 2011 20:09:31 +0000 (UTC) Received: by wyj26 with SMTP id 26so11673272wyj.13 for ; Tue, 11 Oct 2011 13:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=dT54qadGFFLWm52J0ny6hhNUUFr8LWv3pxNIbBfGtGo=; b=uiWT/cv66f2MCM5cQwJNyAIHAyiNMgf5sZE117eDIp59ZPe85sXFKjfn5QftwHiCHW VClrM0kHmMHbqUby5w6mvLxqLxe/2YqZQpNb/GySzTL08nUQW8WAkeH+r/jwqewQHjT8 AXtAVfMAS82czVFCCVoJWxyTTaJL8/u0xLEqU= MIME-Version: 1.0 Received: by 10.227.29.161 with SMTP id q33mr6409728wbc.49.1318363770784; Tue, 11 Oct 2011 13:09:30 -0700 (PDT) Received: by 10.180.103.33 with HTTP; Tue, 11 Oct 2011 13:09:30 -0700 (PDT) In-Reply-To: References: <4E942FF1.9000805@FreeBSD.org> Date: Tue, 11 Oct 2011 16:09:30 -0400 Message-ID: From: Arnaud Lacombe To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: =?ISO-8859-1?Q?Ren=E9_Ladan?= , freebsd-current@freebsd.org, Dimitry Andric , Larry Rosenman Subject: Re: System headers with clang? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2011 20:09:32 -0000 Hi, On Tue, Oct 11, 2011 at 3:24 PM, Garrett Cooper wrote: > On Tue, Oct 11, 2011 at 11:36 AM, Arnaud Lacombe wro= te: >> Hi, >> >> On Tue, Oct 11, 2011 at 8:00 AM, Dimitry Andric 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