based upon the sources of the FreeBSD 2.2.5