Date: Mon, 4 Jul 2011 13:00:32 -0400 From: Ed Maste <emaste@freebsd.org> To: <freebsd-hackers@freebsd.org> Subject: Re: [PATCH] __FreeBSD_kernel__ Message-ID: <20110704170032.GA60078@sandvine.com> In-Reply-To: <4E10C6C8.30007@freebsd.org> References: <CAOfDtXPUxQO1zbnxh8sh%2By7g=d8QaH2svYtEQJ06L4d%2BQKG8VA@mail.gmail.com> <20110702193724.5c55a6c9@kan.dnsalias.net> <20110703020827.GA5763@sandvine.com> <CAGH67wQAv4Tf8HjccN2GZzgD2u1ZrORABtGehxXjeg109%2BRNWQ@mail.gmail.com> <20110703103531.4a553271@kan.dnsalias.net> <4E10C6C8.30007@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110704170032.GA60078>