reent.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */
  8. #define _REENT_BACKWARD_BINARY_COMPAT
  9. #define _REENT_SDIDINIT(_ptr) ((_ptr)->_reserved_0)
  10. #define _REENT_SGLUE(_ptr) (__sglue)
  11. #else
  12. #define _REENT_CLEANUP(_ptr) ((_ptr)->__cleanup)
  13. #define _REENT_STDIN(_ptr) ((_ptr)->_stdin)
  14. #define _REENT_STDOUT(_ptr) ((_ptr)->_stdout)
  15. #define _REENT_STDERR(_ptr) ((_ptr)->_stderr)
  16. #define _REENT_SDIDINIT(_ptr) ((_ptr)->__sdidinit)
  17. #define _REENT_SGLUE(_ptr) ((_ptr)->__sglue)
  18. #endif
  19. #include_next<sys/reent.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */
  24. extern void __sinit (struct _reent *);
  25. extern struct _glue __sglue;
  26. extern struct _reent * _global_impure_ptr;
  27. #else /* __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) */
  28. /* This function is not part of the newlib API, it is defined in libc/stdio/local.h
  29. * There is no nice way to get __cleanup member populated while avoiding __sinit,
  30. * so extern declaration is used here.
  31. */
  32. extern void _cleanup_r(struct _reent *);
  33. #endif /* __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) */
  34. #ifdef __cplusplus
  35. }
  36. #endif