Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jul 2011 22:08:27 -0400
From:      Ed Maste <emaste@freebsd.org>
To:        Alexander Kabaev <kabaev@gmail.com>
Cc:        freebsd-hackers@freebsd.org, Robert Millan <rmh@debian.org>
Subject:   Re: [PATCH] __FreeBSD_kernel__
Message-ID:  <20110703020827.GA5763@sandvine.com>
In-Reply-To: <20110702193724.5c55a6c9@kan.dnsalias.net>
References:  <CAOfDtXPUxQO1zbnxh8sh%2By7g=d8QaH2svYtEQJ06L4d%2BQKG8VA@mail.gmail.com> <20110702193724.5c55a6c9@kan.dnsalias.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 02, 2011 at 07:37:24PM -0400, Alexander Kabaev wrote:

> On Sat, 2 Jul 2011 17:41:03 +0200
> Robert Millan <rmh@debian.org> wrote:
> 
> > My request is that FreeBSD also defines __FreeBSD_kernel__.  If this
> > happens, life would be made a bit easier on both sides, as it'd be
> > more natural for porters of either system to support both using a
> > single macro [1].

I think this is a good idea, especially if it means that a single change can
make it into upstream projects to support both FreeBSD and Debian
kFreeBSD.

> I do not think this belongs in GCC at all. You should already have a
> defined symbol to identify your OS and that should be used in cases
> where it matters.

I suspect the proposed patch put it in GCC based on the fact that we
already have __FreeBSD__ in contrib/gcc/config/freebsd-spec.h:
        builtin_define_with_int_value ("__FreeBSD__", FBSD_MAJOR);      \       

> Alternatively, you should provide the symbol in
> similar way in which we provide __FreeBSD_version, through well-known
> header like sys/param.h and not pollute GCC.

I suspect this is probably a reasonable alternative, but may mean software
will have to pick up an additional #include.

Out of curiosity, what is the canonical way for software to identify a
Linux kernel -- __linux__ or some variant?  Where is it defined?

Regards,
Ed Maste



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110703020827.GA5763>