From owner-freebsd-hackers Sat Feb 1 00:15:18 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id AAA10150 for hackers-outgoing; Sat, 1 Feb 1997 00:15:18 -0800 (PST) Received: from profane.iq.org (profane.iq.org [203.4.184.217]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA10132 for ; Sat, 1 Feb 1997 00:14:48 -0800 (PST) Received: (from proff@localhost) by profane.iq.org (8.8.4/8.8.2) id TAA06303; Sat, 1 Feb 1997 19:15:33 +1100 (EST) From: Julian Assange Message-Id: <199702010815.TAA06303@profane.iq.org> Subject: #include dependencies In-Reply-To: <199701311937.GAA29276@godzilla.zeta.org.au> from Bruce Evans at "Feb 1, 97 06:37:11 am" To: bde@zeta.org.au (Bruce Evans) Date: Sat, 1 Feb 1997 19:15:32 +1100 (EST) Cc: hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > Most of the #include changes are wrong. > > Most of the headers are only used in the kernel. Kernel sources > follow the convention of including or > before any other header. > > Bruce I'm aware of this, this is why you see a number of #ifndef KERNEL. I strongly philosophically disagree with the need for this but have done so out of what appears to be (foolish imho) tradition. At first I thought perhaps this step was due to cross-compilation needs requiring different sys/types.h files. This appears not to be the case and many kernel .c files rely on the fact that sys/types.h is included in sys/libkern.h. In terms of name-space pollution, the only difference between polluting the name-space from the .C file compared to polluting it from the included file, is that the name space *continues* to be polluted even when the included file is changed to no longer be dependent on the pollution. Do not be saying that this is a good thing as it provides a continuity of name-space pollution in the .C file. C code should only explicity resolve those include files which *it* needs to define datatypes that it *directly* uses. Anything else is inherently unstable across time and across changing environments. I have only resolved mandatory dependencies; i.e those dependencies required for gcc to parse the include file without error, which any C code that uses the include file MUST have resolved, one way or the other, in order to compile at all. You state "most of the headers are only used in the kernel". While you may be correct statistically, this is not a view I can endorse. /dev/kmem makes a mockery out of these assumptions and a not insignificant number of user level programs can and do parse kernel data structures just this way. As time goes by and boundaries between user-level programs the kernel break down we can only expect the cross-transfer of data-structures to increase. Personally I believe the only #ifdef KERNEL we should be seeing is around externs and function definitions, because that is where the only REAL difference between user-level and kernel-level include code dependencies should be occurring. I did not enforce my philosophy blindly with these patches. You may recall I started a weeks debate on this issue and at the end if it, the concensus appeared to be strongly supportive of the direction I have taken. It wasn't philosophy driving engineering, though it has certainly dictated the path I chose. The simple impetus was that code which works perfectly well on all other major platforms refuses to compile under FreeBSD for the very reason we have been discussing. From very large, well supported and well ported user-level programs like scilab to kernel/lkm code such as ipfilter. I believe the -hackers archive bears me out on this. Comments? Cheers, Julian