Date: Fri, 11 Apr 1997 10:28:59 +1000 (EST) From: proff@suburbia.net To: avalon@coombs.anu.edu.au (Darren Reed) Cc: terry@lambert.org, hackers@FreeBSD.ORG Subject: Re: detecting kernel version at compile time Message-ID: <19970411002900.15347.qmail@suburbia.net> In-Reply-To: <no.id> from Darren Reed at "Apr 11, 97 08:47:09 am"
next in thread | previous in thread | raw e-mail | index | archive | help
> You are deceiving yourselves if you think you are just making life > easier for everyone. Any change implies more work from 3rd party > developers to accomodate that change. Right but look at the alternative (attached below). You can quite rightly say that this horror is required regardless. But the reality is that the present does indeed become the past and in two years time one can expect users to be running at least what we have as -current now. That is why it is important to create an environment that accommodates change as soon as possible, so during the course of the next two years monstrosity below can be reduced to: #include <sys/param.h> A build support system which enables software to work out what reality it is running in creates no burden on authors -- nothing requires you to use the new constructs, but a little bit of forethought can go a long way. ps. /usr/include/includes.h and /usr/include/sys/includes.h, files containg nothing but a long list of: #define _HAVE_INCLUDES_H #define _HAVE_STDIO_H #define _HAVE_STDLIB_H would be a god-send. Here is another in the portability/maintainability war: #define's pertaining to features are normally deposited in sys/compile/kernel_name/opt_foo.h by config(8) during the kernel configuration process. We would adapt this by having config(8) turn the options list into a list of SYSCTL structure entries to be compiled into the kernel. On boot up, rc has sysctl(8) walk kern.config.opt.* and populate /var/kern/kernel_name (using an install -C variant, so timestamps don't change if values don't change) and a symlink to it from /var/run/kern_opt. /var/kern/kernel_name/opts.h would contain a list of _HAVE_OPT_FOO_H defines for conditional inclusion of opt_foo.h files based is their existence (NOT their contents). This scenario not only solves all the nasty -DDEVFS type problems for lkm's, but would enable completely transparent dependency adaption by /usr/src/lkm/* to any kernel image. -- /* * (C)opyright 1997 by Julian Assange. <proff@suburbia.net> */ #ifdef __FreeBSD__ # if defined(KERNEL) && !defined(_KERNEL) # define _KERNEL # endif # if defined(_KERNEL) && !defined(KERNEL) # define KERNEL # endif # if __FreeBSD__ == 0 /* 1.0 did not define __FreeBSD__ */ # define __FreeBSD_version 199401 # elif __FreeBSD__ == 1 /* 1.1 defined it to be 1 */ # define __FreeBSD_version 199405 # elif __FreeBSD__ >= 2 /* 2.0 and higher define it to be 2 */ # ifndef KERNEL # include <osreldate.h> /* and this works */ # else # include <sys/param.h> /* trickier */ # ifndef __FreeBSD_version # ifdef __FreeBSD_sysversion /* just hopefullness on my part, no-one uses this */ # define __FreeBSD_version __FreeBSD_sysversion # else # if BSD >= 199506 # if MAXLOGNAME >= 17 /* GROSS hack */ # define __FreeBSD_version 300000 # else # define __FreeBSD_version 220000 # endif # else # if MAXSYMLINKS >=32 /* GROSS hack */ # define __FreeBSD_version 210000 # else # define __FreeBSD_version 200000 # endif # endif # endif # endif # endif # endif #endif -- Prof. Julian Assange |If you want to build a ship, don't drum up people |together to collect wood and don't assign them tasks proff@suburbia.net |and work, but rather teach them to long for the endless proff@gnu.ai.mit.edu |immensity of the sea. -- Antoine de Saint Exupery
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970411002900.15347.qmail>