NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD macros

On Dec 11, 2009, at 10:03 AM, Thor Lancelot Simon wrote:
> On Fri, Dec 11, 2009 at 04:44:29PM +0000, Matthias Scheler wrote:
>> I don't think it is a particular good idea to try to figure out the
>> operation system version from "sys/param.h".
> What else can you do, in the source to a C program?  Please don't say
> "use autoconf, spend minutes of run time, and write a value from uname's
> output into a private header file" -- the values are in param.h so you
> *don't* have to do horrible things like that.

The biggest problem I have with autoconf isn't so much the slowness of the 
process, but problem of encouraging developers into making too many decisions 
at compile-time which could better be made at runtime.  It's entirely possible 
to build a binary under one version of the system and run it on a later 
revision, or to build something on a single-processor system for testing/QA 
purposes, and then run it in production usage on SMP hardware, etc.  This 
becomes more important as people  run things more commonly in chroot() 
environments, jails, as users with smaller (or different) limits, under VMs, 

In other words, Matthias' suggestion to query uname(3) (and getrlimit(2), 
sysctl(3), etc) when the program runs is much better than compiling in data 
from a system header and assuming the binary will always run in that same 


Home | Main Index | Thread Index | Old Index