-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libc/picolibc: Add 'write' implementation when needed
This is needed for the picolibc __chk_fail implementation as that uses it up through version 1.8.5. After that, picolibc uses puts. Signed-off-by: Keith Packard <[email protected]>
- Loading branch information
1 parent
a1f24c3
commit a3157ce
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright © 2021, Keith Packard <[email protected]> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <errno.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <zephyr/posix/sys/stat.h> | ||
#include <sys/time.h> | ||
#include <zephyr/arch/cpu.h> | ||
#include <zephyr/linker/linker-defs.h> | ||
#include <zephyr/sys/util.h> | ||
#include <zephyr/sys/errno_private.h> | ||
#include <zephyr/sys/libc-hooks.h> | ||
#include <zephyr/internal/syscall_handler.h> | ||
#include <zephyr/app_memory/app_memdomain.h> | ||
#include <zephyr/init.h> | ||
#include <zephyr/sys/sem.h> | ||
#include <zephyr/logging/log.h> | ||
#ifdef CONFIG_MMU | ||
#include <zephyr/sys/mem_manage.h> | ||
#endif | ||
|
||
/* Don't replace the version supplied by fdtable */ | ||
#if !defined(CONFIG_FDTABLE) || !defined(CONFIG_POSIX_API) | ||
ssize_t write(int fd, const void *buf, size_t len) | ||
{ | ||
size_t count; | ||
const char *b = buf; | ||
|
||
(void) fd; | ||
for (count = 0; count < len; count++) | ||
zephyr_fputc(*b++, stdout); | ||
return len; | ||
} | ||
#endif |