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 _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[email protected]"

