From owner-freebsd-arch@FreeBSD.ORG Wed Nov 16 18:26:10 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F7CC106564A; Wed, 16 Nov 2011 18:26:10 +0000 (UTC) (envelope-from rmh.aybabtu@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id EE3968FC18; Wed, 16 Nov 2011 18:26:09 +0000 (UTC) Received: by iakl21 with SMTP id l21so1417055iak.13 for ; Wed, 16 Nov 2011 10:26:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=JqcReVnpsxN2/UqYZ4ljiP6p1hGT8tlS/83h2PRmvlM=; b=g3SX/IoACSD1+sg1kJwQP+7No2zwkSRSZSGj8gcoJ84hEvGfvkc/1fYk9bBCW78a4D mXzCUfSUT2Ea/j1ga0L8DfznGz9Ed9uvKwrM+6bc0e9b9DPs0X0Y0vENLRv6nQg0+pSu eMmu5V8vDYPoHU9jRTExma2ScIv6GZEolyskI= MIME-Version: 1.0 Received: by 10.42.135.66 with SMTP id o2mr33643126ict.0.1321467969092; Wed, 16 Nov 2011 10:26:09 -0800 (PST) Sender: rmh.aybabtu@gmail.com Received: by 10.42.243.198 with HTTP; Wed, 16 Nov 2011 10:26:09 -0800 (PST) In-Reply-To: <4EC3FBD2.4070009@delphij.net> References: <4EC3FBD2.4070009@delphij.net> Date: Wed, 16 Nov 2011 19:26:09 +0100 X-Google-Sender-Auth: ebUx-h__hYYpl6-mAj8rVFShKug Message-ID: From: Robert Millan To: d@delphij.net Content-Type: text/plain; charset=UTF-8 Cc: Kostik Belousov , Adrian Chadd , freebsd-current@freebsd.org, freebsd-arch@freebsd.org Subject: Re: [PATCH] Detect GNU/kFreeBSD in user-visible kernel headers X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 18:26:10 -0000 2011/11/16 Xin LI : > Just my $0.02 -- I think we should probably do it in a more > centralized place -- otherwise in case someone imported some new code, > they have to do the same defined(__FreeBSD__) || > defined(__FreeBSD_kernel__)? How about something like: #if defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) #define __FreeBSD_kernel__ #endif it can be placed at beginning of each header, then the rest becomes much simpler. Note this has the side-effect of defining __FreeBSD_kernel__ on FreeBSD, which I suspect some people won't be fond of. An alternative could be to come up with an ad-hoc macro that means "this system is either FreeBSD or uses the same kernel as FreeBSD" and define it where needed.