sysconf.c 441 B

123456789101112131415161718192021222324
  1. /*
  2. * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <unistd.h>
  7. #include <errno.h>
  8. #include "sdkconfig.h"
  9. #include "freertos/FreeRTOS.h"
  10. #define CPU_NUM portNUM_PROCESSORS
  11. long sysconf(int arg)
  12. {
  13. switch (arg) {
  14. case _SC_NPROCESSORS_CONF:
  15. case _SC_NPROCESSORS_ONLN:
  16. return CPU_NUM;
  17. default:
  18. errno = EINVAL;
  19. return -1;
  20. }
  21. }