123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #ifndef ZEPHYR_INCLUDE_SYS_LIBC_HOOKS_H_
- #define ZEPHYR_INCLUDE_SYS_LIBC_HOOKS_H_
- #include <toolchain.h>
- #include <stdio.h>
- #include <stddef.h>
- #if defined(CONFIG_NEWLIB_LIBC) || defined(CONFIG_ARCMWDT_LIBC)
- #define _MLIBC_RESTRICT
- __syscall int zephyr_read_stdin(char *buf, int nbytes);
- __syscall int zephyr_write_stdout(const void *buf, int nbytes);
- #else
- __syscall int zephyr_fputc(int c, FILE * stream);
- __syscall size_t zephyr_fwrite(const void *_MLIBC_RESTRICT ptr, size_t size,
- size_t nitems, FILE *_MLIBC_RESTRICT stream);
- #endif
- #ifdef CONFIG_USERSPACE
- #if defined(CONFIG_NEWLIB_LIBC)
- #if (!defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) || \
- (defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) && \
- CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE))
- #define Z_MALLOC_PARTITION_EXISTS 1
- extern struct k_mem_partition z_malloc_partition;
- #endif
- #elif defined(CONFIG_MINIMAL_LIBC)
- #if (CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE > 0)
- #define Z_MALLOC_PARTITION_EXISTS 1
- #endif
- #endif
- #ifdef Z_MALLOC_PARTITION_EXISTS
- extern struct k_mem_partition z_malloc_partition;
- #endif
- #if defined(CONFIG_NEWLIB_LIBC) || defined(CONFIG_STACK_CANARIES) || \
- defined(CONFIG_NEED_LIBC_MEM_PARTITION)
- #define Z_LIBC_PARTITION_EXISTS 1
- extern struct k_mem_partition z_libc_partition;
- #endif
- #endif
- #include <syscalls/libc-hooks.h>
- #endif
|