diff options
-rw-r--r-- | Meta/shell_include.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Meta/shell_include.sh b/Meta/shell_include.sh index 78aa59e9e5..11da2e1999 100644 --- a/Meta/shell_include.sh +++ b/Meta/shell_include.sh @@ -57,3 +57,18 @@ FUSE2FS_PATH="$(find_executable fuse2fs)" RESIZE2FS_PATH="$(find_executable resize2fs)" E2FSCK_PATH="$(find_executable e2fsck)" MKE2FS_PATH="$(find_executable mke2fs)" + +get_number_of_processing_units() { + number_of_processing_units="nproc" + SYSTEM_NAME="$(uname -s)" + + if [ "$SYSTEM_NAME" = "OpenBSD" ]; then + number_of_processing_units="sysctl -n hw.ncpuonline" + elif [ "$SYSTEM_NAME" = "FreeBSD" ]; then + number_of_processing_units="sysctl -n hw.ncpu" + elif [ "$SYSTEM_NAME" = "Darwin" ]; then + number_of_processing_units="sysctl -n hw.ncpu" + fi + + ($number_of_processing_units) +} |