|
|
|
|
|
by netbsdusers
108 days ago
|
|
It's rather a bit more BSD than merely having a "C API that resembles BSD" or a "BSD userland". https://github.com/apple-oss-distributions/xnu/tree/main/bsd You can find there the better part of a whole BSD kernel, including the fundamental datastructures like proc, tty, vnode, and user. The point of departure is 4.4BSD-Lite2. The majority of the core of the BSD kernel carries the relevant notices for that. |
|
https://github.com/apple/darwin-xnu/blob/xnu-123.5/bsd/kern/...
Notice the SCCS version info dates the file 1/21/94. Now look at the Lite2 equivalent:
https://github.com/sergev/4.4BSD-Lite2/blob/master/usr/src/s...
The SCCS date on this file is 1/9/95, a year later. It appears the XNU copy is from Lite1 instead:
https://github.com/dspinellis/unix-history-repo/blob/BSD-4_4...
You'll also see the source has been reorganized, with e.g. the VFS source being regrouped into bsd/vfs, instead of being left in bsd/kern. This coincidentally mirrors how OSF/1 was organized (no other source relation though, just an interesting observation):
https://github.com/Arquivotheca/OSF1/tree/OSC200/src/kernel/...
For that matter, compare the the differences between vfs_bio.c in XNU:
https://github.com/apple-oss-distributions/xnu/blob/rel/xnu-...
With Lite2's, where most function bodies have been replaced with the comment "Body deleted.", presumably due to use of encumbered code:
https://github.com/sergev/4.4BSD-Lite2/blob/master/usr/src/s...
This file had to be reimplemented by all of the BSDs. In this case, this version appears distinct from the FreeBSD and NetBSD versions I can find.
If you grep around for the `NeXT` ifndef/ifdefs in XNU, too, you'll see some code of which some appears to have been copied/adapted from the NeXT source tree, itself derived from Mach/CMU sources. (and 4.3BSD ;-)
I say all this to draw attention to the ways XNU differs from BSD, which is pretty interesting, at least to me.