From owner-freebsd-current@FreeBSD.ORG Tue Oct 11 19:24:28 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 3E229106568D for ; Tue, 11 Oct 2011 19:24:28 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id C06DD8FC15 for ; Tue, 11 Oct 2011 19:24:27 +0000 (UTC) Received: by qadz30 with SMTP id z30so6711643qad.13 for ; Tue, 11 Oct 2011 12:24:27 -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=gl9sPTCW3aSeoKZUQWp8NxKHA/mnTLlW8YszXKRUjpE=; b=axKfD+0b72YleT8tPbOLXM0ExFK96wTCuVjy/XYDA8tDP5i99MP13acve3i8kvm5Tv /tsN1XYElNK5Pyksweh3SCZDSr2pUkhmTjp1iVcBkgeuUZA3E4S3V/TSX05mKocrJ4Ne jfYvOZlYd9prk1vth1Rg6IFRPq3plspXYjlHU= MIME-Version: 1.0 Received: by 10.224.173.69 with SMTP id o5mr15787455qaz.7.1318361067160; Tue, 11 Oct 2011 12:24:27 -0700 (PDT) Received: by 10.224.74.82 with HTTP; Tue, 11 Oct 2011 12:24:27 -0700 (PDT) In-Reply-To: References: <4E942FF1.9000805@FreeBSD.org> Date: Tue, 11 Oct 2011 12:24:27 -0700 Message-ID: From: Garrett Cooper To: Arnaud Lacombe 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 19:24:28 -0000 On Tue, Oct 11, 2011 at 11:36 AM, Arnaud Lacombe wrote= : > 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 ha= d >>> 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 clan= g >>> 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 lsof >> port foolishly does. =A0It probably can't be avoided in such a tool, tho= ugh. >> > #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. 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. Thanks, -Garrett