This is an automated email from the ASF dual-hosted git repository. aguettouche pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 977f04a libc: sysconf support _SC_NPROCESSORS_CONF/_SC_NPROCESSORS_ONLN 977f04a is described below commit 977f04a2b11e9b46b3d43d62b904378159c64987 Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Sat Jun 27 00:08:59 2020 +0800 libc: sysconf support _SC_NPROCESSORS_CONF/_SC_NPROCESSORS_ONLN specified here: https://www.man7.org/linux/man-pages/man3/sysconf.3.html Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> Change-Id: I87fba8476221797e59c69c1953974bebc8d0d7b3 --- include/unistd.h | 3 +++ libs/libc/unistd/lib_sysconf.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/include/unistd.h b/include/unistd.h index 1e3351e..1e29d2a 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -255,6 +255,9 @@ #define _SC_XOPEN_UNIX 0x0079 #define _SC_XOPEN_VERSION 0x007a +#define _SC_NPROCESSORS_CONF 0x007b +#define _SC_NPROCESSORS_ONLN 0x007c + /* The following symbolic constants must be defined for file streams: */ #define STDERR_FILENO 2 /* File number of stderr */ diff --git a/libs/libc/unistd/lib_sysconf.c b/libs/libc/unistd/lib_sysconf.c index c27acf7..6da2394 100644 --- a/libs/libc/unistd/lib_sysconf.c +++ b/libs/libc/unistd/lib_sysconf.c @@ -233,6 +233,14 @@ long sysconf(int name) return 0; #endif + case _SC_NPROCESSORS_CONF: + case _SC_NPROCESSORS_ONLN: +#ifdef CONFIG_SMP_NCPUS + return CONFIG_SMP_NCPUS; +#else + return 1; +#endif + default: #if 0 /* Assume valid but not implemented for the time being */ errcode = EINVAL;