From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 4 17:00:33 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBC0C106566B for ; Mon, 4 Jul 2011 17:00:33 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id ADF4F8FC1F for ; Mon, 4 Jul 2011 17:00:33 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Mon, 4 Jul 2011 13:00:33 -0400 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id ED7B233C02; Mon, 4 Jul 2011 13:00:32 -0400 (EDT) Date: Mon, 4 Jul 2011 13:00:32 -0400 From: Ed Maste To: Message-ID: <20110704170032.GA60078@sandvine.com> References: <20110702193724.5c55a6c9@kan.dnsalias.net> <20110703020827.GA5763@sandvine.com> <20110703103531.4a553271@kan.dnsalias.net> <4E10C6C8.30007@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <4E10C6C8.30007@freebsd.org> User-Agent: Mutt/1.4.2.1i Subject: Re: [PATCH] __FreeBSD_kernel__ X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2011 17:00:34 -0000 On Sun, Jul 03, 2011 at 12:45:12PM -0700, Julian Elischer wrote: > On 7/3/11 7:35 AM, Alexander Kabaev wrote: > >__linux__ is exactly what __FreeBSD__ is and dies not identify kernel > >but rather Linux as whole OS, whatever that might be these days. > > > >There does not appear to be an universal macro that identifies > >environment as using Linux kernel regardless of the rest of components > >used (say, to identify Android and Ubuntu or something embedded with > >ucLibc as running Linux kernel with different userland > >implementations). > I thought it was (__linux__ && __KERNEL__) I corresponded with Julian off-list, but for the sake of the archives I'll summarize here. This is not correct because __KERNEL__ is used for code or header files to detect that they are targetting the kernel (e.g., a device driver) while what we're looking for here is a macro for userland code to detect that it is being compiled to run _on_ a given kernel (Linux or FreeBSD). -Ed