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 <xiaoxiang@xiaomi.com> Change-Id: I87fba8476221797e59c69c1953974bebc8d0d7b3
This commit is contained in:
parent
c26521c38f
commit
977f04a2b1
@ -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 */
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user