Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 1997 12:37:31 +1000 (EST)
From:      Darren Reed <avalon@coombs.anu.edu.au>
To:        terry@lambert.org (Terry Lambert)
Cc:        hackers@freebsd.org
Subject:   Re: detecting kernel version at compile time
Message-ID:  <199704120244.TAA09699@freefall.freebsd.org>
In-Reply-To: <199704110018.RAA10243@phaeton.artisoft.com> from "Terry Lambert" at Apr 10, 97 05:18:14 pm

next in thread | previous in thread | raw e-mail | index | archive | help
In some mail from Terry Lambert, sie said:
> 
> > Lets see...firstly, there is <osreldate.h> which is particular to FreeBSD.
> > Including that file always requires #ifdef's for FreeBSD.  Now you want
> > to introduce <sys/osreldate.h>.  That is going to be conditional on what
> > is in <osreldate.h>.  THen code which currently checks for __FreeBSD_version
> > must be adapted to see if __FreeBSD_sysversion exists.
> 
> 1)	<sys/xxx.h> files can *never* depend on <xxx.h> files.

> 2)	You only have to check the version if you want to protect
> 	against a crash better than you currently do.

> > Why weren't __FreeBSD_version & __FreeBSD_sysversion (IF you need both) put
> > in <sys/param.h> ?  For starters, one doesn't need to worry about extra
> > include files, although removing <osreldate.h> would not be good, now.
> 
> I don't know; I've never used <osreldate.h>.  It really only applies
> to the installation insteance of the toolset, and the instances of the
> API enacted by the standard (not system) include files, IMO.
> 
> It seems to me that it's a concession to vendors who don't want to check
> the BSD manifest constants across BSD platforms.

Given this, are there any objections from anyone about putting
__FreeBSD_sysversion in <sys/param.h> ?

As for the BSD symbols, I use them wherever possible.

> You can't possibly have a system component that reference <osreldate.h>,
> since it's not accessable in the kernel build environment (this is the
> problem he is talking about addressing).

Hmmm, can __FreeBSD_sysversion be made the same value as __FreeBSD_version ?
(or vice versa)

> > Further still, there is the uselessness of __FreeBSD__ in some
> > circumstances.
> 
> That would be those vendor circumstances where vendors want all BSD's
> to standardize on the same interfaces.

The problem with __FreeBSD__ is that it is defined by cc - or gcc/pgcc.

That is, it depends on what system the compiler is built, not what OS
it is running on.

Problem being, it impacts every compilation thereafter.




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