From bb552d00a4427d756f7c0f57ea5fc67563920008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 12 Nov 2019 00:00:00 +0000 Subject: [PATCH] _SC_NPROCESSORS_CONF --- userland/linux/mmap_anonymous.c | 3 +-- userland/linux/sysconf.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/userland/linux/mmap_anonymous.c b/userland/linux/mmap_anonymous.c index 5ea2fa8..3b26ec1 100644 --- a/userland/linux/mmap_anonymous.c +++ b/userland/linux/mmap_anonymous.c @@ -25,8 +25,7 @@ int main(int argc, char **argv) { chars = mmap( NULL, nbytes, - PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANONYMOUS, + PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0 ); diff --git a/userland/linux/sysconf.c b/userland/linux/sysconf.c index e07f9da..ac29cd0 100644 --- a/userland/linux/sysconf.c +++ b/userland/linux/sysconf.c @@ -9,5 +9,7 @@ int main(void) { /* Number of processors, not considering affinity: * http://stackoverflow.com/questions/2693948/how-do-i-retrieve-the-number-of-processors-on-c-linux */ printf("_SC_NPROCESSORS_ONLN = %ld\n", sysconf(_SC_NPROCESSORS_ONLN)); + /* CPUs configured by OS during boog. Some may have gone offline, so could be larger than _SC_NPROCESSORS_ONLN.a */ + printf("_SC_NPROCESSORS_CONF = %ld\n", sysconf(_SC_NPROCESSORS_CONF)); return EXIT_SUCCESS; }