1 /*
2  * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <unistd.h>
8 #include <errno.h>
9 #include "sdkconfig.h"
10 
11 #ifdef CONFIG_FREERTOS_UNICORE
12 #define CPU_NUM 1
13 #else
14 #define CPU_NUM CONFIG_SOC_CPU_CORES_NUM
15 #endif
16 
sysconf(int arg)17 long sysconf(int arg)
18 {
19     switch (arg) {
20     case _SC_NPROCESSORS_CONF:
21     case _SC_NPROCESSORS_ONLN:
22         return CPU_NUM;
23     default:
24         errno = EINVAL;
25         return -1;
26     }
27 }
28