Add FreeBSD support to num_cpu_cores() function

Hello!

Currently num_cpu_cores() function assumes that build environment is either MacOS (Darwin) or Linux. This commit adds support for FreeBSD, which has the same hw.ncpu sysctl as Darwin.
`uname` is now called twice here and so it breaks existing stubs in tests which are per-invocation.

Instead of fixing stubs, my suggestion would be to save the `uname -s` response into a variable and compare that to fixed strings like "Darwin" or "FreeBSD".