← Back to context

Comment by zepto

5 years ago

iOS kernel is Darwin, a current BSD: https://github.com/apple/darwin-xnu

Darwin only half BSD. It uses a Mach kernel and Bash but BSD utilities instead of coreutils. It’s development and administrative utilities along with its init system are custom as well.

  • Fair enough, but that still means this statement (made by ArgylSound): “iOS’ kernel has almost nothing to do with any current BSD distribution.” is false.

  • XNU, Darwin's kernel, is Mach + FreeBSD[1].

    [1] https://github.com/apple/darwin-xnu

    • For more background, see https://developer.apple.com/library/archive/documentation/Da...

      There it clarifies that it is "mostly" FreeBSD. The Mach being used also differs significantly from CMU Mach and what you might find by looking for Mach3/4 source dumps.

      One of the biggest challenges in "converting" NeXTSTEP (MacOS's predecessor) to OS X was both updating software to newer versions and eliminating expensive licenses from AT&T and Adobe.

      NeXTSTEP was a "capital U" UNIX with AT&T proprietary code, based on 4.3/4.4BSD (encumbered). Every copy needed a UNIX license and royalties to AT&T.

      NeXT was based on Mach2, which had 4.3BSD deeply integrated into the kernel source tree. Device drivers were both native BSD ones along with a "DriverKit" interface that used Mach messages to write userland device drivers.

      CMU Mach v3 and v4 cut out all the BSD code and put it into a userland "UX Server", a model incompatible with NeXT. So instead, Apple took the OSF/1 Mach kernel, derived from Mach 2.5, and replaced the BSD subsystem code with 4.4BSD-lite, gradually updating its subsystems with FreeBSD ones.

      So TLDR, Darwin/XNU has both a BSD userland and essentially a FreeBSD kernel. When you make a "UNIX-y" syscall from C in MacOS, you're "talking" to a "FreeBSD kernel".