git: e3a17d6ec3d4 - main - SMP: Use nproc(1) instead of sysctl kern.smp.cpus
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Feb 2023 15:51:38 UTC
The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/ports/commit/?id=e3a17d6ec3d43f5af6cf259ac1cbc26ba0c83c73 commit e3a17d6ec3d43f5af6cf259ac1cbc26ba0c83c73 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-02-16 15:49:53 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2023-02-16 15:51:36 +0000 SMP: Use nproc(1) instead of sysctl kern.smp.cpus The former respects cpuset, while the latter does not. $ cpuset -l 1 -- make -V MAKE_JOBS_NUMBER 1 As nproc is newly introduced, keep the previous variant as a fallback for the time being. Differential Revision: https://reviews.freebsd.org/D38457 --- Mk/bsd.commands.mk | 1 + Mk/bsd.port.mk | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Mk/bsd.commands.mk b/Mk/bsd.commands.mk index acc019e64912..27d9d3e2f47e 100644 --- a/Mk/bsd.commands.mk +++ b/Mk/bsd.commands.mk @@ -64,6 +64,7 @@ MOUNT_DEVFS?= ${MOUNT} -t devfs devfs # a make target MOUNT_NULLFS?= /sbin/mount_nullfs MV?= /bin/mv +NPROC?= /bin/nproc OBJCOPY?= /usr/bin/objcopy OBJDUMP?= /usr/bin/objdump PASTE?= /usr/bin/paste diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 184fbbfe3db3..47bdf9a49b18 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -2041,7 +2041,7 @@ MAKE_JOBS_NUMBER= 1 _MAKE_JOBS_NUMBER:= ${MAKE_JOBS_NUMBER} . else . if !defined(_SMP_CPUS) -_SMP_CPUS!= ${SYSCTL} -n kern.smp.cpus +_SMP_CPUS!= ${NPROC} 2>/dev/null || ${SYSCTL} -n kern.smp.cpus . endif _EXPORTED_VARS+= _SMP_CPUS _MAKE_JOBS_NUMBER= ${_SMP_CPUS}