nproc: denote an incompatiblity with Linux
On Linux _NPROCESSORS_CONF reports CPU threads disabled by the kernel, while it does not on FreeBSD. Flip _NPROCESSORS_ONLN to _NPROCESSORS_CONF. While it keeps reporting the same value, it will automagically unbreak should someone change the above.
This commit is contained in:
parent
5dd48f7184
commit
059320b8c8
@ -3,7 +3,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" * SPDX-License-Identifier: BSD-2-Clause
|
.\" * SPDX-License-Identifier: BSD-2-Clause
|
||||||
.\"
|
.\"
|
||||||
.Dd February 5, 2023
|
.Dd February 15, 2023
|
||||||
.Dt NPROC 1
|
.Dt NPROC 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -40,6 +40,11 @@ Print usage information and exit.
|
|||||||
.El
|
.El
|
||||||
.Sh COMPATIBILITY
|
.Sh COMPATIBILITY
|
||||||
This program is intended to be compatible with nproc as found in GNU coreutils.
|
This program is intended to be compatible with nproc as found in GNU coreutils.
|
||||||
|
.Sh BUGS
|
||||||
|
If HyperThreading is enabled in BIOS and disabled in the kernel, the
|
||||||
|
.Fl -all
|
||||||
|
option on Linux will still report all possible CPU threads.
|
||||||
|
On FreeBSD only active threads will be reported.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr cpuset 1
|
.Xr cpuset 1
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
|
@ -110,7 +110,7 @@ main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
|
|
||||||
if (all_flag) {
|
if (all_flag) {
|
||||||
cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
cpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||||
if (cpus == -1)
|
if (cpus == -1)
|
||||||
err(1, "sysconf");
|
err(1, "sysconf");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user