of the (never committed) in-kernel version (with some optimizations and cleanups), which in turn was ported from NetBSD.