Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Apr 1997 17:33:42 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        proff@suburbia.net
Cc:        avalon@coombs.anu.edu.au, terry@lambert.org, hackers@FreeBSD.ORG
Subject:   Re: detecting kernel version at compile time
Message-ID:  <199704110033.RAA10297@phaeton.artisoft.com>
In-Reply-To: <19970411002900.15347.qmail@suburbia.net> from "proff@suburbia.net" at Apr 11, 97 10:28:59 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 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.

Or simply conforming to POSIX, with vendors using minimal system
specific interfaces apart from POSIX in order to implement.

This has the nice advantage of making the code portable to NT, VMS,
and all other POSIX platforms as well, with minor tweaking of the
the [isolated] system specific code.

BTW: stdio.h already does a:
	#define	_STDIO_H_


> #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.

This is one approach; anothe would be to abstract the interfaces
where these things hook so that you could place any black box
you wanted in there, as long as it met the call/parameter scoping
requirements.


The real problem here is not devfs, but the fact that you need any
"#ifdef DEVFS" anywhere in the kernel at all because you didn't
abstract the interfaces jointly used by the non-devfs and devfs
at the correct level.  This is why my crusade for getting rid of
all conditionally compiled code (and config, as anything other than
a component list editor, in the process).

Q: Why do you need conditional compilation?
A: The interfaces are different

Q: Why are the interfaces different?
A: They were not sufficiently abstracted in the first place

Q: Why aren't they sufficiently abstraced in the integration process?
A: No good reason

[ ... kernel version tagging header elided ... ]


					Regards,
					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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