Fix detecting of CPU cores on FreeBSD

On FreeBSD, use the same approach as OS X with `sysctl`.
Merge branch 'freebsd-cpu'

Closes #610