On Thu, 4 Mar 2010, Xin LI wrote:

One good thing (in my opinion) that NetBSD and Darwin have is that they have a "common" tree which holds the common files that shared between kernel and userland libc. Currently we have 2 or more copies of certain files in the tree but I'm not sure if it's a good idea to migrate them together into a src/common tree, or just modify the Makefile to reference the one copy? Eliminating duplicated files makes it easier for changes to propagate into different areas (like, we have optimization apply against all components, or have bug fixed in one time).

Is this really widely a problem, or just a problem in a few specific cases?

libc and other code depends on countless kernel files to get API definitions, system call lists, etc, without duplicating kernel code. Similarly, userland libraries sharing significant kernel code, such as libsbuf, will directly reference the kernel file, and in ipfilter, code is shared between the kernel and userspace directly as part of the test suite.

The only real exceptions to this rule are libkern, which contains a very constrained part of libc, and the audit code, where the code structure is very similar but there are lots of small differences due to differing semantics for memory allocation in the kernel (M_WAITOK can't fail), so we maintain that copy/merge with the help of Perforce.

Robert N M Watson
Computer Laboratory
University of Cambridge
freebsd-current@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to